aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore14
-rw-r--r--.qmake.conf2
-rw-r--r--examples/virtualkeyboard/basic/Basic.qml4
-rw-r--r--examples/virtualkeyboard/basic/basic-b2qt.qml3
-rw-r--r--examples/virtualkeyboard/basic/content/AutoScroller.qml88
-rw-r--r--examples/virtualkeyboard/basic/content/TextArea.qml4
-rw-r--r--examples/virtualkeyboard/basic/content/TextField.qml6
-rw-r--r--src/config.pri51
-rw-r--r--src/import/dependencies.json22
-rw-r--r--src/import/import.pro34
-rw-r--r--src/import/plugins.qmltypes2031
-rw-r--r--src/import/qmldir10
-rw-r--r--src/import/qtquickvirtualkeyboardplugin.cpp152
-rw-r--r--src/import/qtquickvirtualkeyboardplugin.h50
-rw-r--r--src/plugin/extensionloader.cpp114
-rw-r--r--src/plugin/extensionloader.h59
-rw-r--r--src/plugin/plugin.cpp107
-rw-r--r--src/plugin/plugin.h51
-rw-r--r--src/plugin/plugin.pro29
-rw-r--r--src/plugin/qtvirtualkeyboard.json (renamed from src/virtualkeyboard/qtvirtualkeyboard.json)0
-rw-r--r--src/plugins/hangul/hangul.cpp365
-rw-r--r--src/plugins/hangul/hangul.json6
-rw-r--r--src/plugins/hangul/hangul.pro45
-rw-r--r--src/plugins/hangul/hangul_p.h149
-rw-r--r--src/plugins/hangul/hangulinputmethod.cpp103
-rw-r--r--src/plugins/hangul/hangulinputmethod_p.h72
-rw-r--r--src/plugins/hangul/hangulplugin.cpp44
-rw-r--r--src/plugins/hangul/hangulplugin.h49
-rw-r--r--src/plugins/hunspell/3rdparty/hunspell/hunspell.pro (renamed from src/virtualkeyboard/3rdparty/hunspell/hunspell.pro)0
-rw-r--r--src/plugins/hunspell/hunspell.pro13
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.cpp407
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.pro30
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.cpp338
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.h91
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p_p.h97
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellworker.cpp776
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellworker_p.h294
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/qhunspellinputmethod_global.h49
-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/MIT_LICENSE.txt (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/MIT_LICENSE.txt)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/license.txt (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/license.txt)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/lipi-toolkit.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/lipi-toolkit.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt)bin11505083 -> 11505083 bytes
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.mdt (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.mdt)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/profile.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/profile.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/lipiengine.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/projects/lipiengine.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/qt_attribution.json (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/qt_attribution.json)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKException.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKException.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/common.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/common.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKChannel.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKChannel.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKException.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKException.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKInc.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKInc.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLogger.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLogger.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKMacros.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKMacros.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTrace.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTrace.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTypes.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTypes.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/TpcError.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/TpcError.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/headers.pri (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/headers.pri)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipicommon.pri (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipicommon.pri)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/version.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/version.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipilib.pri (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipilib.pri)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiplugin.pri (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiplugin.pri)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/reco.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/reco.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/src.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/src.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/lib.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/lib.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.cpp (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.cpp)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.def (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.def)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.h (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.h)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.pro)0
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/util.pro (renamed from src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/util.pro)0
-rw-r--r--src/plugins/lipi-toolkit/lipi-toolkit.pro7
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipi.json6
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipiinputmethod.cpp639
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipiinputmethod_p.h97
-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.pri57
-rw-r--r--src/plugins/myscript/myscript.pro4
-rw-r--r--src/plugins/myscript/plugin/myscript.json6
-rw-r--r--src/plugins/myscript/plugin/myscriptinputmethod.cpp1472
-rw-r--r--src/plugins/myscript/plugin/myscriptinputmethod_p.h105
-rw-r--r--src/plugins/myscript/plugin/myscriptinputmethod_p_p.h122
-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.pro109
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/NOTICE (renamed from src/virtualkeyboard/3rdparty/openwnn/NOTICE)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/openwnn.pro63
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/qt_attribution.json (renamed from src/virtualkeyboard/3rdparty/openwnn/qt_attribution.json)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndapi.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndapi.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndbdic.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndbdic.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndcommon.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndcommon.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndfdic.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndfdic.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndldic.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndldic.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndrdic.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndrdic.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/neapi.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/neapi.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/necode.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/necode.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/nj_str.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/nj_str.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_dic.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_dic.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_err.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_err.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_ext.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_lib.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_lib.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njd.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/njd.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njx_lib.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/njx_lib.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/WnnJpnDic.c (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/WnnJpnDic.c)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/composingtext.cpp490
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/composingtext.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/composingtext.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/kanaconverter.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/kanaconverter.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/letterconverter.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/letterconverter.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnnclauseconverterjajp.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnnclauseconverterjajp.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnndictionary.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnndictionary.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnnenginejajp.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnnenginejajp.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkan.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkan.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkanfullkatakana.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkanfullkatakana.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkanhalfkatakana.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkanhalfkatakana.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/strsegment.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/strsegment.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/wnnlookuptable.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/wnnlookuptable.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/wnnword.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/wnnword.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/kanaconverter.cpp)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/letterconverter.cpp (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/letterconverter.cpp)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp388
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/predef_table.h (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/predef_table.h)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkan.cpp)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkanfullkatakana.cpp (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkanfullkatakana.cpp)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkanhalfkatakana.cpp (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkanhalfkatakana.cpp)0
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp (renamed from src/virtualkeyboard/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp)0
-rw-r--r--src/plugins/openwnn/openwnn.pro7
-rw-r--r--src/plugins/openwnn/plugin/openwnn.json6
-rw-r--r--src/plugins/openwnn/plugin/openwnninputmethod.cpp827
-rw-r--r--src/plugins/openwnn/plugin/openwnninputmethod_p.h81
-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/NOTICE (renamed from src/virtualkeyboard/3rdparty/pinyin/NOTICE)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/command/Makefile (renamed from src/virtualkeyboard/3rdparty/pinyin/command/Makefile)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/command/pinyinime_dictbuilder.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/command/pinyinime_dictbuilder.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/data/dict_pinyin.dat (renamed from src/virtualkeyboard/3rdparty/pinyin/data/dict_pinyin.dat)bin1068442 -> 1068442 bytes
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/data/rawdict_utf16_65105_freq.txt (renamed from src/virtualkeyboard/3rdparty/pinyin/data/rawdict_utf16_65105_freq.txt)bin3570346 -> 3570346 bytes
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/data/valid_utf16.txt (renamed from src/virtualkeyboard/3rdparty/pinyin/data/valid_utf16.txt)bin32934 -> 32934 bytes
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/atomdictbase.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/atomdictbase.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/dictbuilder.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/dictbuilder.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/dictdef.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/dictdef.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/dictlist.h120
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/dicttrie.h234
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/lpicache.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/lpicache.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/matrixsearch.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/matrixsearch.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/mystdlib.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/mystdlib.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/ngram.h97
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/pinyinime.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/pinyinime.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/searchutility.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/searchutility.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/spellingtable.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/spellingtable.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/spellingtrie.h259
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/splparser.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/splparser.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/sync.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/sync.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/userdict.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/userdict.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/utf16char.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/utf16char.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/include/utf16reader.h (renamed from src/virtualkeyboard/3rdparty/pinyin/include/utf16reader.h)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/patches/0001-Make-the-keyboard-layout-changeable-in-password-url-.patch132
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/patches/0002-Prepare-Pinyin-library-for-WIN32.patch122
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch41
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/patches/0004-Bundle-pinyin-dictionary-in-the-plugin.patch354
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/patches/0005-Fix-string-cast.patch28
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/pinyin.pro64
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/qt_attribution.json (renamed from src/virtualkeyboard/3rdparty/pinyin/qt_attribution.json)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/dictbuilder.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/dictbuilder.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/dictlist.cpp446
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp936
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/lpicache.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/lpicache.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/matrixsearch.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/matrixsearch.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/mystdlib.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/mystdlib.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/ngram.cpp342
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/pinyinime.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/pinyinime.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/searchutility.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/searchutility.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/spellingtable.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/spellingtable.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/spellingtrie.cpp831
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/splparser.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/splparser.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/sync.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/sync.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/userdict.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/utf16char.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/utf16char.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/utf16reader.cpp (renamed from src/virtualkeyboard/3rdparty/pinyin/share/utf16reader.cpp)0
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/update-patches.sh40
-rw-r--r--src/plugins/pinyin/pinyin.pro7
-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.h81
-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/t9write-build.pri83
-rw-r--r--src/plugins/t9write/3rdparty/t9write/t9write.pro26
-rw-r--r--src/plugins/t9write/3rdparty/t9write/unpack.py (renamed from src/virtualkeyboard/3rdparty/t9write/unpack.py)0
-rw-r--r--src/plugins/t9write/plugin/plugin.pro116
-rw-r--r--src/plugins/t9write/plugin/t9write.json6
-rw-r--r--src/plugins/t9write/plugin/t9write_p.h61
-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.cpp2134
-rw-r--r--src/plugins/t9write/plugin/t9writeinputmethod_p.h116
-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.cpp404
-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/COPYING (renamed from src/virtualkeyboard/3rdparty/tcime/COPYING)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/cangjiedictionary.cpp141
-rw-r--r--src/plugins/tcime/3rdparty/tcime/cangjiedictionary.h (renamed from src/virtualkeyboard/3rdparty/tcime/cangjiedictionary.h)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/cangjietable.cpp (renamed from src/virtualkeyboard/3rdparty/tcime/cangjietable.cpp)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/cangjietable.h (renamed from src/virtualkeyboard/3rdparty/tcime/cangjietable.h)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/data/java/dict_cangjie.dat (renamed from src/virtualkeyboard/3rdparty/tcime/data/java/dict_cangjie.dat)bin58525 -> 58525 bytes
-rw-r--r--src/plugins/tcime/3rdparty/tcime/data/java/dict_phrases.dat (renamed from src/virtualkeyboard/3rdparty/tcime/data/java/dict_phrases.dat)bin133359 -> 133359 bytes
-rw-r--r--src/plugins/tcime/3rdparty/tcime/data/java/dict_zhuyin.dat (renamed from src/virtualkeyboard/3rdparty/tcime/data/java/dict_zhuyin.dat)bin37323 -> 37323 bytes
-rw-r--r--src/plugins/tcime/3rdparty/tcime/data/qt/dict_cangjie.dat (renamed from src/virtualkeyboard/3rdparty/tcime/data/qt/dict_cangjie.dat)bin54840 -> 54840 bytes
-rw-r--r--src/plugins/tcime/3rdparty/tcime/data/qt/dict_phrases.dat (renamed from src/virtualkeyboard/3rdparty/tcime/data/qt/dict_phrases.dat)bin133304 -> 133304 bytes
-rw-r--r--src/plugins/tcime/3rdparty/tcime/data/qt/dict_zhuyin.dat (renamed from src/virtualkeyboard/3rdparty/tcime/data/qt/dict_zhuyin.dat)bin36044 -> 36044 bytes
-rw-r--r--src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp (renamed from src/virtualkeyboard/3rdparty/tcime/phrasedictionary.cpp)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/phrasedictionary.h (renamed from src/virtualkeyboard/3rdparty/tcime/phrasedictionary.h)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/qt_attribution.json (renamed from src/virtualkeyboard/3rdparty/tcime/qt_attribution.json)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/tcime.pro37
-rw-r--r--src/plugins/tcime/3rdparty/tcime/tools/dict2qt.class (renamed from src/virtualkeyboard/3rdparty/tcime/tools/dict2qt.class)bin5163 -> 5163 bytes
-rw-r--r--src/plugins/tcime/3rdparty/tcime/tools/dict2qt.java (renamed from src/virtualkeyboard/3rdparty/tcime/tools/dict2qt.java)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/worddictionary.cpp (renamed from src/virtualkeyboard/3rdparty/tcime/worddictionary.cpp)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/worddictionary.h (renamed from src/virtualkeyboard/3rdparty/tcime/worddictionary.h)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/zhuyindictionary.cpp (renamed from src/virtualkeyboard/3rdparty/tcime/zhuyindictionary.cpp)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/zhuyindictionary.h (renamed from src/virtualkeyboard/3rdparty/tcime/zhuyindictionary.h)0
-rw-r--r--src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp161
-rw-r--r--src/plugins/tcime/3rdparty/tcime/zhuyintable.h (renamed from src/virtualkeyboard/3rdparty/tcime/zhuyintable.h)0
-rw-r--r--src/plugins/tcime/plugin/plugin.pro65
-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.cpp554
-rw-r--r--src/plugins/tcime/plugin/tcinputmethod_p.h88
-rw-r--r--src/plugins/tcime/tcime.pro7
-rw-r--r--src/plugins/thai/plugin/plugin.pro47
-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/settings/plugins.qmltypes50
-rw-r--r--src/settings/qmldir5
-rw-r--r--src/settings/qtquickvirtualkeyboardsettingsplugin.cpp53
-rw-r--r--src/settings/qtquickvirtualkeyboardsettingsplugin.h50
-rw-r--r--src/settings/settings.pro23
-rw-r--r--src/src.pro44
-rw-r--r--src/styles/KeyIcon.qml (renamed from src/virtualkeyboard/styles/KeyIcon.qml)0
-rw-r--r--src/styles/KeyPanel.qml (renamed from src/virtualkeyboard/styles/KeyPanel.qml)0
-rw-r--r--src/styles/KeyboardStyle.qml530
-rw-r--r--src/styles/SelectionListItem.qml70
-rw-r--r--src/styles/TraceCanvas.qml161
-rw-r--r--src/styles/TraceInputKeyPanel.qml (renamed from src/virtualkeyboard/styles/TraceInputKeyPanel.qml)0
-rw-r--r--src/styles/TraceUtils.js89
-rw-r--r--src/styles/plugins.qmltypes1804
-rw-r--r--src/styles/qmldir5
-rw-r--r--src/styles/qtquickvirtualkeyboardstylesplugin.cpp84
-rw-r--r--src/styles/qtquickvirtualkeyboardstylesplugin.h51
-rw-r--r--src/styles/styles.pro34
-rw-r--r--src/styles/styles.qrc (renamed from src/virtualkeyboard/styles/styles.qrc)0
-rw-r--r--src/styles/svgimageprovider.cpp108
-rw-r--r--src/styles/svgimageprovider.h (renamed from src/virtualkeyboard/styles/svgimageprovider.h)0
-rw-r--r--src/virtualkeyboard/3rdparty/openwnn/openwnn.pro56
-rw-r--r--src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp490
-rw-r--r--src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp388
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/include/dictlist.h120
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/include/dicttrie.h233
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/include/ngram.h96
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/include/spellingtrie.h258
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/pinyin.pro59
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/share/dictlist.cpp446
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/share/dicttrie.cpp941
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/share/ngram.cpp342
-rw-r--r--src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp832
-rw-r--r--src/virtualkeyboard/3rdparty/t9write/t9write-build.pri83
-rw-r--r--src/virtualkeyboard/3rdparty/t9write/t9write.pro25
-rw-r--r--src/virtualkeyboard/3rdparty/tcime/cangjiedictionary.cpp141
-rw-r--r--src/virtualkeyboard/3rdparty/tcime/tcime.pro30
-rw-r--r--src/virtualkeyboard/3rdparty/tcime/zhuyintable.cpp161
-rw-r--r--src/virtualkeyboard/abstractinputmethod.cpp331
-rw-r--r--src/virtualkeyboard/abstractinputmethod.h96
-rw-r--r--src/virtualkeyboard/abstractinputpanel.cpp6
-rw-r--r--src/virtualkeyboard/abstractinputpanel.h59
-rw-r--r--src/virtualkeyboard/abstractinputpanel_p.h73
-rw-r--r--src/virtualkeyboard/appinputpanel.cpp5
-rw-r--r--src/virtualkeyboard/appinputpanel.h79
-rw-r--r--src/virtualkeyboard/appinputpanel_p.h76
-rw-r--r--src/virtualkeyboard/appinputpanel_p_p.h70
-rw-r--r--src/virtualkeyboard/content/HandwritingInputPanel.qml4
-rw-r--r--src/virtualkeyboard/content/InputPanel.qml5
-rw-r--r--src/virtualkeyboard/content/components/AlternativeKeys.qml2
-rw-r--r--src/virtualkeyboard/content/components/EnterKey.qml6
-rw-r--r--src/virtualkeyboard/content/components/HideKeyboardKey.qml2
-rw-r--r--src/virtualkeyboard/content/components/InputModeKey.qml38
-rw-r--r--src/virtualkeyboard/content/components/Keyboard.qml478
-rw-r--r--src/virtualkeyboard/content/components/LanguagePopupList.qml67
-rw-r--r--src/virtualkeyboard/content/components/MultitapInputMethod.qml10
-rw-r--r--src/virtualkeyboard/content/components/PopupList.qml67
-rw-r--r--src/virtualkeyboard/content/components/ShadowInputControl.qml10
-rw-r--r--src/virtualkeyboard/content/components/ShiftKey.qml6
-rw-r--r--src/virtualkeyboard/content/components/TraceInputArea.qml12
-rw-r--r--src/virtualkeyboard/content/components/TraceInputKey.qml2
-rw-r--r--src/virtualkeyboard/content/components/WordCandidatePopupList.qml24
-rw-r--r--src/virtualkeyboard/content/content.qrc35
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/digits.qml3
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml34
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/main.qml4
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/numbers.qml3
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/main.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/main.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/dialpad.qml112
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/digits.qml111
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/main.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/main.qml208
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/numbers.qml183
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_GB/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/en_US/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_US/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_US/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_US/main.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_US/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/en_US/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/es_ES/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/es_ES/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/es_ES/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/es_ES/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/es_ES/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/es_MX/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/es_MX/digits.fallback0
-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/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/es_MX/symbols.qml378
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/digits.qml3
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml34
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/main.qml4
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/numbers.qml3
-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/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fi_FI/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fi_FI/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fi_FI/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/fi_FI/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/fi_FI/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fi_FI/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fi_FI/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/fr_CA/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_CA/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_CA/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_CA/main.qml200
-rw-r--r--src/virtualkeyboard/content/layouts/fr_CA/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_CA/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/main.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/symbols.qml4
-rw-r--r--src/virtualkeyboard/content/layouts/hi_IN/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hi_IN/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hi_IN/handwriting.qml103
-rw-r--r--src/virtualkeyboard/content/layouts/hi_IN/main.qml10
-rw-r--r--src/virtualkeyboard/content/layouts/hi_IN/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/id_ID/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/id_ID/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/id_ID/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/id_ID/main.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/id_ID/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/id_ID/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/main.qml26
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/symbols.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml10
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/main.qml4
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/symbols.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/ms_MY/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ms_MY/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ms_MY/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ms_MY/main.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ms_MY/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ms_MY/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/main.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/main.qml199
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/nl_NL/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/pt_BR/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_BR/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_BR/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_BR/main.qml207
-rw-r--r--src/virtualkeyboard/content/layouts/pt_BR/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_BR/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/main.qml540
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/sk_SK/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sk_SK/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sk_SK/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sk_SK/main.qml208
-rw-r--r--src/virtualkeyboard/content/layouts/sk_SK/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sk_SK/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sl_SI/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sl_SI/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sl_SI/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sl_SI/main.qml203
-rw-r--r--src/virtualkeyboard/content/layouts/sl_SI/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sl_SI/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sq_AL/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sq_AL/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sq_AL/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sq_AL/main.qml205
-rw-r--r--src/virtualkeyboard/content/layouts/sq_AL/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sq_AL/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/main.qml6
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/main.qml489
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/tr_TR/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/tr_TR/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/tr_TR/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/tr_TR/main.qml221
-rw-r--r--src/virtualkeyboard/content/layouts/tr_TR/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/tr_TR/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/uk_UA/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/uk_UA/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/uk_UA/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/uk_UA/main.qml373
-rw-r--r--src/virtualkeyboard/content/layouts/uk_UA/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/uk_UA/symbols.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/vi_VN/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/vi_VN/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/vi_VN/handwriting.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/vi_VN/main.qml205
-rw-r--r--src/virtualkeyboard/content/layouts/vi_VN/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/vi_VN/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml8
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/main.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/symbols.qml2
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/dialpad.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/digits.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml8
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/main.qml8
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/numbers.fallback0
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/symbols.qml2
-rw-r--r--src/virtualkeyboard/content/styles/default/style.qml34
-rw-r--r--src/virtualkeyboard/content/styles/default/virtualkeyboard_default_style.qrc (renamed from src/virtualkeyboard/content/styles/default/default_style.qrc)0
-rw-r--r--src/virtualkeyboard/content/styles/retro/style.qml34
-rw-r--r--src/virtualkeyboard/content/styles/retro/virtualkeyboard_retro_style.qrc (renamed from src/virtualkeyboard/content/styles/retro/retro_style.qrc)0
-rw-r--r--src/virtualkeyboard/content/virtualkeyboard_content.qrc35
-rw-r--r--src/virtualkeyboard/defaultinputmethod.cpp79
-rw-r--r--src/virtualkeyboard/defaultinputmethod.h56
-rw-r--r--src/virtualkeyboard/desktopinputpanel.cpp35
-rw-r--r--src/virtualkeyboard/desktopinputpanel.h74
-rw-r--r--src/virtualkeyboard/desktopinputpanel_p.h86
-rw-r--r--src/virtualkeyboard/desktopinputselectioncontrol.cpp42
-rw-r--r--src/virtualkeyboard/desktopinputselectioncontrol.h101
-rw-r--r--src/virtualkeyboard/desktopinputselectioncontrol_p.h115
-rw-r--r--src/virtualkeyboard/doc/QtVirtualKeyboard_pch.h37
-rw-r--r--src/virtualkeyboard/doc/doc.pri1
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-en_US.pngbin0 -> 14929 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-es_MX.pngbin0 -> 15526 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-fr_CA.pngbin0 -> 14589 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-id_ID.pngbin0 -> 14376 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-ms_MY.pngbin0 -> 14227 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-pt_BR.pngbin0 -> 14803 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sk_SK.pngbin0 -> 14398 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sl_SI.pngbin0 -> 14511 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sq_AL.pngbin0 -> 14526 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-th_TH.pngbin0 -> 20185 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-tr_TR.pngbin0 -> 15660 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-uk_UA.pngbin0 -> 16463 bytes
-rw-r--r--src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-vi_VN.pngbin0 -> 14421 bytes
-rw-r--r--src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf35
-rw-r--r--src/virtualkeyboard/doc/src/build.qdoc209
-rw-r--r--src/virtualkeyboard/doc/src/deployment-guide.qdoc32
-rw-r--r--src/virtualkeyboard/doc/src/handwriting.qdoc169
-rw-r--r--src/virtualkeyboard/doc/src/includes/layouts.qdocinc24
-rw-r--r--src/virtualkeyboard/doc/src/layouts.qdoc54
-rw-r--r--src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc16
-rw-r--r--src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc5
-rw-r--r--src/virtualkeyboard/doc/src/technical-guide.qdoc308
-rw-r--r--src/virtualkeyboard/doc/src/user-guide.qdoc7
-rw-r--r--src/virtualkeyboard/enterkeyaction.cpp6
-rw-r--r--src/virtualkeyboard/enterkeyaction.h64
-rw-r--r--src/virtualkeyboard/enterkeyaction_p.h78
-rw-r--r--src/virtualkeyboard/enterkeyactionattachedtype.cpp4
-rw-r--r--src/virtualkeyboard/enterkeyactionattachedtype.h68
-rw-r--r--src/virtualkeyboard/enterkeyactionattachedtype_p.h82
-rw-r--r--src/virtualkeyboard/fallbackinputmethod.cpp81
-rw-r--r--src/virtualkeyboard/fallbackinputmethod_p.h69
-rw-r--r--src/virtualkeyboard/generateresource.pri28
-rw-r--r--src/virtualkeyboard/gesturerecognizer.cpp6
-rw-r--r--src/virtualkeyboard/gesturerecognizer.h50
-rw-r--r--src/virtualkeyboard/gesturerecognizer_p.h64
-rw-r--r--src/virtualkeyboard/handwritinggesturerecognizer.cpp10
-rw-r--r--src/virtualkeyboard/handwritinggesturerecognizer.h54
-rw-r--r--src/virtualkeyboard/handwritinggesturerecognizer_p.h67
-rw-r--r--src/virtualkeyboard/hangul.cpp363
-rw-r--r--src/virtualkeyboard/hangul.h136
-rw-r--r--src/virtualkeyboard/hangulinputmethod.cpp101
-rw-r--r--src/virtualkeyboard/hangulinputmethod.h59
-rw-r--r--src/virtualkeyboard/hunspellinputmethod.cpp351
-rw-r--r--src/virtualkeyboard/hunspellinputmethod.h72
-rw-r--r--src/virtualkeyboard/hunspellinputmethod_p.cpp213
-rw-r--r--src/virtualkeyboard/hunspellinputmethod_p.h75
-rw-r--r--src/virtualkeyboard/hunspellworker.cpp321
-rw-r--r--src/virtualkeyboard/hunspellworker.h155
-rw-r--r--src/virtualkeyboard/import/import.pro12
-rw-r--r--src/virtualkeyboard/import/plugins.qmltypes1999
-rw-r--r--src/virtualkeyboard/import/qmldir5
-rw-r--r--src/virtualkeyboard/inputcontext.cpp1205
-rw-r--r--src/virtualkeyboard/inputcontext.h178
-rw-r--r--src/virtualkeyboard/inputengine.cpp1030
-rw-r--r--src/virtualkeyboard/inputengine.h163
-rw-r--r--src/virtualkeyboard/inputmethod.cpp72
-rw-r--r--src/virtualkeyboard/inputmethod.h71
-rw-r--r--src/virtualkeyboard/inputmethod_p.h86
-rw-r--r--src/virtualkeyboard/inputselectionhandle.cpp6
-rw-r--r--src/virtualkeyboard/inputselectionhandle.h62
-rw-r--r--src/virtualkeyboard/inputselectionhandle_p.h75
-rw-r--r--src/virtualkeyboard/inputview.cpp4
-rw-r--r--src/virtualkeyboard/inputview.h52
-rw-r--r--src/virtualkeyboard/inputview_p.h66
-rw-r--r--src/virtualkeyboard/lipiinputmethod.cpp624
-rw-r--r--src/virtualkeyboard/lipiinputmethod.h78
-rw-r--r--src/virtualkeyboard/lipisharedrecognizer.cpp418
-rw-r--r--src/virtualkeyboard/lipisharedrecognizer.h92
-rw-r--r--src/virtualkeyboard/lipiworker.cpp256
-rw-r--r--src/virtualkeyboard/lipiworker.h148
-rw-r--r--src/virtualkeyboard/openwnninputmethod.cpp823
-rw-r--r--src/virtualkeyboard/openwnninputmethod.h65
-rw-r--r--src/virtualkeyboard/pinyindecoderservice.cpp229
-rw-r--r--src/virtualkeyboard/pinyindecoderservice.h73
-rw-r--r--src/virtualkeyboard/pinyininputmethod.cpp496
-rw-r--r--src/virtualkeyboard/pinyininputmethod.h65
-rw-r--r--src/virtualkeyboard/plaininputmethod.cpp30
-rw-r--r--src/virtualkeyboard/plaininputmethod.h57
-rw-r--r--src/virtualkeyboard/plaininputmethod_p.h70
-rw-r--r--src/virtualkeyboard/platforminputcontext.cpp75
-rw-r--r--src/virtualkeyboard/platforminputcontext.h104
-rw-r--r--src/virtualkeyboard/platforminputcontext_p.h126
-rw-r--r--src/virtualkeyboard/plugin.cpp257
-rw-r--r--src/virtualkeyboard/plugin.h48
-rw-r--r--src/virtualkeyboard/qvirtualkeyboard_global.h49
-rw-r--r--src/virtualkeyboard/qvirtualkeyboard_staticplugin_p.h69
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.cpp363
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h90
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardextensionplugin.cpp68
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardextensionplugin.h54
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp572
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext.h134
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp550
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h204
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputengine.cpp1054
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputengine.h176
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp345
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h107
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardtrace.cpp467
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardtrace.h90
-rw-r--r--src/virtualkeyboard/selectionlistmodel.cpp313
-rw-r--r--src/virtualkeyboard/selectionlistmodel.h93
-rw-r--r--src/virtualkeyboard/settings.cpp4
-rw-r--r--src/virtualkeyboard/settings.h96
-rw-r--r--src/virtualkeyboard/settings/plugins.qmltypes1335
-rw-r--r--src/virtualkeyboard/settings/qmldir4
-rw-r--r--src/virtualkeyboard/settings/settings.pro12
-rw-r--r--src/virtualkeyboard/settings_p.h110
-rw-r--r--src/virtualkeyboard/shadowinputcontext.cpp16
-rw-r--r--src/virtualkeyboard/shadowinputcontext.h90
-rw-r--r--src/virtualkeyboard/shadowinputcontext_p.h107
-rw-r--r--src/virtualkeyboard/shifthandler.cpp157
-rw-r--r--src/virtualkeyboard/shifthandler.h85
-rw-r--r--src/virtualkeyboard/shifthandler_p.h114
-rw-r--r--src/virtualkeyboard/styles/KeyboardStyle.qml527
-rw-r--r--src/virtualkeyboard/styles/SelectionListItem.qml64
-rw-r--r--src/virtualkeyboard/styles/TraceCanvas.qml152
-rw-r--r--src/virtualkeyboard/styles/TraceUtils.js89
-rw-r--r--src/virtualkeyboard/styles/plugins.qmltypes4
-rw-r--r--src/virtualkeyboard/styles/qmldir4
-rw-r--r--src/virtualkeyboard/styles/styles.pro23
-rw-r--r--src/virtualkeyboard/styles/styles_plugin.cpp76
-rw-r--r--src/virtualkeyboard/styles/styles_plugin.h54
-rw-r--r--src/virtualkeyboard/styles/svgimageprovider.cpp108
-rw-r--r--src/virtualkeyboard/t9write.h50
-rw-r--r--src/virtualkeyboard/t9writedictionary.cpp117
-rw-r--r--src/virtualkeyboard/t9writedictionary.h67
-rw-r--r--src/virtualkeyboard/t9writeinputmethod.cpp2129
-rw-r--r--src/virtualkeyboard/t9writeinputmethod.h86
-rw-r--r--src/virtualkeyboard/t9writeworker.cpp414
-rw-r--r--src/virtualkeyboard/t9writeworker.h208
-rw-r--r--src/virtualkeyboard/tcinputmethod.cpp540
-rw-r--r--src/virtualkeyboard/tcinputmethod.h72
-rw-r--r--src/virtualkeyboard/trace.cpp428
-rw-r--r--src/virtualkeyboard/trace.h84
-rw-r--r--src/virtualkeyboard/unipentrace.cpp21
-rw-r--r--src/virtualkeyboard/unipentrace.h57
-rw-r--r--src/virtualkeyboard/unipentrace_p.h71
-rw-r--r--src/virtualkeyboard/virtualkeyboard.pro566
-rw-r--r--src/virtualkeyboard/virtualkeyboarddebug.h40
-rw-r--r--src/virtualkeyboard/virtualkeyboarddebug_p.h57
-rw-r--r--src/virtualkeyboard/virtualkeyboardsettings.cpp31
-rw-r--r--src/virtualkeyboard/virtualkeyboardsettings.h121
-rw-r--r--src/virtualkeyboard/virtualkeyboardsettings_p.h135
-rw-r--r--sync.profile2
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/cmake/CMakeLists.txt12
-rw-r--r--tests/auto/cmake/cmake.pro6
-rw-r--r--tests/auto/inputpanel/BLACKLIST14
-rw-r--r--tests/auto/inputpanel/data/inputpanel/handwriting.js7
-rw-r--r--tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml9
-rw-r--r--tests/auto/inputpanel/data/inputpanel/inputpanel.qml200
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js854
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js1930
-rw-r--r--tests/auto/inputpanel/data/tst_inputpanel.qml447
-rw-r--r--tests/auto/inputpanel/hwr_test_data/korean/44397_100_0.txt208
-rw-r--r--tests/auto/inputpanel/hwr_test_data/korean/50612_100_0.txt46
-rw-r--r--tests/auto/inputpanel/hwr_test_data/korean/54620_100_0.txt276
-rw-r--r--tests/auto/inputpanel/hwr_test_data/vietnamese/103_100_0.txt89
-rw-r--r--tests/auto/inputpanel/hwr_test_data/vietnamese/105_100_0.txt41
-rw-r--r--tests/auto/inputpanel/hwr_test_data/vietnamese/105_100_1.txt29
-rw-r--r--tests/auto/inputpanel/hwr_test_data/vietnamese/110_100_0.txt82
-rw-r--r--tests/auto/inputpanel/hwr_test_data/vietnamese/116_100_0.txt72
-rw-r--r--tests/auto/inputpanel/hwr_test_data/vietnamese/7871_100_0.txt88
-rw-r--r--tests/auto/inputpanel/hwr_test_data/vietnamese/7879_100_0.txt71
-rw-r--r--tests/auto/inputpanel/tst_inputpanel.cpp15
-rw-r--r--tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml2
-rw-r--r--tests/auto/layoutresources/data/layouts/en_GB/main.qml2
958 files changed, 42048 insertions, 35714 deletions
diff --git a/.gitignore b/.gitignore
index 60b9523b..bee08fee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,15 +2,13 @@
# --------------------------------------------------------------
examples/virtualkeyboard/basic/basic
-!src/virtualkeyboard/3rdparty/hunspell/hunspell.pro
-src/virtualkeyboard/3rdparty/hunspell/*
-src/virtualkeyboard/3rdparty/hunspell/doc/html
-src/virtualkeyboard/3rdparty/t9write/build_*
-src/virtualkeyboard/3rdparty/t9write/databases
-src/virtualkeyboard/3rdparty/t9write/doc
-src/virtualkeyboard/3rdparty/t9write/example
+!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/virtualkeyboard/layouts.qrc
*_wrapper.sh
*_wrapper.bat
*_resource.rc
diff --git a/.qmake.conf b/.qmake.conf
index 76c202ab..097d8b94 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,3 @@
load(qt_build_config)
-MODULE_VERSION = 5.11.2
+MODULE_VERSION = 5.12.0
diff --git a/examples/virtualkeyboard/basic/Basic.qml b/examples/virtualkeyboard/basic/Basic.qml
index f3cd59c3..158a7826 100644
--- a/examples/virtualkeyboard/basic/Basic.qml
+++ b/examples/virtualkeyboard/basic/Basic.qml
@@ -41,7 +41,7 @@ Rectangle {
property bool handwritingInputPanelActive: false
Flickable {
- id: contentFlickable
+ id: flickable
anchors.fill: parent
contentWidth: content.width
contentHeight: content.height
@@ -54,7 +54,7 @@ Rectangle {
MouseArea {
id: content
- width: contentFlickable.width
+ width: flickable.width
height: textEditors.height + 24
onClicked: focus = true
diff --git a/examples/virtualkeyboard/basic/basic-b2qt.qml b/examples/virtualkeyboard/basic/basic-b2qt.qml
index 1ab93b27..59c64b86 100644
--- a/examples/virtualkeyboard/basic/basic-b2qt.qml
+++ b/examples/virtualkeyboard/basic/basic-b2qt.qml
@@ -43,9 +43,8 @@ Item {
height: Screen.width < Screen.height ? parent.width : parent.height
anchors.centerIn: parent
rotation: Screen.width < Screen.height ? 90 : 0
-
Basic {
- id: contentContainer
+ id: virtualKeyboard
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
diff --git a/examples/virtualkeyboard/basic/content/AutoScroller.qml b/examples/virtualkeyboard/basic/content/AutoScroller.qml
index 4893f133..b6b7924f 100644
--- a/examples/virtualkeyboard/basic/content/AutoScroller.qml
+++ b/examples/virtualkeyboard/basic/content/AutoScroller.qml
@@ -31,60 +31,74 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
Item {
- property var flickable
- readonly property var inputItem: InputContext.inputItem
- onInputItemChanged: delayedLoading.start()
+ property var innerFlickable
+ property var outerFlickable
+ property var inputItem: InputContext.priv.inputItem
+
+ onInputItemChanged: {
+ innerFlickable = null
+ outerFlickable = null
+ if (inputItem !== null) {
+ var parent_ = inputItem.parent
+ while (parent_) {
+ if (parent_.maximumFlickVelocity) {
+ if (innerFlickable) {
+ outerFlickable = parent_
+ break
+ } else {
+ innerFlickable = parent_
+ }
+ }
+ parent_ = parent_.parent
+ }
+ delayedLoading.restart()
+ }
+ }
function ensureVisible(flickable) {
- if (!Qt.inputMethod.visible || !inputItem || !flickable || !flickable.visible/* || !flickable.interactive*/)
- return;
+ if (Qt.inputMethod.visible && inputItem && flickable && flickable.visible && flickable.interactive) {
- var verticallyFlickable = (flickable.flickableDirection === Flickable.HorizontalAndVerticalFlick || flickable.flickableDirection === Flickable.VerticalFlick
- || (flickable.flickableDirection === Flickable.AutoFlickDirection && flickable.contentHeight > flickable.height))
- var horizontallyFlickable = (flickable.flickableDirection === Flickable.HorizontalAndVerticalFlick || flickable.flickableDirection === Flickable.HorizontalFlick
- || (flickable.flickableDirection === Flickable.AutoFlickDirection && flickable.contentWidth > flickable.width))
+ var verticallyFlickable = (flickable.flickableDirection === Flickable.HorizontalAndVerticalFlick || flickable.flickableDirection === Flickable.VerticalFlick
+ || (flickable.flickableDirection === Flickable.AutoFlickDirection && flickable.contentHeight > flickable.height))
+ var horizontallyFlickable = (flickable.flickableDirection === Flickable.HorizontalAndVerticalFlick || flickable.flickableDirection === Flickable.HorizontalFlick
+ || (flickable.flickableDirection === Flickable.AutoFlickDirection && flickable.contentWidth > flickable.width))
- if ((!verticallyFlickable && !horizontallyFlickable) || !inputItem.hasOwnProperty("cursorRectangle"))
- return
+ if ((!verticallyFlickable && !horizontallyFlickable) || !inputItem.hasOwnProperty("cursorRectangle"))
+ return
- var cursorRectangle = flickable.contentItem.mapFromItem(inputItem, inputItem.cursorRectangle.x, inputItem.cursorRectangle.y)
+ var cursorRectangle = flickable.contentItem.mapFromItem(inputItem, inputItem.cursorRectangle.x, inputItem.cursorRectangle.y)
- if (verticallyFlickable) {
- var scrollMarginVertical = flickable.scrollMarginVertical ? flickable.scrollMarginVertical : 10
- if (flickable.contentY >= cursorRectangle.y - scrollMarginVertical) {
- // The flickable is foo far down; move it up.
- flickable.contentY = Math.max(0, cursorRectangle.y - scrollMarginVertical)
- } else if (flickable.contentY + flickable.height <= cursorRectangle.y + inputItem.cursorRectangle.height + scrollMarginVertical) {
- // The flickable is foo far up; move it down.
- flickable.contentY = Math.min(flickable.contentHeight - flickable.height, cursorRectangle.y + inputItem.cursorRectangle.height - flickable.height + scrollMarginVertical)
+ var oldContentY = flickable.contentY
+ if (verticallyFlickable) {
+ var scrollMarginVertical = (flickable && flickable.scrollMarginVertical) ? flickable.scrollMarginVertical : 10
+ if (flickable.contentY >= cursorRectangle.y - scrollMarginVertical)
+ flickable.contentY = Math.max(0, cursorRectangle.y - scrollMarginVertical)
+ else if (flickable.contentY + flickable.height <= cursorRectangle.y + inputItem.cursorRectangle.height + scrollMarginVertical)
+ flickable.contentY = Math.min(flickable.contentHeight - flickable.height, cursorRectangle.y + inputItem.cursorRectangle.height - flickable.height + scrollMarginVertical)
}
- }
- if (horizontallyFlickable) {
- var scrollMarginHorizontal = flickable.scrollMarginHorizontal ? flickable.scrollMarginHorizontal : 10
- if (flickable.contentX >= cursorRectangle.x - scrollMarginHorizontal) {
- // The flickable is foo far down; move it up.
- flickable.contentX = Math.max(0, cursorRectangle.x - scrollMarginHorizontal)
- } else if (flickable.contentX + flickable.width <= cursorRectangle.x + inputItem.cursorRectangle.width + scrollMarginHorizontal) {
- // The flickable is foo far up; move it down.
- flickable.contentX = Math.min(flickable.contentWidth - flickable.width, cursorRectangle.x + inputItem.cursorRectangle.width - flickable.width + scrollMarginHorizontal)
+ if (horizontallyFlickable) {
+ var scrollMarginHorizontal = (flickable && flickable.scrollMarginHorizontal) ? flickable.scrollMarginHorizontal : 10
+ if (flickable.contentX >= cursorRectangle.x - scrollMarginHorizontal)
+ flickable.contentX = Math.max(0, cursorRectangle.x - scrollMarginHorizontal)
+ else if (flickable.contentX + flickable.width <= cursorRectangle.x + inputItem.cursorRectangle.width + scrollMarginHorizontal)
+ flickable.contentX = Math.min(flickable.contentWidth - flickable.width, cursorRectangle.x + inputItem.cursorRectangle.width - flickable.width + scrollMarginHorizontal)
}
}
}
Timer {
id: delayedLoading
interval: 10
- onTriggered: ensureVisible(flickable)
+ onTriggered: {
+ ensureVisible(innerFlickable)
+ ensureVisible(outerFlickable)
+ }
}
Connections {
ignoreUnknownSignals: true
target: Qt.inputMethod
- onKeyboardRectangleChanged: delayedLoading.start()
- }
- Connections {
- ignoreUnknownSignals: true
- target: inputItem
- enabled: inputItem && inputItem.activeFocus
- onCursorRectangleChanged: delayedLoading.start()
+ onAnimatingChanged: if (inputItem && !Qt.inputMethod.animating) delayedLoading.restart()
+ onKeyboardRectangleChanged: if (inputItem) delayedLoading.restart()
+ onCursorRectangleChanged: if (inputItem && inputItem.activeFocus) delayedLoading.restart()
}
}
diff --git a/examples/virtualkeyboard/basic/content/TextArea.qml b/examples/virtualkeyboard/basic/content/TextArea.qml
index d8ce44a2..899882ab 100644
--- a/examples/virtualkeyboard/basic/content/TextArea.qml
+++ b/examples/virtualkeyboard/basic/content/TextArea.qml
@@ -36,11 +36,15 @@ Controls.TextArea {
color: "#2B2C2E"
selectionColor: Qt.rgba(0.0, 0.0, 0.0, 0.15)
selectedTextColor: color
+ selectByMouse: true
font.pixelSize: Qt.application.font.pixelSize * 2
property int enterKeyAction: EnterKeyAction.None
readonly property bool enterKeyEnabled: enterKeyAction === EnterKeyAction.None || text.length > 0 || inputMethodComposing
+ EnterKeyAction.actionId: control.enterKeyAction
+ EnterKeyAction.enabled: control.enterKeyEnabled
+
background: Rectangle {
color: "#FFFFFF"
border.width: 1
diff --git a/examples/virtualkeyboard/basic/content/TextField.qml b/examples/virtualkeyboard/basic/content/TextField.qml
index 0a6d80ef..6ce4f61c 100644
--- a/examples/virtualkeyboard/basic/content/TextField.qml
+++ b/examples/virtualkeyboard/basic/content/TextField.qml
@@ -36,10 +36,14 @@ Controls.TextField {
color: "#2B2C2E"
selectionColor: Qt.rgba(0.0, 0.0, 0.0, 0.15)
selectedTextColor: color
+ selectByMouse: true
font.pixelSize: Qt.application.font.pixelSize * 2
property int enterKeyAction: EnterKeyAction.None
- readonly property bool enterKeyEnabled: enterKeyAction === EnterKeyAction.None || text.length > 0 || inputMethodComposing
+ readonly property bool enterKeyEnabled: enterKeyAction === EnterKeyAction.None || acceptableInput || inputMethodComposing
+
+ EnterKeyAction.actionId: control.enterKeyAction
+ EnterKeyAction.enabled: control.enterKeyEnabled
background: Rectangle {
color: "#FFFFFF"
diff --git a/src/config.pri b/src/config.pri
index 94ce1fa4..81e05763 100644
--- a/src/config.pri
+++ b/src/config.pri
@@ -1,15 +1,36 @@
# Enable handwriting
-handwriting:!lipi-toolkit:!t9write {
- include(virtualkeyboard/3rdparty/t9write/t9write-build.pri)
- equals(T9WRITE_FOUND, 1): CONFIG += t9write
- else: CONFIG += lipi-toolkit
+handwriting:!lipi-toolkit:!t9write:!myscript {
+ include(plugins/myscript/3rdparty/myscript/myscript.pri)
+ equals(MYSCRIPT_FOUND, 1) {
+ CONFIG += myscript
+ } else {
+ include(plugins/t9write/3rdparty/t9write/t9write-build.pri)
+ equals(T9WRITE_FOUND, 1): CONFIG += t9write
+ else: CONFIG += lipi-toolkit
+ }
+}
+myscript {
+ !handwriting: include(plugins/myscript/3rdparty/myscript/myscript.pri)
}
t9write {
- !handwriting: include(virtualkeyboard/3rdparty/t9write/t9write-build.pri)
+ !handwriting: include(plugins/t9write/3rdparty/t9write/t9write-build.pri)
equals(T9WRITE_CJK_FOUND, 1): CONFIG += t9write-cjk
equals(T9WRITE_ALPHABETIC_FOUND, 1): CONFIG += t9write-alphabetic
}
+# Enable pkgconfig
+win32: CONFIG += no-pkg-config
+!no-pkg-config: CONFIG += link_pkgconfig
+
+# Enable Hunspell
+!disable-hunspell:!hunspell-library:!hunspell-package {
+ exists(plugins/hunspell/3rdparty/hunspell/src/hunspell/hunspell.h): CONFIG += hunspell-library
+ else:link_pkgconfig:packagesExist(hunspell): CONFIG += hunspell-package
+ else: CONFIG += disable-hunspell
+}
+disable-hunspell: CONFIG -= hunspell
+else: CONFIG += hunspell
+
# Disable built-in layouts
disable-layouts {
message("The built-in layouts are now excluded from the Qt Virtual Keyboard plugin.")
@@ -19,6 +40,7 @@ disable-layouts {
hangul: CONFIG += lang-ko_KR
pinyin: CONFIG += lang-zh_CN
tcime|zhuyin|cangjie: CONFIG += lang-zh_TW
+ thai: CONFIG += lang-th_TH
# Use all languages by default
!contains(CONFIG, lang-.*): CONFIG += lang-all
@@ -32,35 +54,54 @@ disable-layouts {
lang-de_DE \
lang-el_GR \
lang-en_GB \
+ lang-en_US \
lang-es_ES \
+ lang-es_MX \
lang-et_EE \
lang-fa_FA \
lang-fi_FI \
+ lang-fr_CA \
lang-fr_FR \
lang-he_IL \
lang-hi_IN \
lang-hr_HR \
lang-hu_HU \
+ lang-id_ID \
lang-it_IT \
lang-ja_JP \
lang-ko_KR \
+ lang-ms_MY \
lang-nb_NO \
lang-nl_NL \
lang-pl_PL \
+ lang-pt_BR \
lang-pt_PT \
lang-ro_RO \
lang-ru_RU \
+ lang-sk_SK \
+ lang-sl_SI \
+ lang-sq_AL \
lang-sr_SP \
lang-sv_SE \
+ lang-th_TH \
+ lang-tr_TR \
+ lang-uk_UA \
+ lang-vi_VN \
lang-zh_CN \
lang-zh_TW
}
+# Common variables
+LAYOUTS_BASE = $$PWD/virtualkeyboard
+LAYOUTS_PREFIX = /QtQuick/VirtualKeyboard
+VIRTUALKEYBOARD_INSTALL_DATA = $$[QT_INSTALL_DATA]/qtvirtualkeyboard
+
# Enable features by languages
contains(CONFIG, lang-ja.*)|lang-all: CONFIG += openwnn
contains(CONFIG, lang-ko.*)|lang-all: CONFIG += hangul
contains(CONFIG, lang-zh(_CN)?)|lang-all: CONFIG += pinyin
contains(CONFIG, lang-zh(_TW)?)|lang-all: CONFIG += tcime
+contains(CONFIG, lang-th.*)|lang-all: CONFIG += thai
# Feature dependencies
tcime {
diff --git a/src/import/dependencies.json b/src/import/dependencies.json
new file mode 100644
index 00000000..f5bc2b31
--- /dev/null
+++ b/src/import/dependencies.json
@@ -0,0 +1,22 @@
+[
+ {
+ "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
new file mode 100644
index 00000000..c1045ffc
--- /dev/null
+++ b/src/import/import.pro
@@ -0,0 +1,34 @@
+TARGET = qtquickvirtualkeyboardplugin
+TARGETPATH = QtQuick/VirtualKeyboard
+IMPORT_VERSION = 2.4
+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
new file mode 100644
index 00000000..8e6c3c02
--- /dev/null
+++ b/src/import/plugins.qmltypes
@@ -0,0 +1,2031 @@
+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.4'
+
+Module {
+ dependencies: [
+ "Qt.labs.folderlistmodel 2.1",
+ "QtQuick 2.0",
+ "QtQuick.Layouts 1.0",
+ "QtQuick.Window 2.2"
+ ]
+ Component {
+ name: "QVirtualKeyboardInputContext"
+ prototype: "QObject"
+ exports: [
+ "QtQuick.VirtualKeyboard/InputContext 1.0",
+ "QtQuick.VirtualKeyboard/InputContext 2.0",
+ "QtQuick.VirtualKeyboard/InputContext 2.4"
+ ]
+ isCreatable: false
+ isSingleton: true
+ exportMetaObjectRevisions: [0, 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: "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
+ }
+ }
+ 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::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::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 {
+ 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 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/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/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 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/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/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/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/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 2.3"
+ exports: ["QtQuick.VirtualKeyboard/InputPanel 2.3"]
+ exportMetaObjectRevisions: [3]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
+ Property { name: "__isRootItem"; type: "bool"; isReadonly: true }
+ Property { name: "active"; type: "bool" }
+ Property { name: "keyboard"; type: "Keyboard_QMLTYPE_16"; 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: "__isRootItem"; type: "bool"; isReadonly: true }
+ Property { name: "active"; type: "bool" }
+ Property { name: "keyboard"; type: "Keyboard_QMLTYPE_16"; 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: "__isRootItem"; type: "bool"; isReadonly: true }
+ Property { name: "active"; type: "bool" }
+ Property { name: "keyboard"; type: "Keyboard_QMLTYPE_16"; 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: "__isRootItem"; type: "bool"; isReadonly: true }
+ Property { name: "active"; type: "bool" }
+ Property { name: "keyboard"; type: "Keyboard_QMLTYPE_16"; 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: "__isRootItem"; type: "bool"; isReadonly: true }
+ Property { name: "active"; type: "bool" }
+ Property { name: "keyboard"; type: "Keyboard_QMLTYPE_16"; 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: "__isRootItem"; type: "bool"; isReadonly: true }
+ Property { name: "active"; type: "bool" }
+ Property { name: "keyboard"; type: "Keyboard_QMLTYPE_16"; 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.0"
+ exports: ["QtQuick.VirtualKeyboard/InputPanel 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
+ Property { name: "__isRootItem"; type: "bool"; isReadonly: true }
+ Property { name: "active"; type: "bool" }
+ Property { name: "keyboard"; type: "Keyboard_QMLTYPE_16"; 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: "__isRootItem"; type: "bool"; isReadonly: true }
+ Property { name: "active"; type: "bool" }
+ Property { name: "keyboard"; type: "Keyboard_QMLTYPE_16"; 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: "QQuickItem"; 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: "QQuickItem"; 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 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/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/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 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: "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: "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: "QVirtualKeyboardAbstractInputMethod"
+ 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
+ }
+ }
+ Component {
+ prototype: "QVirtualKeyboardAbstractInputMethod"
+ 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
+ }
+ }
+ 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: "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: "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 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/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/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
new file mode 100644
index 00000000..e1110f1a
--- /dev/null
+++ b/src/import/qmldir
@@ -0,0 +1,10 @@
+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
new file mode 100644
index 00000000..969884c2
--- /dev/null
+++ b/src/import/qtquickvirtualkeyboardplugin.cpp
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** 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");
+ qmlRegisterType<EnterKeyActionAttachedType>();
+ 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");
+
+ // New revisions in 5.12.
+ qmlRegisterSingletonType<QVirtualKeyboardInputContext>(uri, 2, 4, "InputContext", createInputContextModule);
+}
+
+QT_END_NAMESPACE
diff --git a/src/import/qtquickvirtualkeyboardplugin.h b/src/import/qtquickvirtualkeyboardplugin.h
new file mode 100644
index 00000000..24651644
--- /dev/null
+++ b/src/import/qtquickvirtualkeyboardplugin.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** 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);
+};
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKVIRTUALKEYBOARDPLUGIN_H
+
diff --git a/src/plugin/extensionloader.cpp b/src/plugin/extensionloader.cpp
new file mode 100644
index 00000000..e3f1b28e
--- /dev/null
+++ b/src/plugin/extensionloader.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** 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;
+QHash<QString, QJsonObject> ExtensionLoader::m_plugins;
+bool ExtensionLoader::m_alreadyDiscovered = false;
+
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+ (QVirtualKeyboardExtensionPluginFactoryInterface_iid,
+ QLatin1String("/virtualkeyboard")))
+
+QHash<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.insertMulti(name, obj);
+ }
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugin/extensionloader.h b/src/plugin/extensionloader.h
new file mode 100644
index 00000000..4d18ad30
--- /dev/null
+++ b/src/plugin/extensionloader.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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 QHash<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 QHash<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
new file mode 100644
index 00000000..e1e03df7
--- /dev/null
+++ b/src/plugin/plugin.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** 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 "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>
+
+QT_BEGIN_NAMESPACE
+
+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
+{
+ return QStringList(QLatin1String(pluginName));
+}
+
+QPlatformInputContext *QVirtualKeyboardPlugin::create(const QString &system, const QStringList &paramList)
+{
+ Q_UNUSED(paramList);
+
+#if defined(QT_STATICPLUGIN)
+ Q_INIT_RESOURCE(qmake_virtualkeyboard_layouts);
+ Q_INIT_RESOURCE(virtualkeyboard_content);
+ Q_INIT_RESOURCE(virtualkeyboard_default_style);
+ Q_INIT_RESOURCE(virtualkeyboard_retro_style);
+ 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 (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");
+
+ QHash<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);
+ }
+ }
+
+ platformInputContext->setInputMethods(inputMethodList);
+
+ return platformInputContext;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugin/plugin.h b/src/plugin/plugin.h
new file mode 100644
index 00000000..c3353022
--- /dev/null
+++ b/src/plugin/plugin.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** 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 PLUGIN_H
+#define PLUGIN_H
+
+#include <qpa/qplatforminputcontextplugin_p.h>
+#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
+#include <QStringList>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardPlugin : public QPlatformInputContextPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE "qtvirtualkeyboard.json")
+
+public:
+ QStringList keys() const;
+ QPlatformInputContext *create(const QString&, const QStringList&);
+};
+
+QT_END_NAMESPACE
+
+#endif // PLUGIN_H
diff --git a/src/plugin/plugin.pro b/src/plugin/plugin.pro
new file mode 100644
index 00000000..8cf53c9a
--- /dev/null
+++ b/src/plugin/plugin.pro
@@ -0,0 +1,29 @@
+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
+
+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/virtualkeyboard/qtvirtualkeyboard.json b/src/plugin/qtvirtualkeyboard.json
index 76d17069..76d17069 100644
--- a/src/virtualkeyboard/qtvirtualkeyboard.json
+++ b/src/plugin/qtvirtualkeyboard.json
diff --git a/src/plugins/hangul/hangul.cpp b/src/plugins/hangul/hangul.cpp
new file mode 100644
index 00000000..f29fb3a3
--- /dev/null
+++ b/src/plugins/hangul/hangul.cpp
@@ -0,0 +1,365 @@
+/****************************************************************************
+**
+** 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 "hangul_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+const QList<ushort> Hangul::initials = QList<ushort>()
+ << 0x3131 << 0x3132 << 0x3134 << 0x3137 << 0x3138 << 0x3139 << 0x3141
+ << 0x3142 << 0x3143 << 0x3145 << 0x3146 << 0x3147 << 0x3148 << 0x3149
+ << 0x314A << 0x314B << 0x314C << 0x314D << 0x314E;
+const QList<ushort> Hangul::finals = QList<ushort>()
+ << 0x0000 << 0x3131 << 0x3132 << 0x3133 << 0x3134 << 0x3135 << 0x3136
+ << 0x3137 << 0x3139 << 0x313A << 0x313B << 0x313C << 0x313D << 0x313E
+ << 0x313F << 0x3140 << 0x3141 << 0x3142 << 0x3144 << 0x3145 << 0x3146
+ << 0x3147 << 0x3148 << 0x314A << 0x314B << 0x314C << 0x314D << 0x314E;
+const QMap<ushort, Hangul::HangulMedialIndex> Hangul::doubleMedialMap =
+ Hangul::initDoubleMedialMap();
+const QMap<ushort, Hangul::HangulFinalIndex> Hangul::doubleFinalMap =
+ Hangul::initDoubleFinalMap();
+const int Hangul::SBase = 0xAC00;
+const int Hangul::LBase = 0x1100;
+const int Hangul::VBase = 0x314F;
+const int Hangul::TBase = 0x11A7;
+const int Hangul::LCount = 19;
+const int Hangul::VCount = 21;
+const int Hangul::TCount = 28;
+const int Hangul::NCount = Hangul::VCount * Hangul::TCount; // 588
+const int Hangul::SCount = Hangul::LCount * Hangul::NCount; // 11172
+
+/*!
+ \class QtVirtualKeyboard::Hangul
+ \internal
+*/
+
+QString Hangul::decompose(const QString &source)
+{
+ QString result;
+ const int len = source.length();
+ for (int i = 0; i < len; i++) {
+ QChar ch = source.at(i);
+ int SIndex = (int)ch.unicode() - SBase;
+ if (SIndex >= 0 && SIndex < SCount) {
+
+ // Decompose initial consonant
+ result.append(QChar((int)initials[SIndex / NCount]));
+
+ // Decompose medial vowel and check if it consists of double Jamo
+ int VIndex = (SIndex % NCount) / TCount;
+ ushort key = findDoubleMedial((HangulMedialIndex)VIndex);
+ if (key) {
+ HangulMedialIndex VIndexA, VIndexB;
+ unpackDoubleMedial(key, VIndexA, VIndexB);
+ result.append(QChar(VBase + (int)VIndexA));
+ result.append(QChar(VBase + (int)VIndexB));
+ } else {
+ result.append(QChar(VBase + VIndex));
+ }
+
+ // Decompose final consonant and check if it consists of double Jamo
+ int TIndex = SIndex % TCount;
+ if (TIndex != 0) {
+ key = findDoubleFinal((HangulFinalIndex)TIndex);
+ if (key) {
+ HangulFinalIndex TIndexA, TIndexB;
+ unpackDoubleFinal(key, TIndexA, TIndexB);
+ result.append(QChar(finals[(int)TIndexA]));
+ result.append(QChar(finals[(int)TIndexB]));
+ } else {
+ result.append(QChar(finals[TIndex]));
+ }
+ }
+ } else {
+ result.append(ch);
+ }
+ }
+ return result;
+}
+
+QString Hangul::compose(const QString &source)
+{
+ const int len = source.length();
+ if (len == 0)
+ return QString();
+
+ // Always add the initial character into buffer.
+ // The last character will serve as the current
+ // Hangul Syllable.
+ QChar last = source.at(0);
+ QString result = QString(last);
+
+ // Go through the input buffer starting at next character
+ for (int i = 1; i < len; i++) {
+ const QChar ch = source.at(i);
+
+ // Check to see if the character is Hangul Compatibility Jamo
+ const ushort unicode = ch.unicode();
+ if (isJamo(unicode)) {
+
+ // Check to see if the character is syllable
+ const ushort lastUnicode = last.unicode();
+ int SIndex = (int)lastUnicode - SBase;
+ if (SIndex >= 0 && SIndex < SCount) {
+
+ // Check to see if the syllable type is LV or LV+T
+ int TIndex = SIndex % TCount;
+ if (TIndex == 0) {
+
+ // If the current character is final consonant, then
+ // make syllable of form LV+T
+ TIndex = finals.indexOf(unicode);
+ if (TIndex != -1) {
+ last = QChar((int)lastUnicode + TIndex);
+ result.replace(result.length() - 1, 1, last);
+ continue;
+ }
+
+ // Check to see if the current character is vowel
+ HangulMedialIndex VIndexB = (HangulMedialIndex)((int)unicode - VBase);
+ if (isMedial(VIndexB)) {
+
+ // Some medial Jamos do not exist in the keyboard layout as is.
+ // Such Jamos can only be formed by combining the two specific Jamos,
+ // aka the double Jamos.
+
+ HangulMedialIndex VIndexA = (HangulMedialIndex)((SIndex % NCount) / TCount);
+ if (isMedial(VIndexA)) {
+
+ // Search the double medial map if such a combination exists
+ ushort key = packDoubleMedial(VIndexA, VIndexB);
+ const auto it = doubleMedialMap.constFind(key);
+ if (it != doubleMedialMap.cend()) {
+
+ // Update syllable by adding the difference between
+ // the vowels indices
+ HangulMedialIndex VIndexD = it.value();
+ int VDiff = (int)VIndexD - (int)VIndexA;
+ last = QChar((int)lastUnicode + VDiff * TCount);
+ result.replace(result.length() - 1, 1, last);
+ continue;
+ }
+ }
+ }
+
+ } else {
+
+ // Check to see if current jamo is vowel
+ int VIndex = (int)unicode - VBase;
+ if (VIndex >= 0 && VIndex < VCount) {
+
+ // Since some initial and final consonants use the same
+ // Unicode values, we need to check whether the previous final
+ // Jamo is actually an initial Jamo of the next syllable.
+ //
+ // Consider the following scenario:
+ // LVT+V == not possible
+ // LV, L+V == possible
+ int LIndex = initials.indexOf(finals[TIndex]);
+ if (LIndex >= 0 && LIndex < LCount) {
+
+ // 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);
+
+ // Make new syllable of form LV
+ last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
+ result.append(last);
+ continue;
+ }
+
+ // Check to see if the current final Jamo is double consonant.
+ // In this scenario, the double consonant is split into parts
+ // and the second part is removed from the current syllable.
+ // Then the second part is joined with the current vowel making
+ // the new syllable of form LV.
+ ushort key = findDoubleFinal((HangulFinalIndex)TIndex);
+ if (key) {
+
+ // Split the consonant into two jamos and remove the
+ // second jamo B from the current syllable
+ HangulFinalIndex TIndexA, TIndexB;
+ unpackDoubleFinal(key, TIndexA, TIndexB);
+ last = QChar((int)lastUnicode - TIndex + (int)TIndexA);
+ result.replace(result.length() - 1, 1, last);
+
+ // Add new syllable by combining the initial jamo
+ // and the current vowel
+ LIndex = initials.indexOf(finals[TIndexB]);
+ last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
+ result.append(last);
+ continue;
+ }
+ }
+
+ // Check whether the current consonant can connect to current
+ // consonant forming a double final consonant
+ HangulFinalIndex TIndexA = (HangulFinalIndex)TIndex;
+ if (isFinal(TIndexA)) {
+
+ HangulFinalIndex TIndexB = (HangulFinalIndex)finals.indexOf(unicode);
+ if (isFinal(TIndexB)) {
+
+ // Search the double final map if such a combination exists
+ ushort key = packDoubleFinal(TIndexA, TIndexB);
+ const auto it = doubleFinalMap.constFind(key);
+ if (it != doubleFinalMap.cend()) {
+
+ // Update syllable by adding the difference between
+ // the consonant indices
+ HangulFinalIndex TIndexD = it.value();
+ int TDiff = (int)TIndexD - (int)TIndexA;
+ last = QChar((int)lastUnicode + TDiff);
+ result.replace(result.length() - 1, 1, last);
+ continue;
+ }
+ }
+ }
+ }
+
+ } else {
+
+ // The last character is not syllable.
+ // Check to see if the last character is an initial consonant
+ int LIndex = initials.indexOf(lastUnicode);
+ if (LIndex != -1) {
+
+ // If the current character is medial vowel,
+ // make syllable of form LV
+ int VIndex = (int)unicode - VBase;
+ if (VIndex >= 0 && VIndex < VCount) {
+ last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
+ result.replace(result.length() - 1, 1, last);
+ continue;
+ }
+ }
+
+ }
+ }
+
+ // Otherwise, add the character into buffer
+ last = ch;
+ result = result.append(ch);
+ }
+ return result;
+}
+
+bool Hangul::isJamo(const ushort &unicode)
+{
+ return unicode >= 0x3131 && unicode <= 0x3163;
+}
+
+bool Hangul::isMedial(HangulMedialIndex vowel)
+{
+ return vowel >= HANGUL_MEDIAL_A && vowel <= HANGUL_MEDIAL_I;
+}
+
+bool Hangul::isFinal(HangulFinalIndex consonant)
+{
+ return consonant >= HANGUL_FINAL_KIYEOK && consonant <= HANGUL_FINAL_HIEUH;
+}
+
+ushort Hangul::findDoubleMedial(HangulMedialIndex vowel)
+{
+ return doubleMedialMap.key(vowel, 0);
+}
+
+ushort Hangul::findDoubleFinal(HangulFinalIndex consonant)
+{
+ return doubleFinalMap.key(consonant, 0);
+}
+
+// Packs two Hangul Jamo indices into 16-bit integer.
+// The result can be used as a key to the double jamos lookup table.
+// Note: The returned value is not a Unicode character!
+ushort Hangul::packDoubleMedial(HangulMedialIndex a, HangulMedialIndex b)
+{
+ Q_ASSERT(isMedial(a));
+ Q_ASSERT(isMedial(b));
+ return (ushort)a | ((ushort)b << 8);
+}
+
+ushort Hangul::packDoubleFinal(HangulFinalIndex a, HangulFinalIndex b)
+{
+ Q_ASSERT(isFinal(a));
+ Q_ASSERT(isFinal(b));
+ return (ushort)a | ((ushort)b << 8);
+}
+
+void Hangul::unpackDoubleMedial(ushort key, HangulMedialIndex &a, HangulMedialIndex &b)
+{
+ a = (HangulMedialIndex)(key & 0xFF);
+ b = (HangulMedialIndex)(key >> 8);
+ Q_ASSERT(isMedial(a));
+ Q_ASSERT(isMedial(b));
+}
+
+void Hangul::unpackDoubleFinal(ushort key, HangulFinalIndex &a, HangulFinalIndex &b)
+{
+ a = (HangulFinalIndex)(key & 0xFF);
+ b = (HangulFinalIndex)(key >> 8);
+ Q_ASSERT(isFinal(a));
+ Q_ASSERT(isFinal(b));
+}
+
+QMap<ushort, Hangul::HangulMedialIndex> Hangul::initDoubleMedialMap()
+{
+ QMap<ushort, HangulMedialIndex> map;
+ map.insert(packDoubleMedial(HANGUL_MEDIAL_O, HANGUL_MEDIAL_A), HANGUL_MEDIAL_WA);
+ map.insert(packDoubleMedial(HANGUL_MEDIAL_O, HANGUL_MEDIAL_AE), HANGUL_MEDIAL_WAE);
+ map.insert(packDoubleMedial(HANGUL_MEDIAL_O, HANGUL_MEDIAL_I), HANGUL_MEDIAL_OE);
+ map.insert(packDoubleMedial(HANGUL_MEDIAL_U, HANGUL_MEDIAL_EO), HANGUL_MEDIAL_WEO);
+ map.insert(packDoubleMedial(HANGUL_MEDIAL_U, HANGUL_MEDIAL_E), HANGUL_MEDIAL_WE);
+ map.insert(packDoubleMedial(HANGUL_MEDIAL_U, HANGUL_MEDIAL_I), HANGUL_MEDIAL_WI);
+ map.insert(packDoubleMedial(HANGUL_MEDIAL_EU, HANGUL_MEDIAL_I), HANGUL_MEDIAL_YI);
+ return map;
+}
+
+QMap<ushort, Hangul::HangulFinalIndex> Hangul::initDoubleFinalMap()
+{
+ QMap<ushort, HangulFinalIndex> map;
+ map.insert(packDoubleFinal(HANGUL_FINAL_KIYEOK, HANGUL_FINAL_SIOS), HANGUL_FINAL_KIYEOK_SIOS);
+ map.insert(packDoubleFinal(HANGUL_FINAL_NIEUN, HANGUL_FINAL_CIEUC), HANGUL_FINAL_NIEUN_CIEUC);
+ map.insert(packDoubleFinal(HANGUL_FINAL_NIEUN, HANGUL_FINAL_HIEUH), HANGUL_FINAL_NIEUN_HIEUH);
+ map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_KIYEOK), HANGUL_FINAL_RIEUL_KIYEOK);
+ map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_MIEUM), HANGUL_FINAL_RIEUL_MIEUM);
+ map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_PIEUP), HANGUL_FINAL_RIEUL_PIEUP);
+ map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_SIOS), HANGUL_FINAL_RIEUL_SIOS);
+ map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_THIEUTH), HANGUL_FINAL_RIEUL_THIEUTH);
+ map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_PHIEUPH), HANGUL_FINAL_RIEUL_PHIEUPH);
+ map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_HIEUH), HANGUL_FINAL_RIEUL_HIEUH);
+ map.insert(packDoubleFinal(HANGUL_FINAL_PIEUP, HANGUL_FINAL_SIOS), HANGUL_FINAL_PIEUP_SIOS);
+ map.insert(packDoubleFinal(HANGUL_FINAL_SIOS, HANGUL_FINAL_SIOS), HANGUL_FINAL_SSANGSIOS);
+ return map;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/hangul/hangul.json b/src/plugins/hangul/hangul.json
new file mode 100644
index 00000000..f7008a87
--- /dev/null
+++ b/src/plugins/hangul/hangul.json
@@ -0,0 +1,6 @@
+{
+ "Name": "hangul",
+ "Provider": "Qt Hangul Extension",
+ "InputMethod": "HangulInputMethod",
+ "Version": 100
+}
diff --git a/src/plugins/hangul/hangul.pro b/src/plugins/hangul/hangul.pro
new file mode 100644
index 00000000..5ce08a65
--- /dev/null
+++ b/src/plugins/hangul/hangul.pro
@@ -0,0 +1,45 @@
+TARGET = qtvirtualkeyboard_hangul
+QT += qml virtualkeyboard
+
+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
+
+include(../../config.pri)
+
+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
new file mode 100644
index 00000000..4f8c70c9
--- /dev/null
+++ b/src/plugins/hangul/hangul_p.h
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** 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 HANGUL_P_H
+#define HANGUL_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 <QList>
+#include <QMap>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Hangul
+{
+ Q_DISABLE_COPY(Hangul)
+
+ enum HangulMedialIndex { // VIndex Letter Jungseong Double Jamo
+ // ----------------------------------------------------------------------
+ HANGUL_MEDIAL_A, // 0 314F 1161
+ HANGUL_MEDIAL_AE, // 1 3150 1162
+ HANGUL_MEDIAL_YA, // 2 3151 1163
+ HANGUL_MEDIAL_YAE, // 3 3152 1164
+ HANGUL_MEDIAL_EO, // 4 3153 1165
+ HANGUL_MEDIAL_E, // 5 3154 1166
+ HANGUL_MEDIAL_YEO, // 6 3155 1167
+ HANGUL_MEDIAL_YE, // 7 3156 1168
+ HANGUL_MEDIAL_O, // 8 3157 1169
+ HANGUL_MEDIAL_WA, // 9 3158 116A 3157+314F
+ HANGUL_MEDIAL_WAE, // 10 3159 116B 3157+3150
+ HANGUL_MEDIAL_OE, // 11 315A 116C 3157+3163
+ HANGUL_MEDIAL_YO, // 12 315B 116D
+ HANGUL_MEDIAL_U, // 13 315C 116E
+ HANGUL_MEDIAL_WEO, // 14 315D 116F 315C+3153
+ HANGUL_MEDIAL_WE, // 15 315E 1170 315C+3154
+ HANGUL_MEDIAL_WI, // 16 315F 1171 315C+3163
+ HANGUL_MEDIAL_YU, // 17 3160 1172
+ HANGUL_MEDIAL_EU, // 18 3161 1173
+ HANGUL_MEDIAL_YI, // 19 3162 1174 3161+3163
+ HANGUL_MEDIAL_I // 20 3163 1175
+ };
+
+ enum HangulFinalIndex { // TIndex Letter Jongseong Double Jamo
+ // ----------------------------------------------------------------------
+ HANGUL_FINAL_NONE, // 0 n/a n/a
+ HANGUL_FINAL_KIYEOK, // 1 3131 11A8
+ HANGUL_FINAL_SSANGKIYEOK, // 2 3132 11A9
+ HANGUL_FINAL_KIYEOK_SIOS, // 3 3133 11AA 3131+3145
+ HANGUL_FINAL_NIEUN, // 4 3134 11AB
+ HANGUL_FINAL_NIEUN_CIEUC, // 5 3135 11AC 3134+3148
+ HANGUL_FINAL_NIEUN_HIEUH, // 6 3136 11AD 3134+314E
+ HANGUL_FINAL_TIKEUT, // 7 3137 11AE
+ HANGUL_FINAL_RIEUL, // 8 3139 11AF
+ HANGUL_FINAL_RIEUL_KIYEOK, // 9 313A 11B0 3139+3131
+ HANGUL_FINAL_RIEUL_MIEUM, // 10 313B 11B1 3139+3141
+ HANGUL_FINAL_RIEUL_PIEUP, // 11 313C 11B2 3139+3142
+ HANGUL_FINAL_RIEUL_SIOS, // 12 313D 11B3 3139+3145
+ HANGUL_FINAL_RIEUL_THIEUTH, // 13 313E 11B4 3139+314C
+ HANGUL_FINAL_RIEUL_PHIEUPH, // 14 313F 11B5 3139+314D
+ HANGUL_FINAL_RIEUL_HIEUH, // 15 3140 11B6 3139+314E
+ HANGUL_FINAL_MIEUM, // 16 3141 11B7
+ HANGUL_FINAL_PIEUP, // 17 3142 11B8
+ HANGUL_FINAL_PIEUP_SIOS, // 18 3144 11B9 3142+3145
+ HANGUL_FINAL_SIOS, // 19 3145 11BA
+ HANGUL_FINAL_SSANGSIOS, // 20 3146 11BB 3145+3145
+ HANGUL_FINAL_IEUNG, // 21 3147 11BC
+ HANGUL_FINAL_CIEUC, // 22 3148 11BD
+ HANGUL_FINAL_CHIEUCH, // 23 314A 11BE
+ HANGUL_FINAL_KHIEUKH, // 24 314B 11BF
+ HANGUL_FINAL_THIEUTH, // 25 314C 11C0
+ HANGUL_FINAL_PHIEUPH, // 26 314D 11C1
+ HANGUL_FINAL_HIEUH // 27 314E 11C2
+ };
+
+ Hangul();
+
+public:
+ static QString decompose(const QString &source);
+ static QString compose(const QString &source);
+ static bool isJamo(const ushort &unicode);
+
+private:
+ static bool isMedial(HangulMedialIndex vowel);
+ static bool isFinal(HangulFinalIndex consonant);
+ static ushort findDoubleMedial(HangulMedialIndex vowel);
+ static ushort findDoubleFinal(HangulFinalIndex consonant);
+ static ushort packDoubleMedial(HangulMedialIndex a, HangulMedialIndex b);
+ static ushort packDoubleFinal(HangulFinalIndex a, HangulFinalIndex b);
+ static void unpackDoubleMedial(ushort key, HangulMedialIndex &a, HangulMedialIndex &b);
+ static void unpackDoubleFinal(ushort key, HangulFinalIndex &a, HangulFinalIndex &b);
+ static QMap<ushort, HangulMedialIndex> initDoubleMedialMap();
+ static QMap<ushort, HangulFinalIndex> initDoubleFinalMap();
+
+ static const QList<ushort> initials;
+ static const QList<ushort> finals;
+ static const QMap<ushort, HangulMedialIndex> doubleMedialMap;
+ static const QMap<ushort, HangulFinalIndex> doubleFinalMap;
+ static const int SBase;
+ static const int LBase;
+ static const int VBase;
+ static const int TBase;
+ static const int LCount;
+ static const int VCount;
+ static const int TCount;
+ static const int NCount;
+ static const int SCount;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/hangul/hangulinputmethod.cpp b/src/plugins/hangul/hangulinputmethod.cpp
new file mode 100644
index 00000000..1bef78cb
--- /dev/null
+++ b/src/plugins/hangul/hangulinputmethod.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** 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 "hangulinputmethod_p.h"
+#include "hangul_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::HangulInputMethod
+ \internal
+*/
+
+HangulInputMethod::HangulInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(parent)
+{
+}
+
+HangulInputMethod::~HangulInputMethod()
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> HangulInputMethod::inputModes(const QString &locale)
+{
+ Q_UNUSED(locale)
+ return QList<QVirtualKeyboardInputEngine::InputMode>() << QVirtualKeyboardInputEngine::InputMode::Hangul;
+}
+
+bool HangulInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_UNUSED(locale)
+ Q_UNUSED(inputMode)
+ return true;
+}
+
+bool HangulInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase)
+ return true;
+}
+
+bool HangulInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(modifiers)
+ QVirtualKeyboardInputContext *ic = inputContext();
+ bool accept = false;
+ int cursorPosition = ic->cursorPosition();
+ if (ic->cursorPosition() > 0) {
+ 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) {
+ ic->commit(Hangul::compose(hangul.left(length - 1)), -contextLength, contextLength);
+ accept = true;
+ }
+ } else if (!text.isEmpty() && Hangul::isJamo(text.at(0).unicode())) {
+ QString hangul = Hangul::compose(ic->surroundingText().mid(cursorPosition - 1, 1) + text);
+ ic->commit(hangul, -1, 1);
+ accept = true;
+ }
+ }
+ return accept;
+}
+
+void HangulInputMethod::reset()
+{
+}
+
+void HangulInputMethod::update()
+{
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/hangul/hangulinputmethod_p.h b/src/plugins/hangul/hangulinputmethod_p.h
new file mode 100644
index 00000000..f53e0712
--- /dev/null
+++ b/src/plugins/hangul/hangulinputmethod_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** 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 HANGULINPUTMETHOD_P_H
+#define HANGULINPUTMETHOD_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 HangulInputMethodPrivate;
+
+class HangulInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(HangulInputMethod)
+public:
+ explicit HangulInputMethod(QObject *parent = nullptr);
+ ~HangulInputMethod();
+
+ 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();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // HANGULINPUTMETHOD_P_H
diff --git a/src/plugins/hangul/hangulplugin.cpp b/src/plugins/hangul/hangulplugin.cpp
new file mode 100644
index 00000000..a1438ed8
--- /dev/null
+++ b/src/plugins/hangul/hangulplugin.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..a4da52c2
--- /dev/null
+++ b/src/plugins/hangul/hangulplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/virtualkeyboard/3rdparty/hunspell/hunspell.pro b/src/plugins/hunspell/3rdparty/hunspell/hunspell.pro
index bd5eccb3..bd5eccb3 100644
--- a/src/virtualkeyboard/3rdparty/hunspell/hunspell.pro
+++ b/src/plugins/hunspell/3rdparty/hunspell/hunspell.pro
diff --git a/src/plugins/hunspell/hunspell.pro b/src/plugins/hunspell/hunspell.pro
new file mode 100644
index 00000000..fbe25a0a
--- /dev/null
+++ b/src/plugins/hunspell/hunspell.pro
@@ -0,0 +1,13 @@
+TEMPLATE = subdirs
+
+include(../../config.pri)
+
+SUBDIRS += \
+ hunspellinputmethod \
+ plugin
+hunspell-library {
+ SUBDIRS += 3rdparty/hunspell
+ hunspellinputmethod.depends += 3rdparty/hunspell
+}
+
+plugin.depends += hunspellinputmethod
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.cpp b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.cpp
new file mode 100644
index 00000000..884ec9df
--- /dev/null
+++ b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.cpp
@@ -0,0 +1,407 @@
+/****************************************************************************
+**
+** 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) {
+ /* 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()) {
+ ic->commit(QLatin1String(" "));
+ }
+ }
+ }
+ /* 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(text);
+ 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
new file mode 100644
index 00000000..9dc2e654
--- /dev/null
+++ b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.pro
@@ -0,0 +1,30 @@
+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
+
+include(../../../config.pri)
+
+hunspell-library: QMAKE_USE += hunspell
+else:hunspell-package: PKGCONFIG += hunspell
+
+load(qt_module)
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.cpp b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.cpp
new file mode 100644
index 00000000..4651ac1f
--- /dev/null
+++ b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.cpp
@@ -0,0 +1,338 @@
+/****************************************************************************
+**
+** 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 <QTextCodec>
+#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, QString::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
new file mode 100644
index 00000000..4c19063b
--- /dev/null
+++ b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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);
+ 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();
+
+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
new file mode 100644
index 00000000..2e604350
--- /dev/null
+++ b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..15af0841
--- /dev/null
+++ b/src/plugins/hunspell/hunspellinputmethod/hunspellworker.cpp
@@ -0,0 +1,776 @@
+/****************************************************************************
+**
+** 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 <QVector>
+#include <QTextCodec>
+#include <QFileInfo>
+#include <QRegularExpression>
+#include <QTime>
+#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 QTextCodec.
+ */
+ if (!QTextCodec::codecForName(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.
+ */
+ textCodec = QTextCodec::codecForName(Hunspell_get_dic_encoding(hunspell));
+ if (!textCodec)
+ return;
+
+ char **slst = nullptr;
+ int n = Hunspell_suggest(hunspell, &slst, textCodec->fromUnicode(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(textCodec->toUnicode(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, textCodec->fromUnicode(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(QLatin1Literal("[0-9]"))))
+ return true;
+ return Hunspell_spell(hunspell, textCodec->fromUnicode(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();
+ QVector<int> v0(t.length() + 1);
+ QVector<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()
+{
+ const QTextCodec *textCodec;
+ textCodec = QTextCodec::codecForName(Hunspell_get_dic_encoding(hunspell));
+ if (!textCodec)
+ 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, textCodec->fromUnicode(word).constData());
+ if (HunspellAddWordTask::alternativeForm(word, tmpWord))
+ Hunspell_add(hunspell, textCodec->fromUnicode(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()
+{
+ const QTextCodec *textCodec;
+ textCodec = QTextCodec::codecForName(Hunspell_get_dic_encoding(hunspell));
+ if (!textCodec)
+ 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, textCodec->fromUnicode(word).constData());
+ if (HunspellAddWordTask::alternativeForm(word, tmpWord))
+ Hunspell_remove(hunspell, textCodec->fromUnicode(tmpWord).constData());
+ }
+}
+
+void HunspellLoadWordListTask::run()
+{
+ wordList->clear();
+
+ QFile inputFile(filePath);
+ if (inputFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QTextStream inStream(&inputFile);
+ inStream.setCodec(QTextCodec::codecForName("UTF-8"));
+ 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);
+ outStream.setCodec(QTextCodec::codecForName("UTF-8"));
+ 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()
+{
+ QTime 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
new file mode 100644
index 00000000..2a8a2694
--- /dev/null
+++ b/src/plugins/hunspell/hunspellinputmethod/hunspellworker_p.h
@@ -0,0 +1,294 @@
+/****************************************************************************
+**
+** 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 <QVector>
+#include <QLoggingCategory>
+#include <hunspell/hunspell.h>
+#include <QtHunspellInputMethod/qhunspellinputmethod_global.h>
+
+QT_BEGIN_NAMESPACE
+class QTextCodec;
+
+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;
+ QVector<Flags> _flags;
+ QVector<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();
+
+signals:
+ void completed(bool success);
+
+public:
+ Hunhandle **hunspellPtr;
+ const QString locale;
+ const QStringList searchPaths;
+};
+
+class HunspellBuildSuggestionsTask : public HunspellTask
+{
+ Q_OBJECT
+ const QTextCodec *textCodec;
+public:
+ QSharedPointer<HunspellWordList> wordList;
+ bool autoCorrect;
+
+ void run();
+ bool spellCheck(const QString &word);
+ int levenshteinDistance(const QString &s, const QString &t);
+ QString removeAccentsAndDiacritics(const QString& s);
+};
+
+class HunspellUpdateSuggestionsTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+
+ void run();
+
+signals:
+ void updateSuggestions(const QSharedPointer<HunspellWordList> &wordList, int tag);
+
+public:
+ int tag;
+};
+
+class HunspellAddWordTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+
+ void run();
+
+ static bool alternativeForm(const QString &word, QString &alternativeForm);
+};
+
+class HunspellRemoveWordTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+
+ void run();
+};
+
+class HunspellLoadWordListTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+ QString filePath;
+
+ void run();
+};
+
+class HunspellSaveWordListTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+ QString filePath;
+
+ void run();
+};
+
+class HunspellFilterWordTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ HunspellFilterWordTask() :
+ HunspellTask(),
+ startIndex(1)
+ {}
+
+ QSharedPointer<HunspellWordList> wordList;
+ QSharedPointer<HunspellWordList> filterList;
+ int startIndex;
+
+ void run();
+};
+
+class HunspellBoostWordTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ HunspellBoostWordTask() :
+ HunspellTask()
+ {}
+
+ QSharedPointer<HunspellWordList> wordList;
+ QSharedPointer<HunspellWordList> boostList;
+
+ void run();
+};
+
+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();
+
+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
new file mode 100644
index 00000000..9a548c92
--- /dev/null
+++ b/src/plugins/hunspell/hunspellinputmethod/qhunspellinputmethod_global.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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/plugin/hunspell.json b/src/plugins/hunspell/plugin/hunspell.json
new file mode 100644
index 00000000..449e440c
--- /dev/null
+++ b/src/plugins/hunspell/plugin/hunspell.json
@@ -0,0 +1,6 @@
+{
+ "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
new file mode 100644
index 00000000..0a952675
--- /dev/null
+++ b/src/plugins/hunspell/plugin/hunspellplugin.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..6880f69c
--- /dev/null
+++ b/src/plugins/hunspell/plugin/hunspellplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/hunspell/plugin/plugin.pro b/src/plugins/hunspell/plugin/plugin.pro
new file mode 100644
index 00000000..1981b5e5
--- /dev/null
+++ b/src/plugins/hunspell/plugin/plugin.pro
@@ -0,0 +1,40 @@
+TARGET = qtvirtualkeyboard_hunspell
+QT += qml virtualkeyboard hunspellinputmethod-private
+
+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
+
+include(../../../config.pri)
+
+hunspell-library {
+ 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/virtualkeyboard/3rdparty/lipi-toolkit/MIT_LICENSE.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/MIT_LICENSE.txt
index 5d391355..5d391355 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/MIT_LICENSE.txt
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/MIT_LICENSE.txt
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/license.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/license.txt
index 219193f6..219193f6 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/license.txt
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/license.txt
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/lipi-toolkit.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/lipi-toolkit.pro
index 9593051a..9593051a 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/lipi-toolkit.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/lipi-toolkit.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg
index 73e13e21..73e13e21 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt
index 3941986b..3941986b 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg
index ddf5704f..ddf5704f 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg
index 32fe6ba1..32fe6ba1 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini
index 7b75d3f0..7b75d3f0 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini
diff --git a/src/virtualkeyboard/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
index f7322e5c..f7322e5c 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 5430d396..5430d396 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index ddf5704f..ddf5704f 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg
index 98fa2526..98fa2526 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini
index e45c7afc..e45c7afc 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/lipiengine.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/lipiengine.cfg
index c924d943..c924d943 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/projects/lipiengine.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/lipiengine.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/qt_attribution.json b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/qt_attribution.json
index c26f7870..c26f7870 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/qt_attribution.json
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/qt_attribution.json
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp
index 0b2b2a26..0b2b2a26 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp
index 918419c9..918419c9 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKException.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKException.cpp
index 48a0c834..48a0c834 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKException.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKException.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp
index 735e7437..735e7437 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp
index 3625ce50..3625ce50 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp
index 65706dea..65706dea 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp
index 282789d5..282789d5 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/common.pro
index fcb567bb..fcb567bb 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/common/common.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/common.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h
index 5acb9838..5acb9838 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKChannel.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKChannel.h
index e5328bfd..e5328bfd 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKChannel.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKChannel.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h
index 745b0bf0..745b0bf0 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h
index 3307ae9a..3307ae9a 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKException.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKException.h
index 1914ffa9..1914ffa9 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKException.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKException.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKInc.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKInc.h
index 91fb8dd1..91fb8dd1 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKInc.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKInc.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h
index 04d315b9..04d315b9 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLogger.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLogger.h
index e0594d90..e0594d90 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLogger.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLogger.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h
index 8bd94b5e..8bd94b5e 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKMacros.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKMacros.h
index b9cc072d..b9cc072d 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKMacros.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKMacros.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h
index 88a56ac8..88a56ac8 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h
index 2427d80e..2427d80e 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h
index 36179a7c..36179a7c 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h
index 8ef68249..8ef68249 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h
index fb913100..fb913100 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h
index cf1bcc62..cf1bcc62 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h
index 3b67c9ee..3b67c9ee 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h
index 08374256..08374256 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h
index 7d107dd1..7d107dd1 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h
index 1c9bc299..1c9bc299 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h
index c33b727b..c33b727b 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h
index 7dc74129..7dc74129 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h
index 9a4c3776..9a4c3776 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h
index 7938b1f4..7938b1f4 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTrace.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTrace.h
index f114cd7a..f114cd7a 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTrace.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTrace.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h
index 26901b05..26901b05 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h
index e96b4a63..e96b4a63 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTypes.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTypes.h
index 6c10ccc2..6c10ccc2 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKTypes.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTypes.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h
index 535b4c2a..535b4c2a 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h
index 3d54d6c2..3d54d6c2 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h
index 0322b79c..0322b79c 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/TpcError.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/TpcError.h
index acace684..acace684 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/TpcError.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/TpcError.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/headers.pri b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/headers.pri
index b84d5e53..b84d5e53 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/include/headers.pri
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/headers.pri
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipicommon.pri b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipicommon.pri
index a1b770bb..a1b770bb 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipicommon.pri
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipicommon.pri
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp
index f5a69788..f5a69788 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h
index 9ccffac3..9ccffac3 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp
index eb55ddb4..eb55ddb4 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def
index 96f73e12..96f73e12 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h
index bc1aa408..bc1aa408 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro
index bfcc0bcd..bfcc0bcd 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/version.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/version.h
index a31c2503..a31c2503 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiengine/version.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/version.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipilib.pri b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipilib.pri
index c28eb85d..c28eb85d 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipilib.pri
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipilib.pri
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiplugin.pri b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiplugin.pri
index 3dd51a22..3dd51a22 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/lipiplugin.pri
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiplugin.pri
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/reco.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/reco.pro
index 72efcc7f..72efcc7f 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/reco.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/reco.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp
index bdbec8c2..bdbec8c2 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def
index 0a4f75c9..0a4f75c9 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h
index 854dc6da..854dc6da 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp
index e0c36e6b..e0c36e6b 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h
index 276eeb24..276eeb24 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp
index 34886d32..34886d32 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h
index 4d183487..4d183487 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp
index 2514a626..2514a626 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h
index f79182ea..f79182ea 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp
index 247f5f98..247f5f98 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h
index 9459d5c7..9459d5c7 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg
index 142470cf..142470cf 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro
index 255c5512..255c5512 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp
index 8ff31c80..8ff31c80 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp
index 746d45dc..746d45dc 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp
index 2d944d0c..2d944d0c 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp
index bed1ca48..bed1ca48 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp
index 4044c86f..4044c86f 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h
index 02ec1f7f..02ec1f7f 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro
index a8b0756b..a8b0756b 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro
diff --git a/src/virtualkeyboard/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
index c233d3c5..c233d3c5 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 1b4e9532..1b4e9532 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 51ab4b57..51ab4b57 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 07fa2adc..07fa2adc 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index d178d6ef..d178d6ef 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index ae6ce1d2..ae6ce1d2 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro
index 538b9f29..538b9f29 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro
diff --git a/src/virtualkeyboard/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
index 16eaaca4..16eaaca4 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 6c767112..6c767112 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 19e6a9c1..19e6a9c1 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 9c48636d..9c48636d 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index eca6cf84..eca6cf84 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 9a185d39..9a185d39 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index c0f64a01..c0f64a01 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 2372c2cf..2372c2cf 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 1d142230..1d142230 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 9a185d39..9a185d39 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index c1a410d7..c1a410d7 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index a05867be..a05867be 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 1f9f5f08..1f9f5f08 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index e20b63dc..e20b63dc 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 18ca347e..18ca347e 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index dacec369..dacec369 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 81678e45..81678e45 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 9a185d39..9a185d39 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 91ee5e6b..91ee5e6b 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 02e5c9c7..02e5c9c7 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 4e05a0ca..4e05a0ca 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 49260852..49260852 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 59f14e20..59f14e20 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 39eff0ee..39eff0ee 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 8484b39d..8484b39d 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index c35a826e..c35a826e 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 125ab5ae..125ab5ae 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index fb282d31..fb282d31 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 791ed9a7..791ed9a7 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 87e0cd05..87e0cd05 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 7d803727..7d803727 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/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
index 804d1f42..804d1f42 100644
--- a/src/virtualkeyboard/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
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp
index ac6cdae5..ac6cdae5 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def
index 0a4f75c9..0a4f75c9 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h
index bfe4ac02..bfe4ac02 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp
index 3c406f68..3c406f68 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h
index 6e32002a..6e32002a 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg
index e52d3147..e52d3147 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro
index 8359a4f3..8359a4f3 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp
index 167e7fed..167e7fed 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def
index 0a4f75c9..0a4f75c9 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h
index 0241eb21..0241eb21 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp
index 7e57252b..7e57252b 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h
index 2b78be50..2b78be50 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp
index 78b09e47..78b09e47 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h
index cce1baf0..cce1baf0 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg
index c20803b7..c20803b7 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro
index 0b7046db..0b7046db 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp
index a3eae6cd..a3eae6cd 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp
index b6f4fa28..b6f4fa28 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def
index ca038d78..ca038d78 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h
index 5d052153..5d052153 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro
index e8a11983..e8a11983 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro
index 8b5d5e3b..8b5d5e3b 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp
index dbcdca58..dbcdca58 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h
index e0703b5a..e0703b5a 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg
index b727da97..b727da97 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp
index 45969652..45969652 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def
index 452b6dd6..452b6dd6 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h
index f44d2ab3..f44d2ab3 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro
index 5d16d041..5d16d041 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp
index 4fc45305..4fc45305 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp
index 57fc6317..57fc6317 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp
index f7c60716..f7c60716 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro
index bac16ef9..bac16ef9 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro
index cf49e45d..cf49e45d 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/src.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/src.pro
index a3f90198..a3f90198 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/src.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/src.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp
index a9041ba6..a9041ba6 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h
index 511bfbaa..511bfbaa 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp
index 30e06f42..30e06f42 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h
index 361d70f6..361d70f6 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h
index dced46bc..dced46bc 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp
index 2cf87532..2cf87532 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h
index eac0224b..eac0224b 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h
index 921c6085..921c6085 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp
index 9067ca98..9067ca98 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h
index c1e387e6..c1e387e6 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp
index da5e89b7..da5e89b7 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h
index 16704688..16704688 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp
index ae7fdd3f..ae7fdd3f 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h
index ee41ac4c..ee41ac4c 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp
index 53a34c13..53a34c13 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h
index a6ca369e..a6ca369e 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp
index f7f85702..f7f85702 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h
index d8eef6f2..d8eef6f2 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp
index 1971a69d..1971a69d 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h
index 2f09831b..2f09831b 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp
index 87e14a64..87e14a64 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp
index 3d27249e..3d27249e 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h
index a61517fb..a61517fb 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp
index 7f56a66d..7f56a66d 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h
index 4a2c9442..4a2c9442 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp
index 1b48e8d4..1b48e8d4 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h
index 476aae72..476aae72 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp
index 1462fedf..1462fedf 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h
index 649a2700..649a2700 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp
index 825ee84c..825ee84c 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h
index d62350d9..d62350d9 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/lib.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/lib.pro
index 362973c4..362973c4 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/lib/lib.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/lib.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp
index 75ad218e..75ad218e 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.cpp
index 2fa735bb..2fa735bb 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.cpp
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.cpp
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.def
index 5a47ec22..5a47ec22 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.def
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.def
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.h
index dfcbde30..dfcbde30 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.h
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.h
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.pro
index 5f1cc5ac..5f1cc5ac 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/logger/logger.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.pro
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/util.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/util.pro
index 79cfc027..79cfc027 100644
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/util/util.pro
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/util.pro
diff --git a/src/plugins/lipi-toolkit/lipi-toolkit.pro b/src/plugins/lipi-toolkit/lipi-toolkit.pro
new file mode 100644
index 00000000..ce996b66
--- /dev/null
+++ b/src/plugins/lipi-toolkit/lipi-toolkit.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ 3rdparty/lipi-toolkit \
+ plugin
+
+plugin.depends += 3rdparty/lipi-toolkit
diff --git a/src/plugins/lipi-toolkit/plugin/lipi.json b/src/plugins/lipi-toolkit/plugin/lipi.json
new file mode 100644
index 00000000..8e22b4e9
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipi.json
@@ -0,0 +1,6 @@
+{
+ "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
new file mode 100644
index 00000000..ca23c491
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipiinputmethod.cpp
@@ -0,0 +1,639 @@
+/****************************************************************************
+**
+** 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>
+
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+#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 {
+
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+#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) :
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+ 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();
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+ 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);
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+ 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;
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+ HunspellInputMethod::setTextCase(textCase);
+#endif
+ return true;
+}
+
+bool LipiInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+ 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)
+{
+ 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();
+ }
+ }
+ 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
new file mode 100644
index 00000000..abbccf90
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipiinputmethod_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** 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.
+//
+
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+#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
new file mode 100644
index 00000000..8878f45a
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipiplugin.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..79e5b20d
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipiplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..090f129c
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipisharedrecognizer.cpp
@@ -0,0 +1,408 @@
+/****************************************************************************
+**
+** 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::fromLatin1(configEntry->second.c_str()).split(QLatin1Char('('), QString::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
new file mode 100644
index 00000000..9d7cfbea
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipisharedrecognizer_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..ffe5c3b7
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipiworker.cpp
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..098e198b
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/lipiworker_p.h
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..c3a12440
--- /dev/null
+++ b/src/plugins/lipi-toolkit/plugin/plugin.pro
@@ -0,0 +1,68 @@
+TARGET = qtvirtualkeyboard_lipi
+CONFIG += exceptions
+QT += qml virtualkeyboard-private
+
+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
+
+include(../../../config.pri)
+
+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
+
+!disable-hunspell {
+ QT += hunspellinputmethod-private
+}
+
+LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fallback/handwriting.qml
+contains(CONFIG, lang-en(_GB)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback
+contains(CONFIG, lang-en(_US)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback
+contains(CONFIG, lang-id.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback
+contains(CONFIG, lang-ms.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback
+contains(CONFIG, lang-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
new file mode 100644
index 00000000..76854351
--- /dev/null
+++ b/src/plugins/myscript/3rdparty/myscript/myscript.pri
@@ -0,0 +1,57 @@
+#
+# 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}MyScript2D$${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/myscript.pro b/src/plugins/myscript/myscript.pro
new file mode 100644
index 00000000..b6e92972
--- /dev/null
+++ b/src/plugins/myscript/myscript.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ plugin
diff --git a/src/plugins/myscript/plugin/myscript.json b/src/plugins/myscript/plugin/myscript.json
new file mode 100644
index 00000000..8f573972
--- /dev/null
+++ b/src/plugins/myscript/plugin/myscript.json
@@ -0,0 +1,6 @@
+{
+ "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
new file mode 100644
index 00000000..aaa4d62e
--- /dev/null
+++ b/src/plugins/myscript/plugin/myscriptinputmethod.cpp
@@ -0,0 +1,1472 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "myscriptinputmethod_p.h"
+#include "myscriptinputmethod_p_p.h"
+
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
+
+#include <QLoggingCategory>
+
+#include MYSCRIPT_CERTIFICATE
+#include <common/Properties.h>
+#include <common/PortabilityDefinitions.h>
+#include <voim.h>
+
+#include <thread>
+#include <mutex>
+#include <chrono>
+
+#ifndef PATH_MAX
+#define PATH_MAX 512
+#endif
+
+#include <QCryptographicHash>
+#include <QThread>
+
+#include <QtCore/qmath.h>
+#include <QtCore/QLibraryInfo>
+#include <QTextFormat>
+
+#define VERIFY(arg) if (!(arg)) abort();
+
+#define VERIFY2(arg, msg, engine) if (!(arg)) { \
+ qCCritical(qlcVKMyScript) << msg << strMyScriptError(voGetError(engine)); \
+ abort(); \
+ }
+
+#define GESTURE_STRING_RIGHT_TO_LEFT "\xF3\xB0\x80\x82" // equivalent Unicode is "\U000F0002"
+#define GESTURE_STRING_LEFT_TO_RIGHT "\xF3\xB0\x80\x83" // equivalent Unicode is "\U000F0003"
+#define GESTURE_STRING_DOWN_THEN_LEFT "\xF3\xB0\x80\x84" // equivalent Unicode is "\U000F0004"
+#define GESTURE_STRING_DOWN_THEN_RIGHT "\xF3\xB0\x80\x88" // equivalent Unicode is "\U000F0008"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_LOGGING_CATEGORY(qlcVKMyScript, "qt.virtualkeyboard.myscript")
+
+typedef enum GESTURE_TYPE {
+ GESTURE_TYPE_NONE = 0,
+ GESTURE_TYPE_RIGHT_TO_LEFT = 0x000F0002,
+ GESTURE_TYPE_LEFT_TO_RIGHT = 0x000F0003,
+ GESTURE_TYPE_DOWN_THEN_LEFT = 0x000F0004,
+ GESTURE_TYPE_DOWN_THEN_RIGHT = 0x000F0008
+} GestureType;
+
+typedef struct CANDIDATE_ITEM {
+ int candidateIndex;
+ QStringList candidates;
+} CandidateItem;
+
+static inline QString getVoimErrorMessage(const voimErrorCode code)
+{
+ QString message;
+
+ switch (code) {
+ case VOIM_EC_NO_ERROR:
+ message = QString::fromLatin1("no error occurred");
+ break;
+ case VOIM_EC_INVALID_VALUE:
+ message = QString::fromLatin1("a value passed to an API function was not valid");
+ break;
+ case VOIM_EC_INVALID_INDEX:
+ message = QString::fromLatin1("an index passed to an API function was out of range");
+ break;
+ case VOIM_EC_INVALID_OPERATION:
+ message = QString::fromLatin1("the requested operation is not valid regarding the current state of the target object");
+ break;
+ case VOIM_EC_OUT_OF_MEMORY:
+ message = QString::fromLatin1("a memory allocation failure");
+ break;
+ case VOIM_EC_IO_FAILURE:
+ message = QString::fromLatin1("an I/O operation failure");
+ break;
+ case VOIM_EC_INTERNAL_ERROR:
+ message = QString::fromLatin1("an internal error");
+ break;
+ default:
+ message = QString::fromLatin1("unknown error code - ") + QString::number(code);
+ break;
+ }
+
+ return message;
+}
+
+class MyScriptInputMethodPrivate
+{
+ Q_DECLARE_PUBLIC(MyScriptInputMethod)
+public:
+ MyScriptInputMethodPrivate(MyScriptInputMethod *q_ptr) :
+ q_ptr(q_ptr),
+ m_engine(nullptr),
+ m_languageManager(nullptr),
+ m_recognizer(nullptr),
+ m_onManagingResult(false),
+ m_isProcessing(false),
+ m_commitTimer(0),
+ textCase(QVirtualKeyboardInputEngine::TextCase::Lower),
+ wordIndex(-1),
+ m_itemIndex(-1),
+ m_preeditCursorPosition(0)
+ {
+ initHwrEngine();
+ }
+
+ ~MyScriptInputMethodPrivate()
+ {
+ destroyHwrEngine();
+ }
+
+ void setContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo,
+ const QVariantMap &traceScreenInfo)
+ {
+ Q_UNUSED(patternRecognitionMode);
+ Q_UNUSED(traceCaptureDeviceInfo);
+ Q_UNUSED(traceScreenInfo);
+
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+ }
+
+ QVirtualKeyboardTrace *traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+ {
+ Q_UNUSED(patternRecognitionMode);
+ Q_UNUSED(traceCaptureDeviceInfo);
+ Q_UNUSED(traceScreenInfo);
+
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO << traceId;
+
+ if (!m_isProcessing) {
+ Q_Q(MyScriptInputMethod);
+ if (!q->inputContext()->preeditText().isEmpty())
+ q->inputContext()->commit();
+ }
+
+ stopCommitTimer();
+
+ for (int i = 0; i < traceList.size(); i++) {
+ traceList[i]->setOpacity(qMax(0.0, 1 - 0.25 * (traceList.size() - i)));
+ }
+
+ QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace();
+ traceList.append(trace);
+
+ return trace;
+ }
+
+ void traceEnd(QVirtualKeyboardTrace *trace)
+ {
+ if (trace->isCanceled()) {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO << "discarded" << trace;
+ traceList.removeOne(trace);
+ delete trace;
+ } else {
+ addPointsToTraceGroup(trace);
+ }
+
+ if (!traceList.isEmpty() && countActiveTraces() == 0) {
+ resetCommitTimer();
+ }
+ }
+
+ int countActiveTraces() const
+ {
+ int count = 0;
+ for (QVirtualKeyboardTrace *trace : qAsConst(traceList)) {
+ if (!trace->isFinal())
+ count++;
+ }
+ return count;
+ }
+
+ void clearTraces()
+ {
+ qDeleteAll(traceList);
+ traceList.clear();
+ }
+
+ void handleBackspace()
+ {
+ Q_Q(MyScriptInputMethod);
+
+ cancelRecognition();
+
+ clearCandidates();
+ clearItems();
+ q->inputContext()->commit();
+ }
+
+ void addPointsToTraceGroup(QVirtualKeyboardTrace *trace)
+ {
+ const QVariantList sourcePoints = trace->points();
+
+ struct voPoint {
+ float x;
+ float y;
+ };
+
+ std::vector<voPoint> points;
+ points.reserve(sourcePoints.size());
+ for (const QVariant &p : sourcePoints) {
+ const QPointF pt(p.toPointF());
+ points.push_back({ (float)pt.x(), (float)pt.y() });
+ }
+
+ if (!voim_addStroke(m_engine, m_recognizer, &points.data()->x, sizeof(voPoint), &points.data()->y, sizeof(voPoint), (int)(points.size())) &&
+ voim_getError(m_engine) != VOIM_EC_NO_ERROR) {
+ qCCritical(qlcVKMyScript) << "voim_addStroke() failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ return;
+ }
+ }
+
+ void clearCandidates(void)
+ {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ wordCandidates.clear();
+ word = QString();
+ wordIndex = -1;
+
+ updateCandidateView();
+ }
+
+ void clearItems(void)
+ {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ m_itemIndex = -1;
+
+ for (int i = 0; i < m_items.count(); i++) {
+ CandidateItem *candidateItem = m_items.at(i).second;
+ delete candidateItem;
+ }
+
+ m_items.clear();
+ }
+
+ bool cancelRecognition()
+ {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+ Q_ASSERT(m_engine != nullptr && m_recognizer != nullptr);
+
+ if (m_isProcessing)
+ stopCommitTimer(); //commit();
+ clearTraces();
+
+ if (voim_cancel(m_engine, m_recognizer) &&
+ voim_getError(m_engine) != VOIM_EC_NO_ERROR) {
+ qCCritical(qlcVKMyScript) << "voim_cancel() failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ return false;
+ }
+
+ m_isProcessing = false;
+ return !traceList.isEmpty();
+ }
+
+ void resetCommitTimer(void)
+ {
+ Q_Q(MyScriptInputMethod);
+
+ stopCommitTimer();
+ m_commitTimer = q->startTimer(1500);
+ }
+
+ void stopCommitTimer(void)
+ {
+ if (m_commitTimer) {
+ Q_Q(MyScriptInputMethod);
+ q->killTimer(m_commitTimer);
+ m_commitTimer = 0;
+ }
+ }
+
+ void initHwrEngine(void)
+ {
+ if (!createEngine())
+ return;
+
+ if (!createLanguageManager()) {
+ voim_destroyEngine(m_engine);
+ m_engine = nullptr;
+
+ return;
+ }
+
+ if (!createRecognizer()) {
+ voim_destroyLanguageManager(m_engine, m_languageManager);
+ voim_destroyEngine(m_engine);
+
+ m_languageManager = nullptr;
+ m_engine = nullptr;
+
+ return;
+ }
+
+ if (!voim_setNotificationCallback(m_engine, m_recognizer, notificationCallback, this)) {
+ qCCritical(qlcVKMyScript) << "voim_setNotificationCallback() failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ return;
+ }
+
+ m_threadController.reset(new MyScriptRecognizeController(this, m_engine, m_recognizer));
+ }
+
+ bool createEngine(void)
+ {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ /*
+ * NOTE: you must use the certificate provided by MyScript to use a MyScript product.
+ * It is described in MyCertificate.c and MyCertificate.h
+ */
+ const voCertificate *certificate = &myCertificate;
+ voimProperty *properties = nullptr;
+
+ QString imLibrary = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/" + 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;
+ 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;
+ return false;
+ }
+
+ QString propertyFile = QLatin1String("/Engine.properties");
+ propertyFile = QLibraryInfo::location(QLibraryInfo::DataPath) + "/" + MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
+
+ if (!checkFile(propertyFile)) {
+ qCCritical(qlcVKMyScript) << "failed to open Engine Property file " << propertyFile;
+ return false;
+ }
+
+ m_engine = voim_createEngine(certificate, propertyFile.toStdString().c_str(), properties);
+ if (!m_engine) {
+ qCCritical(qlcVKMyScript) << "voim_createEngine() failed";
+ return false;
+ }
+
+ return true;
+ }
+
+ bool createLanguageManager(void)
+ {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ voimProperty *properties = nullptr;
+
+ QString languageConf = QLibraryInfo::location(QLibraryInfo::DataPath) + "/" + 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;
+ return false;
+ }
+
+ properties = Properties_put(properties, "com.myscript.im.languageManifestSuffix", ".conf");
+ if (!properties) {
+ qCCritical(qlcVKMyScript) << "failed to define property " << "com.myscript.im.languageManifestSuffix" << " with value" << " \".conf\"";
+ return false;
+ }
+
+ QString propertyFile = QLatin1String("/LanguageManager.properties");
+ propertyFile = QLibraryInfo::location(QLibraryInfo::DataPath) + "/" + MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
+
+ if (!checkFile(propertyFile)) {
+ qCCritical(qlcVKMyScript) << "failed to open LanguageManager Property file " << propertyFile;
+ return false;
+ }
+
+ m_languageManager = voim_createLanguageManager(m_engine, propertyFile.toStdString().c_str(), properties);
+ if (!m_languageManager) {
+ qCCritical(qlcVKMyScript) << "voim_createLanguageManager() failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ return false;
+ }
+
+ voim_refreshLanguageList(m_engine, m_languageManager);
+ if (voim_getError(m_engine) != VOIM_EC_NO_ERROR) {
+ qCCritical(qlcVKMyScript) << "voim_refreshLanguageList failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ }
+ Properties_destroy(properties);
+
+ return true;
+ }
+
+ bool createRecognizer(void)
+ {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ QString propertyFile = QLatin1String("/Recognizer.properties");
+ propertyFile = QLibraryInfo::location(QLibraryInfo::DataPath) + "/" + MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
+
+ if (!checkFile(propertyFile)) {
+ qCCritical(qlcVKMyScript) << "failed to open Recognizer Property file " << propertyFile;
+ return false;
+ }
+
+ m_recognizer = voim_createRecognizer(m_engine, m_languageManager, propertyFile.toStdString().c_str(), NULL);
+ if (!m_recognizer) {
+ qCCritical(qlcVKMyScript) << "voim_createRecognizer() failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ return false;
+ }
+
+ return true;
+ }
+
+ QString getLanguageName(const QString &locale)
+ {
+ if (locale.startsWith(QLatin1String("ar"))) // (language == "ar_EG" || language == "ar_AR")
+ return QLatin1String("ar");
+ else if (locale.startsWith(QLatin1String("fa"))) // (language == "fa_FA")
+ return QLatin1String("fa_IR");
+ else if (locale.startsWith(QLatin1String("nb")))
+ return QLatin1String("no_NO");
+ else if (locale.startsWith(QLatin1String("sr")))
+ return QLatin1String("sr_Cyrl_RS");
+ else
+ return locale;
+ }
+
+ QString getModeName(Qt::InputMethodHints inputMethodHints)
+ {
+ /*
+ * Qt::InputMethodHints flags description
+ *
+ * - Qt::ImhNone :0x00000000
+ * - Qt::ImhHiddenText :0x00000001
+ * - Qt::ImhSensitiveData :0x00000002
+ * - Qt::ImhNoAutoUppercase :0x00000004
+ * - Qt::ImhPreferNumbers :0x00000008
+ * - Qt::ImhPreferUppercase :0x00000010
+ * - Qt::ImhPreferLowercase :0x00000020
+ * - Qt::ImhNoPredictiveText :0x00000040
+ * - Qt::ImhDate :0x00000080
+ * - Qt::ImhTime :0x00000100
+ * - Qt::ImhPreferLatin :0x00000200
+ * - Qt::ImhMultiLine :0x00000400
+ * - Qt::ImhExclusiveInputMask :0xffff0000
+ * - Qt::ImhDigitsOnly :0x00010000
+ * - Qt::ImhFormattedNumbersOnly :0x00020000
+ * - Qt::ImhUppercaseOnly :0x00040000
+ * - Qt::ImhLowercaseOnly :0x00080000
+ * - Qt::ImhDialableCharactersOnly :0x00100000
+ * - Qt::ImhEmailCharactersOnly :0x00200000
+ * - Qt::ImhUrlCharactersOnly :0x00400000
+ * - Qt::ImhLatinOnly :0x00800000
+ */
+
+ if (inputMethodHints & Qt::ImhDigitsOnly)
+ return QLatin1String("number-superimposed");
+
+ if (inputMethodHints & Qt::ImhFormattedNumbersOnly)
+ return QLatin1String("number-superimposed"); // "number-superimposed" is not correctly matched with Qt::ImhFormattedNumbersOnly
+ // temporary linked to "number-superimposed", need to improve it later on
+
+ if (inputMethodHints & Qt::ImhDialableCharactersOnly)
+ return QLatin1String("phone_number-superimposed");
+
+ if (inputMethodHints & Qt::ImhEmailCharactersOnly)
+ return QLatin1String("email-superimposed");
+
+ if (inputMethodHints & Qt::ImhUrlCharactersOnly)
+ return QLatin1String("uri-superimposed");
+
+ return QLatin1String("text-superimposed");
+ }
+
+ bool setMode(const QString &locale, Qt::InputMethodHints inputMethodHints)
+ {
+ if (locale == m_locale && inputMethodHints == m_inputMethodHints)
+ return false;
+
+ m_locale = locale;
+ m_inputMethodHints = inputMethodHints;
+
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO << locale;
+ Q_ASSERT(m_engine != nullptr && m_recognizer != nullptr);
+
+ QString language = getLanguageName(m_locale);
+ QString mode = getModeName(m_inputMethodHints);
+
+ if (!voim_setMode(m_engine, m_recognizer, language.toStdString().c_str(), mode.toStdString().c_str()) &&
+ voim_getError(m_engine) != VOIM_EC_NO_ERROR) {
+ qCCritical(qlcVKMyScript) << "voim_setMode() failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ return false;
+ }
+
+ return true;
+ }
+
+ bool commit(void)
+ {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+ Q_ASSERT(m_engine != nullptr && m_recognizer != nullptr);
+
+ if (!voim_commit(m_engine, m_recognizer) &&
+ voim_getError(m_engine) != VOIM_EC_NO_ERROR) {
+ qCCritical(qlcVKMyScript) << "voim_commit() failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ return false;
+ }
+
+ stopCommitTimer();
+
+ return true;
+ }
+
+ void destroyHwrEngine(void)
+ {
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ cancelRecognition();
+
+ if (m_engine) {
+ if (m_recognizer)
+ voim_destroyRecognizer(m_engine, m_recognizer);
+
+ if (m_languageManager)
+ voim_destroyLanguageManager(m_engine, m_languageManager);
+
+ voim_destroyEngine(m_engine);
+ }
+
+ m_threadController.reset();
+ }
+
+ bool checkFile(QString filename)
+ {
+ if (QFile::exists(filename)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /******************************************************************************
+ * The notificationCallback handles events raised by
+ * the worker thread of a recognizer
+ *
+ * Parameters:
+ * - engine : the VOIM engine
+ * - recognizer : the VOIM recognizer that sends the event.
+ * - eventType : the type of the event.
+ * - eventParameters : the parameters associated with the event, if any.
+ * - userParam : the userParameter that passed to
+ * voim_setNotificationCallback
+ *****************************************************************************/
+ static void notificationCallback(voimEngine *engine,
+ voimRecognizer *recognizer,
+ voimEventType eventType,
+ const void *eventParameters,
+ void *userParam)
+ {
+ if (userParam) {
+ MyScriptInputMethodPrivate *pParent = static_cast<MyScriptInputMethodPrivate *>(userParam);
+ pParent->onNotify(engine, recognizer, eventType, eventParameters);
+ }
+ }
+
+ /******************************************************************************
+ * Event types of VOIM handwriting notification callback
+ *
+ * - VOIM_EVENT_ON_SET_MODE
+ * :Occurs when a mode change request has been taken into account.
+ * - VOIM_EVENT_ON_SET_POSITION_AND_SCALE_INDICATOR
+ * :Occurs when a guide line change request has been taken into account.
+ * - VOIM_EVENT_ON_SET_USER_DICTIONARY
+ * :Occurs when a user dictionary has been set to the recognizer.
+ * - VOIM_EVENT_ON_ADD_STROKE
+ * :Occurs when a new digital ink stroke has been added to
+ * the recognizer and received by the worker thread.
+ * - VOIM_EVENT_ON_RECOGNITION_START
+ * :Occurs when a recognition process starts.
+ * - VOIM_EVENT_ON_RECOGNITION_PROGRESS
+ * :Occurs during a recognition process.
+ * - VOIM_EVENT_ON_RECOGNITION_END
+ * :Occurs when a recognition process ends.
+ * - VOIM_EVENT_ON_COMMIT
+ * :Occurs when a commit request has been taken into account.
+ * - VOIM_EVENT_ON_CANCEL
+ * :Occurs when a cancel request has been taken into account.
+ * - VOIM_EVENT_ON_FLOW_SYNC
+ * :Occurs when a flow sync command is received by
+ * the recognizer worker thread.
+ * - VOIM_EVENT_ON_NEW_INPUT_ITEM
+ * :Occurs when a new input item command is received by
+ * the recognizer worker thread.
+ * - VOIM_EVENT_ON_ADD_STRING
+ * :Occurs when a new digital text string has been added
+ * to the recognizer and received by the worker thread.
+ *****************************************************************************/
+ void onNotify(voimEngine *engine, voimRecognizer *recognizer,
+ voimEventType eventType, const void *eventParameters)
+ {
+ Q_UNUSED(recognizer);
+
+ switch (eventType) {
+
+ case VOIM_EVENT_ON_SET_MODE:
+ {
+ /*
+ * voimSetModeParameters
+ *
+ * voimLanguage *language - The language that contains the handwriting mode
+ * int modeIndex - The index of the mode in the language
+ * bool successful - True if the operation was successful
+ */
+ const voimSetModeParameters *p = (const voimSetModeParameters *)eventParameters;
+
+ if (p->successful) {
+ QString language = QString::fromUtf8(voim_getLanguageName(engine, p->language));
+ QString mode = QString::fromUtf8(voim_getLanguageModeNameAt(engine, p->language, p->modeIndex));
+
+ qCDebug(qlcVKMyScript) << "a mode" << language << "/" << mode <<
+ "has been set, ready to receive strokes";
+ } else {
+ qCCritical(qlcVKMyScript) << "failed to set mode";
+ }
+ }
+ break;
+
+ case VOIM_EVENT_ON_SET_POSITION_AND_SCALE_INDICATOR:
+ {
+ /*
+ * voimSetPositionAndScaleIndicatorParameters
+ *
+ * float baselinePosition - The baseline position
+ * float xHeight - The height of small letter x
+ * float lineSpacing - The line spacing
+ * bool successful - True if the operation was successful
+ */
+ const voimSetPositionAndScaleIndicatorParameters *p = (const voimSetPositionAndScaleIndicatorParameters *)eventParameters;
+
+ if (p->successful) {
+ qCDebug(qlcVKMyScript) << "baselinePosition \"" << p->baselinePosition << "\", " <<
+ "xHeight \"" << p->xHeight << "\", " <<
+ "lineSpacing \"" << p->lineSpacing << "\" have been set";
+ } else {
+ qCCritical(qlcVKMyScript) << "failed to set position and scale indicator";
+ }
+ }
+ break;
+
+ case VOIM_EVENT_ON_SET_USER_DICTIONARY:
+ {
+ /*
+ * voimSetUserDictionaryParameters
+ *
+ * voimDictionary *dictionary - The dictionary
+ * bool successful - True if the operation was successful
+ */
+ const voimSetUserDictionaryParameters *p = (const voimSetUserDictionaryParameters *)eventParameters;
+
+ if (p->successful)
+ qCDebug(qlcVKMyScript) << "user dictionary has been set";
+ else
+ qCCritical(qlcVKMyScript) << "failed to set user dictionary";
+ }
+ break;
+
+ case VOIM_EVENT_ON_ADD_STROKE:
+ {
+ /*
+ * voimAddStrokeParameters
+ *
+ * int sessionIndex - The index of the recognition session
+ * int strokeIndex - The index of the stroke in the recognition session
+ * bool successful - True if the operation was successful
+ */
+ const voimAddStrokeParameters *p = (const voimAddStrokeParameters *)eventParameters;
+
+ if (p->successful) {
+ qCDebug(qlcVKMyScript) << "a stroke with sessionIndex \"" << p->sessionIndex << "\", " <<
+ "strokeIndex \"" << p->strokeIndex << "\" has been added";
+ } else {
+ qCCritical(qlcVKMyScript) << "failed to add stroke";
+ }
+ }
+ break;
+
+ case VOIM_EVENT_ON_RECOGNITION_START:
+ {
+ /*
+ * voimRecognitionStartParameters
+ *
+ * int firstStrokeIndex - The index of the first new stroke to be recognized
+ * int sessionIndex - The index of the recognition session
+ * int strokeCount - The number of new strokes to be recognized
+ */
+ const voimRecognitionStartParameters *p = (const voimRecognitionStartParameters *)eventParameters;
+
+ qCDebug(qlcVKMyScript) << "recognition started at sessionIndex \"" << p->sessionIndex << "\", " <<
+ "firstStrokeIndex \"" << p->firstStrokeIndex << "\", " <<
+ "strokeCount \"" << p->strokeCount << "\"";
+
+ m_isProcessing = true;
+ }
+ break;
+
+ case VOIM_EVENT_ON_RECOGNITION_PROGRESS:
+ {
+ /*
+ * voimRecognitionProgressParameters
+ *
+ * int amountDone - The current amount of work done
+ * int amountToDo - The current amount of work to do
+ */
+ const voimRecognitionProgressParameters *p = (const voimRecognitionProgressParameters *)eventParameters;
+
+ if (p->amountDone == p->amountToDo)
+ qCDebug(qlcVKMyScript) << "progress recognition, " << p->amountDone << "/" << p->amountToDo;
+ }
+ break;
+
+ case VOIM_EVENT_ON_RECOGNITION_END:
+ {
+ /*
+ * voimRecognitionEndParameters
+ *
+ * bool successful - True if the operation was successful
+ */
+ const voimRecognitionEndParameters *p = (const voimRecognitionEndParameters *)eventParameters;
+
+ if (p->successful) {
+ qCDebug(qlcVKMyScript) << "recognition has been ended";
+
+ if (!m_onManagingResult) {
+ m_onManagingResult = true;
+ if (m_threadController) {
+ m_threadController->emitRecognitionEnded();
+ }
+ }
+ } else {
+ qCCritical(qlcVKMyScript) << "failed to finish recognition";
+ }
+ }
+ break;
+
+ case VOIM_EVENT_ON_COMMIT:
+ {
+ /*
+ * voimCommitParameters
+ *
+ * bool successful - True if the operation was successful
+ */
+ const voimCommitParameters *p = (const voimCommitParameters *)eventParameters;
+
+ if (p->successful) {
+ qCDebug(qlcVKMyScript) << "recognition has been committed";
+
+ if (m_threadController) {
+ m_threadController->emitRecognitionCommitted();
+ }
+ } else {
+ qCCritical(qlcVKMyScript) << "failed to commit recognition";
+ }
+ }
+ break;
+
+ case VOIM_EVENT_ON_CANCEL:
+ {
+ /*
+ * voimCancelParameters
+ *
+ * bool successful - True if the operation was successful
+ */
+ const voimCancelParameters *p = (const voimCancelParameters *)eventParameters;
+
+ if (p->successful)
+ qCDebug(qlcVKMyScript) << "recognition has been canceled";
+ else
+ qCCritical(qlcVKMyScript) << "failed to cancel recognition";
+ }
+ break;
+
+ case VOIM_EVENT_ON_FLOW_SYNC:
+ {
+ /*
+ * voimFlowSyncParameters
+ *
+ * int intValue - The integer value that was passed to the voim_flowSync() function
+ */
+ const voimFlowSyncParameters *p = (const voimFlowSyncParameters *)eventParameters;
+
+ qCDebug(qlcVKMyScript) << "voim_flowSync() has been called with value \"" << p->intValue << "\"";
+ }
+ break;
+
+ case VOIM_EVENT_ON_NEW_INPUT_ITEM:
+ {
+ /*
+ * voimNewInputItemParameters
+ *
+ * bool successful - True if the operation was successful
+ */
+ const voimNewInputItemParameters *p = (const voimNewInputItemParameters *)eventParameters;
+
+ if (p->successful)
+ qCDebug(qlcVKMyScript) << "new recognition session being created while remaining in the current session";
+ else
+ qCCritical(qlcVKMyScript) << "failed to create new recogniiton session";
+ }
+ break;
+
+ case VOIM_EVENT_ON_ADD_STRING:
+ {
+ /*
+ * [Note that the parameters are same as that of the VOIM_EVENT_ON_ADD_STROKE event
+ * because references to it in the result work the same (using stroke index
+ * for string and point index for its characters)]
+ *
+ * voimAddStrokeParameters
+ *
+ * int sessionIndex - The index of the recognition session
+ * int strokeIndex - The index of the stroke in the recognition session
+ * bool successful - True if the operation was successful
+ */
+ const voimAddStrokeParameters *p = (const voimAddStrokeParameters *)eventParameters;
+
+ if (p->successful) {
+ qCDebug(qlcVKMyScript) << "a stroke with sessionIndex \"" << p->sessionIndex << "\", " <<
+ "strokeIndex \"" << p->strokeIndex << "\" has been added";
+ } else {
+ qCCritical(qlcVKMyScript) << "failed to add string";
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ void updateCandidateView(void)
+ {
+ Q_Q(MyScriptInputMethod);
+
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, wordIndex);
+ }
+
+ void updatePreeditTextCursor(int cursorPosition)
+ {
+ Q_Q(MyScriptInputMethod);
+
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return;
+
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+ qCDebug(qlcVKMyScript) << "preeditText:" << ic->preeditText();
+
+ bool isItemChanged = false;
+ int lastPosition = 0;
+ QVector<std::pair<int, CandidateItem *>>::const_iterator iter;
+
+ for (iter = m_items.cbegin(); iter != m_items.cend(); iter++) {
+ int itemIndex = iter->first;
+ CandidateItem *candidateItem = iter->second;
+ int candidateIndex = candidateItem->candidateIndex;
+ QString candidate = candidateItem->candidates.at(candidateIndex);
+
+ lastPosition += candidate.length();
+ if (candidate != " " && cursorPosition <= lastPosition) {
+ m_itemStartPosition = lastPosition - candidate.length();
+ m_itemLength = candidate.length();
+
+ if (m_itemIndex != itemIndex) {
+ clearCandidates();
+ word = candidate;
+ wordIndex = candidateIndex;
+ wordCandidates = candidateItem->candidates;
+
+ m_itemIndex = itemIndex;
+ isItemChanged = true;
+ }
+
+ break;
+ }
+ }
+
+ if (isItemChanged)
+ updateCandidateView();
+ }
+
+ MyScriptInputMethod *q_ptr;
+
+ QScopedPointer<MyScriptRecognizeController> m_threadController;
+
+ voimEngine *m_engine;
+ voimLanguageManager *m_languageManager;
+ voimRecognizer *m_recognizer;
+ bool m_onManagingResult;
+ bool m_isProcessing;
+ int m_commitTimer;
+
+ QList<QVirtualKeyboardTrace *> traceList;
+
+ QVirtualKeyboardInputEngine::TextCase textCase;
+ QStringList wordCandidates;
+ QString word;
+ int wordIndex;
+
+ int m_itemIndex;
+ int m_itemStartPosition;
+ int m_itemLength;
+ QVector<std::pair<int, CandidateItem *>> m_items;
+
+ QString m_locale;
+ Qt::InputMethodHints m_inputMethodHints;
+
+ int m_preeditCursorPosition;
+};
+
+/*!
+ \class QtVirtualKeyboard::MyScriptInputMethod
+ \internal
+*/
+
+MyScriptInputMethod::MyScriptInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(parent),
+ d_ptr(new MyScriptInputMethodPrivate(this))
+{
+ connect(this, SIGNAL(preeditTextChanged(QString, bool, int, int, int)), this, SLOT(setPreeditText(QString, bool, int, int, int)));
+ connect(this, SIGNAL(gestureDetected(int, int)), this, SLOT(doGestureAction(int, int)));
+}
+
+MyScriptInputMethod::~MyScriptInputMethod()
+{
+
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> MyScriptInputMethod::inputModes(const QString &locale)
+{
+ Q_UNUSED(locale);
+ return QList<QVirtualKeyboardInputEngine::InputMode>()
+ << QVirtualKeyboardInputEngine::InputMode::Latin;
+}
+
+bool MyScriptInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_UNUSED(inputMode);
+ Q_D(MyScriptInputMethod);
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (d->setMode(locale, ic->inputMethodHints())) {
+ d->m_locale = locale;
+ return true;
+ }
+ return false;
+}
+
+bool MyScriptInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_D(MyScriptInputMethod);
+ d->textCase = textCase;
+ return true;
+}
+
+bool MyScriptInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(text);
+ Q_UNUSED(modifiers);
+
+ Q_D(MyScriptInputMethod);
+ switch (key) {
+ case Qt::Key_Backspace:
+ d->handleBackspace();
+ break;
+ default:
+ d->cancelRecognition();
+ if (inputContext())
+ inputContext()->commit();
+ break;
+ }
+ return false;
+}
+
+void MyScriptInputMethod::reset()
+{
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (ic) {
+ Q_D(MyScriptInputMethod);
+ d->clearCandidates();
+ ic->commit();
+ }
+}
+
+void MyScriptInputMethod::update()
+{
+ Q_D(MyScriptInputMethod);
+ if (d->m_isProcessing)
+ d->cancelRecognition();
+
+ reset();
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> MyScriptInputMethod::selectionLists()
+{
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int MyScriptInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_D(MyScriptInputMethod);
+
+ if (type != QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
+ return 0;
+
+ return d->wordCandidates.count();
+}
+
+QVariant MyScriptInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ Q_D(MyScriptInputMethod);
+
+ if (type != QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
+ return QVariant();
+
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ return QVariant(d->wordCandidates.at(index));
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ {
+ const QString wordCandidate(d->wordCandidates.at(index));
+ int wordCompletionLength = wordCandidate.length() - d->word.length();
+ return QVariant((wordCompletionLength > 0 && wordCandidate.startsWith(d->word)) ? wordCompletionLength : 0);
+ }
+ default:
+ return QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
+ }
+}
+
+void MyScriptInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_D(MyScriptInputMethod);
+
+ if (d->m_isProcessing)
+ return;
+
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (!ic)
+ return;
+
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ QVirtualKeyboardAbstractInputMethod::selectionListItemSelected(type, index);
+
+ int itemIndex = d->m_itemIndex;
+ CandidateItem *candidateItem = d->m_items.at(itemIndex).second;
+
+ QString candidate = candidateItem->candidates.at(index);
+ candidateItem->candidateIndex = index;
+
+ QString label = ic->preeditText();
+ label.replace(d->m_itemStartPosition, d->m_itemLength, candidate);
+ setPreeditText(label, true, d->m_preeditCursorPosition, d->m_itemStartPosition, candidate.length());
+
+ d->updatePreeditTextCursor(d->m_preeditCursorPosition);
+}
+
+QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> MyScriptInputMethod::patternRecognitionModes() const
+{
+ return QList<QVirtualKeyboardInputEngine::PatternRecognitionMode>()
+ << QVirtualKeyboardInputEngine::PatternRecognitionMode::Handwriting;
+}
+
+QVirtualKeyboardTrace *MyScriptInputMethod::traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+{
+ Q_D(MyScriptInputMethod);
+
+ return d->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
+}
+
+bool MyScriptInputMethod::traceEnd(QVirtualKeyboardTrace *trace)
+{
+ Q_D(MyScriptInputMethod);
+
+ d->traceEnd(trace);
+ return true;
+}
+
+bool MyScriptInputMethod::clickPreeditText(int cursorPosition)
+{
+ Q_D(MyScriptInputMethod);
+
+ if (d->m_isProcessing)
+ return true;
+
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (ic) {
+ setPreeditText(ic->preeditText(), true, cursorPosition);
+ }
+
+ return true;
+}
+
+void MyScriptInputMethod::timerEvent(QTimerEvent *timerEvent)
+{
+ Q_D(MyScriptInputMethod);
+
+ if (timerEvent->timerId() == d->m_commitTimer) {
+ d->commit();
+ }
+}
+
+void MyScriptInputMethod::setPreeditText(QString label, bool isCommitted, int cursorPosition, int highlightStart, int highlightLength)
+{
+ Q_D(MyScriptInputMethod);
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ QBrush foreground = isCommitted ? QBrush(Qt::black) : QBrush(Qt::blue);
+ QBrush backgroundNormal = QBrush(Qt::white);
+ QBrush backgroundHighlight = QBrush(QColor(0x66, 0xCD, 0xAA));
+
+ QTextCharFormat textFormat;
+ textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, label.length(), textFormat));
+
+ int highlightEnd = highlightStart + highlightLength;
+ if (highlightLength > 0 && highlightStart <= label.length() && highlightEnd <= label.length()) {
+
+ if (highlightStart > 0) {
+ QTextCharFormat normal;
+ normal.setBackground(backgroundNormal);
+ normal.setForeground(foreground);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, highlightStart, normal));
+ }
+
+ QTextCharFormat highlight;
+ highlight.setBackground(backgroundHighlight);
+ highlight.setForeground(foreground);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, highlightStart, highlightLength, highlight));
+
+ if (highlightEnd < label.length()) {
+ QTextCharFormat normal;
+ int highlightLength = label.length() - highlightEnd;
+ normal.setBackground(backgroundNormal);
+ normal.setForeground(foreground);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, highlightEnd, highlightLength, normal));
+ }
+ } else {
+
+ QTextCharFormat normal;
+ normal.setBackground(backgroundNormal);
+ normal.setForeground(foreground);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, label.length(), normal));
+ }
+
+ d->m_preeditCursorPosition = (cursorPosition != -1) ? cursorPosition : label.length();
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, d->m_preeditCursorPosition, 1, QVariant()));
+
+ inputContext()->setPreeditText(label, attributes);
+ if (isCommitted) {
+ Q_D(MyScriptInputMethod);
+ d->updatePreeditTextCursor(d->m_preeditCursorPosition);
+ }
+}
+
+void MyScriptInputMethod::doGestureAction(const int gestureType, const int gestureCount)
+{
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+
+ Q_D(MyScriptInputMethod);
+ d->cancelRecognition();
+
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (ic) {
+ switch (gestureType) {
+ case GESTURE_TYPE_LEFT_TO_RIGHT:
+ if (d->m_locale.contains("ar")) {
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
+ } else {
+ for (int i = 0; i < gestureCount; i++)
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
+ }
+ break;
+
+ case GESTURE_TYPE_RIGHT_TO_LEFT:
+ if (d->m_locale.contains("ar")) {
+ for (int i = 0; i < gestureCount; i++)
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
+ } else {
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
+ }
+ break;
+
+ case GESTURE_TYPE_DOWN_THEN_LEFT:
+ if (!d->m_locale.contains("ar"))
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Return, QString(), Qt::NoModifier);
+ break;
+
+ case GESTURE_TYPE_DOWN_THEN_RIGHT:
+ if (d->m_locale.contains("ar"))
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Return, QString(), Qt::NoModifier);
+ break;
+ }
+ }
+}
+
+MyScriptRecognizeWorker::MyScriptRecognizeWorker(voimEngine *engine, voimRecognizer *recognizer)
+ : QObject()
+ , m_engine(engine)
+ , m_recognizer(recognizer)
+ , m_resultLabel(QString())
+{
+}
+
+void MyScriptRecognizeWorker::manageRecognitionEnded() {
+ qCDebug(qlcVKMyScript) << "recognition has been ended (thread)";
+ manageRecognitionResult(m_engine, m_recognizer, false);
+}
+
+void MyScriptRecognizeWorker::manageRecognitionCommitted() {
+ qCDebug(qlcVKMyScript) << "recognition has been committed (thread)";
+ manageRecognitionResult(m_engine, m_recognizer, true);
+}
+
+void MyScriptRecognizeWorker::manageRecognitionResult(voimEngine *engine, voimRecognizer *recognizer, const bool isCommitted)
+{
+ Q_ASSERT(engine != nullptr && recognizer != nullptr);
+
+ voimResult *result = voim_getResult(engine, recognizer, false, true);
+ if (result != NULL) {
+
+ QString resultLabel = "";
+ qCDebug(qlcVKMyScript) << ">>> recognition result";
+
+ QStringList wordCandidates;
+ QString word;
+ int wordIndex = -1;
+
+ int gestureType = GESTURE_TYPE_NONE;
+ int gestureCount = 1;
+
+ emit clearItem();
+
+ int itemCount = voim_getItemCount(engine, result);
+ for (int itemIndex = 0; itemIndex < itemCount; itemIndex++) {
+
+ wordCandidates.clear();
+ word = QString();
+ wordIndex = -1;
+
+ qCDebug(qlcVKMyScript) << " * item #" << itemIndex << " of " << itemCount;
+
+ int candidateCount = voim_getItemCandidateCount(engine, result, itemIndex);
+ for (int candidateIndex = 0; candidateIndex < candidateCount; candidateIndex++) {
+
+ int length = voim_getItemCandidateLabel(engine, result, itemIndex, candidateIndex, nullptr, 0, "UTF-8");
+
+ if (length > 0) {
+
+ std::vector<char> bytes(length + 1);
+ char *temp = bytes.data();
+
+ voim_getItemCandidateLabel(engine, result, itemIndex, candidateIndex, temp, length, "UTF-8");
+ float score = voim_getItemCandidateScore(engine, result, itemIndex, candidateIndex);
+ qCDebug(qlcVKMyScript) << " - candidate #" << candidateIndex << " of " << candidateCount << " :" << temp << "(" << score << ")";
+
+ QString label = QString::fromUtf8(temp);
+
+ if (candidateIndex == 0) {
+ gestureType = isGesture(label);
+
+ if (gestureType == GESTURE_TYPE_NONE) {
+ resultLabel += label;
+ } else {
+ gestureCount = label.length() / QString::fromStdString(GESTURE_STRING_LEFT_TO_RIGHT).length();
+ break;
+ }
+ }
+
+ if (isGesture(label) == GESTURE_TYPE_NONE) {
+ if (wordIndex == -1) {
+ word = label;
+ wordIndex = candidateIndex;
+ }
+
+ wordCandidates << label;
+ }
+ }
+ }
+
+ if (gestureType != GESTURE_TYPE_NONE)
+ break;
+
+ emit newItem(itemIndex, wordIndex, wordCandidates);
+ }
+
+ voim_destroyResult(m_engine, result);
+
+ if (gestureType != GESTURE_TYPE_NONE) {
+ emit clearTraces();
+ emit gestureDetected(gestureType, gestureCount);
+ } else {
+ m_resultLabel = resultLabel;
+ emit preeditChanged(m_resultLabel, false);
+ emit newCandidates(wordCandidates, word, wordIndex);
+ }
+
+ } else if (result == NULL && voim_getError(m_engine) != VOIM_EC_NO_ERROR) {
+ qCCritical(qlcVKMyScript) << "voim_getResult() failed -" << getVoimErrorMessage(voim_getError(m_engine));
+ }
+
+ emit recognitionEnded();
+
+ if (isCommitted) {
+ emit clearTraces();
+ emit preeditChanged(m_resultLabel, true);
+ emit recognitionCommitted();
+ }
+}
+
+int MyScriptRecognizeWorker::isGesture(const QString label)
+{
+ if (label.length() < 2)
+ return GESTURE_TYPE_NONE;
+
+ if (label.contains(QString::fromUtf8(GESTURE_STRING_RIGHT_TO_LEFT)))
+ return GESTURE_TYPE_RIGHT_TO_LEFT;
+
+ if (label.contains(QString::fromUtf8(GESTURE_STRING_LEFT_TO_RIGHT)))
+ return GESTURE_TYPE_LEFT_TO_RIGHT;
+
+ if (label.contains(QString::fromUtf8(GESTURE_STRING_DOWN_THEN_LEFT)))
+ return GESTURE_TYPE_DOWN_THEN_LEFT;
+
+ if (label.contains(QString::fromUtf8(GESTURE_STRING_DOWN_THEN_RIGHT)))
+ return GESTURE_TYPE_DOWN_THEN_RIGHT;
+
+ return GESTURE_TYPE_NONE;
+}
+
+MyScriptRecognizeController::MyScriptRecognizeController(MyScriptInputMethodPrivate *d_, voimEngine *engine, voimRecognizer *recognizer)
+ : QObject()
+ , d(d_)
+{
+ MyScriptRecognizeWorker *worker = new MyScriptRecognizeWorker(engine, recognizer);
+ worker->moveToThread(&workerThread);
+ connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
+ connect(this, &MyScriptRecognizeController::recognitionEnded, worker, &MyScriptRecognizeWorker::manageRecognitionEnded);
+ connect(this, &MyScriptRecognizeController::recognitionCommitted, worker, &MyScriptRecognizeWorker::manageRecognitionCommitted);
+ connect(worker, &MyScriptRecognizeWorker::recognitionEnded, this, &MyScriptRecognizeController::handleRecognitionEnded);
+ connect(worker, &MyScriptRecognizeWorker::recognitionCommitted, this, &MyScriptRecognizeController::handleRecognitionCommitted);
+ connect(worker, &MyScriptRecognizeWorker::gestureDetected, this, &MyScriptRecognizeController::handelGestureDetected);
+ connect(worker, &MyScriptRecognizeWorker::preeditChanged, this, &MyScriptRecognizeController::handlePreeditChanged);
+ connect(worker, &MyScriptRecognizeWorker::clearItem, this, &MyScriptRecognizeController::handleClearItem);
+ connect(worker, &MyScriptRecognizeWorker::newItem, this, &MyScriptRecognizeController::handleNewItem);
+ connect(worker, &MyScriptRecognizeWorker::newCandidates, this, &MyScriptRecognizeController::handleNewCandidates);
+ connect(worker, &MyScriptRecognizeWorker::clearTraces, this, &MyScriptRecognizeController::handleClearTraces);
+ workerThread.start();
+}
+
+MyScriptRecognizeController::~MyScriptRecognizeController()
+{
+ workerThread.quit();
+ workerThread.wait();
+}
+
+void MyScriptRecognizeController::emitRecognitionEnded()
+{
+ emit recognitionEnded();
+}
+
+void MyScriptRecognizeController::emitRecognitionCommitted()
+{
+ emit recognitionCommitted();
+}
+
+void MyScriptRecognizeController::handleRecognitionEnded()
+{
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+ d->m_onManagingResult = false;
+}
+
+void MyScriptRecognizeController::handleRecognitionCommitted()
+{
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+ d->m_isProcessing = false;
+}
+
+void MyScriptRecognizeController::handelGestureDetected(const int gestureType, const int gestureCount)
+{
+ qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
+ emit d->q_ptr->gestureDetected(gestureType, gestureCount);
+}
+
+void MyScriptRecognizeController::handlePreeditChanged(const QString &preedit, const bool isCommitted)
+{
+ emit d->q_ptr->preeditTextChanged(preedit, isCommitted, -1, 0, 0);
+}
+
+void MyScriptRecognizeController::handleClearItem()
+{
+ d->clearItems();
+}
+
+void MyScriptRecognizeController::handleNewItem(const int itemIndex, const int candidateIndex, const QStringList &candidates)
+{
+ CandidateItem *candidateItem = new CandidateItem;
+
+ candidateItem->candidateIndex = candidateIndex;
+ candidateItem->candidates = candidates;
+
+ d->m_items.push_back(std::make_pair(itemIndex, candidateItem));
+
+ d->m_itemIndex = itemIndex;
+}
+
+void MyScriptRecognizeController::handleNewCandidates(const QStringList &candidates, const QString &word, int wordIndex)
+{
+ d->wordCandidates = candidates;
+ d->word = word;
+ d->wordIndex = wordIndex;
+
+ if (!word.isEmpty() && word != " " && word != "\u00A0") {
+ d->updateCandidateView();
+ }
+}
+
+void MyScriptRecognizeController::handleClearTraces()
+{
+ d->clearTraces();
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/myscript/plugin/myscriptinputmethod_p.h b/src/plugins/myscript/plugin/myscriptinputmethod_p.h
new file mode 100644
index 00000000..2f022fd2
--- /dev/null
+++ b/src/plugins/myscript/plugin/myscriptinputmethod_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef MYSCRIPTINPUTMETHOD_P_H
+#define MYSCRIPTINPUTMETHOD_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 MyScriptInputMethodPrivate;
+
+class MyScriptInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(MyScriptInputMethod)
+ Q_PROPERTY(bool superimposed READ superimposed CONSTANT)
+public:
+ explicit MyScriptInputMethod(QObject *parent = nullptr);
+ ~MyScriptInputMethod();
+
+ 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 clickPreeditText(int cursorPosition) override;
+
+ bool superimposed() const { return true; }
+
+protected:
+ void timerEvent(QTimerEvent *timerEvent) override;
+
+Q_SIGNALS:
+ void preeditTextChanged(QString label, bool isCommitted, int cursorPosition, int highlightStart, int highlightEnd);
+ void recognitionCommitted(const int gestureType);
+ void gestureDetected(const int gestureType, const int gestureCount);
+
+protected Q_SLOTS:
+ void setPreeditText(QString label, bool isCommitted, int cursorPosition = -1, int highlightStart = 0, int highlightLength = 0);
+ void doGestureAction(const int gestureType, const int gestureCount);
+
+private:
+ QScopedPointer<MyScriptInputMethodPrivate> d_ptr;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/myscript/plugin/myscriptinputmethod_p_p.h b/src/plugins/myscript/plugin/myscriptinputmethod_p_p.h
new file mode 100644
index 00000000..7118e6ff
--- /dev/null
+++ b/src/plugins/myscript/plugin/myscriptinputmethod_p_p.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef MYSCRIPTINPUTMETHOD_P_P_H
+#define MYSCRIPTINPUTMETHOD_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 <QObject>
+#include <QString>
+#include <QThread>
+#include <QVector>
+
+typedef struct VOIM_ENGINE voimEngine;
+typedef struct VOIM_RECOGNIZER voimRecognizer;
+typedef struct CANDIDATE_ITEM CandidateItem;
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class MyScriptRecognizeWorker : public QObject
+{
+ Q_OBJECT
+
+public:
+ MyScriptRecognizeWorker(voimEngine* engine, voimRecognizer* recognizer);
+
+public slots:
+ void manageRecognitionEnded();
+ void manageRecognitionCommitted();
+
+signals:
+ void recognitionEnded();
+ void recognitionCommitted();
+ void gestureDetected(const int gestureType, const int gestureCount);
+ void preeditChanged(const QString &preedit, const bool isCommitted);
+ void clearItem();
+ void newItem(const int itemIndex, const int candidateIndex, const QStringList &candidates);
+ void newCandidates(const QStringList &candidates, const QString &word, int wordIndex);
+ void clearTraces();
+
+private:
+ void manageRecognitionResult(voimEngine *engine, voimRecognizer *recognizer, const bool isCommitted);
+ int isGesture(const QString label);
+
+ voimEngine* m_engine;
+ voimRecognizer* m_recognizer;
+ QString m_resultLabel;
+};
+
+class MyScriptInputMethodPrivate;
+
+class MyScriptRecognizeController : public QObject
+{
+ Q_OBJECT
+public:
+ MyScriptRecognizeController(MyScriptInputMethodPrivate *d, voimEngine *engine, voimRecognizer *recognizer);
+ ~MyScriptRecognizeController();
+
+ void emitRecognitionEnded();
+ void emitRecognitionCommitted();
+
+public slots:
+ void handleRecognitionEnded();
+ void handleRecognitionCommitted();
+ void handelGestureDetected(const int gestureType, const int gestureCount);
+ void handlePreeditChanged(const QString &preedit, const bool isCommitted);
+ void handleClearItem();
+ void handleNewItem(const int itemIndex, const int candidateIndex, const QStringList &candidates);
+ void handleNewCandidates(const QStringList &candidates, const QString &word, int wordIndex);
+ void handleClearTraces();
+
+signals:
+ void recognitionEnded();
+ void recognitionCommitted();
+
+private:
+ QThread workerThread;
+ MyScriptInputMethodPrivate *d;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // MYSCRIPTINPUTMETHOD_P_P_H
diff --git a/src/plugins/myscript/plugin/myscriptplugin.cpp b/src/plugins/myscript/plugin/myscriptplugin.cpp
new file mode 100644
index 00000000..779a52d2
--- /dev/null
+++ b/src/plugins/myscript/plugin/myscriptplugin.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..7b7873ca
--- /dev/null
+++ b/src/plugins/myscript/plugin/myscriptplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..0bb8a90e
--- /dev/null
+++ b/src/plugins/myscript/plugin/plugin.pro
@@ -0,0 +1,109 @@
+TARGET = qtvirtualkeyboard_myscript
+QT += qml virtualkeyboard
+
+include(../../../config.pri)
+
+equals(MYSCRIPT_FOUND, 0): \
+ error("MyScript SDK could not be found. For more information, see" \
+ "the documentation in Building Qt Virtual Keyboard")
+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
+contains(CONFIG, lang-en(_GB)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback
+contains(CONFIG, lang-en(_US)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback
+contains(CONFIG, lang-ar.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ar_AR/handwriting.qml
+contains(CONFIG, lang-bg.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/bg_BG/handwriting.qml
+contains(CONFIG, lang-cs.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/cs_CZ/handwriting.qml
+contains(CONFIG, lang-da.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/da_DK/handwriting.fallback
+contains(CONFIG, lang-de.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/de_DE/handwriting.fallback
+contains(CONFIG, lang-el.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/el_GR/handwriting.qml
+contains(CONFIG, lang-es(_ES)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/es_ES/handwriting.qml
+contains(CONFIG, lang-es(_MX)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/es_MX/handwriting.qml
+contains(CONFIG, lang-et.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/et_EE/handwriting.fallback
+contains(CONFIG, lang-fa.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fa_FA/handwriting.qml
+contains(CONFIG, lang-fi.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fi_FI/handwriting.fallback
+contains(CONFIG, lang-fr(_FR)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fr_FR/handwriting.fallback
+contains(CONFIG, lang-fr(_CA)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fr_CA/handwriting.fallback
+contains(CONFIG, lang-he.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/he_IL/handwriting.qml
+contains(CONFIG, lang-hi.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hi_IN/handwriting.qml
+contains(CONFIG, lang-hr.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hr_HR/handwriting.qml
+contains(CONFIG, lang-hu.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hu_HU/handwriting.qml
+contains(CONFIG, lang-id.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback
+contains(CONFIG, lang-it.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/it_IT/handwriting.fallback
+contains(CONFIG, lang-ja.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ja_JP/handwriting.qml
+contains(CONFIG, lang-ko.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ko_KR/handwriting.qml
+contains(CONFIG, lang-ms.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback
+contains(CONFIG, lang-nb.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nb_NO/handwriting.fallback
+contains(CONFIG, lang-nl.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback
+contains(CONFIG, lang-pl.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pl_PL/handwriting.fallback
+contains(CONFIG, lang-pt(_BR)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pt_BR/handwriting.fallback
+contains(CONFIG, lang-pt(_PT)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pt_PT/handwriting.fallback
+contains(CONFIG, lang-ro.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ro_RO/handwriting.qml
+contains(CONFIG, lang-ru.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ru_RU/handwriting.fallback
+contains(CONFIG, lang-sk.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sk_SK/handwriting.fallback
+contains(CONFIG, lang-sl.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sl_SI/handwriting.fallback
+contains(CONFIG, lang-sq.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sq_AL/handwriting.fallback
+contains(CONFIG, lang-sr.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sr_SP/handwriting.qml
+contains(CONFIG, lang-sv.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sv_SE/handwriting.fallback
+contains(CONFIG, lang-th.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/th_TH/handwriting.fallback
+contains(CONFIG, lang-tr.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/tr_TR/handwriting.fallback
+contains(CONFIG, lang-uk.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/uk_UA/handwriting.fallback
+contains(CONFIG, lang-vi.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/vi_VN/handwriting.fallback
+contains(CONFIG, lang-zh(_CN)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/zh_CN/handwriting.qml
+contains(CONFIG, 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/virtualkeyboard/3rdparty/openwnn/NOTICE b/src/plugins/openwnn/3rdparty/openwnn/NOTICE
index 828dc845..828dc845 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/NOTICE
+++ b/src/plugins/openwnn/3rdparty/openwnn/NOTICE
diff --git a/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro b/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro
new file mode 100644
index 00000000..150ed169
--- /dev/null
+++ b/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro
@@ -0,0 +1,63 @@
+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/virtualkeyboard/3rdparty/openwnn/qt_attribution.json b/src/plugins/openwnn/3rdparty/openwnn/qt_attribution.json
index 9ac944df..9ac944df 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/qt_attribution.json
+++ b/src/plugins/openwnn/3rdparty/openwnn/qt_attribution.json
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndapi.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndapi.c
index 55971c69..55971c69 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndapi.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndapi.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndbdic.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndbdic.c
index 6cf73da7..6cf73da7 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndbdic.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndbdic.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndcommon.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndcommon.c
index fc1c25a6..fc1c25a6 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndcommon.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndcommon.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndfdic.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndfdic.c
index 1a7c37e2..1a7c37e2 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndfdic.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndfdic.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndldic.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndldic.c
index d140ea22..d140ea22 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndldic.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndldic.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndrdic.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndrdic.c
index b8fe6347..b8fe6347 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/ndrdic.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/ndrdic.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/neapi.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/neapi.c
index 4b59aac7..4b59aac7 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/neapi.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/neapi.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/necode.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/necode.c
index ca331861..ca331861 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/necode.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/necode.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/nj_str.c b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/nj_str.c
index 1892458b..1892458b 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/engine/nj_str.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/engine/nj_str.c
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_dic.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_dic.h
index 47b54acd..47b54acd 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_dic.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_dic.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_err.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_err.h
index 3b4010ca..3b4010ca 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_err.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_err.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_ext.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h
index 87553a00..87553a00 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_ext.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_lib.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_lib.h
index 3334d1fc..3334d1fc 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/nj_lib.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_lib.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/njd.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njd.h
index 937a009b..937a009b 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/njd.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njd.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/njx_lib.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njx_lib.h
index 91755e70..91755e70 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnDictionary/include/njx_lib.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njx_lib.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/WnnJpnDic.c b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/WnnJpnDic.c
index d3929598..d3929598 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/WnnJpnDic.c
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/WnnJpnDic.c
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/composingtext.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/composingtext.cpp
new file mode 100644
index 00000000..1f9ca4ff
--- /dev/null
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/composingtext.cpp
@@ -0,0 +1,490 @@
+/*
+ * Qt implementation of OpenWnn library
+ * This file is part of the Qt Virtual Keyboard module.
+ * Contact: http://www.qt.io/licensing/
+ *
+ * Copyright (C) 2015 The Qt Company
+ * Copyright (C) 2008-2012 OMRON SOFTWARE Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "composingtext.h"
+
+#include <QtCore/private/qobject_p.h>
+
+class ComposingTextPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(ComposingText)
+public:
+ ComposingTextPrivate(ComposingText *q_ptr) :
+ QObjectPrivate(),
+ q_ptr(q_ptr)
+ {
+ memset(mCursor, 0, sizeof(mCursor));
+ }
+
+ void modifyUpper(ComposingText::TextLayer layer, int mod_from, int mod_len, int org_len)
+ {
+ Q_Q(ComposingText);
+ if (layer >= (ComposingText::MAX_LAYER - 1)) {
+ /* no layer above */
+ return;
+ }
+
+ ComposingText::TextLayer uplayer = (ComposingText::TextLayer)(layer + 1);
+ QList<StrSegment> &strUplayer = mStringLayer[uplayer];
+ if (strUplayer.size() <= 0) {
+ /*
+ * if there is no element on above layer,
+ * add a element includes whole elements of the lower layer.
+ */
+ strUplayer.append(StrSegment(q->toString(layer), 0, mStringLayer[layer].size() - 1));
+ modifyUpper(uplayer, 0, 1, 0);
+ return;
+ }
+
+ int mod_to = mod_from + ((mod_len == 0) ? 0 : (mod_len - 1));
+ int org_to = mod_from + ((org_len == 0) ? 0 : (org_len - 1));
+ StrSegment &last = strUplayer[strUplayer.size() - 1];
+ if (last.to < mod_from) {
+ /* add at the tail */
+ last.to = mod_to;
+ last.string = q->toString(layer, last.from, last.to);
+ modifyUpper(uplayer, strUplayer.size()-1, 1, 1);
+ return;
+ }
+
+ int uplayer_mod_from = -1;
+ int uplayer_org_to = -1;
+ for (int i = 0; i < strUplayer.size(); i++) {
+ const StrSegment &ss = strUplayer.at(i);
+ if (ss.from > mod_from) {
+ if (ss.to <= org_to) {
+ /* the segment is included */
+ if (uplayer_mod_from < 0) {
+ uplayer_mod_from = i;
+ }
+ uplayer_org_to = i;
+ } else {
+ /* included in this segment */
+ uplayer_org_to = i;
+ break;
+ }
+ } else {
+ if (org_len == 0 && ss.from == mod_from) {
+ /* when an element is added */
+ uplayer_mod_from = i - 1;
+ uplayer_org_to = i - 1;
+ break;
+ } else {
+ /* start from this segment */
+ uplayer_mod_from = i;
+ uplayer_org_to = i;
+ if (ss.to >= org_to) {
+ break;
+ }
+ }
+ }
+ }
+
+ int diff = mod_len - org_len;
+ if (uplayer_mod_from >= 0) {
+ /* update an element */
+ StrSegment &ss = strUplayer[uplayer_mod_from];
+ int last_to = ss.to;
+ int next = uplayer_mod_from + 1;
+ for (int i = next; i <= uplayer_org_to; i++) {
+ const StrSegment &ss2 = strUplayer.at(next);
+ if (last_to > ss2.to) {
+ last_to = ss2.to;
+ }
+ strUplayer.removeAt(next);
+ }
+ ss.to = (last_to < mod_to)? mod_to : (last_to + diff);
+
+ ss.string = q->toString(layer, ss.from, ss.to);
+
+ for (int i = next; i < strUplayer.size(); i++) {
+ StrSegment &ss2 = strUplayer[i];
+ ss2.from += diff;
+ ss2.to += diff;
+ }
+
+ modifyUpper(uplayer, uplayer_mod_from, 1, uplayer_org_to - uplayer_mod_from + 1);
+ } else {
+ /* add an element at the head */
+ strUplayer.insert(0, StrSegment(q->toString(layer, mod_from, mod_to), mod_from, mod_to));
+ for (int i = 1; i < strUplayer.size(); i++) {
+ StrSegment &ss = strUplayer[i];
+ ss.from += diff;
+ ss.to += diff;
+ }
+ modifyUpper(uplayer, 0, 1, 0);
+ }
+ }
+
+ void deleteStrSegment0(ComposingText::TextLayer layer, int from, int to, int diff)
+ {
+ QList<StrSegment> &strLayer = mStringLayer[layer];
+ if (diff != 0) {
+ for (int i = to + 1; i < strLayer.size(); i++) {
+ StrSegment &ss = strLayer[i];
+ ss.from -= diff;
+ ss.to -= diff;
+ }
+ }
+ for (int i = from; i <= to; i++) {
+ strLayer.removeAt(from);
+ }
+ }
+
+ void replaceStrSegment0(ComposingText::TextLayer layer, const QList<StrSegment> &str, int from, int to)
+ {
+ QList<StrSegment> &strLayer = mStringLayer[layer];
+
+ if (from < 0 || from > strLayer.size()) {
+ from = strLayer.size();
+ }
+ if (to < 0 || to > strLayer.size()) {
+ to = strLayer.size();
+ }
+ for (int i = from; i <= to; i++) {
+ strLayer.removeAt(from);
+ }
+ for (int i = str.size() - 1; i >= 0; i--) {
+ strLayer.insert(from, str.at(i));
+ }
+
+ modifyUpper(layer, from, str.size(), to - from + 1);
+ }
+
+ ComposingText *q_ptr;
+ QList<StrSegment> mStringLayer[ComposingText::MAX_LAYER];
+ int mCursor[ComposingText::MAX_LAYER];
+
+};
+
+ComposingText::ComposingText(QObject *parent) :
+ QObject(*new ComposingTextPrivate(this), parent)
+{
+
+}
+
+ComposingText::~ComposingText()
+{
+
+}
+
+StrSegment ComposingText::getStrSegment(TextLayer layer, int pos) const
+{
+ Q_D(const ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return StrSegment();
+
+ const QList<StrSegment> &strLayer = d->mStringLayer[layer];
+ if (pos < 0) {
+ pos = strLayer.size() - 1;
+ }
+ if (pos >= strLayer.size() || pos < 0) {
+ return StrSegment();
+ }
+ return strLayer.at(pos);
+}
+
+void ComposingText::debugout() const
+{
+ Q_D(const ComposingText);
+ for (int i = LAYER0; i < MAX_LAYER; i++) {
+ QString tmp;
+ for (QList<StrSegment>::ConstIterator it = d->mStringLayer[i].constBegin();
+ it != d->mStringLayer[i].constEnd(); it++) {
+ tmp += QStringLiteral("(%1,%2,%3)").arg(it->string).arg(it->from).arg(it->to);
+ }
+ }
+}
+
+QString ComposingText::toString(TextLayer layer, int from, int to) const
+{
+ Q_D(const ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return QString();
+
+ QString buf;
+ const QList<StrSegment> &strLayer = d->mStringLayer[layer];
+
+ for (int i = from; i <= to; i++) {
+ const StrSegment &ss = strLayer.at(i);
+ buf.append(ss.string);
+ }
+ return buf;
+}
+
+QString ComposingText::toString(TextLayer layer) const
+{
+ Q_D(const ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return QString();
+
+ return toString(layer, 0, d->mStringLayer[layer].size() - 1);
+}
+
+void ComposingText::insertStrSegment(TextLayer layer, const StrSegment& str)
+{
+ Q_D(ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return;
+
+ int cursor = d->mCursor[layer];
+ d->mStringLayer[layer].insert(cursor, str);
+ d->modifyUpper(layer, cursor, 1, 0);
+ setCursor(layer, cursor + 1);
+}
+
+void ComposingText::insertStrSegment(TextLayer layer1, TextLayer layer2, const StrSegment &str)
+{
+ Q_D(ComposingText);
+
+ if (layer1 < LAYER0 || layer1 >= MAX_LAYER || layer2 < LAYER0 || layer2 >= MAX_LAYER)
+ return;
+
+ d->mStringLayer[layer1].insert(d->mCursor[layer1], str);
+ d->mCursor[layer1]++;
+
+ for (int i = (int)layer1 + 1; i <= (int)layer2; i++) {
+ int pos = d->mCursor[i - 1] - 1;
+ StrSegment tmp(str.string, pos, pos);
+ QList<StrSegment> &strLayer = d->mStringLayer[i];
+ strLayer.insert(d->mCursor[i], tmp);
+ d->mCursor[i]++;
+ for (int j = d->mCursor[i]; j < strLayer.size(); j++) {
+ StrSegment &ss = strLayer[j];
+ ss.from++;
+ ss.to++;
+ }
+ }
+ int cursor = d->mCursor[layer2];
+ d->modifyUpper(layer2, cursor - 1, 1, 0);
+ setCursor(layer2, cursor);
+}
+
+void ComposingText::replaceStrSegment(TextLayer layer, const QList<StrSegment> &str, int num)
+{
+ Q_D(ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return;
+
+ int cursor = d->mCursor[layer];
+ d->replaceStrSegment0(layer, str, cursor - num, cursor - 1);
+ setCursor(layer, cursor + str.size() - num);
+}
+
+void ComposingText::deleteStrSegment(TextLayer layer, int from, int to)
+{
+ Q_D(ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return;
+
+ int fromL[3] = { -1, -1, -1 };
+ int toL[3] = { -1, -1, -1 };
+
+ QList<StrSegment> &strLayer2 = d->mStringLayer[LAYER2];
+ QList<StrSegment> &strLayer1 = d->mStringLayer[LAYER1];
+
+ if (layer == LAYER2) {
+ fromL[LAYER2] = from;
+ toL[LAYER2] = to;
+ fromL[LAYER1] = strLayer2.at(from).from;
+ toL[LAYER1] = strLayer2.at(to).to;
+ fromL[LAYER0] = strLayer1.at(fromL[LAYER1]).from;
+ toL[LAYER0] = strLayer1.at(toL[LAYER1]).to;
+ } else if (layer == LAYER1) {
+ fromL[LAYER1] = from;
+ toL[LAYER1] = to;
+ fromL[LAYER0] = strLayer1.at(from).from;
+ toL[LAYER0] = strLayer1.at(to).to;
+ } else {
+ fromL[LAYER0] = from;
+ toL[LAYER0] = to;
+ }
+
+ int diff = to - from + 1;
+ for (int lv = LAYER0; lv < MAX_LAYER; lv++) {
+ if (fromL[lv] >= 0) {
+ d->deleteStrSegment0((TextLayer)lv, fromL[lv], toL[lv], diff);
+ } else {
+ int boundary_from = -1;
+ int boundary_to = -1;
+ QList<StrSegment> &strLayer = d->mStringLayer[lv];
+ for (int i = 0; i < strLayer.size(); i++) {
+ const StrSegment &ss = strLayer.at(i);
+ if ((ss.from >= fromL[lv-1] && ss.from <= toL[lv-1]) ||
+ (ss.to >= fromL[lv-1] && ss.to <= toL[lv-1]) ) {
+ if (fromL[lv] < 0) {
+ fromL[lv] = i;
+ boundary_from = ss.from;
+ }
+ toL[lv] = i;
+ boundary_to = ss.to;
+ } else if (ss.from <= fromL[lv-1] && ss.to >= toL[lv-1]) {
+ boundary_from = ss.from;
+ boundary_to = ss.to;
+ fromL[lv] = i;
+ toL[lv] = i;
+ break;
+ } else if (ss.from > toL[lv-1]) {
+ break;
+ }
+ }
+ if (boundary_from != fromL[lv-1] || boundary_to != toL[lv-1]) {
+ d->deleteStrSegment0((TextLayer)lv, fromL[lv] + 1, toL[lv], diff);
+ boundary_to -= diff;
+ QList<StrSegment> tmp = QList<StrSegment>() <<
+ StrSegment(toString((TextLayer)(lv - 1)), boundary_from, boundary_to);
+ d->replaceStrSegment0((TextLayer)lv, tmp, fromL[lv], fromL[lv]);
+ return;
+ } else {
+ d->deleteStrSegment0((TextLayer)lv, fromL[lv], toL[lv], diff);
+ }
+ }
+ diff = toL[lv] - fromL[lv] + 1;
+ }
+}
+
+int ComposingText::deleteAt(TextLayer layer, bool rightside)
+{
+ Q_D(ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return 0;
+
+ int cursor = d->mCursor[layer];
+ QList<StrSegment> &strLayer = d->mStringLayer[layer];
+
+ if (!rightside && cursor > 0) {
+ deleteStrSegment(layer, cursor - 1, cursor - 1);
+ setCursor(layer, cursor - 1);
+ } else if (rightside && cursor < strLayer.size()) {
+ deleteStrSegment(layer, cursor, cursor);
+ setCursor(layer, cursor);
+ }
+ return strLayer.size();
+}
+
+QList<StrSegment> ComposingText::getStringLayer(TextLayer layer) const
+{
+ Q_D(const ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return QList<StrSegment>();
+
+ return d->mStringLayer[layer];
+}
+
+int ComposingText::included(TextLayer layer, int pos)
+{
+ Q_D(ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER - 1)
+ return 0;
+
+ if (pos == 0) {
+ return 0;
+ }
+ int uplayer = (TextLayer)(layer + 1);
+ int i;
+ QList<StrSegment> &strLayer = d->mStringLayer[uplayer];
+ for (i = 0; i < strLayer.size(); i++) {
+ const StrSegment &ss = strLayer.at(i);
+ if (ss.from <= pos && pos <= ss.to) {
+ break;
+ }
+ }
+ return i;
+}
+
+int ComposingText::setCursor(TextLayer layer, int pos)
+{
+ Q_D(ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return -1;
+
+ if (pos > d->mStringLayer[layer].size()) {
+ pos = d->mStringLayer[layer].size();
+ }
+ if (pos < 0) {
+ pos = 0;
+ }
+ if (layer == ComposingText::LAYER0) {
+ d->mCursor[ComposingText::LAYER0] = pos;
+ d->mCursor[ComposingText::LAYER1] = included(ComposingText::LAYER0, pos);
+ d->mCursor[ComposingText::LAYER2] = included(ComposingText::LAYER1, d->mCursor[ComposingText::LAYER1]);
+ } else if (layer == ComposingText::LAYER1) {
+ d->mCursor[ComposingText::LAYER2] = included(ComposingText::LAYER1, pos);
+ d->mCursor[ComposingText::LAYER1] = pos;
+ d->mCursor[ComposingText::LAYER0] = (pos > 0) ? d->mStringLayer[ComposingText::LAYER1].at(pos - 1).to + 1 : 0;
+ } else {
+ d->mCursor[ComposingText::LAYER2] = pos;
+ d->mCursor[ComposingText::LAYER1] = (pos > 0) ? d->mStringLayer[ComposingText::LAYER2].at(pos - 1).to + 1 : 0;
+ d->mCursor[ComposingText::LAYER0] = (d->mCursor[ComposingText::LAYER1] > 0) ? d->mStringLayer[ComposingText::LAYER1].at(d->mCursor[ComposingText::LAYER1] - 1).to + 1 : 0;
+ }
+ return pos;
+}
+
+int ComposingText::moveCursor(TextLayer layer, int diff)
+{
+ Q_D(ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return -1;
+
+ int c = d->mCursor[layer] + diff;
+
+ return setCursor(layer, c);
+}
+
+int ComposingText::getCursor(TextLayer layer) const
+{
+ Q_D(const ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return -1;
+
+ return d->mCursor[layer];
+}
+
+int ComposingText::size(TextLayer layer) const
+{
+ Q_D(const ComposingText);
+
+ if (layer < LAYER0 || layer >= MAX_LAYER)
+ return 0;
+
+ return d->mStringLayer[layer].size();
+}
+
+void ComposingText::clear()
+{
+ Q_D(ComposingText);
+ for (int i = 0; i < MAX_LAYER; i++) {
+ d->mStringLayer[i].clear();
+ d->mCursor[i] = 0;
+ }
+}
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/composingtext.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/composingtext.h
index be2cee2d..be2cee2d 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/composingtext.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/composingtext.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/kanaconverter.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/kanaconverter.h
index 13f14ebf..13f14ebf 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/kanaconverter.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/kanaconverter.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/letterconverter.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/letterconverter.h
index 5aa1cc56..5aa1cc56 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/letterconverter.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/letterconverter.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnnclauseconverterjajp.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnnclauseconverterjajp.h
index 5bd0d234..5bd0d234 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnnclauseconverterjajp.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnnclauseconverterjajp.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnndictionary.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnndictionary.h
index 8bc62940..8bc62940 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnndictionary.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnndictionary.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnnenginejajp.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnnenginejajp.h
index db416732..db416732 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/openwnnenginejajp.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/openwnnenginejajp.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkan.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkan.h
index 5889a659..5889a659 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkan.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkan.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkanfullkatakana.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkanfullkatakana.h
index 9e9db9fc..9e9db9fc 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkanfullkatakana.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkanfullkatakana.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkanhalfkatakana.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkanhalfkatakana.h
index 884fe493..884fe493 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/romkanhalfkatakana.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/romkanhalfkatakana.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/strsegment.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/strsegment.h
index f65665fd..f65665fd 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/strsegment.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/strsegment.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/wnnlookuptable.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/wnnlookuptable.h
index 49d88208..49d88208 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/wnnlookuptable.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/wnnlookuptable.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/wnnword.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/wnnword.h
index c7674ca4..c7674ca4 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/include/wnnword.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/include/wnnword.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/kanaconverter.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
index 2b200b9e..2b200b9e 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/letterconverter.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/letterconverter.cpp
index 7dc94580..7dc94580 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/letterconverter.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/letterconverter.cpp
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
index 947f6cee..947f6cee 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
index 1063fd9a..1063fd9a 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
new file mode 100644
index 00000000..534e97b6
--- /dev/null
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
@@ -0,0 +1,388 @@
+/*
+ * Qt implementation of OpenWnn library
+ * This file is part of the Qt Virtual Keyboard module.
+ * Contact: http://www.qt.io/licensing/
+ *
+ * Copyright (C) 2015 The Qt Company
+ * Copyright (C) 2008-2012 OMRON SOFTWARE Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "openwnnenginejajp.h"
+#include "openwnndictionary.h"
+#include "openwnnclauseconverterjajp.h"
+#include "wnnword.h"
+#include "kanaconverter.h"
+#include <QtCore/private/qobject_p.h>
+
+class OpenWnnEngineJAJPPrivate : public QObjectPrivate
+{
+public:
+ OpenWnnEngineJAJPPrivate() :
+ QObjectPrivate(),
+ mDictType(OpenWnnEngineJAJP::DIC_LANG_INIT),
+ mKeyboardType(OpenWnnEngineJAJP::KEYBOARD_QWERTY),
+ mOutputNum(0),
+ mGetCandidateFrom(0),
+ mExactMatchMode(false),
+ mSingleClauseMode(false)
+ {
+ /* clear dictionary settings */
+ mDictionaryJP.clearDictionary();
+ mDictionaryJP.clearApproxPattern();
+
+ mClauseConverter.setDictionary(&mDictionaryJP);
+ mKanaConverter.setDictionary(&mDictionaryJP);
+ }
+
+ void setDictionaryForPrediction(int strlen)
+ {
+ OpenWnnDictionary &dict = mDictionaryJP;
+
+ dict.clearDictionary();
+
+ if (mDictType != OpenWnnEngineJAJP::DIC_LANG_JP_EISUKANA) {
+ dict.clearApproxPattern();
+ if (strlen == 0) {
+ dict.setDictionary(2, 245, 245);
+ dict.setDictionary(3, 100, 244);
+
+ dict.setDictionary(OpenWnnDictionary::INDEX_LEARN_DICTIONARY, OpenWnnEngineJAJP::FREQ_LEARN, OpenWnnEngineJAJP::FREQ_LEARN);
+ } else {
+ dict.setDictionary(0, 100, 400);
+ if (strlen > 1) {
+ dict.setDictionary(1, 100, 400);
+ }
+ dict.setDictionary(2, 245, 245);
+ dict.setDictionary(3, 100, 244);
+
+ dict.setDictionary(OpenWnnDictionary::INDEX_USER_DICTIONARY, OpenWnnEngineJAJP::FREQ_USER, OpenWnnEngineJAJP::FREQ_USER);
+ dict.setDictionary(OpenWnnDictionary::INDEX_LEARN_DICTIONARY, OpenWnnEngineJAJP::FREQ_LEARN, OpenWnnEngineJAJP::FREQ_LEARN);
+ if (mKeyboardType != OpenWnnEngineJAJP::KEYBOARD_QWERTY) {
+ dict.setApproxPattern(OpenWnnDictionary::APPROX_PATTERN_JAJP_12KEY_NORMAL);
+ }
+ }
+ }
+ }
+
+ QSharedPointer<WnnWord> getCandidate(int index)
+ {
+ QSharedPointer<WnnWord> word;
+
+ if (mGetCandidateFrom == 0) {
+ if (mDictType == OpenWnnEngineJAJP::DIC_LANG_JP_EISUKANA) {
+ /* skip to Kana conversion if EISU-KANA conversion mode */
+ mGetCandidateFrom = 2;
+ } else if (mSingleClauseMode) {
+ /* skip to single clause conversion if single clause conversion mode */
+ mGetCandidateFrom = 1;
+ } else {
+ if (mConvResult.size() < OpenWnnEngineJAJP::PREDICT_LIMIT) {
+ /* get prefix matching words from the dictionaries */
+ while (index >= mConvResult.size()) {
+ if ((word = mDictionaryJP.getNextWord()) == NULL) {
+ mGetCandidateFrom = 1;
+ break;
+ }
+ if (!mExactMatchMode || mInputHiragana.compare(word->stroke) == 0) {
+ addCandidate(word);
+ if (mConvResult.size() >= OpenWnnEngineJAJP::PREDICT_LIMIT) {
+ mGetCandidateFrom = 1;
+ break;
+ }
+ }
+ }
+ } else {
+ mGetCandidateFrom = 1;
+ }
+ }
+ }
+
+ /* get candidates by single clause conversion */
+ if (mGetCandidateFrom == 1) {
+ QList<WnnClause> convResult = mClauseConverter.convert(mInputHiragana);
+ if (!convResult.isEmpty()) {
+ for (QList<WnnClause>::ConstIterator it = convResult.constBegin();
+ it != convResult.constEnd(); it++) {
+ addCandidate(QSharedPointer<WnnWord>::create(*it));
+ }
+ }
+ /* end of candidates by single clause conversion */
+ mGetCandidateFrom = 2;
+ }
+
+ /* get candidates from Kana converter */
+ if (mGetCandidateFrom == 2) {
+ QList<WnnWord> addCandidateList = mKanaConverter.createPseudoCandidateList(mInputHiragana, mInputRomaji);
+
+ for (QList<WnnWord>::ConstIterator it = addCandidateList.constBegin();
+ it != addCandidateList.constEnd(); it++) {
+ addCandidate(QSharedPointer<WnnWord>::create(*it));
+ }
+
+ mGetCandidateFrom = 3;
+ }
+
+ if (index >= mConvResult.size()) {
+ return QSharedPointer<WnnWord>();
+ }
+ return mConvResult.at(index);
+ }
+
+ bool addCandidate(QSharedPointer<WnnWord> word)
+ {
+ if (word.isNull() || word->candidate.isEmpty() || mCandTable.contains(word->candidate)
+ || word->candidate.length() > OpenWnnEngineJAJP::MAX_OUTPUT_LENGTH) {
+ return false;
+ }
+ /*
+ if (mFilter != NULL && !mFilter->isAllowed(word)) {
+ return false;
+ }
+ */
+ mCandTable.insert(word->candidate, word);
+ mConvResult.append(word);
+ return true;
+ }
+
+ void clearCandidates()
+ {
+ mConvResult.clear();
+ mCandTable.clear();
+ mOutputNum = 0;
+ mInputHiragana.clear();
+ mInputRomaji.clear();
+ mGetCandidateFrom = 0;
+ mSingleClauseMode = false;
+ }
+
+ int setSearchKey(const ComposingText &text, int maxLen)
+ {
+ QString input = text.toString(ComposingText::LAYER1);
+ if (0 <= maxLen && maxLen <= input.length()) {
+ input = input.mid(0, maxLen);
+ mExactMatchMode = true;
+ } else {
+ mExactMatchMode = false;
+ }
+
+ if (input.length() == 0) {
+ mInputHiragana.clear();
+ mInputRomaji.clear();
+ return 0;
+ }
+
+ mInputHiragana = input;
+ mInputRomaji = text.toString(ComposingText::LAYER0);
+
+ return input.length();
+ }
+
+ void clearPreviousWord()
+ {
+ mPreviousWord.reset();
+ }
+
+ OpenWnnEngineJAJP::DictionaryType mDictType;
+ OpenWnnEngineJAJP::KeyboardType mKeyboardType;
+ OpenWnnDictionary mDictionaryJP;
+ QList<QSharedPointer<WnnWord> > mConvResult;
+ QMap<QString, QSharedPointer<WnnWord> > mCandTable;
+ QString mInputHiragana;
+ QString mInputRomaji;
+ int mOutputNum;
+ int mGetCandidateFrom;
+ QSharedPointer<WnnWord> mPreviousWord;
+ OpenWnnClauseConverterJAJP mClauseConverter;
+ KanaConverter mKanaConverter;
+ bool mExactMatchMode;
+ bool mSingleClauseMode;
+ QSharedPointer<WnnSentence> mConvertSentence;
+};
+
+OpenWnnEngineJAJP::OpenWnnEngineJAJP(QObject *parent) :
+ QObject(*new OpenWnnEngineJAJPPrivate(), parent)
+{
+
+}
+
+OpenWnnEngineJAJP::~OpenWnnEngineJAJP()
+{
+}
+
+bool OpenWnnEngineJAJP::setDictionary(DictionaryType type)
+{
+ Q_D(OpenWnnEngineJAJP);
+ d->mDictType = type;
+ return true;
+}
+
+int OpenWnnEngineJAJP::predict(const ComposingText &text, int minLen, int maxLen)
+{
+ Q_D(OpenWnnEngineJAJP);
+ Q_UNUSED(minLen)
+
+ d->clearCandidates();
+
+ /* set mInputHiragana and mInputRomaji */
+ int len = d->setSearchKey(text, maxLen);
+
+ /* set dictionaries by the length of input */
+ d->setDictionaryForPrediction(len);
+
+ /* search dictionaries */
+ d->mDictionaryJP.setInUseState(true);
+
+ if (len == 0) {
+ /* search by previously selected word */
+ if (d->mPreviousWord.isNull())
+ return -1;
+ return d->mDictionaryJP.searchWord(OpenWnnDictionary::SEARCH_LINK, OpenWnnDictionary::ORDER_BY_FREQUENCY,
+ d->mInputHiragana, *d->mPreviousWord);
+ } else {
+ if (d->mExactMatchMode) {
+ /* exact matching */
+ d->mDictionaryJP.searchWord(OpenWnnDictionary::SEARCH_EXACT, OpenWnnDictionary::ORDER_BY_FREQUENCY,
+ d->mInputHiragana);
+ } else {
+ /* prefix matching */
+ d->mDictionaryJP.searchWord(OpenWnnDictionary::SEARCH_PREFIX, OpenWnnDictionary::ORDER_BY_FREQUENCY,
+ d->mInputHiragana);
+ }
+ return 1;
+ }
+}
+
+int OpenWnnEngineJAJP::convert(ComposingText &text)
+{
+ Q_D(OpenWnnEngineJAJP);
+
+ d->clearCandidates();
+
+ d->mDictionaryJP.setInUseState(true);
+
+ int cursor = text.getCursor(ComposingText::LAYER1);
+ QString input;
+ QSharedPointer<WnnClause> head;
+ if (cursor > 0) {
+ /* convert previous part from cursor */
+ input = text.toString(ComposingText::LAYER1, 0, cursor - 1);
+ QList<WnnClause> headCandidates = d->mClauseConverter.convert(input);
+ if (headCandidates.isEmpty()) {
+ return 0;
+ }
+ head = QSharedPointer<WnnClause>::create(input, headCandidates.first());
+
+ /* set the rest of input string */
+ input = text.toString(ComposingText::LAYER1, cursor, text.size(ComposingText::LAYER1) - 1);
+ } else {
+ /* set whole of input string */
+ input = text.toString(ComposingText::LAYER1);
+ }
+
+ QSharedPointer<WnnSentence> sentence;
+ if (input.length() != 0) {
+ sentence = d->mClauseConverter.consecutiveClauseConvert(input);
+ }
+ if (!head.isNull()) {
+ sentence = QSharedPointer<WnnSentence>::create(*head, sentence.data());
+ }
+ if (sentence.isNull()) {
+ return 0;
+ }
+
+ QList<StrSegment> ss;
+ int pos = 0;
+ for (QList<WnnClause>::ConstIterator it = sentence->elements.constBegin();
+ it != sentence->elements.constEnd(); it++) {
+ const WnnClause &clause = *it;
+ int len = clause.stroke.length();
+ ss.append(StrSegment(clause, pos, pos + len - 1));
+ pos += len;
+ }
+ text.setCursor(ComposingText::LAYER2, text.size(ComposingText::LAYER2));
+ text.replaceStrSegment(ComposingText::LAYER2, ss,
+ text.getCursor(ComposingText::LAYER2));
+ d->mConvertSentence = sentence;
+
+ return 0;
+}
+
+QSharedPointer<WnnWord> OpenWnnEngineJAJP::getNextCandidate()
+{
+ Q_D(OpenWnnEngineJAJP);
+
+ if (d->mInputHiragana.isEmpty()) {
+ return QSharedPointer<WnnWord>();
+ }
+ QSharedPointer<WnnWord> word = d->getCandidate(d->mOutputNum);
+ if (!word.isNull()) {
+ d->mOutputNum++;
+ }
+ return word;
+}
+
+bool OpenWnnEngineJAJP::learn(WnnWord &word)
+{
+ Q_D(OpenWnnEngineJAJP);
+
+ int ret = -1;
+ if (word.partOfSpeech.right == 0) {
+ word.partOfSpeech = d->mDictionaryJP.getPOS(OpenWnnDictionary::POS_TYPE_MEISI);
+ }
+
+ OpenWnnDictionary &dict = d->mDictionaryJP;
+ if (word.isSentence()) {
+ const WnnSentence *sentence = static_cast<const WnnSentence *>(&word);
+ for (QList<WnnClause>::ConstIterator clauses = sentence->elements.constBegin();
+ clauses != sentence->elements.constEnd(); clauses++) {
+ const WnnWord &wd = *clauses;
+ ret = dict.learnWord(wd, d->mPreviousWord.data());
+ d->mPreviousWord.reset(static_cast<WnnWord *>(new WnnSentence(*sentence)));
+ if (ret != 0) {
+ break;
+ }
+ }
+ } else {
+ ret = dict.learnWord(word, d->mPreviousWord.data());
+ d->mPreviousWord = QSharedPointer<WnnWord>::create(word);
+ d->mClauseConverter.setDictionary(&dict);
+ }
+
+ return (ret == 0);
+}
+
+void OpenWnnEngineJAJP::breakSequence()
+{
+ Q_D(OpenWnnEngineJAJP);
+
+ d->clearPreviousWord();
+}
+
+int OpenWnnEngineJAJP::makeCandidateListOf(int clausePosition)
+{
+ Q_D(OpenWnnEngineJAJP);
+
+ d->clearCandidates();
+
+ if ((d->mConvertSentence == NULL) || (d->mConvertSentence->elements.size() <= clausePosition)) {
+ return 0;
+ }
+ d->mSingleClauseMode = true;
+ const WnnClause &clause = d->mConvertSentence->elements.at(clausePosition);
+ d->mInputHiragana = clause.stroke;
+ d->mInputRomaji = clause.candidate;
+
+ return 1;
+}
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/predef_table.h b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/predef_table.h
index 34b6b660..34b6b660 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/predef_table.h
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/predef_table.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkan.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
index 3a555e2b..3a555e2b 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkan.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkanfullkatakana.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkanfullkatakana.cpp
index 32726f6b..32726f6b 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkanfullkatakana.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkanfullkatakana.cpp
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkanhalfkatakana.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkanhalfkatakana.cpp
index 14bdf527..14bdf527 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/romkanhalfkatakana.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkanhalfkatakana.cpp
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
index 87f83dad..87f83dad 100644
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
diff --git a/src/plugins/openwnn/openwnn.pro b/src/plugins/openwnn/openwnn.pro
new file mode 100644
index 00000000..33b18551
--- /dev/null
+++ b/src/plugins/openwnn/openwnn.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ 3rdparty/openwnn \
+ plugin
+
+plugin.depends += 3rdparty/openwnn
diff --git a/src/plugins/openwnn/plugin/openwnn.json b/src/plugins/openwnn/plugin/openwnn.json
new file mode 100644
index 00000000..053875f0
--- /dev/null
+++ b/src/plugins/openwnn/plugin/openwnn.json
@@ -0,0 +1,6 @@
+{
+ "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
new file mode 100644
index 00000000..d6206732
--- /dev/null
+++ b/src/plugins/openwnn/plugin/openwnninputmethod.cpp
@@ -0,0 +1,827 @@
+/****************************************************************************
+**
+** 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);
+ 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
new file mode 100644
index 00000000..dbb2c8ed
--- /dev/null
+++ b/src/plugins/openwnn/plugin/openwnninputmethod_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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);
+ 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();
+
+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
new file mode 100644
index 00000000..a8490960
--- /dev/null
+++ b/src/plugins/openwnn/plugin/openwnnplugin.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..16826cba
--- /dev/null
+++ b/src/plugins/openwnn/plugin/openwnnplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/openwnn/plugin/plugin.pro b/src/plugins/openwnn/plugin/plugin.pro
new file mode 100644
index 00000000..7e11d890
--- /dev/null
+++ b/src/plugins/openwnn/plugin/plugin.pro
@@ -0,0 +1,45 @@
+TARGET = qtvirtualkeyboard_openwnn
+QT += qml virtualkeyboard
+
+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
+
+include(../../../config.pri)
+
+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/virtualkeyboard/3rdparty/pinyin/NOTICE b/src/plugins/pinyin/3rdparty/pinyin/NOTICE
index 64aaa8db..64aaa8db 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/NOTICE
+++ b/src/plugins/pinyin/3rdparty/pinyin/NOTICE
diff --git a/src/virtualkeyboard/3rdparty/pinyin/command/Makefile b/src/plugins/pinyin/3rdparty/pinyin/command/Makefile
index 8ef2315c..8ef2315c 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/command/Makefile
+++ b/src/plugins/pinyin/3rdparty/pinyin/command/Makefile
diff --git a/src/virtualkeyboard/3rdparty/pinyin/command/pinyinime_dictbuilder.cpp b/src/plugins/pinyin/3rdparty/pinyin/command/pinyinime_dictbuilder.cpp
index 41ea648d..41ea648d 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/command/pinyinime_dictbuilder.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/command/pinyinime_dictbuilder.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/data/dict_pinyin.dat b/src/plugins/pinyin/3rdparty/pinyin/data/dict_pinyin.dat
index 1be3f9c7..1be3f9c7 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/data/dict_pinyin.dat
+++ b/src/plugins/pinyin/3rdparty/pinyin/data/dict_pinyin.dat
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/pinyin/data/rawdict_utf16_65105_freq.txt b/src/plugins/pinyin/3rdparty/pinyin/data/rawdict_utf16_65105_freq.txt
index 28805ba6..28805ba6 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/data/rawdict_utf16_65105_freq.txt
+++ b/src/plugins/pinyin/3rdparty/pinyin/data/rawdict_utf16_65105_freq.txt
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/pinyin/data/valid_utf16.txt b/src/plugins/pinyin/3rdparty/pinyin/data/valid_utf16.txt
index fecc67eb..fecc67eb 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/data/valid_utf16.txt
+++ b/src/plugins/pinyin/3rdparty/pinyin/data/valid_utf16.txt
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/atomdictbase.h b/src/plugins/pinyin/3rdparty/pinyin/include/atomdictbase.h
index 0a70a510..0a70a510 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/atomdictbase.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/atomdictbase.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/dictbuilder.h b/src/plugins/pinyin/3rdparty/pinyin/include/dictbuilder.h
index da0d6cd3..da0d6cd3 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/dictbuilder.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/dictbuilder.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/dictdef.h b/src/plugins/pinyin/3rdparty/pinyin/include/dictdef.h
index 5e1d7818..5e1d7818 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/dictdef.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/dictdef.h
diff --git a/src/plugins/pinyin/3rdparty/pinyin/include/dictlist.h b/src/plugins/pinyin/3rdparty/pinyin/include/dictlist.h
new file mode 100644
index 00000000..1c1daef4
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/dictlist.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PINYINIME_INCLUDE_DICTLIST_H__
+#define PINYINIME_INCLUDE_DICTLIST_H__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "./dictdef.h"
+#include "./searchutility.h"
+#include "./spellingtrie.h"
+#include "./utf16char.h"
+
+namespace ime_pinyin {
+
+class DictList {
+ private:
+ bool initialized_;
+
+ const SpellingTrie *spl_trie_;
+
+ // Number of SingCharItem. The first is blank, because id 0 is invalid.
+ uint32 scis_num_;
+ char16 *scis_hz_;
+ SpellingId *scis_splid_;
+
+ // The large memory block to store the word list.
+ char16 *buf_;
+
+ // Starting position of those words whose lengths are i+1, counted in
+ // char16
+ uint32 start_pos_[kMaxLemmaSize + 1];
+
+ uint32 start_id_[kMaxLemmaSize + 1];
+
+ int (*cmp_func_[kMaxLemmaSize])(const void *, const void *);
+
+ bool alloc_resource(size_t buf_size, size_t scim_num);
+
+ void free_resource();
+
+#ifdef ___BUILD_MODEL___
+ // Calculate the requsted memory, including the start_pos[] buffer.
+ size_t calculate_size(const LemmaEntry *lemma_arr, size_t lemma_num);
+
+ void fill_scis(const SingleCharItem *scis, size_t scis_num);
+
+ // Copy the related content to the inner buffer
+ // It should be called after calculate_size()
+ void fill_list(const LemmaEntry *lemma_arr, size_t lemma_num);
+
+ // Find the starting position for the buffer of those 2-character Chinese word
+ // whose first character is the given Chinese character.
+ char16* find_pos2_startedbyhz(char16 hz_char);
+#endif
+
+ // Find the starting position for the buffer of those words whose lengths are
+ // word_len. The given parameter cmp_func decides how many characters from
+ // beginning will be used to compare.
+ char16* find_pos_startedbyhzs(const char16 last_hzs[],
+ size_t word_Len,
+ int (*cmp_func)(const void *, const void *));
+
+ public:
+
+ DictList();
+ ~DictList();
+
+ bool save_list(FILE *fp);
+ bool load_list(QFile *fp);
+
+#ifdef ___BUILD_MODEL___
+ // Init the list from the LemmaEntry array.
+ // lemma_arr should have been sorted by the hanzi_str, and have been given
+ // ids from 1
+ bool init_list(const SingleCharItem *scis, size_t scis_num,
+ const LemmaEntry *lemma_arr, size_t lemma_num);
+#endif
+
+ // Get the hanzi string for the given id
+ uint16 get_lemma_str(LemmaIdType id_hz, char16 *str_buf, uint16 str_max);
+
+ void convert_to_hanzis(char16 *str, uint16 str_len);
+
+ void convert_to_scis_ids(char16 *str, uint16 str_len);
+
+ // last_hzs stores the last n Chinese characters history, its length should be
+ // less or equal than kMaxPredictSize.
+ // hzs_len specifies the length(<= kMaxPredictSize).
+ // predict_buf is used to store the result.
+ // buf_len specifies the buffer length.
+ // b4_used specifies how many items before predict_buf have been used.
+ // Returned value is the number of newly added items.
+ size_t predict(const char16 last_hzs[], uint16 hzs_len,
+ NPredictItem *npre_items, size_t npre_max,
+ size_t b4_used);
+
+ // If half_splid is a valid half spelling id, return those full spelling
+ // ids which share this half id.
+ uint16 get_splids_for_hanzi(char16 hanzi, uint16 half_splid,
+ uint16 *splids, uint16 max_splids);
+
+ LemmaIdType get_lemma_id(const char16 *str, uint16 str_len);
+};
+}
+
+#endif // PINYINIME_INCLUDE_DICTLIST_H__
diff --git a/src/plugins/pinyin/3rdparty/pinyin/include/dicttrie.h b/src/plugins/pinyin/3rdparty/pinyin/include/dicttrie.h
new file mode 100644
index 00000000..86a8ee25
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/dicttrie.h
@@ -0,0 +1,234 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PINYINIME_INCLUDE_DICTTRIE_H__
+#define PINYINIME_INCLUDE_DICTTRIE_H__
+
+#include <stdlib.h>
+#include "./atomdictbase.h"
+#include "./dictdef.h"
+#include "./dictlist.h"
+#include "./searchutility.h"
+#include <QFile>
+
+namespace ime_pinyin {
+
+class DictTrie : AtomDictBase {
+ private:
+ struct ParsingMark {
+ size_t node_offset:24;
+ size_t node_num:8; // Number of nodes with this spelling id given
+ // by spl_id. If spl_id is a Shengmu, for nodes
+ // in the first layer of DictTrie, it equals to
+ // SpellingTrie::shm2full_num(); but for those
+ // nodes which are not in the first layer,
+ // node_num < SpellingTrie::shm2full_num().
+ // For a full spelling id, node_num = 1;
+ };
+
+ // Used to indicate an extended mile stone.
+ // An extended mile stone is used to mark a partial match in the dictionary
+ // trie to speed up further potential extending.
+ // For example, when the user inputs "w", a mile stone is created to mark the
+ // partial match status, so that when user inputs another char 'm', it will be
+ // faster to extend search space based on this mile stone.
+ //
+ // For partial match status of "wm", there can be more than one sub mile
+ // stone, for example, "wm" can be matched to "wanm", "wom", ..., etc, so
+ // there may be more one parsing mark used to mark these partial matchings.
+ // A mile stone records the starting position in the mark list and number of
+ // marks.
+ struct MileStone {
+ uint16 mark_start;
+ uint16 mark_num;
+ };
+
+ DictList* dict_list_;
+
+ const SpellingTrie *spl_trie_;
+
+ LmaNodeLE0* root_; // Nodes for root and the first layer.
+ LmaNodeGE1* nodes_ge1_; // Nodes for other layers.
+
+ // An quick index from spelling id to the LmaNodeLE0 node buffer, or
+ // to the root_ buffer.
+ // Index length:
+ // SpellingTrie::get_instance().get_spelling_num() + 1. The last one is used
+ // to get the end.
+ // All Shengmu ids are not indexed because they will be converted into
+ // corresponding full ids.
+ // So, given an id splid, the son is:
+ // root_[splid_le0_index_[splid - kFullSplIdStart]]
+ uint16 *splid_le0_index_;
+
+ uint32 lma_node_num_le0_;
+ uint32 lma_node_num_ge1_;
+
+ // The first part is for homophnies, and the last top_lma_num_ items are
+ // lemmas with highest scores.
+ unsigned char *lma_idx_buf_;
+ uint32 lma_idx_buf_len_; // The total size of lma_idx_buf_ in byte.
+ uint32 total_lma_num_; // Total number of lemmas in this dictionary.
+ uint32 top_lmas_num_; // Number of lemma with highest scores.
+
+ // Parsing mark list used to mark the detailed extended statuses.
+ ParsingMark *parsing_marks_;
+ // The position for next available mark.
+ uint16 parsing_marks_pos_;
+
+ // Mile stone list used to mark the extended status.
+ MileStone *mile_stones_;
+ // The position for the next available mile stone. We use positions (except 0)
+ // as handles.
+ MileStoneHandle mile_stones_pos_;
+
+ // Get the offset of sons for a node.
+ inline size_t get_son_offset(const LmaNodeGE1 *node);
+
+ // Get the offset of homonious ids for a node.
+ inline size_t get_homo_idx_buf_offset(const LmaNodeGE1 *node);
+
+ // Get the lemma id by the offset.
+ inline LemmaIdType get_lemma_id(size_t id_offset);
+
+ void free_resource(bool free_dict_list);
+
+ bool load_dict(QFile *fp);
+
+ // Given a LmaNodeLE0 node, extract the lemmas specified by it, and fill
+ // them into the lpi_items buffer.
+ // This function is called by the search engine.
+ size_t fill_lpi_buffer(LmaPsbItem lpi_items[], size_t max_size,
+ LmaNodeLE0 *node);
+
+ // Given a LmaNodeGE1 node, extract the lemmas specified by it, and fill
+ // them into the lpi_items buffer.
+ // This function is called by inner functions extend_dict0(), extend_dict1()
+ // and extend_dict2().
+ size_t fill_lpi_buffer(LmaPsbItem lpi_items[], size_t max_size,
+ size_t homo_buf_off, LmaNodeGE1 *node,
+ uint16 lma_len);
+
+ // Extend in the trie from level 0.
+ MileStoneHandle extend_dict0(MileStoneHandle from_handle,
+ const DictExtPara *dep, LmaPsbItem *lpi_items,
+ size_t lpi_max, size_t *lpi_num);
+
+ // Extend in the trie from level 1.
+ MileStoneHandle extend_dict1(MileStoneHandle from_handle,
+ const DictExtPara *dep, LmaPsbItem *lpi_items,
+ size_t lpi_max, size_t *lpi_num);
+
+ // Extend in the trie from level 2.
+ MileStoneHandle extend_dict2(MileStoneHandle from_handle,
+ const DictExtPara *dep, LmaPsbItem *lpi_items,
+ size_t lpi_max, size_t *lpi_num);
+
+ // Try to extend the given spelling id buffer, and if the given id_lemma can
+ // be successfully gotten, return true;
+ // The given spelling ids are all valid full ids.
+ bool try_extend(const uint16 *splids, uint16 splid_num, LemmaIdType id_lemma);
+
+#ifdef ___BUILD_MODEL___
+ bool save_dict(FILE *fp);
+#endif // ___BUILD_MODEL___
+
+ static const int kMaxMileStone = 100;
+ static const int kMaxParsingMark = 600;
+ static const MileStoneHandle kFirstValidMileStoneHandle = 1;
+
+ friend class DictParser;
+ friend class DictBuilder;
+
+ public:
+
+ DictTrie();
+ ~DictTrie();
+
+#ifdef ___BUILD_MODEL___
+ // Construct the tree from the file fn_raw.
+ // fn_validhzs provide the valid hanzi list. If fn_validhzs is
+ // NULL, only chars in GB2312 will be included.
+ bool build_dict(const char *fn_raw, const char *fn_validhzs);
+
+ // Save the binary dictionary
+ // Actually, the SpellingTrie/DictList instance will be also saved.
+ bool save_dict(const char *filename);
+#endif // ___BUILD_MODEL___
+
+ void convert_to_hanzis(char16 *str, uint16 str_len);
+
+ void convert_to_scis_ids(char16 *str, uint16 str_len);
+
+ // Load a binary dictionary
+ // The SpellingTrie instance/DictList will be also loaded
+ bool load_dict(const char *filename, LemmaIdType start_id,
+ LemmaIdType end_id);
+ bool load_dict_fd(int sys_fd, long start_offset, long length,
+ LemmaIdType start_id, LemmaIdType end_id);
+ bool close_dict() {return true;}
+ size_t number_of_lemmas() {return 0;}
+
+ void reset_milestones(uint16 from_step, MileStoneHandle from_handle);
+
+ MileStoneHandle extend_dict(MileStoneHandle from_handle,
+ const DictExtPara *dep,
+ LmaPsbItem *lpi_items,
+ size_t lpi_max, size_t *lpi_num);
+
+ size_t get_lpis(const uint16 *splid_str, uint16 splid_str_len,
+ LmaPsbItem *lpi_items, size_t lpi_max);
+
+ uint16 get_lemma_str(LemmaIdType id_lemma, char16 *str_buf, uint16 str_max);
+
+ uint16 get_lemma_splids(LemmaIdType id_lemma, uint16 *splids,
+ uint16 splids_max, bool arg_valid);
+
+ size_t predict(const char16 *last_hzs, uint16 hzs_len,
+ NPredictItem *npre_items, size_t npre_max,
+ size_t b4_used);
+
+ LemmaIdType put_lemma(char16 /*lemma_str*/[], uint16 /*splids*/[],
+ uint16 /*lemma_len*/, uint16 /*count*/) {return 0;}
+
+ LemmaIdType update_lemma(LemmaIdType /*lemma_id*/, int16 /*delta_count*/,
+ bool /*selected*/) {return 0;}
+
+ LemmaIdType get_lemma_id(char16 /*lemma_str*/[], uint16 /*splids*/[],
+ uint16 /*lemma_len*/) {return 0;}
+
+ LmaScoreType get_lemma_score(LemmaIdType /*lemma_id*/) {return 0;}
+
+ LmaScoreType get_lemma_score(char16 /*lemma_str*/[], uint16 /*splids*/[],
+ uint16 /*lemma_len*/) {return 0;}
+
+ bool remove_lemma(LemmaIdType /*lemma_id*/) {return false;}
+
+ size_t get_total_lemma_count() {return 0;}
+ void set_total_lemma_count_of_others(size_t count);
+
+ void flush_cache() {}
+
+ LemmaIdType get_lemma_id(const char16 lemma_str[], uint16 lemma_len);
+
+ // Fill the lemmas with highest scores to the prediction buffer.
+ // his_len is the history length to fill in the prediction buffer.
+ size_t predict_top_lmas(size_t his_len, NPredictItem *npre_items,
+ size_t npre_max, size_t b4_used);
+};
+}
+
+#endif // PINYINIME_INCLUDE_DICTTRIE_H__
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/lpicache.h b/src/plugins/pinyin/3rdparty/pinyin/include/lpicache.h
index 60735971..60735971 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/lpicache.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/lpicache.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/matrixsearch.h b/src/plugins/pinyin/3rdparty/pinyin/include/matrixsearch.h
index 61e78aa6..61e78aa6 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/matrixsearch.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/matrixsearch.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/mystdlib.h b/src/plugins/pinyin/3rdparty/pinyin/include/mystdlib.h
index dfcf980b..dfcf980b 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/mystdlib.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/mystdlib.h
diff --git a/src/plugins/pinyin/3rdparty/pinyin/include/ngram.h b/src/plugins/pinyin/3rdparty/pinyin/include/ngram.h
new file mode 100644
index 00000000..1d3a86e6
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/ngram.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PINYINIME_INCLUDE_NGRAM_H__
+#define PINYINIME_INCLUDE_NGRAM_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "./dictdef.h"
+#include <QFile>
+
+namespace ime_pinyin {
+
+typedef unsigned char CODEBOOK_TYPE;
+
+static const size_t kCodeBookSize = 256;
+
+class NGram {
+ public:
+ // The maximum score of a lemma item.
+ static const LmaScoreType kMaxScore = 0x3fff;
+
+ // In order to reduce the storage size, the original log value is amplified by
+ // kScoreAmplifier, and we use LmaScoreType to store.
+ // After this process, an item with a lower score has a higher frequency.
+ static const int kLogValueAmplifier = -800;
+
+ // System words' total frequency. It is not the real total frequency, instead,
+ // It is only used to adjust system lemmas' scores when the user dictionary's
+ // total frequency changes.
+ // In this version, frequencies of system lemmas are fixed. We are considering
+ // to make them changable in next version.
+ static const size_t kSysDictTotalFreq = 100000000;
+
+ private:
+
+ static NGram* instance_;
+
+ bool initialized_;
+ uint32 idx_num_;
+
+ size_t total_freq_none_sys_;
+
+ // Score compensation for system dictionary lemmas.
+ // Because after user adds some user lemmas, the total frequency changes, and
+ // we use this value to normalize the score.
+ float sys_score_compensation_;
+
+#ifdef ___BUILD_MODEL___
+ double *freq_codes_df_;
+#endif
+ LmaScoreType *freq_codes_;
+ CODEBOOK_TYPE *lma_freq_idx_;
+
+ public:
+ NGram();
+ ~NGram();
+
+ static NGram& get_instance();
+
+ bool save_ngram(FILE *fp);
+ bool load_ngram(QFile *fp);
+
+ // Set the total frequency of all none system dictionaries.
+ void set_total_freq_none_sys(size_t freq_none_sys);
+
+ float get_uni_psb(LemmaIdType lma_id);
+
+ // Convert a probability to score. Actually, the score will be limited to
+ // kMaxScore, but at runtime, we also need float expression to get accurate
+ // value of the score.
+ // After the conversion, a lower score indicates a higher probability of the
+ // item.
+ static float convert_psb_to_score(double psb);
+
+#ifdef ___BUILD_MODEL___
+ // For constructing the unigram mode model.
+ bool build_unigram(LemmaEntry *lemma_arr, size_t num,
+ LemmaIdType next_idx_unused);
+#endif
+};
+}
+
+#endif // PINYINIME_INCLUDE_NGRAM_H__
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/pinyinime.h b/src/plugins/pinyin/3rdparty/pinyin/include/pinyinime.h
index e376c20c..e376c20c 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/pinyinime.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/pinyinime.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/searchutility.h b/src/plugins/pinyin/3rdparty/pinyin/include/searchutility.h
index f1357107..f1357107 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/searchutility.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/searchutility.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/spellingtable.h b/src/plugins/pinyin/3rdparty/pinyin/include/spellingtable.h
index fd79c6ef..fd79c6ef 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/spellingtable.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/spellingtable.h
diff --git a/src/plugins/pinyin/3rdparty/pinyin/include/spellingtrie.h b/src/plugins/pinyin/3rdparty/pinyin/include/spellingtrie.h
new file mode 100644
index 00000000..f943a24d
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/spellingtrie.h
@@ -0,0 +1,259 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PINYINIME_INCLUDE_SPELLINGTRIE_H__
+#define PINYINIME_INCLUDE_SPELLINGTRIE_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "./dictdef.h"
+#include <QFile>
+
+namespace ime_pinyin {
+
+static const unsigned short kFullSplIdStart = kHalfSpellingIdNum + 1;
+
+// Node used for the trie of spellings
+struct SpellingNode {
+ SpellingNode *first_son;
+ // The spelling id for each node. If you need more bits to store
+ // spelling id, please adjust this structure.
+ uint16 spelling_idx:11;
+ uint16 num_of_son:5;
+ char char_this_node;
+ unsigned char score;
+};
+
+class SpellingTrie {
+ private:
+ static const int kMaxYmNum = 64;
+ static const size_t kValidSplCharNum = 26;
+
+ static const uint16 kHalfIdShengmuMask = 0x01;
+ static const uint16 kHalfIdYunmuMask = 0x02;
+ static const uint16 kHalfIdSzmMask = 0x04;
+
+ // Map from half spelling id to single char.
+ // For half ids of Zh/Ch/Sh, map to z/c/s (low case) respectively.
+ // For example, 1 to 'A', 2 to 'B', 3 to 'C', 4 to 'c', 5 to 'D', ...,
+ // 28 to 'Z', 29 to 'z'.
+ // [0] is not used to achieve better efficiency.
+ static const char kHalfId2Sc_[kFullSplIdStart + 1];
+
+ static unsigned char char_flags_[];
+ static SpellingTrie* instance_;
+
+ // The spelling table
+ char *spelling_buf_;
+
+ // The size of longest spelling string, includes '\0' and an extra char to
+ // store score. For example, "zhuang" is the longgest item in Pinyin list,
+ // so spelling_size_ is 8.
+ // Structure: The string ended with '\0' + score char.
+ // An item with a lower score has a higher probability.
+ uint32 spelling_size_;
+
+ // Number of full spelling ids.
+ uint32 spelling_num_;
+
+ float score_amplifier_;
+ unsigned char average_score_;
+
+ // The Yunmu id list for the spelling ids (for half ids of Shengmu,
+ // the Yunmu id is 0).
+ // The length of the list is spelling_num_ + kFullSplIdStart,
+ // so that spl_ym_ids_[splid] is the Yunmu id of the splid.
+ uint8 *spl_ym_ids_;
+
+ // The Yunmu table.
+ // Each Yunmu will be assigned with Yunmu id from 1.
+ char *ym_buf_;
+ size_t ym_size_; // The size of longest Yunmu string, '\0'included.
+ size_t ym_num_;
+
+ // The spelling string just queried
+ char *splstr_queried_;
+
+ // The spelling string just queried
+ char16 *splstr16_queried_;
+
+ // The root node of the spelling tree
+ SpellingNode* root_;
+
+ // If a none qwerty key such as a fnction key like ENTER is given, this node
+ // will be used to indicate that this is not a QWERTY node.
+ SpellingNode* dumb_node_;
+
+ // If a splitter key is pressed, this node will be used to indicate that this
+ // is a splitter key.
+ SpellingNode* splitter_node_;
+
+ // Used to get the first level sons.
+ SpellingNode* level1_sons_[kValidSplCharNum];
+
+ // The full spl_id range for specific half id.
+ // h2f means half to full.
+ // A half id can be a ShouZiMu id (id to represent the first char of a full
+ // spelling, including Shengmu and Yunmu), or id of zh/ch/sh.
+ // [1..kFullSplIdStart-1] is the arrange of half id.
+ uint16 h2f_start_[kFullSplIdStart];
+ uint16 h2f_num_[kFullSplIdStart];
+
+ // Map from full id to half id.
+ uint16 *f2h_;
+
+#ifdef ___BUILD_MODEL___
+ // How many node used to build the trie.
+ size_t node_num_;
+#endif
+
+ SpellingTrie();
+
+ void free_son_trie(SpellingNode* node);
+
+ // Construct a subtree using a subset of the spelling array (from
+ // item_star to item_end).
+ // Member spelliing_buf_ and spelling_size_ should be valid.
+ // parent is used to update its num_of_son and score.
+ SpellingNode* construct_spellings_subset(size_t item_start, size_t item_end,
+ size_t level, SpellingNode *parent);
+ bool build_f2h();
+
+ // The caller should guarantee ch >= 'A' && ch <= 'Z'
+ bool is_shengmu_char(char ch) const;
+
+ // The caller should guarantee ch >= 'A' && ch <= 'Z'
+ bool is_yunmu_char(char ch) const;
+
+#ifdef ___BUILD_MODEL___
+ // Given a spelling string, return its Yunmu string.
+ // The caller guaratees spl_str is valid.
+ const char* get_ym_str(const char *spl_str);
+
+ // Build the Yunmu list, and the mapping relation between the full ids and the
+ // Yunmu ids. This functin is called after the spelling trie is built.
+ bool build_ym_info();
+#endif
+
+ friend class SpellingParser;
+ friend class SmartSplParser;
+ friend class SmartSplParser2;
+
+ public:
+ ~SpellingTrie();
+
+ inline static bool is_valid_spl_char(char ch) {
+ return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
+ }
+
+ // The caller guarantees that the two chars are valid spelling chars.
+ inline static bool is_same_spl_char(char ch1, char ch2) {
+ return ch1 == ch2 || ch1 - ch2 == 'a' - 'A' || ch2 - ch1 == 'a' - 'A';
+ }
+
+ // Construct the tree from the input pinyin array
+ // The given string list should have been sorted.
+ // score_amplifier is used to convert a possibility value into score.
+ // average_score is the average_score of all spellings. The dumb node is
+ // assigned with this score.
+ bool construct(const char* spelling_arr, size_t item_size, size_t item_num,
+ float score_amplifier, unsigned char average_score);
+
+ // Test if the given id is a valid spelling id.
+ // If function returns true, the given splid may be updated like this:
+ // When 'A' is not enabled in ShouZiMu mode, the parsing result for 'A' is
+ // first given as a half id 1, but because 'A' is a one-char Yunmu and
+ // it is a valid id, it needs to updated to its corresponding full id.
+ bool if_valid_id_update(uint16 *splid) const;
+
+ // Test if the given id is a half id.
+ bool is_half_id(uint16 splid) const;
+
+ bool is_full_id(uint16 splid) const;
+
+ // Test if the given id is a one-char Yunmu id (obviously, it is also a half
+ // id), such as 'A', 'E' and 'O'.
+ bool is_half_id_yunmu(uint16 splid) const;
+
+ // Test if this char is a ShouZiMu char. This ShouZiMu char may be not enabled.
+ // For Pinyin, only i/u/v is not a ShouZiMu char.
+ // The caller should guarantee that ch >= 'A' && ch <= 'Z'
+ bool is_szm_char(char ch) const;
+
+ // Test If this char is enabled in ShouZiMu mode.
+ // The caller should guarantee that ch >= 'A' && ch <= 'Z'
+ bool szm_is_enabled(char ch) const;
+
+ // Enable/disable Shengmus in ShouZiMu mode(using the first char of a spelling
+ // to input).
+ void szm_enable_shm(bool enable);
+
+ // Enable/disable Yunmus in ShouZiMu mode.
+ void szm_enable_ym(bool enable);
+
+ // Test if this char is enabled in ShouZiMu mode.
+ // The caller should guarantee ch >= 'A' && ch <= 'Z'
+ bool is_szm_enabled(char ch) const;
+
+ // Return the number of full ids for the given half id.
+ uint16 half2full_num(uint16 half_id) const;
+
+ // Return the number of full ids for the given half id, and fill spl_id_start
+ // to return the first full id.
+ uint16 half_to_full(uint16 half_id, uint16 *spl_id_start) const;
+
+ // Return the corresponding half id for the given full id.
+ // Not frequently used, low efficient.
+ // Return 0 if fails.
+ uint16 full_to_half(uint16 full_id) const;
+
+ // To test whether a half id is compatible with a full id.
+ // Generally, when half_id == full_to_half(full_id), return true.
+ // But for "Zh, Ch, Sh", if fussy mode is on, half id for 'Z' is compatible
+ // with a full id like "Zhe". (Fussy mode is not ready).
+ bool half_full_compatible(uint16 half_id, uint16 full_id) const;
+
+ static const SpellingTrie* get_cpinstance();
+
+ static SpellingTrie& get_instance();
+
+ // Save to the file stream
+ bool save_spl_trie(FILE *fp);
+
+ // Load from the file stream
+ bool load_spl_trie(QFile *fp);
+
+ // Get the number of spellings
+ size_t get_spelling_num();
+
+ // Return the Yunmu id for the given Yunmu string.
+ // If the string is not valid, return 0;
+ uint8 get_ym_id(const char* ym_str);
+
+ // Get the readonly Pinyin string for a given spelling id
+ const char* get_spelling_str(uint16 splid);
+
+ // Get the readonly Pinyin string for a given spelling id
+ const char16* get_spelling_str16(uint16 splid);
+
+ // Get Pinyin string for a given spelling id. Return the length of the
+ // string, and fill-in '\0' at the end.
+ size_t get_spelling_str16(uint16 splid, char16 *splstr16,
+ size_t splstr16_len);
+};
+}
+
+#endif // PINYINIME_INCLUDE_SPELLINGTRIE_H__
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/splparser.h b/src/plugins/pinyin/3rdparty/pinyin/include/splparser.h
index d783bd73..d783bd73 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/splparser.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/splparser.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/sync.h b/src/plugins/pinyin/3rdparty/pinyin/include/sync.h
index bf42d1f1..bf42d1f1 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/sync.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/sync.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/userdict.h b/src/plugins/pinyin/3rdparty/pinyin/include/userdict.h
index db010912..db010912 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/userdict.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/userdict.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/utf16char.h b/src/plugins/pinyin/3rdparty/pinyin/include/utf16char.h
index 7e957db5..7e957db5 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/utf16char.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/utf16char.h
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/utf16reader.h b/src/plugins/pinyin/3rdparty/pinyin/include/utf16reader.h
index b6d6719e..b6d6719e 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/include/utf16reader.h
+++ b/src/plugins/pinyin/3rdparty/pinyin/include/utf16reader.h
diff --git a/src/plugins/pinyin/3rdparty/pinyin/patches/0001-Make-the-keyboard-layout-changeable-in-password-url-.patch b/src/plugins/pinyin/3rdparty/pinyin/patches/0001-Make-the-keyboard-layout-changeable-in-password-url-.patch
new file mode 100644
index 00000000..9f5ea99b
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/patches/0001-Make-the-keyboard-layout-changeable-in-password-url-.patch
@@ -0,0 +1,132 @@
+From 1290471fc3e542388e79e27cb2c4ce654f5023f3 Mon Sep 17 00:00:00 2001
+From: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
+Date: Tue, 5 Aug 2014 13:37:49 +0300
+Subject: [PATCH] Make the keyboard layout changeable in password / url input
+ mode
+
+Removed latin-only restriction with specific input method hints.
+More specifically, the latin-only keyboard was previously enforced
+when password, hidden, sensitive or latin-only flags were set for
+the input control.
+
+Now it is possible to use non-latin input methods and keyboard
+layouts with these modes too. However, this change implies some
+additional changes to the Pinyin and Hunspell input methods.
+
+Changes to PinyinInputMethod:
+- Disable the user dictionary when sensitive data flag is set.
+ This is required so that sensitive data (such as passwords)
+ is not stored in the user dictionary.
+
+Changes to HunspellInputMethod:
+- Disable the auto space functionality when the input mode is not
+ latin, or the exclusive input mode is set to url or email input.
+
+Task-number: QTRD-3210
+Change-Id: I444c4b87c9805b69dc773ef6cac76f1c11dd220a
+Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
+Reviewed-by: Rainer Keller <rainer.keller@digia.com>
+---
+ .../3rdparty/pinyin/include/matrixsearch.h | 4 ++++
+ .../3rdparty/pinyin/include/pinyinime.h | 12 +++++++++++
+ .../3rdparty/pinyin/share/matrixsearch.cpp | 23 ++++++++++++++++++++++
+ .../3rdparty/pinyin/share/pinyinime.cpp | 11 +++++++++++
+ 4 files changed, 50 insertions(+)
+
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/matrixsearch.h b/src/virtualkeyboard/3rdparty/pinyin/include/matrixsearch.h
+index f581d30..61e78aa 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/include/matrixsearch.h
++++ b/src/virtualkeyboard/3rdparty/pinyin/include/matrixsearch.h
+@@ -380,6 +380,10 @@ class MatrixSearch {
+ bool init_fd(int sys_fd, long start_offset, long length,
+ const char *fn_usr_dict);
+
++ void init_user_dictionary(const char *fn_usr_dict);
++
++ bool is_user_dictionary_enabled() const;
++
+ void set_max_lens(size_t max_sps_len, size_t max_hzs_len);
+
+ void close();
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/pinyinime.h b/src/virtualkeyboard/3rdparty/pinyin/include/pinyinime.h
+index 0744ec7..e376c20 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/include/pinyinime.h
++++ b/src/virtualkeyboard/3rdparty/pinyin/include/pinyinime.h
+@@ -202,6 +202,18 @@ extern "C" {
+ * Enable Yunmus in ShouZiMu mode.
+ */
+ void im_enable_ym_as_szm(bool enable);
++
++ /**
++ * Initializes or uninitializes the user dictionary.
++ *
++ * @param fn_usr_dict The file name of the user dictionary.
++ */
++ void im_init_user_dictionary(const char *fn_usr_dict);
++
++ /**
++ * Returns the current status of user dictinary.
++ */
++ bool im_is_user_dictionary_enabled(void);
+ }
+
+ #ifdef __cplusplus
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/matrixsearch.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/matrixsearch.cpp
+index 12d092a..41e1143 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/matrixsearch.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/matrixsearch.cpp
+@@ -169,6 +169,29 @@ bool MatrixSearch::init_fd(int sys_fd, long start_offset, long length,
+ return true;
+ }
+
++void MatrixSearch::init_user_dictionary(const char *fn_usr_dict) {
++ assert(inited_);
++
++ if (NULL != user_dict_) {
++ delete user_dict_;
++ user_dict_ = NULL;
++ }
++
++ if (NULL != fn_usr_dict) {
++ user_dict_ = static_cast<AtomDictBase*>(new UserDict());
++ if (!user_dict_->load_dict(fn_usr_dict, kUserDictIdStart, kUserDictIdEnd)) {
++ delete user_dict_;
++ user_dict_ = NULL;
++ }
++ }
++
++ reset_search0();
++}
++
++bool MatrixSearch::is_user_dictionary_enabled() const {
++ return NULL != user_dict_;
++}
++
+ void MatrixSearch::set_max_lens(size_t max_sps_len, size_t max_hzs_len) {
+ if (0 != max_sps_len)
+ max_sps_len_ = max_sps_len;
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/pinyinime.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/pinyinime.cpp
+index 550da7b..4d206a7 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/pinyinime.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/pinyinime.cpp
+@@ -181,6 +181,17 @@ extern "C" {
+ spl_trie.szm_enable_ym(enable);
+ }
+
++ void im_init_user_dictionary(const char *fn_usr_dict) {
++ if (!matrix_search)
++ return;
++ matrix_search->flush_cache();
++ matrix_search->init_user_dictionary(fn_usr_dict);
++ }
++
++ bool im_is_user_dictionary_enabled(void) {
++ return NULL != matrix_search ? matrix_search->is_user_dictionary_enabled() : false;
++ }
++
+ #ifdef __cplusplus
+ }
+ #endif
+--
+2.14.1.windows.1
+
diff --git a/src/plugins/pinyin/3rdparty/pinyin/patches/0002-Prepare-Pinyin-library-for-WIN32.patch b/src/plugins/pinyin/3rdparty/pinyin/patches/0002-Prepare-Pinyin-library-for-WIN32.patch
new file mode 100644
index 00000000..fff5130b
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/patches/0002-Prepare-Pinyin-library-for-WIN32.patch
@@ -0,0 +1,122 @@
+From 4a77ad1ebe17681765e9c03b01485ff970ad20c5 Mon Sep 17 00:00:00 2001
+From: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
+Date: Wed, 31 Dec 2014 11:26:50 +0200
+Subject: [PATCH] Prepare Pinyin library for WIN32
+
+Build as static library in all platforms.
+On Windows the library uses Qt for platform abstraction.
+Fix compiler warnings.
+
+Change-Id: Icddba8f1f23daa220735c68a0998005a801c5d03
+Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
+---
+ .../3rdparty/pinyin/include/userdict.h | 4 +++
+ .../3rdparty/pinyin/share/spellingtrie.cpp | 4 +++
+ .../3rdparty/pinyin/share/userdict.cpp | 31 ++++++++++++++++++++++
+ 3 files changed, 39 insertions(+)
+
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/userdict.h b/src/virtualkeyboard/3rdparty/pinyin/include/userdict.h
+index 51ca3b0..1b9673f 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/include/userdict.h
++++ b/src/virtualkeyboard/3rdparty/pinyin/include/userdict.h
+@@ -24,7 +24,11 @@
+ // Debug performance for operations
+ // #define ___DEBUG_PERF___
+
++#ifdef _WIN32
++#include <winsock.h> // timeval
++#else
+ #include <pthread.h>
++#endif
+ #include "atomdictbase.h"
+
+ namespace ime_pinyin {
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp
+index e15b66c..e01c89a 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp
+@@ -19,6 +19,10 @@
+ #include <assert.h>
+ #include "../include/dictdef.h"
+
++#ifdef _WIN32
++#define snprintf _snprintf
++#endif
++
+ #ifdef ___BUILD_MODEL___
+ #include "../include/spellingtable.h"
+ #endif
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp
+index 614180c..a3db888 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp
+@@ -23,19 +23,41 @@
+ #ifdef ___DEBUG_PERF___
+ #include <cutils/log.h>
+ #endif
++#ifdef _WIN32
++#include <io.h>
++#else
+ #include <unistd.h>
++#endif
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <assert.h>
+ #include <ctype.h>
+ #include <sys/types.h>
++#ifndef _WIN32
+ #include <sys/time.h>
++#endif
+ #include <time.h>
++#ifdef _WIN32
++#undef max
++#undef min
++#include <QDateTime>
++#include <QMutex>
++#else
+ #include <pthread.h>
++#endif
+ #include <math.h>
+
+ namespace ime_pinyin {
+
++#ifdef _WIN32
++static int gettimeofday(struct timeval *tp, void *) {
++ const qint64 current_msecs_since_epoch = QDateTime::currentMSecsSinceEpoch();
++ tp->tv_sec = (long)(current_msecs_since_epoch / 1000);
++ tp->tv_usec = (long)((current_msecs_since_epoch % 1000) * 1000);
++ return 0;
++}
++#endif
++
+ #ifdef ___DEBUG_PERF___
+ static uint64 _ellapse_ = 0;
+ static struct timeval _tv_start_, _tv_end_;
+@@ -58,7 +80,14 @@ static struct timeval _tv_start_, _tv_end_;
+ #endif
+
+ // XXX File load and write are thread-safe by g_mutex_
++#ifdef _WIN32
++static QMutex g_mutex_;
++#define pthread_mutex_lock(MUTEX) ((MUTEX)->lock())
++#define pthread_mutex_unlock(MUTEX) ((MUTEX)->unlock())
++#define pthread_mutex_trylock(MUTEX) (!(MUTEX)->tryLock(0))
++#else
+ static pthread_mutex_t g_mutex_ = PTHREAD_MUTEX_INITIALIZER;
++#endif
+ static struct timeval g_last_update_ = {0, 0};
+
+ inline uint32 UserDict::get_dict_file_size(UserDictInfo * info) {
+@@ -1267,7 +1296,9 @@ void UserDict::write_back() {
+ // It seems truncate is not need on Linux, Windows except Mac
+ // I am doing it here anyway for safety.
+ off_t cur = lseek(fd, 0, SEEK_CUR);
++#ifndef _WIN32
+ ftruncate(fd, cur);
++#endif
+ close(fd);
+ state_ = USER_DICT_SYNC;
+ }
+--
+2.14.1.windows.1
+
diff --git a/src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch b/src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch
new file mode 100644
index 00000000..25452c7f
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch
@@ -0,0 +1,41 @@
+From 6fe7d1f903046de1b436d2b34126d595afe2d5cd Mon Sep 17 00:00:00 2001
+From: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
+Date: Wed, 8 Apr 2015 13:53:06 +0300
+Subject: [PATCH] Fix crash in pinyin ime if the user dictionary cannot be
+ opened
+
+This change fixes a crash caused by dangling pointer.
+
+The crash happens the next time the user dictionary is flushed after
+it fails to open the file.
+
+Change-Id: If1f51279a8d42f01f08879f0cefcef541d0beff8
+Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
+---
+ src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp
+index a3db888..f5f9371 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp
+@@ -309,6 +309,7 @@ bool UserDict::load_dict(const char *file_name, LemmaIdType start_id,
+ return true;
+ error:
+ free((void*)dict_file_);
++ dict_file_ = NULL;
+ start_id_ = 0;
+ return false;
+ }
+@@ -1021,6 +1022,8 @@ bool UserDict::remove_lemma(LemmaIdType lemma_id) {
+
+ void UserDict::flush_cache() {
+ LemmaIdType start_id = start_id_;
++ if (!dict_file_)
++ return;
+ const char * file = strdup(dict_file_);
+ if (!file)
+ return;
+--
+2.14.1.windows.1
+
diff --git a/src/plugins/pinyin/3rdparty/pinyin/patches/0004-Bundle-pinyin-dictionary-in-the-plugin.patch b/src/plugins/pinyin/3rdparty/pinyin/patches/0004-Bundle-pinyin-dictionary-in-the-plugin.patch
new file mode 100644
index 00000000..68857d45
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/patches/0004-Bundle-pinyin-dictionary-in-the-plugin.patch
@@ -0,0 +1,354 @@
+From 8342c36a8a216481ddacc6aee514077586b08573 Mon Sep 17 00:00:00 2001
+From: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
+Date: Sat, 31 Mar 2018 09:51:32 +0300
+Subject: [PATCH] Bundle pinyin dictionary in the plugin
+
+This change modifies the pinyin library and adds support for loading
+the dictionary from the qt resource system.
+
+[ChangeLog] The pinyin dictionary is now bundled in the plugin by default.
+
+Task-number: QTBUG-66198
+Change-Id: I17459c4bde89cc4ccd96ad5c97393a5ad502b902
+Reviewed-by: Andy Shaw <andy.shaw@qt.io>
+Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
+---
+ .../3rdparty/pinyin/include/dictlist.h | 2 +-
+ .../3rdparty/pinyin/include/dicttrie.h | 3 +-
+ .../3rdparty/pinyin/include/ngram.h | 3 +-
+ .../3rdparty/pinyin/include/spellingtrie.h | 3 +-
+ .../3rdparty/pinyin/share/dictlist.cpp | 20 +++++-----
+ .../3rdparty/pinyin/share/dicttrie.cpp | 43 ++++++++++------------
+ .../3rdparty/pinyin/share/ngram.cpp | 10 ++---
+ .../3rdparty/pinyin/share/spellingtrie.cpp | 13 +++----
+ 8 files changed, 47 insertions(+), 50 deletions(-)
+
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/dictlist.h b/src/virtualkeyboard/3rdparty/pinyin/include/dictlist.h
+index 27fa6d8..1c1daef 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/include/dictlist.h
++++ b/src/virtualkeyboard/3rdparty/pinyin/include/dictlist.h
+@@ -80,7 +80,7 @@ class DictList {
+ ~DictList();
+
+ bool save_list(FILE *fp);
+- bool load_list(FILE *fp);
++ bool load_list(QFile *fp);
+
+ #ifdef ___BUILD_MODEL___
+ // Init the list from the LemmaEntry array.
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/dicttrie.h b/src/virtualkeyboard/3rdparty/pinyin/include/dicttrie.h
+index 75b7ee0..86a8ee2 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/include/dicttrie.h
++++ b/src/virtualkeyboard/3rdparty/pinyin/include/dicttrie.h
+@@ -22,6 +22,7 @@
+ #include "./dictdef.h"
+ #include "./dictlist.h"
+ #include "./searchutility.h"
++#include <QFile>
+
+ namespace ime_pinyin {
+
+@@ -105,7 +106,7 @@ class DictTrie : AtomDictBase {
+
+ void free_resource(bool free_dict_list);
+
+- bool load_dict(FILE *fp);
++ bool load_dict(QFile *fp);
+
+ // Given a LmaNodeLE0 node, extract the lemmas specified by it, and fill
+ // them into the lpi_items buffer.
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/ngram.h b/src/virtualkeyboard/3rdparty/pinyin/include/ngram.h
+index 7adb46d..1d3a86e 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/include/ngram.h
++++ b/src/virtualkeyboard/3rdparty/pinyin/include/ngram.h
+@@ -20,6 +20,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include "./dictdef.h"
++#include <QFile>
+
+ namespace ime_pinyin {
+
+@@ -71,7 +72,7 @@ class NGram {
+ static NGram& get_instance();
+
+ bool save_ngram(FILE *fp);
+- bool load_ngram(FILE *fp);
++ bool load_ngram(QFile *fp);
+
+ // Set the total frequency of all none system dictionaries.
+ void set_total_freq_none_sys(size_t freq_none_sys);
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/spellingtrie.h b/src/virtualkeyboard/3rdparty/pinyin/include/spellingtrie.h
+index 03510ed..f943a24 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/include/spellingtrie.h
++++ b/src/virtualkeyboard/3rdparty/pinyin/include/spellingtrie.h
+@@ -20,6 +20,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include "./dictdef.h"
++#include <QFile>
+
+ namespace ime_pinyin {
+
+@@ -233,7 +234,7 @@ class SpellingTrie {
+ bool save_spl_trie(FILE *fp);
+
+ // Load from the file stream
+- bool load_spl_trie(FILE *fp);
++ bool load_spl_trie(QFile *fp);
+
+ // Get the number of spellings
+ size_t get_spelling_num();
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/dictlist.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/dictlist.cpp
+index 64d8d08..a5238ae 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/dictlist.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/dictlist.cpp
+@@ -408,21 +408,21 @@ bool DictList::save_list(FILE *fp) {
+ return true;
+ }
+
+-bool DictList::load_list(FILE *fp) {
++bool DictList::load_list(QFile *fp) {
+ if (NULL == fp)
+ return false;
+
+ initialized_ = false;
+
+- if (fread(&scis_num_, sizeof(uint32), 1, fp) != 1)
++ if (fp->read((char *)&scis_num_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+- if (fread(start_pos_, sizeof(uint32), kMaxLemmaSize + 1, fp) !=
+- kMaxLemmaSize + 1)
++ if (fp->read((char *)start_pos_, sizeof(uint32) * (kMaxLemmaSize + 1)) !=
++ sizeof(uint32) * (kMaxLemmaSize + 1))
+ return false;
+
+- if (fread(start_id_, sizeof(uint32), kMaxLemmaSize + 1, fp) !=
+- kMaxLemmaSize + 1)
++ if (fp->read((char *)start_id_, sizeof(uint32) * (kMaxLemmaSize + 1)) !=
++ sizeof(uint32) * (kMaxLemmaSize + 1))
+ return false;
+
+ free_resource();
+@@ -430,14 +430,14 @@ bool DictList::load_list(FILE *fp) {
+ if (!alloc_resource(start_pos_[kMaxLemmaSize], scis_num_))
+ return false;
+
+- if (fread(scis_hz_, sizeof(char16), scis_num_, fp) != scis_num_)
++ if (fp->read((char *)scis_hz_, sizeof(char16) * scis_num_) != sizeof(char16) * scis_num_)
+ return false;
+
+- if (fread(scis_splid_, sizeof(SpellingId), scis_num_, fp) != scis_num_)
++ if (fp->read((char *)scis_splid_, sizeof(SpellingId) * scis_num_) != sizeof(SpellingId) * scis_num_)
+ return false;
+
+- if (fread(buf_, sizeof(char16), start_pos_[kMaxLemmaSize], fp) !=
+- start_pos_[kMaxLemmaSize])
++ if (fp->read((char *)buf_, sizeof(char16) * start_pos_[kMaxLemmaSize]) !=
++ sizeof(char16) * start_pos_[kMaxLemmaSize])
+ return false;
+
+ initialized_ = true;
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/dicttrie.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/dicttrie.cpp
+index 0cdd098..e7d194f 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/dicttrie.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/dicttrie.cpp
+@@ -165,19 +165,19 @@ bool DictTrie::save_dict(const char *filename) {
+ }
+ #endif // ___BUILD_MODEL___
+
+-bool DictTrie::load_dict(FILE *fp) {
++bool DictTrie::load_dict(QFile *fp) {
+ if (NULL == fp)
+ return false;
+- if (fread(&lma_node_num_le0_, sizeof(uint32), 1, fp) != 1)
++ if (fp->read((char *)&lma_node_num_le0_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+- if (fread(&lma_node_num_ge1_, sizeof(uint32), 1, fp) != 1)
++ if (fp->read((char *)&lma_node_num_ge1_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+- if (fread(&lma_idx_buf_len_, sizeof(uint32), 1, fp) != 1)
++ if (fp->read((char *)&lma_idx_buf_len_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+- if (fread(&top_lmas_num_, sizeof(uint32), 1, fp) != 1 ||
++ if (fp->read((char *)&top_lmas_num_, sizeof(uint32)) != sizeof(uint32) ||
+ top_lmas_num_ >= lma_idx_buf_len_)
+ return false;
+
+@@ -206,16 +206,16 @@ bool DictTrie::load_dict(FILE *fp) {
+ return false;
+ }
+
+- if (fread(root_, sizeof(LmaNodeLE0), lma_node_num_le0_, fp)
+- != lma_node_num_le0_)
++ if (fp->read((char *)root_, sizeof(LmaNodeLE0) * lma_node_num_le0_)
++ != sizeof(LmaNodeLE0) * lma_node_num_le0_)
+ return false;
+
+- if (fread(nodes_ge1_, sizeof(LmaNodeGE1), lma_node_num_ge1_, fp)
+- != lma_node_num_ge1_)
++ if (fp->read((char *)nodes_ge1_, sizeof(LmaNodeGE1) * lma_node_num_ge1_)
++ != sizeof(LmaNodeGE1) * lma_node_num_ge1_)
+ return false;
+
+- if (fread(lma_idx_buf_, sizeof(unsigned char), lma_idx_buf_len_, fp) !=
+- lma_idx_buf_len_)
++ if (fp->read((char *)lma_idx_buf_, sizeof(unsigned char) * lma_idx_buf_len_) !=
++ sizeof(unsigned char) * lma_idx_buf_len_)
+ return false;
+
+ // The quick index for the first level sons
+@@ -245,15 +245,15 @@ bool DictTrie::load_dict(const char *filename, LemmaIdType start_id,
+ if (NULL == filename || end_id <= start_id)
+ return false;
+
+- FILE *fp = fopen(filename, "rb");
+- if (NULL == fp)
++ QFile file(filename);
++ if (!file.open(QIODevice::ReadOnly))
+ return false;
++ QFile *fp = &file;
+
+ free_resource(true);
+
+ dict_list_ = new DictList();
+ if (NULL == dict_list_) {
+- fclose(fp);
+ return false;
+ }
+
+@@ -264,11 +264,9 @@ bool DictTrie::load_dict(const char *filename, LemmaIdType start_id,
+ !load_dict(fp) || !ngram.load_ngram(fp) ||
+ total_lma_num_ > end_id - start_id + 1) {
+ free_resource(true);
+- fclose(fp);
+ return false;
+ }
+
+- fclose(fp);
+ return true;
+ }
+
+@@ -278,12 +276,12 @@ bool DictTrie::load_dict_fd(int sys_fd, long start_offset,
+ if (start_offset < 0 || length <= 0 || end_id <= start_id)
+ return false;
+
+- FILE *fp = fdopen(sys_fd, "rb");
+- if (NULL == fp)
++ QFile file;
++ if (!file.open(sys_fd, QIODevice::ReadOnly))
+ return false;
++ QFile *fp = &file;
+
+- if (-1 == fseek(fp, start_offset, SEEK_SET)) {
+- fclose(fp);
++ if (!fp->seek(start_offset)) {
+ return false;
+ }
+
+@@ -291,7 +289,6 @@ bool DictTrie::load_dict_fd(int sys_fd, long start_offset,
+
+ dict_list_ = new DictList();
+ if (NULL == dict_list_) {
+- fclose(fp);
+ return false;
+ }
+
+@@ -300,14 +297,12 @@ bool DictTrie::load_dict_fd(int sys_fd, long start_offset,
+
+ if (!spl_trie.load_spl_trie(fp) || !dict_list_->load_list(fp) ||
+ !load_dict(fp) || !ngram.load_ngram(fp) ||
+- ftell(fp) < start_offset + length ||
++ fp->pos() < start_offset + length ||
+ total_lma_num_ > end_id - start_id + 1) {
+ free_resource(true);
+- fclose(fp);
+ return false;
+ }
+
+- fclose(fp);
+ return true;
+ }
+
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/ngram.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/ngram.cpp
+index 6aec850..39155bf 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/ngram.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/ngram.cpp
+@@ -177,13 +177,13 @@ bool NGram::save_ngram(FILE *fp) {
+ return true;
+ }
+
+-bool NGram::load_ngram(FILE *fp) {
++bool NGram::load_ngram(QFile *fp) {
+ if (NULL == fp)
+ return false;
+
+ initialized_ = false;
+
+- if (fread(&idx_num_, sizeof(uint32), 1, fp) != 1 )
++ if (fp->read((char *)&idx_num_, sizeof(uint32)) != sizeof(uint32) )
+ return false;
+
+ if (NULL != lma_freq_idx_)
+@@ -200,11 +200,11 @@ bool NGram::load_ngram(FILE *fp) {
+ if (NULL == lma_freq_idx_ || NULL == freq_codes_)
+ return false;
+
+- if (fread(freq_codes_, sizeof(LmaScoreType), kCodeBookSize, fp) !=
+- kCodeBookSize)
++ if (fp->read((char *)freq_codes_, sizeof(LmaScoreType) * kCodeBookSize) !=
++ sizeof(LmaScoreType) * kCodeBookSize)
+ return false;
+
+- if (fread(lma_freq_idx_, sizeof(CODEBOOK_TYPE), idx_num_, fp) != idx_num_)
++ if (fp->read((char *)lma_freq_idx_, sizeof(CODEBOOK_TYPE) * idx_num_) != sizeof(CODEBOOK_TYPE) * idx_num_)
+ return false;
+
+ initialized_ = true;
+diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp
+index e01c89a..355c56b 100644
+--- a/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp
++++ b/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp
+@@ -663,20 +663,20 @@ bool SpellingTrie::save_spl_trie(FILE *fp) {
+ return true;
+ }
+
+-bool SpellingTrie::load_spl_trie(FILE *fp) {
++bool SpellingTrie::load_spl_trie(QFile *fp) {
+ if (NULL == fp)
+ return false;
+
+- if (fread(&spelling_size_, sizeof(uint32), 1, fp) != 1)
++ if (fp->read((char *)&spelling_size_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+- if (fread(&spelling_num_, sizeof(uint32), 1, fp) != 1)
++ if (fp->read((char *)&spelling_num_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+- if (fread(&score_amplifier_, sizeof(float), 1, fp) != 1)
++ if (fp->read((char *)&score_amplifier_, sizeof(float)) != sizeof(float))
+ return false;
+
+- if (fread(&average_score_, sizeof(unsigned char), 1, fp) != 1)
++ if (fp->read((char *)&average_score_, sizeof(unsigned char)) != sizeof(unsigned char))
+ return false;
+
+ if (NULL != spelling_buf_)
+@@ -686,8 +686,7 @@ bool SpellingTrie::load_spl_trie(FILE *fp) {
+ if (NULL == spelling_buf_)
+ return false;
+
+- if (fread(spelling_buf_, sizeof(char) * spelling_size_,
+- spelling_num_, fp) != spelling_num_)
++ if (fp->read((char *)spelling_buf_, spelling_size_ * spelling_num_) != spelling_size_ * spelling_num_)
+ return false;
+
+ return construct(spelling_buf_, spelling_size_, spelling_num_,
+--
+2.14.1.windows.1
+
diff --git a/src/plugins/pinyin/3rdparty/pinyin/patches/0005-Fix-string-cast.patch b/src/plugins/pinyin/3rdparty/pinyin/patches/0005-Fix-string-cast.patch
new file mode 100644
index 00000000..63e126d1
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/patches/0005-Fix-string-cast.patch
@@ -0,0 +1,28 @@
+From 821c869ad7af125a7a718093f8d4730108cffe5b Mon Sep 17 00:00:00 2001
+From: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
+Date: Thu, 23 Aug 2018 21:51:19 +0300
+Subject: [PATCH] Fix string cast
+
+Enforce proper string cast using QT_NO_CAST_TO_ASCII and friends.
+
+Change-Id: I039b23144c8d57f12aad1c27f29654b382078222
+---
+ src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp
+index e7d194f..a084395 100644
+--- a/src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp
++++ b/src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp
+@@ -245,7 +245,7 @@ bool DictTrie::load_dict(const char *filename, LemmaIdType start_id,
+ if (NULL == filename || end_id <= start_id)
+ return false;
+
+- QFile file(filename);
++ QFile file(QString::fromUtf8(filename));
+ if (!file.open(QIODevice::ReadOnly))
+ return false;
+ QFile *fp = &file;
+--
+2.14.1.windows.1
+
diff --git a/src/plugins/pinyin/3rdparty/pinyin/pinyin.pro b/src/plugins/pinyin/3rdparty/pinyin/pinyin.pro
new file mode 100644
index 00000000..193f571a
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/pinyin.pro
@@ -0,0 +1,64 @@
+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/virtualkeyboard/3rdparty/pinyin/qt_attribution.json b/src/plugins/pinyin/3rdparty/pinyin/qt_attribution.json
index c739749f..c739749f 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/qt_attribution.json
+++ b/src/plugins/pinyin/3rdparty/pinyin/qt_attribution.json
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/dictbuilder.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/dictbuilder.cpp
index 6f0bd4f7..6f0bd4f7 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/dictbuilder.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/dictbuilder.cpp
diff --git a/src/plugins/pinyin/3rdparty/pinyin/share/dictlist.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/dictlist.cpp
new file mode 100644
index 00000000..a5238aeb
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/dictlist.cpp
@@ -0,0 +1,446 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include "../include/dictlist.h"
+#include "../include/mystdlib.h"
+#include "../include/ngram.h"
+#include "../include/searchutility.h"
+
+namespace ime_pinyin {
+
+DictList::DictList() {
+ initialized_ = false;
+ scis_num_ = 0;
+ scis_hz_ = NULL;
+ scis_splid_ = NULL;
+ buf_ = NULL;
+ spl_trie_ = SpellingTrie::get_cpinstance();
+
+ assert(kMaxLemmaSize == 8);
+ cmp_func_[0] = cmp_hanzis_1;
+ cmp_func_[1] = cmp_hanzis_2;
+ cmp_func_[2] = cmp_hanzis_3;
+ cmp_func_[3] = cmp_hanzis_4;
+ cmp_func_[4] = cmp_hanzis_5;
+ cmp_func_[5] = cmp_hanzis_6;
+ cmp_func_[6] = cmp_hanzis_7;
+ cmp_func_[7] = cmp_hanzis_8;
+}
+
+DictList::~DictList() {
+ free_resource();
+}
+
+bool DictList::alloc_resource(size_t buf_size, size_t scis_num) {
+ // Allocate memory
+ buf_ = static_cast<char16*>(malloc(buf_size * sizeof(char16)));
+ if (NULL == buf_)
+ return false;
+
+ scis_num_ = scis_num;
+
+ scis_hz_ = static_cast<char16*>(malloc(scis_num_ * sizeof(char16)));
+ if (NULL == scis_hz_)
+ return false;
+
+ scis_splid_ = static_cast<SpellingId*>
+ (malloc(scis_num_ * sizeof(SpellingId)));
+
+ if (NULL == scis_splid_)
+ return false;
+
+ return true;
+}
+
+void DictList::free_resource() {
+ if (NULL != buf_)
+ free(buf_);
+ buf_ = NULL;
+
+ if (NULL != scis_hz_)
+ free(scis_hz_);
+ scis_hz_ = NULL;
+
+ if (NULL != scis_splid_)
+ free(scis_splid_);
+ scis_splid_ = NULL;
+}
+
+#ifdef ___BUILD_MODEL___
+bool DictList::init_list(const SingleCharItem *scis, size_t scis_num,
+ const LemmaEntry *lemma_arr, size_t lemma_num) {
+ if (NULL == scis || 0 == scis_num || NULL == lemma_arr || 0 == lemma_num)
+ return false;
+
+ initialized_ = false;
+
+ if (NULL != buf_)
+ free(buf_);
+
+ // calculate the size
+ size_t buf_size = calculate_size(lemma_arr, lemma_num);
+ if (0 == buf_size)
+ return false;
+
+ if (!alloc_resource(buf_size, scis_num))
+ return false;
+
+ fill_scis(scis, scis_num);
+
+ // Copy the related content from the array to inner buffer
+ fill_list(lemma_arr, lemma_num);
+
+ initialized_ = true;
+ return true;
+}
+
+size_t DictList::calculate_size(const LemmaEntry* lemma_arr, size_t lemma_num) {
+ size_t last_hz_len = 0;
+ size_t list_size = 0;
+ size_t id_num = 0;
+
+ for (size_t i = 0; i < lemma_num; i++) {
+ if (0 == i) {
+ last_hz_len = lemma_arr[i].hz_str_len;
+
+ assert(last_hz_len > 0);
+ assert(lemma_arr[0].idx_by_hz == 1);
+
+ id_num++;
+ start_pos_[0] = 0;
+ start_id_[0] = id_num;
+
+ last_hz_len = 1;
+ list_size += last_hz_len;
+ } else {
+ size_t current_hz_len = lemma_arr[i].hz_str_len;
+
+ assert(current_hz_len >= last_hz_len);
+
+ if (current_hz_len == last_hz_len) {
+ list_size += current_hz_len;
+ id_num++;
+ } else {
+ for (size_t len = last_hz_len; len < current_hz_len - 1; len++) {
+ start_pos_[len] = start_pos_[len - 1];
+ start_id_[len] = start_id_[len - 1];
+ }
+
+ start_pos_[current_hz_len - 1] = list_size;
+
+ id_num++;
+ start_id_[current_hz_len - 1] = id_num;
+
+ last_hz_len = current_hz_len;
+ list_size += current_hz_len;
+ }
+ }
+ }
+
+ for (size_t i = last_hz_len; i <= kMaxLemmaSize; i++) {
+ if (0 == i) {
+ start_pos_[0] = 0;
+ start_id_[0] = 1;
+ } else {
+ start_pos_[i] = list_size;
+ start_id_[i] = id_num;
+ }
+ }
+
+ return start_pos_[kMaxLemmaSize];
+}
+
+void DictList::fill_scis(const SingleCharItem *scis, size_t scis_num) {
+ assert(scis_num_ == scis_num);
+
+ for (size_t pos = 0; pos < scis_num_; pos++) {
+ scis_hz_[pos] = scis[pos].hz;
+ scis_splid_[pos] = scis[pos].splid;
+ }
+}
+
+void DictList::fill_list(const LemmaEntry* lemma_arr, size_t lemma_num) {
+ size_t current_pos = 0;
+
+ utf16_strncpy(buf_, lemma_arr[0].hanzi_str,
+ lemma_arr[0].hz_str_len);
+
+ current_pos = lemma_arr[0].hz_str_len;
+
+ size_t id_num = 1;
+
+ for (size_t i = 1; i < lemma_num; i++) {
+ utf16_strncpy(buf_ + current_pos, lemma_arr[i].hanzi_str,
+ lemma_arr[i].hz_str_len);
+
+ id_num++;
+ current_pos += lemma_arr[i].hz_str_len;
+ }
+
+ assert(current_pos == start_pos_[kMaxLemmaSize]);
+ assert(id_num == start_id_[kMaxLemmaSize]);
+}
+
+char16* DictList::find_pos2_startedbyhz(char16 hz_char) {
+ char16 *found_2w = static_cast<char16*>
+ (mybsearch(&hz_char, buf_ + start_pos_[1],
+ (start_pos_[2] - start_pos_[1]) / 2,
+ sizeof(char16) * 2, cmp_hanzis_1));
+ if (NULL == found_2w)
+ return NULL;
+
+ while (found_2w > buf_ + start_pos_[1] && *found_2w == *(found_2w - 1))
+ found_2w -= 2;
+
+ return found_2w;
+}
+#endif // ___BUILD_MODEL___
+
+char16* DictList::find_pos_startedbyhzs(const char16 last_hzs[],
+ size_t word_len, int (*cmp_func)(const void *, const void *)) {
+ char16 *found_w = static_cast<char16*>
+ (mybsearch(last_hzs, buf_ + start_pos_[word_len - 1],
+ (start_pos_[word_len] - start_pos_[word_len - 1])
+ / word_len,
+ sizeof(char16) * word_len, cmp_func));
+
+ if (NULL == found_w)
+ return NULL;
+
+ while (found_w > buf_ + start_pos_[word_len -1] &&
+ cmp_func(found_w, found_w - word_len) == 0)
+ found_w -= word_len;
+
+ return found_w;
+}
+
+size_t DictList::predict(const char16 last_hzs[], uint16 hzs_len,
+ NPredictItem *npre_items, size_t npre_max,
+ size_t b4_used) {
+ assert(hzs_len <= kMaxPredictSize && hzs_len > 0);
+
+ // 1. Prepare work
+ int (*cmp_func)(const void *, const void *) = cmp_func_[hzs_len - 1];
+
+ NGram& ngram = NGram::get_instance();
+
+ size_t item_num = 0;
+
+ // 2. Do prediction
+ for (uint16 pre_len = 1; pre_len <= kMaxPredictSize + 1 - hzs_len;
+ pre_len++) {
+ uint16 word_len = hzs_len + pre_len;
+ char16 *w_buf = find_pos_startedbyhzs(last_hzs, word_len, cmp_func);
+ if (NULL == w_buf)
+ continue;
+ while (w_buf < buf_ + start_pos_[word_len] &&
+ cmp_func(w_buf, last_hzs) == 0 &&
+ item_num < npre_max) {
+ memset(npre_items + item_num, 0, sizeof(NPredictItem));
+ utf16_strncpy(npre_items[item_num].pre_hzs, w_buf + hzs_len, pre_len);
+ npre_items[item_num].psb =
+ ngram.get_uni_psb((size_t)(w_buf - buf_ - start_pos_[word_len - 1])
+ / word_len + start_id_[word_len - 1]);
+ npre_items[item_num].his_len = hzs_len;
+ item_num++;
+ w_buf += word_len;
+ }
+ }
+
+ size_t new_num = 0;
+ for (size_t i = 0; i < item_num; i++) {
+ // Try to find it in the existing items
+ size_t e_pos;
+ for (e_pos = 1; e_pos <= b4_used; e_pos++) {
+ if (utf16_strncmp((*(npre_items - e_pos)).pre_hzs, npre_items[i].pre_hzs,
+ kMaxPredictSize) == 0)
+ break;
+ }
+ if (e_pos <= b4_used)
+ continue;
+
+ // If not found, append it to the buffer
+ npre_items[new_num] = npre_items[i];
+ new_num++;
+ }
+
+ return new_num;
+}
+
+uint16 DictList::get_lemma_str(LemmaIdType id_lemma, char16 *str_buf,
+ uint16 str_max) {
+ if (!initialized_ || id_lemma >= start_id_[kMaxLemmaSize] || NULL == str_buf
+ || str_max <= 1)
+ return 0;
+
+ // Find the range
+ for (uint16 i = 0; i < kMaxLemmaSize; i++) {
+ if (i + 1 > str_max - 1)
+ return 0;
+ if (start_id_[i] <= id_lemma && start_id_[i + 1] > id_lemma) {
+ size_t id_span = id_lemma - start_id_[i];
+
+ uint16 *buf = buf_ + start_pos_[i] + id_span * (i + 1);
+ for (uint16 len = 0; len <= i; len++) {
+ str_buf[len] = buf[len];
+ }
+ str_buf[i+1] = (char16)'\0';
+ return i + 1;
+ }
+ }
+ return 0;
+}
+
+uint16 DictList::get_splids_for_hanzi(char16 hanzi, uint16 half_splid,
+ uint16 *splids, uint16 max_splids) {
+ char16 *hz_found = static_cast<char16*>
+ (mybsearch(&hanzi, scis_hz_, scis_num_, sizeof(char16), cmp_hanzis_1));
+ assert(NULL != hz_found && hanzi == *hz_found);
+
+ // Move to the first one.
+ while (hz_found > scis_hz_ && hanzi == *(hz_found - 1))
+ hz_found--;
+
+ // First try to found if strict comparison result is not zero.
+ char16 *hz_f = hz_found;
+ bool strict = false;
+ while (hz_f < scis_hz_ + scis_num_ && hanzi == *hz_f) {
+ uint16 pos = hz_f - scis_hz_;
+ if (0 == half_splid || scis_splid_[pos].half_splid == half_splid) {
+ strict = true;
+ }
+ hz_f++;
+ }
+
+ uint16 found_num = 0;
+ while (hz_found < scis_hz_ + scis_num_ && hanzi == *hz_found) {
+ uint16 pos = hz_found - scis_hz_;
+ if (0 == half_splid ||
+ (strict && scis_splid_[pos].half_splid == half_splid) ||
+ (!strict && spl_trie_->half_full_compatible(half_splid,
+ scis_splid_[pos].full_splid))) {
+ assert(found_num + 1 < max_splids);
+ splids[found_num] = scis_splid_[pos].full_splid;
+ found_num++;
+ }
+ hz_found++;
+ }
+
+ return found_num;
+}
+
+LemmaIdType DictList::get_lemma_id(const char16 *str, uint16 str_len) {
+ if (NULL == str || str_len > kMaxLemmaSize)
+ return 0;
+
+ char16 *found = find_pos_startedbyhzs(str, str_len, cmp_func_[str_len - 1]);
+ if (NULL == found)
+ return 0;
+
+ assert(found > buf_);
+ assert(static_cast<size_t>(found - buf_) >= start_pos_[str_len - 1]);
+ return static_cast<LemmaIdType>
+ (start_id_[str_len - 1] +
+ (found - buf_ - start_pos_[str_len - 1]) / str_len);
+}
+
+void DictList::convert_to_hanzis(char16 *str, uint16 str_len) {
+ assert(NULL != str);
+
+ for (uint16 str_pos = 0; str_pos < str_len; str_pos++) {
+ str[str_pos] = scis_hz_[str[str_pos]];
+ }
+}
+
+void DictList::convert_to_scis_ids(char16 *str, uint16 str_len) {
+ assert(NULL != str);
+
+ for (uint16 str_pos = 0; str_pos < str_len; str_pos++) {
+ str[str_pos] = 0x100;
+ }
+}
+
+bool DictList::save_list(FILE *fp) {
+ if (!initialized_ || NULL == fp)
+ return false;
+
+ if (NULL == buf_ || 0 == start_pos_[kMaxLemmaSize] ||
+ NULL == scis_hz_ || NULL == scis_splid_ || 0 == scis_num_)
+ return false;
+
+ if (fwrite(&scis_num_, sizeof(uint32), 1, fp) != 1)
+ return false;
+
+ if (fwrite(start_pos_, sizeof(uint32), kMaxLemmaSize + 1, fp) !=
+ kMaxLemmaSize + 1)
+ return false;
+
+ if (fwrite(start_id_, sizeof(uint32), kMaxLemmaSize + 1, fp) !=
+ kMaxLemmaSize + 1)
+ return false;
+
+ if (fwrite(scis_hz_, sizeof(char16), scis_num_, fp) != scis_num_)
+ return false;
+
+ if (fwrite(scis_splid_, sizeof(SpellingId), scis_num_, fp) != scis_num_)
+ return false;
+
+ if (fwrite(buf_, sizeof(char16), start_pos_[kMaxLemmaSize], fp) !=
+ start_pos_[kMaxLemmaSize])
+ return false;
+
+ return true;
+}
+
+bool DictList::load_list(QFile *fp) {
+ if (NULL == fp)
+ return false;
+
+ initialized_ = false;
+
+ if (fp->read((char *)&scis_num_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+ if (fp->read((char *)start_pos_, sizeof(uint32) * (kMaxLemmaSize + 1)) !=
+ sizeof(uint32) * (kMaxLemmaSize + 1))
+ return false;
+
+ if (fp->read((char *)start_id_, sizeof(uint32) * (kMaxLemmaSize + 1)) !=
+ sizeof(uint32) * (kMaxLemmaSize + 1))
+ return false;
+
+ free_resource();
+
+ if (!alloc_resource(start_pos_[kMaxLemmaSize], scis_num_))
+ return false;
+
+ if (fp->read((char *)scis_hz_, sizeof(char16) * scis_num_) != sizeof(char16) * scis_num_)
+ return false;
+
+ if (fp->read((char *)scis_splid_, sizeof(SpellingId) * scis_num_) != sizeof(SpellingId) * scis_num_)
+ return false;
+
+ if (fp->read((char *)buf_, sizeof(char16) * start_pos_[kMaxLemmaSize]) !=
+ sizeof(char16) * start_pos_[kMaxLemmaSize])
+ return false;
+
+ initialized_ = true;
+ return true;
+}
+} // namespace ime_pinyin
diff --git a/src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp
new file mode 100644
index 00000000..a084395e
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/dicttrie.cpp
@@ -0,0 +1,936 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include "../include/dicttrie.h"
+#include "../include/dictbuilder.h"
+#include "../include/lpicache.h"
+#include "../include/mystdlib.h"
+#include "../include/ngram.h"
+
+namespace ime_pinyin {
+
+DictTrie::DictTrie() {
+ spl_trie_ = SpellingTrie::get_cpinstance();
+
+ root_ = NULL;
+ splid_le0_index_ = NULL;
+ lma_node_num_le0_ = 0;
+ nodes_ge1_ = NULL;
+ lma_node_num_ge1_ = 0;
+ lma_idx_buf_ = NULL;
+ lma_idx_buf_len_ = 0;
+ total_lma_num_ = 0;
+ top_lmas_num_ = 0;
+ dict_list_ = NULL;
+
+ parsing_marks_ = NULL;
+ mile_stones_ = NULL;
+ reset_milestones(0, kFirstValidMileStoneHandle);
+}
+
+DictTrie::~DictTrie() {
+ free_resource(true);
+}
+
+void DictTrie::free_resource(bool free_dict_list) {
+ if (NULL != root_)
+ free(root_);
+ root_ = NULL;
+
+ if (NULL != splid_le0_index_)
+ free(splid_le0_index_);
+ splid_le0_index_ = NULL;
+
+ if (NULL != nodes_ge1_)
+ free(nodes_ge1_);
+ nodes_ge1_ = NULL;
+
+ if (NULL != lma_idx_buf_)
+ free(lma_idx_buf_);
+ lma_idx_buf_ = NULL;
+
+ if (free_dict_list) {
+ if (NULL != dict_list_) {
+ delete dict_list_;
+ }
+ dict_list_ = NULL;
+ }
+
+ if (parsing_marks_)
+ delete [] parsing_marks_;
+ parsing_marks_ = NULL;
+
+ if (mile_stones_)
+ delete [] mile_stones_;
+ mile_stones_ = NULL;
+
+ reset_milestones(0, kFirstValidMileStoneHandle);
+}
+
+inline size_t DictTrie::get_son_offset(const LmaNodeGE1 *node) {
+ return ((size_t)node->son_1st_off_l + ((size_t)node->son_1st_off_h << 16));
+}
+
+inline size_t DictTrie::get_homo_idx_buf_offset(const LmaNodeGE1 *node) {
+ return ((size_t)node->homo_idx_buf_off_l +
+ ((size_t)node->homo_idx_buf_off_h << 16));
+}
+
+inline LemmaIdType DictTrie::get_lemma_id(size_t id_offset) {
+ LemmaIdType id = 0;
+ for (uint16 pos = kLemmaIdSize - 1; pos > 0; pos--)
+ id = (id << 8) + lma_idx_buf_[id_offset * kLemmaIdSize + pos];
+ id = (id << 8) + lma_idx_buf_[id_offset * kLemmaIdSize];
+ return id;
+}
+
+#ifdef ___BUILD_MODEL___
+bool DictTrie::build_dict(const char* fn_raw, const char* fn_validhzs) {
+ DictBuilder* dict_builder = new DictBuilder();
+
+ free_resource(true);
+
+ return dict_builder->build_dict(fn_raw, fn_validhzs, this);
+}
+
+bool DictTrie::save_dict(FILE *fp) {
+ if (NULL == fp)
+ return false;
+
+ if (fwrite(&lma_node_num_le0_, sizeof(uint32), 1, fp) != 1)
+ return false;
+
+ if (fwrite(&lma_node_num_ge1_, sizeof(uint32), 1, fp) != 1)
+ return false;
+
+ if (fwrite(&lma_idx_buf_len_, sizeof(uint32), 1, fp) != 1)
+ return false;
+
+ if (fwrite(&top_lmas_num_, sizeof(uint32), 1, fp) != 1)
+ return false;
+
+ if (fwrite(root_, sizeof(LmaNodeLE0), lma_node_num_le0_, fp)
+ != lma_node_num_le0_)
+ return false;
+
+ if (fwrite(nodes_ge1_, sizeof(LmaNodeGE1), lma_node_num_ge1_, fp)
+ != lma_node_num_ge1_)
+ return false;
+
+ if (fwrite(lma_idx_buf_, sizeof(unsigned char), lma_idx_buf_len_, fp) !=
+ lma_idx_buf_len_)
+ return false;
+
+ return true;
+}
+
+bool DictTrie::save_dict(const char *filename) {
+ if (NULL == filename)
+ return false;
+
+ if (NULL == root_ || NULL == dict_list_)
+ return false;
+
+ SpellingTrie &spl_trie = SpellingTrie::get_instance();
+ NGram &ngram = NGram::get_instance();
+
+ FILE *fp = fopen(filename, "wb");
+ if (NULL == fp)
+ return false;
+
+ if (!spl_trie.save_spl_trie(fp) || !dict_list_->save_list(fp) ||
+ !save_dict(fp) || !ngram.save_ngram(fp)) {
+ fclose(fp);
+ return false;
+ }
+
+ fclose(fp);
+ return true;
+}
+#endif // ___BUILD_MODEL___
+
+bool DictTrie::load_dict(QFile *fp) {
+ if (NULL == fp)
+ return false;
+ if (fp->read((char *)&lma_node_num_le0_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+ if (fp->read((char *)&lma_node_num_ge1_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+ if (fp->read((char *)&lma_idx_buf_len_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+ if (fp->read((char *)&top_lmas_num_, sizeof(uint32)) != sizeof(uint32) ||
+ top_lmas_num_ >= lma_idx_buf_len_)
+ return false;
+
+ free_resource(false);
+
+ root_ = static_cast<LmaNodeLE0*>
+ (malloc(lma_node_num_le0_ * sizeof(LmaNodeLE0)));
+ nodes_ge1_ = static_cast<LmaNodeGE1*>
+ (malloc(lma_node_num_ge1_ * sizeof(LmaNodeGE1)));
+ lma_idx_buf_ = (unsigned char*)malloc(lma_idx_buf_len_);
+ total_lma_num_ = lma_idx_buf_len_ / kLemmaIdSize;
+
+ size_t buf_size = SpellingTrie::get_instance().get_spelling_num() + 1;
+ assert(lma_node_num_le0_ <= buf_size);
+ splid_le0_index_ = static_cast<uint16*>(malloc(buf_size * sizeof(uint16)));
+
+ // Init the space for parsing.
+ parsing_marks_ = new ParsingMark[kMaxParsingMark];
+ mile_stones_ = new MileStone[kMaxMileStone];
+ reset_milestones(0, kFirstValidMileStoneHandle);
+
+ if (NULL == root_ || NULL == nodes_ge1_ || NULL == lma_idx_buf_ ||
+ NULL == splid_le0_index_ || NULL == parsing_marks_ ||
+ NULL == mile_stones_) {
+ free_resource(false);
+ return false;
+ }
+
+ if (fp->read((char *)root_, sizeof(LmaNodeLE0) * lma_node_num_le0_)
+ != sizeof(LmaNodeLE0) * lma_node_num_le0_)
+ return false;
+
+ if (fp->read((char *)nodes_ge1_, sizeof(LmaNodeGE1) * lma_node_num_ge1_)
+ != sizeof(LmaNodeGE1) * lma_node_num_ge1_)
+ return false;
+
+ if (fp->read((char *)lma_idx_buf_, sizeof(unsigned char) * lma_idx_buf_len_) !=
+ sizeof(unsigned char) * lma_idx_buf_len_)
+ return false;
+
+ // The quick index for the first level sons
+ uint16 last_splid = kFullSplIdStart;
+ size_t last_pos = 0;
+ for (size_t i = 1; i < lma_node_num_le0_; i++) {
+ for (uint16 splid = last_splid; splid < root_[i].spl_idx; splid++)
+ splid_le0_index_[splid - kFullSplIdStart] = last_pos;
+
+ splid_le0_index_[root_[i].spl_idx - kFullSplIdStart] =
+ static_cast<uint16>(i);
+ last_splid = root_[i].spl_idx;
+ last_pos = i;
+ }
+
+ for (uint16 splid = last_splid + 1;
+ splid < buf_size + kFullSplIdStart; splid++) {
+ assert(static_cast<size_t>(splid - kFullSplIdStart) < buf_size);
+ splid_le0_index_[splid - kFullSplIdStart] = last_pos + 1;
+ }
+
+ return true;
+}
+
+bool DictTrie::load_dict(const char *filename, LemmaIdType start_id,
+ LemmaIdType end_id) {
+ if (NULL == filename || end_id <= start_id)
+ return false;
+
+ QFile file(QString::fromUtf8(filename));
+ if (!file.open(QIODevice::ReadOnly))
+ return false;
+ QFile *fp = &file;
+
+ free_resource(true);
+
+ dict_list_ = new DictList();
+ if (NULL == dict_list_) {
+ return false;
+ }
+
+ SpellingTrie &spl_trie = SpellingTrie::get_instance();
+ NGram &ngram = NGram::get_instance();
+
+ if (!spl_trie.load_spl_trie(fp) || !dict_list_->load_list(fp) ||
+ !load_dict(fp) || !ngram.load_ngram(fp) ||
+ total_lma_num_ > end_id - start_id + 1) {
+ free_resource(true);
+ return false;
+ }
+
+ return true;
+}
+
+bool DictTrie::load_dict_fd(int sys_fd, long start_offset,
+ long length, LemmaIdType start_id,
+ LemmaIdType end_id) {
+ if (start_offset < 0 || length <= 0 || end_id <= start_id)
+ return false;
+
+ QFile file;
+ if (!file.open(sys_fd, QIODevice::ReadOnly))
+ return false;
+ QFile *fp = &file;
+
+ if (!fp->seek(start_offset)) {
+ return false;
+ }
+
+ free_resource(true);
+
+ dict_list_ = new DictList();
+ if (NULL == dict_list_) {
+ return false;
+ }
+
+ SpellingTrie &spl_trie = SpellingTrie::get_instance();
+ NGram &ngram = NGram::get_instance();
+
+ if (!spl_trie.load_spl_trie(fp) || !dict_list_->load_list(fp) ||
+ !load_dict(fp) || !ngram.load_ngram(fp) ||
+ fp->pos() < start_offset + length ||
+ total_lma_num_ > end_id - start_id + 1) {
+ free_resource(true);
+ return false;
+ }
+
+ return true;
+}
+
+size_t DictTrie::fill_lpi_buffer(LmaPsbItem lpi_items[], size_t lpi_max,
+ LmaNodeLE0 *node) {
+ size_t lpi_num = 0;
+ NGram& ngram = NGram::get_instance();
+ for (size_t homo = 0; homo < (size_t)node->num_of_homo; homo++) {
+ lpi_items[lpi_num].id = get_lemma_id(node->homo_idx_buf_off +
+ homo);
+ lpi_items[lpi_num].lma_len = 1;
+ lpi_items[lpi_num].psb =
+ static_cast<LmaScoreType>(ngram.get_uni_psb(lpi_items[lpi_num].id));
+ lpi_num++;
+ if (lpi_num >= lpi_max)
+ break;
+ }
+
+ return lpi_num;
+}
+
+size_t DictTrie::fill_lpi_buffer(LmaPsbItem lpi_items[], size_t lpi_max,
+ size_t homo_buf_off, LmaNodeGE1 *node,
+ uint16 lma_len) {
+ size_t lpi_num = 0;
+ NGram& ngram = NGram::get_instance();
+ for (size_t homo = 0; homo < (size_t)node->num_of_homo; homo++) {
+ lpi_items[lpi_num].id = get_lemma_id(homo_buf_off + homo);
+ lpi_items[lpi_num].lma_len = lma_len;
+ lpi_items[lpi_num].psb =
+ static_cast<LmaScoreType>(ngram.get_uni_psb(lpi_items[lpi_num].id));
+ lpi_num++;
+ if (lpi_num >= lpi_max)
+ break;
+ }
+
+ return lpi_num;
+}
+
+void DictTrie::reset_milestones(uint16 from_step, MileStoneHandle from_handle) {
+ if (0 == from_step) {
+ parsing_marks_pos_ = 0;
+ mile_stones_pos_ = kFirstValidMileStoneHandle;
+ } else {
+ if (from_handle > 0 && from_handle < mile_stones_pos_) {
+ mile_stones_pos_ = from_handle;
+
+ MileStone *mile_stone = mile_stones_ + from_handle;
+ parsing_marks_pos_ = mile_stone->mark_start;
+ }
+ }
+}
+
+MileStoneHandle DictTrie::extend_dict(MileStoneHandle from_handle,
+ const DictExtPara *dep,
+ LmaPsbItem *lpi_items, size_t lpi_max,
+ size_t *lpi_num) {
+ if (NULL == dep)
+ return 0;
+
+ // from LmaNodeLE0 (root) to LmaNodeLE0
+ if (0 == from_handle) {
+ assert(0 == dep->splids_extended);
+ return extend_dict0(from_handle, dep, lpi_items, lpi_max, lpi_num);
+ }
+
+ // from LmaNodeLE0 to LmaNodeGE1
+ if (1 == dep->splids_extended)
+ return extend_dict1(from_handle, dep, lpi_items, lpi_max, lpi_num);
+
+ // From LmaNodeGE1 to LmaNodeGE1
+ return extend_dict2(from_handle, dep, lpi_items, lpi_max, lpi_num);
+}
+
+MileStoneHandle DictTrie::extend_dict0(MileStoneHandle from_handle,
+ const DictExtPara *dep,
+ LmaPsbItem *lpi_items,
+ size_t lpi_max, size_t *lpi_num) {
+ assert(NULL != dep && 0 == from_handle);
+ *lpi_num = 0;
+ MileStoneHandle ret_handle = 0;
+
+ uint16 splid = dep->splids[dep->splids_extended];
+ uint16 id_start = dep->id_start;
+ uint16 id_num = dep->id_num;
+
+ LpiCache& lpi_cache = LpiCache::get_instance();
+ bool cached = lpi_cache.is_cached(splid);
+
+ // 2. Begin exgtending
+ // 2.1 Get the LmaPsbItem list
+ LmaNodeLE0 *node = root_;
+ size_t son_start = splid_le0_index_[id_start - kFullSplIdStart];
+ size_t son_end = splid_le0_index_[id_start + id_num - kFullSplIdStart];
+ for (size_t son_pos = son_start; son_pos < son_end; son_pos++) {
+ assert(1 == node->son_1st_off);
+ LmaNodeLE0 *son = root_ + son_pos;
+ assert(son->spl_idx >= id_start && son->spl_idx < id_start + id_num);
+
+ if (!cached && *lpi_num < lpi_max) {
+ bool need_lpi = true;
+ if (spl_trie_->is_half_id_yunmu(splid) && son_pos != son_start)
+ need_lpi = false;
+
+ if (need_lpi)
+ *lpi_num += fill_lpi_buffer(lpi_items + (*lpi_num),
+ lpi_max - *lpi_num, son);
+ }
+
+ // If necessary, fill in a new mile stone.
+ if (son->spl_idx == id_start) {
+ if (mile_stones_pos_ < kMaxMileStone &&
+ parsing_marks_pos_ < kMaxParsingMark) {
+ parsing_marks_[parsing_marks_pos_].node_offset = son_pos;
+ parsing_marks_[parsing_marks_pos_].node_num = id_num;
+ mile_stones_[mile_stones_pos_].mark_start = parsing_marks_pos_;
+ mile_stones_[mile_stones_pos_].mark_num = 1;
+ ret_handle = mile_stones_pos_;
+ parsing_marks_pos_++;
+ mile_stones_pos_++;
+ }
+ }
+
+ if (son->spl_idx >= id_start + id_num -1)
+ break;
+ }
+
+ // printf("----- parsing marks: %d, mile stone: %d \n", parsing_marks_pos_,
+ // mile_stones_pos_);
+ return ret_handle;
+}
+
+MileStoneHandle DictTrie::extend_dict1(MileStoneHandle from_handle,
+ const DictExtPara *dep,
+ LmaPsbItem *lpi_items,
+ size_t lpi_max, size_t *lpi_num) {
+ assert(NULL != dep && from_handle > 0 && from_handle < mile_stones_pos_);
+
+ MileStoneHandle ret_handle = 0;
+
+ // 1. If this is a half Id, get its corresponding full starting Id and
+ // number of full Id.
+ size_t ret_val = 0;
+
+ uint16 id_start = dep->id_start;
+ uint16 id_num = dep->id_num;
+
+ // 2. Begin extending.
+ MileStone *mile_stone = mile_stones_ + from_handle;
+
+ for (uint16 h_pos = 0; h_pos < mile_stone->mark_num; h_pos++) {
+ ParsingMark p_mark = parsing_marks_[mile_stone->mark_start + h_pos];
+ uint16 ext_num = p_mark.node_num;
+ for (uint16 ext_pos = 0; ext_pos < ext_num; ext_pos++) {
+ LmaNodeLE0 *node = root_ + p_mark.node_offset + ext_pos;
+ size_t found_start = 0;
+ size_t found_num = 0;
+ for (size_t son_pos = 0; son_pos < (size_t)node->num_of_son; son_pos++) {
+ assert(node->son_1st_off <= lma_node_num_ge1_);
+ LmaNodeGE1 *son = nodes_ge1_ + node->son_1st_off + son_pos;
+ if (son->spl_idx >= id_start
+ && son->spl_idx < id_start + id_num) {
+ if (*lpi_num < lpi_max) {
+ size_t homo_buf_off = get_homo_idx_buf_offset(son);
+ *lpi_num += fill_lpi_buffer(lpi_items + (*lpi_num),
+ lpi_max - *lpi_num, homo_buf_off, son,
+ 2);
+ }
+
+ // If necessary, fill in the new DTMI
+ if (0 == found_num) {
+ found_start = son_pos;
+ }
+ found_num++;
+ }
+ if (son->spl_idx >= id_start + id_num - 1 || son_pos ==
+ (size_t)node->num_of_son - 1) {
+ if (found_num > 0) {
+ if (mile_stones_pos_ < kMaxMileStone &&
+ parsing_marks_pos_ < kMaxParsingMark) {
+ parsing_marks_[parsing_marks_pos_].node_offset =
+ node->son_1st_off + found_start;
+ parsing_marks_[parsing_marks_pos_].node_num = found_num;
+ if (0 == ret_val)
+ mile_stones_[mile_stones_pos_].mark_start =
+ parsing_marks_pos_;
+ parsing_marks_pos_++;
+ }
+
+ ret_val++;
+ }
+ break;
+ } // for son_pos
+ } // for ext_pos
+ } // for h_pos
+ }
+
+ if (ret_val > 0) {
+ mile_stones_[mile_stones_pos_].mark_num = ret_val;
+ ret_handle = mile_stones_pos_;
+ mile_stones_pos_++;
+ ret_val = 1;
+ }
+
+ // printf("----- parsing marks: %d, mile stone: %d \n", parsing_marks_pos_,
+ // mile_stones_pos_);
+ return ret_handle;
+}
+
+MileStoneHandle DictTrie::extend_dict2(MileStoneHandle from_handle,
+ const DictExtPara *dep,
+ LmaPsbItem *lpi_items,
+ size_t lpi_max, size_t *lpi_num) {
+ assert(NULL != dep && from_handle > 0 && from_handle < mile_stones_pos_);
+
+ MileStoneHandle ret_handle = 0;
+
+ // 1. If this is a half Id, get its corresponding full starting Id and
+ // number of full Id.
+ size_t ret_val = 0;
+
+ uint16 id_start = dep->id_start;
+ uint16 id_num = dep->id_num;
+
+ // 2. Begin extending.
+ MileStone *mile_stone = mile_stones_ + from_handle;
+
+ for (uint16 h_pos = 0; h_pos < mile_stone->mark_num; h_pos++) {
+ ParsingMark p_mark = parsing_marks_[mile_stone->mark_start + h_pos];
+ uint16 ext_num = p_mark.node_num;
+ for (uint16 ext_pos = 0; ext_pos < ext_num; ext_pos++) {
+ LmaNodeGE1 *node = nodes_ge1_ + p_mark.node_offset + ext_pos;
+ size_t found_start = 0;
+ size_t found_num = 0;
+
+ for (size_t son_pos = 0; son_pos < (size_t)node->num_of_son; son_pos++) {
+ assert(node->son_1st_off_l > 0 || node->son_1st_off_h > 0);
+ LmaNodeGE1 *son = nodes_ge1_ + get_son_offset(node) + son_pos;
+ if (son->spl_idx >= id_start
+ && son->spl_idx < id_start + id_num) {
+ if (*lpi_num < lpi_max) {
+ size_t homo_buf_off = get_homo_idx_buf_offset(son);
+ *lpi_num += fill_lpi_buffer(lpi_items + (*lpi_num),
+ lpi_max - *lpi_num, homo_buf_off, son,
+ dep->splids_extended + 1);
+ }
+
+ // If necessary, fill in the new DTMI
+ if (0 == found_num) {
+ found_start = son_pos;
+ }
+ found_num++;
+ }
+ if (son->spl_idx >= id_start + id_num - 1 || son_pos ==
+ (size_t)node->num_of_son - 1) {
+ if (found_num > 0) {
+ if (mile_stones_pos_ < kMaxMileStone &&
+ parsing_marks_pos_ < kMaxParsingMark) {
+ parsing_marks_[parsing_marks_pos_].node_offset =
+ get_son_offset(node) + found_start;
+ parsing_marks_[parsing_marks_pos_].node_num = found_num;
+ if (0 == ret_val)
+ mile_stones_[mile_stones_pos_].mark_start =
+ parsing_marks_pos_;
+ parsing_marks_pos_++;
+ }
+
+ ret_val++;
+ }
+ break;
+ }
+ } // for son_pos
+ } // for ext_pos
+ } // for h_pos
+
+ if (ret_val > 0) {
+ mile_stones_[mile_stones_pos_].mark_num = ret_val;
+ ret_handle = mile_stones_pos_;
+ mile_stones_pos_++;
+ }
+
+ // printf("----- parsing marks: %d, mile stone: %d \n", parsing_marks_pos_,
+ // mile_stones_pos_);
+ return ret_handle;
+}
+
+bool DictTrie::try_extend(const uint16 *splids, uint16 splid_num,
+ LemmaIdType id_lemma) {
+ if (0 == splid_num || NULL == splids)
+ return false;
+
+ void *node = root_ + splid_le0_index_[splids[0] - kFullSplIdStart];
+
+ for (uint16 pos = 1; pos < splid_num; pos++) {
+ if (1 == pos) {
+ LmaNodeLE0 *node_le0 = reinterpret_cast<LmaNodeLE0*>(node);
+ LmaNodeGE1 *node_son;
+ uint16 son_pos;
+ for (son_pos = 0; son_pos < static_cast<uint16>(node_le0->num_of_son);
+ son_pos++) {
+ assert(node_le0->son_1st_off <= lma_node_num_ge1_);
+ node_son = nodes_ge1_ + node_le0->son_1st_off
+ + son_pos;
+ if (node_son->spl_idx == splids[pos])
+ break;
+ }
+ if (son_pos < node_le0->num_of_son)
+ node = reinterpret_cast<void*>(node_son);
+ else
+ return false;
+ } else {
+ LmaNodeGE1 *node_ge1 = reinterpret_cast<LmaNodeGE1*>(node);
+ LmaNodeGE1 *node_son;
+ uint16 son_pos;
+ for (son_pos = 0; son_pos < static_cast<uint16>(node_ge1->num_of_son);
+ son_pos++) {
+ assert(node_ge1->son_1st_off_l > 0 || node_ge1->son_1st_off_h > 0);
+ node_son = nodes_ge1_ + get_son_offset(node_ge1) + son_pos;
+ if (node_son->spl_idx == splids[pos])
+ break;
+ }
+ if (son_pos < node_ge1->num_of_son)
+ node = reinterpret_cast<void*>(node_son);
+ else
+ return false;
+ }
+ }
+
+ if (1 == splid_num) {
+ LmaNodeLE0* node_le0 = reinterpret_cast<LmaNodeLE0*>(node);
+ size_t num_of_homo = (size_t)node_le0->num_of_homo;
+ for (size_t homo_pos = 0; homo_pos < num_of_homo; homo_pos++) {
+ LemmaIdType id_this = get_lemma_id(node_le0->homo_idx_buf_off + homo_pos);
+ char16 str[2];
+ get_lemma_str(id_this, str, 2);
+ if (id_this == id_lemma)
+ return true;
+ }
+ } else {
+ LmaNodeGE1* node_ge1 = reinterpret_cast<LmaNodeGE1*>(node);
+ size_t num_of_homo = (size_t)node_ge1->num_of_homo;
+ for (size_t homo_pos = 0; homo_pos < num_of_homo; homo_pos++) {
+ size_t node_homo_off = get_homo_idx_buf_offset(node_ge1);
+ if (get_lemma_id(node_homo_off + homo_pos) == id_lemma)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+size_t DictTrie::get_lpis(const uint16* splid_str, uint16 splid_str_len,
+ LmaPsbItem* lma_buf, size_t max_lma_buf) {
+ if (splid_str_len > kMaxLemmaSize)
+ return 0;
+
+#define MAX_EXTENDBUF_LEN 200
+
+ size_t* node_buf1[MAX_EXTENDBUF_LEN]; // use size_t for data alignment
+ size_t* node_buf2[MAX_EXTENDBUF_LEN];
+ LmaNodeLE0** node_fr_le0 =
+ reinterpret_cast<LmaNodeLE0**>(node_buf1); // Nodes from.
+ LmaNodeLE0** node_to_le0 =
+ reinterpret_cast<LmaNodeLE0**>(node_buf2); // Nodes to.
+ LmaNodeGE1** node_fr_ge1 = NULL;
+ LmaNodeGE1** node_to_ge1 = NULL;
+ size_t node_fr_num = 1;
+ size_t node_to_num = 0;
+ node_fr_le0[0] = root_;
+ if (NULL == node_fr_le0[0])
+ return 0;
+
+ size_t spl_pos = 0;
+
+ while (spl_pos < splid_str_len) {
+ uint16 id_num = 1;
+ uint16 id_start = splid_str[spl_pos];
+ // If it is a half id
+ if (spl_trie_->is_half_id(splid_str[spl_pos])) {
+ id_num = spl_trie_->half_to_full(splid_str[spl_pos], &id_start);
+ assert(id_num > 0);
+ }
+
+ // Extend the nodes
+ if (0 == spl_pos) { // From LmaNodeLE0 (root) to LmaNodeLE0 nodes
+ for (size_t node_fr_pos = 0; node_fr_pos < node_fr_num; node_fr_pos++) {
+ LmaNodeLE0 *node = node_fr_le0[node_fr_pos];
+ assert(node == root_ && 1 == node_fr_num);
+ size_t son_start = splid_le0_index_[id_start - kFullSplIdStart];
+ size_t son_end =
+ splid_le0_index_[id_start + id_num - kFullSplIdStart];
+ for (size_t son_pos = son_start; son_pos < son_end; son_pos++) {
+ assert(1 == node->son_1st_off);
+ LmaNodeLE0 *node_son = root_ + son_pos;
+ assert(node_son->spl_idx >= id_start
+ && node_son->spl_idx < id_start + id_num);
+ if (node_to_num < MAX_EXTENDBUF_LEN) {
+ node_to_le0[node_to_num] = node_son;
+ node_to_num++;
+ }
+ // id_start + id_num - 1 is the last one, which has just been
+ // recorded.
+ if (node_son->spl_idx >= id_start + id_num - 1)
+ break;
+ }
+ }
+
+ spl_pos++;
+ if (spl_pos >= splid_str_len || node_to_num == 0)
+ break;
+ // Prepare the nodes for next extending
+ // next time, from LmaNodeLE0 to LmaNodeGE1
+ LmaNodeLE0** node_tmp = node_fr_le0;
+ node_fr_le0 = node_to_le0;
+ node_to_le0 = NULL;
+ node_to_ge1 = reinterpret_cast<LmaNodeGE1**>(node_tmp);
+ } else if (1 == spl_pos) { // From LmaNodeLE0 to LmaNodeGE1 nodes
+ for (size_t node_fr_pos = 0; node_fr_pos < node_fr_num; node_fr_pos++) {
+ LmaNodeLE0 *node = node_fr_le0[node_fr_pos];
+ for (size_t son_pos = 0; son_pos < (size_t)node->num_of_son;
+ son_pos++) {
+ assert(node->son_1st_off <= lma_node_num_ge1_);
+ LmaNodeGE1 *node_son = nodes_ge1_ + node->son_1st_off
+ + son_pos;
+ if (node_son->spl_idx >= id_start
+ && node_son->spl_idx < id_start + id_num) {
+ if (node_to_num < MAX_EXTENDBUF_LEN) {
+ node_to_ge1[node_to_num] = node_son;
+ node_to_num++;
+ }
+ }
+ // id_start + id_num - 1 is the last one, which has just been
+ // recorded.
+ if (node_son->spl_idx >= id_start + id_num - 1)
+ break;
+ }
+ }
+
+ spl_pos++;
+ if (spl_pos >= splid_str_len || node_to_num == 0)
+ break;
+ // Prepare the nodes for next extending
+ // next time, from LmaNodeGE1 to LmaNodeGE1
+ node_fr_ge1 = node_to_ge1;
+ node_to_ge1 = reinterpret_cast<LmaNodeGE1**>(node_fr_le0);
+ node_fr_le0 = NULL;
+ node_to_le0 = NULL;
+ } else { // From LmaNodeGE1 to LmaNodeGE1 nodes
+ for (size_t node_fr_pos = 0; node_fr_pos < node_fr_num; node_fr_pos++) {
+ LmaNodeGE1 *node = node_fr_ge1[node_fr_pos];
+ for (size_t son_pos = 0; son_pos < (size_t)node->num_of_son;
+ son_pos++) {
+ assert(node->son_1st_off_l > 0 || node->son_1st_off_h > 0);
+ LmaNodeGE1 *node_son = nodes_ge1_
+ + get_son_offset(node) + son_pos;
+ if (node_son->spl_idx >= id_start
+ && node_son->spl_idx < id_start + id_num) {
+ if (node_to_num < MAX_EXTENDBUF_LEN) {
+ node_to_ge1[node_to_num] = node_son;
+ node_to_num++;
+ }
+ }
+ // id_start + id_num - 1 is the last one, which has just been
+ // recorded.
+ if (node_son->spl_idx >= id_start + id_num - 1)
+ break;
+ }
+ }
+
+ spl_pos++;
+ if (spl_pos >= splid_str_len || node_to_num == 0)
+ break;
+ // Prepare the nodes for next extending
+ // next time, from LmaNodeGE1 to LmaNodeGE1
+ LmaNodeGE1 **node_tmp = node_fr_ge1;
+ node_fr_ge1 = node_to_ge1;
+ node_to_ge1 = node_tmp;
+ }
+
+ // The number of node for next extending
+ node_fr_num = node_to_num;
+ node_to_num = 0;
+ } // while
+
+ if (0 == node_to_num)
+ return 0;
+
+ NGram &ngram = NGram::get_instance();
+ size_t lma_num = 0;
+
+ // If the length is 1, and the splid is a one-char Yunmu like 'a', 'o', 'e',
+ // only those candidates for the full matched one-char id will be returned.
+ if (1 == splid_str_len && spl_trie_->is_half_id_yunmu(splid_str[0]))
+ node_to_num = node_to_num > 0 ? 1 : 0;
+
+ for (size_t node_pos = 0; node_pos < node_to_num; node_pos++) {
+ size_t num_of_homo = 0;
+ if (spl_pos <= 1) { // Get from LmaNodeLE0 nodes
+ LmaNodeLE0* node_le0 = node_to_le0[node_pos];
+ num_of_homo = (size_t)node_le0->num_of_homo;
+ for (size_t homo_pos = 0; homo_pos < num_of_homo; homo_pos++) {
+ size_t ch_pos = lma_num + homo_pos;
+ lma_buf[ch_pos].id =
+ get_lemma_id(node_le0->homo_idx_buf_off + homo_pos);
+ lma_buf[ch_pos].lma_len = 1;
+ lma_buf[ch_pos].psb =
+ static_cast<LmaScoreType>(ngram.get_uni_psb(lma_buf[ch_pos].id));
+
+ if (lma_num + homo_pos >= max_lma_buf - 1)
+ break;
+ }
+ } else { // Get from LmaNodeGE1 nodes
+ LmaNodeGE1* node_ge1 = node_to_ge1[node_pos];
+ num_of_homo = (size_t)node_ge1->num_of_homo;
+ for (size_t homo_pos = 0; homo_pos < num_of_homo; homo_pos++) {
+ size_t ch_pos = lma_num + homo_pos;
+ size_t node_homo_off = get_homo_idx_buf_offset(node_ge1);
+ lma_buf[ch_pos].id = get_lemma_id(node_homo_off + homo_pos);
+ lma_buf[ch_pos].lma_len = splid_str_len;
+ lma_buf[ch_pos].psb =
+ static_cast<LmaScoreType>(ngram.get_uni_psb(lma_buf[ch_pos].id));
+
+ if (lma_num + homo_pos >= max_lma_buf - 1)
+ break;
+ }
+ }
+
+ lma_num += num_of_homo;
+ if (lma_num >= max_lma_buf) {
+ lma_num = max_lma_buf;
+ break;
+ }
+ }
+ return lma_num;
+}
+
+uint16 DictTrie::get_lemma_str(LemmaIdType id_lemma, char16 *str_buf,
+ uint16 str_max) {
+ return dict_list_->get_lemma_str(id_lemma, str_buf, str_max);
+}
+
+uint16 DictTrie::get_lemma_splids(LemmaIdType id_lemma, uint16 *splids,
+ uint16 splids_max, bool arg_valid) {
+ char16 lma_str[kMaxLemmaSize + 1];
+ uint16 lma_len = get_lemma_str(id_lemma, lma_str, kMaxLemmaSize + 1);
+ assert((!arg_valid && splids_max >= lma_len) || lma_len == splids_max);
+
+ uint16 spl_mtrx[kMaxLemmaSize * 5];
+ uint16 spl_start[kMaxLemmaSize + 1];
+ spl_start[0] = 0;
+ uint16 try_num = 1;
+
+ for (uint16 pos = 0; pos < lma_len; pos++) {
+ uint16 cand_splids_this = 0;
+ if (arg_valid && spl_trie_->is_full_id(splids[pos])) {
+ spl_mtrx[spl_start[pos]] = splids[pos];
+ cand_splids_this = 1;
+ } else {
+ cand_splids_this = dict_list_->get_splids_for_hanzi(lma_str[pos],
+ arg_valid ? splids[pos] : 0, spl_mtrx + spl_start[pos],
+ kMaxLemmaSize * 5 - spl_start[pos]);
+ assert(cand_splids_this > 0);
+ }
+ spl_start[pos + 1] = spl_start[pos] + cand_splids_this;
+ try_num *= cand_splids_this;
+ }
+
+ for (uint16 try_pos = 0; try_pos < try_num; try_pos++) {
+ uint16 mod = 1;
+ for (uint16 pos = 0; pos < lma_len; pos++) {
+ uint16 radix = spl_start[pos + 1] - spl_start[pos];
+ splids[pos] = spl_mtrx[ spl_start[pos] + try_pos / mod % radix];
+ mod *= radix;
+ }
+
+ if (try_extend(splids, lma_len, id_lemma))
+ return lma_len;
+ }
+
+ return 0;
+}
+
+void DictTrie::set_total_lemma_count_of_others(size_t count) {
+ NGram& ngram = NGram::get_instance();
+ ngram.set_total_freq_none_sys(count);
+}
+
+void DictTrie::convert_to_hanzis(char16 *str, uint16 str_len) {
+ return dict_list_->convert_to_hanzis(str, str_len);
+}
+
+void DictTrie::convert_to_scis_ids(char16 *str, uint16 str_len) {
+ return dict_list_->convert_to_scis_ids(str, str_len);
+}
+
+LemmaIdType DictTrie::get_lemma_id(const char16 lemma_str[], uint16 lemma_len) {
+ if (NULL == lemma_str || lemma_len > kMaxLemmaSize)
+ return 0;
+
+ return dict_list_->get_lemma_id(lemma_str, lemma_len);
+}
+
+size_t DictTrie::predict_top_lmas(size_t his_len, NPredictItem *npre_items,
+ size_t npre_max, size_t b4_used) {
+ NGram &ngram = NGram::get_instance();
+
+ size_t item_num = 0;
+ size_t top_lmas_id_offset = lma_idx_buf_len_ / kLemmaIdSize - top_lmas_num_;
+ size_t top_lmas_pos = 0;
+ while (item_num < npre_max && top_lmas_pos < top_lmas_num_) {
+ memset(npre_items + item_num, 0, sizeof(NPredictItem));
+ LemmaIdType top_lma_id = get_lemma_id(top_lmas_id_offset + top_lmas_pos);
+ top_lmas_pos += 1;
+ if (dict_list_->get_lemma_str(top_lma_id,
+ npre_items[item_num].pre_hzs,
+ kMaxLemmaSize - 1) == 0) {
+ continue;
+ }
+ npre_items[item_num].psb = ngram.get_uni_psb(top_lma_id);
+ npre_items[item_num].his_len = his_len;
+ item_num++;
+ }
+ return item_num;
+}
+
+size_t DictTrie::predict(const char16 *last_hzs, uint16 hzs_len,
+ NPredictItem *npre_items, size_t npre_max,
+ size_t b4_used) {
+ return dict_list_->predict(last_hzs, hzs_len, npre_items, npre_max, b4_used);
+}
+} // namespace ime_pinyin
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/lpicache.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/lpicache.cpp
index 4bb4ca26..4bb4ca26 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/lpicache.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/lpicache.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/matrixsearch.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/matrixsearch.cpp
index 41e11433..41e11433 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/matrixsearch.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/matrixsearch.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/mystdlib.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/mystdlib.cpp
index 93bbcc9f..93bbcc9f 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/mystdlib.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/mystdlib.cpp
diff --git a/src/plugins/pinyin/3rdparty/pinyin/share/ngram.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/ngram.cpp
new file mode 100644
index 00000000..39155bfb
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/ngram.cpp
@@ -0,0 +1,342 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include "../include/mystdlib.h"
+#include "../include/ngram.h"
+
+namespace ime_pinyin {
+
+#define ADD_COUNT 0.3
+
+int comp_double(const void *p1, const void *p2) {
+ if (*static_cast<const double*>(p1) < *static_cast<const double*>(p2))
+ return -1;
+ if (*static_cast<const double*>(p1) > *static_cast<const double*>(p2))
+ return 1;
+ return 0;
+}
+
+inline double distance(double freq, double code) {
+ // return fabs(freq - code);
+ return freq * fabs(log(freq) - log(code));
+}
+
+// Find the index of the code value which is nearest to the given freq
+int qsearch_nearest(double code_book[], double freq, int start, int end) {
+ if (start == end)
+ return start;
+
+ if (start + 1 == end) {
+ if (distance(freq, code_book[end]) > distance(freq, code_book[start]))
+ return start;
+ return end;
+ }
+
+ int mid = (start + end) / 2;
+
+ if (code_book[mid] > freq)
+ return qsearch_nearest(code_book, freq, start, mid);
+ else
+ return qsearch_nearest(code_book, freq, mid, end);
+}
+
+size_t update_code_idx(double freqs[], size_t num, double code_book[],
+ CODEBOOK_TYPE *code_idx) {
+ size_t changed = 0;
+ for (size_t pos = 0; pos < num; pos++) {
+ CODEBOOK_TYPE idx;
+ idx = qsearch_nearest(code_book, freqs[pos], 0, kCodeBookSize - 1);
+ if (idx != code_idx[pos])
+ changed++;
+ code_idx[pos] = idx;
+ }
+ return changed;
+}
+
+double recalculate_kernel(double freqs[], size_t num, double code_book[],
+ CODEBOOK_TYPE *code_idx) {
+ double ret = 0;
+
+ size_t *item_num = new size_t[kCodeBookSize];
+ assert(item_num);
+ memset(item_num, 0, sizeof(size_t) * kCodeBookSize);
+
+ double *cb_new = new double[kCodeBookSize];
+ assert(cb_new);
+ memset(cb_new, 0, sizeof(double) * kCodeBookSize);
+
+ for (size_t pos = 0; pos < num; pos++) {
+ ret += distance(freqs[pos], code_book[code_idx[pos]]);
+
+ cb_new[code_idx[pos]] += freqs[pos];
+ item_num[code_idx[pos]] += 1;
+ }
+
+ for (size_t code = 0; code < kCodeBookSize; code++) {
+ assert(item_num[code] > 0);
+ code_book[code] = cb_new[code] / item_num[code];
+ }
+
+ delete [] item_num;
+ delete [] cb_new;
+
+ return ret;
+}
+
+void iterate_codes(double freqs[], size_t num, double code_book[],
+ CODEBOOK_TYPE *code_idx) {
+ size_t iter_num = 0;
+ double delta_last = 0;
+ do {
+ size_t changed = update_code_idx(freqs, num, code_book, code_idx);
+
+ double delta = recalculate_kernel(freqs, num, code_book, code_idx);
+
+ if (kPrintDebug0) {
+ printf("---Unigram codebook iteration: %d : %d, %.9f\n",
+ iter_num, changed, delta);
+ }
+ iter_num++;
+
+ if (iter_num > 1 &&
+ (delta == 0 || fabs(delta_last - delta)/fabs(delta) < 0.000000001))
+ break;
+ delta_last = delta;
+ } while (true);
+}
+
+
+NGram* NGram::instance_ = NULL;
+
+NGram::NGram() {
+ initialized_ = false;
+ idx_num_ = 0;
+ lma_freq_idx_ = NULL;
+ sys_score_compensation_ = 0;
+
+#ifdef ___BUILD_MODEL___
+ freq_codes_df_ = NULL;
+#endif
+ freq_codes_ = NULL;
+}
+
+NGram::~NGram() {
+ if (NULL != lma_freq_idx_)
+ free(lma_freq_idx_);
+
+#ifdef ___BUILD_MODEL___
+ if (NULL != freq_codes_df_)
+ free(freq_codes_df_);
+#endif
+
+ if (NULL != freq_codes_)
+ free(freq_codes_);
+}
+
+NGram& NGram::get_instance() {
+ if (NULL == instance_)
+ instance_ = new NGram();
+ return *instance_;
+}
+
+bool NGram::save_ngram(FILE *fp) {
+ if (!initialized_ || NULL == fp)
+ return false;
+
+ if (0 == idx_num_ || NULL == freq_codes_ || NULL == lma_freq_idx_)
+ return false;
+
+ if (fwrite(&idx_num_, sizeof(uint32), 1, fp) != 1)
+ return false;
+
+ if (fwrite(freq_codes_, sizeof(LmaScoreType), kCodeBookSize, fp) !=
+ kCodeBookSize)
+ return false;
+
+ if (fwrite(lma_freq_idx_, sizeof(CODEBOOK_TYPE), idx_num_, fp) != idx_num_)
+ return false;
+
+ return true;
+}
+
+bool NGram::load_ngram(QFile *fp) {
+ if (NULL == fp)
+ return false;
+
+ initialized_ = false;
+
+ if (fp->read((char *)&idx_num_, sizeof(uint32)) != sizeof(uint32) )
+ return false;
+
+ if (NULL != lma_freq_idx_)
+ free(lma_freq_idx_);
+
+ if (NULL != freq_codes_)
+ free(freq_codes_);
+
+ lma_freq_idx_ = static_cast<CODEBOOK_TYPE*>
+ (malloc(idx_num_ * sizeof(CODEBOOK_TYPE)));
+ freq_codes_ = static_cast<LmaScoreType*>
+ (malloc(kCodeBookSize * sizeof(LmaScoreType)));
+
+ if (NULL == lma_freq_idx_ || NULL == freq_codes_)
+ return false;
+
+ if (fp->read((char *)freq_codes_, sizeof(LmaScoreType) * kCodeBookSize) !=
+ sizeof(LmaScoreType) * kCodeBookSize)
+ return false;
+
+ if (fp->read((char *)lma_freq_idx_, sizeof(CODEBOOK_TYPE) * idx_num_) != sizeof(CODEBOOK_TYPE) * idx_num_)
+ return false;
+
+ initialized_ = true;
+
+ total_freq_none_sys_ = 0;
+ return true;
+}
+
+void NGram::set_total_freq_none_sys(size_t freq_none_sys) {
+ total_freq_none_sys_ = freq_none_sys;
+ if (0 == total_freq_none_sys_) {
+ sys_score_compensation_ = 0;
+ } else {
+ double factor = static_cast<double>(kSysDictTotalFreq) / (
+ kSysDictTotalFreq + total_freq_none_sys_);
+ sys_score_compensation_ = static_cast<float>(
+ log(factor) * kLogValueAmplifier);
+ }
+}
+
+// The caller makes sure this oject is initialized.
+float NGram::get_uni_psb(LemmaIdType lma_id) {
+ return static_cast<float>(freq_codes_[lma_freq_idx_[lma_id]]) +
+ sys_score_compensation_;
+}
+
+float NGram::convert_psb_to_score(double psb) {
+ float score = static_cast<float>(
+ log(psb) * static_cast<double>(kLogValueAmplifier));
+ if (score > static_cast<float>(kMaxScore)) {
+ score = static_cast<float>(kMaxScore);
+ }
+ return score;
+}
+
+#ifdef ___BUILD_MODEL___
+bool NGram::build_unigram(LemmaEntry *lemma_arr, size_t lemma_num,
+ LemmaIdType next_idx_unused) {
+ if (NULL == lemma_arr || 0 == lemma_num || next_idx_unused <= 1)
+ return false;
+
+ double total_freq = 0;
+ double *freqs = new double[next_idx_unused];
+ if (NULL == freqs)
+ return false;
+
+ freqs[0] = ADD_COUNT;
+ total_freq += freqs[0];
+ LemmaIdType idx_now = 0;
+ for (size_t pos = 0; pos < lemma_num; pos++) {
+ if (lemma_arr[pos].idx_by_hz == idx_now)
+ continue;
+ idx_now++;
+
+ assert(lemma_arr[pos].idx_by_hz == idx_now);
+
+ freqs[idx_now] = lemma_arr[pos].freq;
+ if (freqs[idx_now] <= 0)
+ freqs[idx_now] = 0.3;
+
+ total_freq += freqs[idx_now];
+ }
+
+ double max_freq = 0;
+ idx_num_ = idx_now + 1;
+ assert(idx_now + 1 == next_idx_unused);
+
+ for (size_t pos = 0; pos < idx_num_; pos++) {
+ freqs[pos] = freqs[pos] / total_freq;
+ assert(freqs[pos] > 0);
+ if (freqs[pos] > max_freq)
+ max_freq = freqs[pos];
+ }
+
+ // calculate the code book
+ if (NULL == freq_codes_df_)
+ freq_codes_df_ = new double[kCodeBookSize];
+ assert(freq_codes_df_);
+ memset(freq_codes_df_, 0, sizeof(double) * kCodeBookSize);
+
+ if (NULL == freq_codes_)
+ freq_codes_ = new LmaScoreType[kCodeBookSize];
+ assert(freq_codes_);
+ memset(freq_codes_, 0, sizeof(LmaScoreType) * kCodeBookSize);
+
+ size_t freq_pos = 0;
+ for (size_t code_pos = 0; code_pos < kCodeBookSize; code_pos++) {
+ bool found = true;
+
+ while (found) {
+ found = false;
+ double cand = freqs[freq_pos];
+ for (size_t i = 0; i < code_pos; i++)
+ if (freq_codes_df_[i] == cand) {
+ found = true;
+ break;
+ }
+ if (found)
+ freq_pos++;
+ }
+
+ freq_codes_df_[code_pos] = freqs[freq_pos];
+ freq_pos++;
+ }
+
+ myqsort(freq_codes_df_, kCodeBookSize, sizeof(double), comp_double);
+
+ if (NULL == lma_freq_idx_)
+ lma_freq_idx_ = new CODEBOOK_TYPE[idx_num_];
+ assert(lma_freq_idx_);
+
+ iterate_codes(freqs, idx_num_, freq_codes_df_, lma_freq_idx_);
+
+ delete [] freqs;
+
+ if (kPrintDebug0) {
+ printf("\n------Language Model Unigram Codebook------\n");
+ }
+
+ for (size_t code_pos = 0; code_pos < kCodeBookSize; code_pos++) {
+ double log_score = log(freq_codes_df_[code_pos]);
+ float final_score = convert_psb_to_score(freq_codes_df_[code_pos]);
+ if (kPrintDebug0) {
+ printf("code:%d, probability:%.9f, log score:%.3f, final score: %.3f\n",
+ code_pos, freq_codes_df_[code_pos], log_score, final_score);
+ }
+ freq_codes_[code_pos] = static_cast<LmaScoreType>(final_score);
+ }
+
+ initialized_ = true;
+ return true;
+}
+#endif
+
+} // namespace ime_pinyin
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/pinyinime.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/pinyinime.cpp
index 4d206a76..4d206a76 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/pinyinime.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/pinyinime.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/searchutility.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/searchutility.cpp
index 281da388..281da388 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/searchutility.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/searchutility.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/spellingtable.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/spellingtable.cpp
index 6005e20d..6005e20d 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/spellingtable.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/spellingtable.cpp
diff --git a/src/plugins/pinyin/3rdparty/pinyin/share/spellingtrie.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/spellingtrie.cpp
new file mode 100644
index 00000000..355c56be
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/spellingtrie.cpp
@@ -0,0 +1,831 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include "../include/dictdef.h"
+
+#ifdef _WIN32
+#define snprintf _snprintf
+#endif
+
+#ifdef ___BUILD_MODEL___
+#include "../include/spellingtable.h"
+#endif
+
+#include "../include/spellingtrie.h"
+
+namespace ime_pinyin {
+
+SpellingTrie* SpellingTrie::instance_ = NULL;
+
+// z/c/s is for Zh/Ch/Sh
+const char SpellingTrie::kHalfId2Sc_[kFullSplIdStart + 1] =
+ "0ABCcDEFGHIJKLMNOPQRSsTUVWXYZz";
+
+// Bit 0 : is it a Shengmu char?
+// Bit 1 : is it a Yunmu char? (one char is a Yunmu)
+// Bit 2 : is it enabled in ShouZiMu(first char) mode?
+unsigned char SpellingTrie::char_flags_[] = {
+ // a b c d e f g
+ 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01,
+ // h i j k l m n
+ 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // o p q r s t
+ 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // u v w x y z
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x01
+};
+
+int compare_spl(const void* p1, const void* p2) {
+ return strcmp((const char*)(p1), (const char*)(p2));
+}
+
+SpellingTrie::SpellingTrie() {
+ spelling_buf_ = NULL;
+ spelling_size_ = 0;
+ spelling_num_ = 0;
+ spl_ym_ids_ = NULL;
+ splstr_queried_ = NULL;
+ splstr16_queried_ = NULL;
+ root_ = NULL;
+ dumb_node_ = NULL;
+ splitter_node_ = NULL;
+ instance_ = NULL;
+ ym_buf_ = NULL;
+ f2h_ = NULL;
+
+ szm_enable_shm(true);
+ szm_enable_ym(true);
+
+#ifdef ___BUILD_MODEL___
+ node_num_ = 0;
+#endif
+}
+
+SpellingTrie::~SpellingTrie() {
+ if (NULL != spelling_buf_)
+ delete [] spelling_buf_;
+
+ if (NULL != splstr_queried_)
+ delete [] splstr_queried_;
+
+ if (NULL != splstr16_queried_)
+ delete [] splstr16_queried_;
+
+ if (NULL != spl_ym_ids_)
+ delete [] spl_ym_ids_;
+
+ if (NULL != root_) {
+ free_son_trie(root_);
+ delete root_;
+ }
+
+ if (NULL != dumb_node_) {
+ delete [] dumb_node_;
+ }
+
+ if (NULL != splitter_node_) {
+ delete [] splitter_node_;
+ }
+
+ if (NULL != instance_) {
+ delete instance_;
+ instance_ = NULL;
+ }
+
+ if (NULL != ym_buf_)
+ delete [] ym_buf_;
+
+ if (NULL != f2h_)
+ delete [] f2h_;
+}
+
+bool SpellingTrie::if_valid_id_update(uint16 *splid) const {
+ if (NULL == splid || 0 == *splid)
+ return false;
+
+ if (*splid >= kFullSplIdStart)
+ return true;
+ if (*splid < kFullSplIdStart) {
+ char ch = kHalfId2Sc_[*splid];
+ if (ch > 'Z') {
+ return true;
+ } else {
+ if (szm_is_enabled(ch)) {
+ return true;
+ } else if (is_yunmu_char(ch)) {
+ assert(h2f_num_[*splid] > 0);
+ *splid = h2f_start_[*splid];
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool SpellingTrie::is_half_id(uint16 splid) const {
+ if (0 == splid || splid >= kFullSplIdStart)
+ return false;
+
+ return true;
+}
+
+bool SpellingTrie::is_full_id(uint16 splid) const {
+ if (splid < kFullSplIdStart || splid >= kFullSplIdStart + spelling_num_)
+ return false;
+ return true;
+}
+
+bool SpellingTrie::half_full_compatible(uint16 half_id, uint16 full_id) const {
+ uint16 half_fr_full = full_to_half(full_id);
+
+ if (half_fr_full == half_id)
+ return true;
+
+ // &~0x20 is used to conver the char to upper case.
+ // So that Zh/Ch/Sh(whose char is z/c/s) can be matched with Z/C/S.
+ char ch_f = (kHalfId2Sc_[half_fr_full] & (~0x20));
+ char ch_h = kHalfId2Sc_[half_id];
+ if (ch_f == ch_h)
+ return true;
+
+ return false;
+}
+
+bool SpellingTrie::is_half_id_yunmu(uint16 splid) const {
+ if (0 == splid || splid >= kFullSplIdStart)
+ return false;
+
+ char ch = kHalfId2Sc_[splid];
+ // If ch >= 'a', that means the half id is one of Zh/Ch/Sh
+ if (ch >= 'a') {
+ return false;
+ }
+
+ return char_flags_[ch - 'A'] & kHalfIdYunmuMask;
+}
+
+bool SpellingTrie::is_shengmu_char(char ch) const {
+ return char_flags_[ch - 'A'] & kHalfIdShengmuMask;
+}
+
+bool SpellingTrie::is_yunmu_char(char ch) const {
+ return char_flags_[ch - 'A'] & kHalfIdYunmuMask;
+}
+
+bool SpellingTrie::is_szm_char(char ch) const {
+ return is_shengmu_char(ch) || is_yunmu_char(ch);
+}
+
+bool SpellingTrie::szm_is_enabled(char ch) const {
+ return char_flags_[ch - 'A'] & kHalfIdSzmMask;
+}
+
+void SpellingTrie::szm_enable_shm(bool enable) {
+ if (enable) {
+ for (char ch = 'A'; ch <= 'Z'; ch++) {
+ if (is_shengmu_char(ch))
+ char_flags_[ch - 'A'] = char_flags_[ch - 'A'] | kHalfIdSzmMask;
+ }
+ } else {
+ for (char ch = 'A'; ch <= 'Z'; ch++) {
+ if (is_shengmu_char(ch))
+ char_flags_[ch - 'A'] = char_flags_[ch - 'A'] & (kHalfIdSzmMask ^ 0xff);
+ }
+ }
+}
+
+void SpellingTrie::szm_enable_ym(bool enable) {
+ if (enable) {
+ for (char ch = 'A'; ch <= 'Z'; ch++) {
+ if (is_yunmu_char(ch))
+ char_flags_[ch - 'A'] = char_flags_[ch - 'A'] | kHalfIdSzmMask;
+ }
+ } else {
+ for (char ch = 'A'; ch <= 'Z'; ch++) {
+ if (is_yunmu_char(ch))
+ char_flags_[ch - 'A'] = char_flags_[ch - 'A'] & (kHalfIdSzmMask ^ 0xff);
+ }
+ }
+}
+
+bool SpellingTrie::is_szm_enabled(char ch) const {
+ return char_flags_[ch - 'A'] & kHalfIdSzmMask;
+}
+
+const SpellingTrie* SpellingTrie::get_cpinstance() {
+ return &get_instance();
+}
+
+SpellingTrie& SpellingTrie::get_instance() {
+ if (NULL == instance_)
+ instance_ = new SpellingTrie();
+
+ return *instance_;
+}
+
+uint16 SpellingTrie::half2full_num(uint16 half_id) const {
+ if (NULL == root_ || half_id >= kFullSplIdStart)
+ return 0;
+ return h2f_num_[half_id];
+}
+
+uint16 SpellingTrie::half_to_full(uint16 half_id, uint16 *spl_id_start) const {
+ if (NULL == spl_id_start || NULL == root_ || half_id >= kFullSplIdStart)
+ return 0;
+
+ *spl_id_start = h2f_start_[half_id];
+ return h2f_num_[half_id];
+}
+
+uint16 SpellingTrie::full_to_half(uint16 full_id) const {
+ if (NULL == root_ || full_id < kFullSplIdStart ||
+ full_id > spelling_num_ + kFullSplIdStart)
+ return 0;
+
+ return f2h_[full_id - kFullSplIdStart];
+}
+
+void SpellingTrie::free_son_trie(SpellingNode* node) {
+ if (NULL == node)
+ return;
+
+ for (size_t pos = 0; pos < node->num_of_son; pos++) {
+ free_son_trie(node->first_son + pos);
+ }
+
+ if (NULL != node->first_son)
+ delete [] node->first_son;
+}
+
+bool SpellingTrie::construct(const char* spelling_arr, size_t item_size,
+ size_t item_num, float score_amplifier,
+ unsigned char average_score) {
+ if (spelling_arr == NULL)
+ return false;
+
+ memset(h2f_start_, 0, sizeof(uint16) * kFullSplIdStart);
+ memset(h2f_num_, 0, sizeof(uint16) * kFullSplIdStart);
+
+ // If the arr is the same as the buf, means this function is called by
+ // load_table(), the table data are ready; otherwise the array should be
+ // saved.
+ if (spelling_arr != spelling_buf_) {
+ if (NULL != spelling_buf_)
+ delete [] spelling_buf_;
+ spelling_buf_ = new char[item_size * item_num];
+ if (NULL == spelling_buf_)
+ return false;
+ memcpy(spelling_buf_, spelling_arr, sizeof(char) * item_size * item_num);
+ }
+
+ spelling_size_ = item_size;
+ spelling_num_ = item_num;
+
+ score_amplifier_ = score_amplifier;
+ average_score_ = average_score;
+
+ if (NULL != splstr_queried_)
+ delete [] splstr_queried_;
+ splstr_queried_ = new char[spelling_size_];
+ if (NULL == splstr_queried_)
+ return false;
+
+ if (NULL != splstr16_queried_)
+ delete [] splstr16_queried_;
+ splstr16_queried_ = new char16[spelling_size_];
+ if (NULL == splstr16_queried_)
+ return false;
+
+ // First, sort the buf to ensure they are in ascendant order
+ qsort(spelling_buf_, spelling_num_, spelling_size_, compare_spl);
+
+#ifdef ___BUILD_MODEL___
+ node_num_ = 1;
+#endif
+
+ root_ = new SpellingNode();
+ memset(root_, 0, sizeof(SpellingNode));
+
+ dumb_node_ = new SpellingNode();
+ memset(dumb_node_, 0, sizeof(SpellingNode));
+ dumb_node_->score = average_score_;
+
+ splitter_node_ = new SpellingNode();
+ memset(splitter_node_, 0, sizeof(SpellingNode));
+ splitter_node_->score = average_score_;
+
+ memset(level1_sons_, 0, sizeof(SpellingNode*) * kValidSplCharNum);
+
+ root_->first_son = construct_spellings_subset(0, spelling_num_, 0, root_);
+
+ // Root's score should be cleared.
+ root_->score = 0;
+
+ if (NULL == root_->first_son)
+ return false;
+
+ h2f_start_[0] = h2f_num_[0] = 0;
+
+ if (!build_f2h())
+ return false;
+
+#ifdef ___BUILD_MODEL___
+ if (kPrintDebug0) {
+ printf("---SpellingTrie Nodes: %d\n", (int)node_num_);
+ }
+ return build_ym_info();
+#else
+ return true;
+#endif
+}
+
+#ifdef ___BUILD_MODEL___
+const char* SpellingTrie::get_ym_str(const char *spl_str) {
+ bool start_ZCS = false;
+ if (is_shengmu_char(*spl_str)) {
+ if ('Z' == *spl_str || 'C' == *spl_str || 'S' == *spl_str)
+ start_ZCS = true;
+ spl_str += 1;
+ if (start_ZCS && 'h' == *spl_str)
+ spl_str += 1;
+ }
+ return spl_str;
+}
+
+bool SpellingTrie::build_ym_info() {
+ bool sucess;
+ SpellingTable *spl_table = new SpellingTable();
+
+ sucess = spl_table->init_table(kMaxPinyinSize - 1, 2 * kMaxYmNum, false);
+ assert(sucess);
+
+ for (uint16 pos = 0; pos < spelling_num_; pos++) {
+ const char *spl_str = spelling_buf_ + spelling_size_ * pos;
+ spl_str = get_ym_str(spl_str);
+ if ('\0' != spl_str[0]) {
+ sucess = spl_table->put_spelling(spl_str, 0);
+ assert(sucess);
+ }
+ }
+
+ size_t ym_item_size; // '\0' is included
+ size_t ym_num;
+ const char* ym_buf;
+ ym_buf = spl_table->arrange(&ym_item_size, &ym_num);
+
+ if (NULL != ym_buf_)
+ delete [] ym_buf_;
+ ym_buf_ = new char[ym_item_size * ym_num];
+ if (NULL == ym_buf_) {
+ delete spl_table;
+ return false;
+ }
+
+ memcpy(ym_buf_, ym_buf, sizeof(char) * ym_item_size * ym_num);
+ ym_size_ = ym_item_size;
+ ym_num_ = ym_num;
+
+ delete spl_table;
+
+ // Generate the maping from the spelling ids to the Yunmu ids.
+ if (spl_ym_ids_)
+ delete spl_ym_ids_;
+ spl_ym_ids_ = new uint8[spelling_num_ + kFullSplIdStart];
+ if (NULL == spl_ym_ids_)
+ return false;
+
+ memset(spl_ym_ids_, 0, sizeof(uint8) * (spelling_num_ + kFullSplIdStart));
+
+ for (uint16 id = 1; id < spelling_num_ + kFullSplIdStart; id++) {
+ const char *str = get_spelling_str(id);
+
+ str = get_ym_str(str);
+ if ('\0' != str[0]) {
+ uint8 ym_id = get_ym_id(str);
+ spl_ym_ids_[id] = ym_id;
+ assert(ym_id > 0);
+ } else {
+ spl_ym_ids_[id] = 0;
+ }
+ }
+ return true;
+}
+#endif
+
+SpellingNode* SpellingTrie::construct_spellings_subset(
+ size_t item_start, size_t item_end, size_t level, SpellingNode* parent) {
+ if (level >= spelling_size_ || item_end <= item_start || NULL == parent)
+ return NULL;
+
+ SpellingNode *first_son = NULL;
+ uint16 num_of_son = 0;
+ unsigned char min_son_score = 255;
+
+ const char *spelling_last_start = spelling_buf_ + spelling_size_ * item_start;
+ char char_for_node = spelling_last_start[level];
+ assert((char_for_node >= 'A' && char_for_node <= 'Z') ||
+ 'h' == char_for_node);
+
+ // Scan the array to find how many sons
+ for (size_t i = item_start + 1; i < item_end; i++) {
+ const char *spelling_current = spelling_buf_ + spelling_size_ * i;
+ char char_current = spelling_current[level];
+ if (char_current != char_for_node) {
+ num_of_son++;
+ char_for_node = char_current;
+ }
+ }
+ num_of_son++;
+
+ // Allocate memory
+#ifdef ___BUILD_MODEL___
+ node_num_ += num_of_son;
+#endif
+ first_son = new SpellingNode[num_of_son];
+ memset(first_son, 0, sizeof(SpellingNode)*num_of_son);
+
+ // Now begin construct tree
+ size_t son_pos = 0;
+
+ spelling_last_start = spelling_buf_ + spelling_size_ * item_start;
+ char_for_node = spelling_last_start[level];
+
+ bool spelling_endable = true;
+ if (spelling_last_start[level + 1] != '\0')
+ spelling_endable = false;
+
+ size_t item_start_next = item_start;
+
+ for (size_t i = item_start + 1; i < item_end; i++) {
+ const char *spelling_current = spelling_buf_ + spelling_size_ * i;
+ char char_current = spelling_current[level];
+ assert(is_valid_spl_char(char_current));
+
+ if (char_current != char_for_node) {
+ // Construct a node
+ SpellingNode *node_current = first_son + son_pos;
+ node_current->char_this_node = char_for_node;
+
+ // For quick search in the first level
+ if (0 == level)
+ level1_sons_[char_for_node - 'A'] = node_current;
+
+ if (spelling_endable) {
+ node_current->spelling_idx = kFullSplIdStart + item_start_next;
+ }
+
+ if (spelling_last_start[level + 1] != '\0' || i - item_start_next > 1) {
+ size_t real_start = item_start_next;
+ if (spelling_last_start[level + 1] == '\0')
+ real_start++;
+
+ node_current->first_son =
+ construct_spellings_subset(real_start, i, level + 1,
+ node_current);
+
+ if (real_start == item_start_next + 1) {
+ uint16 score_this = static_cast<unsigned char>(
+ spelling_last_start[spelling_size_ - 1]);
+ if (score_this < node_current->score)
+ node_current->score = score_this;
+ }
+ } else {
+ node_current->first_son = NULL;
+ node_current->score = static_cast<unsigned char>(
+ spelling_last_start[spelling_size_ - 1]);
+ }
+
+ if (node_current->score < min_son_score)
+ min_son_score = node_current->score;
+
+ bool is_half = false;
+ if (level == 0 && is_szm_char(char_for_node)) {
+ node_current->spelling_idx =
+ static_cast<uint16>(char_for_node - 'A' + 1);
+
+ if (char_for_node > 'C')
+ node_current->spelling_idx++;
+ if (char_for_node > 'S')
+ node_current->spelling_idx++;
+
+ h2f_num_[node_current->spelling_idx] = i - item_start_next;
+ is_half = true;
+ } else if (level == 1 && char_for_node == 'h') {
+ char ch_level0 = spelling_last_start[0];
+ uint16 part_id = 0;
+ if (ch_level0 == 'C')
+ part_id = 'C' - 'A' + 1 + 1;
+ else if (ch_level0 == 'S')
+ part_id = 'S' - 'A' + 1 + 2;
+ else if (ch_level0 == 'Z')
+ part_id = 'Z' - 'A' + 1 + 3;
+ if (0 != part_id) {
+ node_current->spelling_idx = part_id;
+ h2f_num_[node_current->spelling_idx] = i - item_start_next;
+ is_half = true;
+ }
+ }
+
+ if (is_half) {
+ if (h2f_num_[node_current->spelling_idx] > 0)
+ h2f_start_[node_current->spelling_idx] =
+ item_start_next + kFullSplIdStart;
+ else
+ h2f_start_[node_current->spelling_idx] = 0;
+ }
+
+ // for next sibling
+ spelling_last_start = spelling_current;
+ char_for_node = char_current;
+ item_start_next = i;
+ spelling_endable = true;
+ if (spelling_current[level + 1] != '\0')
+ spelling_endable = false;
+
+ son_pos++;
+ }
+ }
+
+ // the last one
+ SpellingNode *node_current = first_son + son_pos;
+ node_current->char_this_node = char_for_node;
+
+ // For quick search in the first level
+ if (0 == level)
+ level1_sons_[char_for_node - 'A'] = node_current;
+
+ if (spelling_endable) {
+ node_current->spelling_idx = kFullSplIdStart + item_start_next;
+ }
+
+ if (spelling_last_start[level + 1] != '\0' ||
+ item_end - item_start_next > 1) {
+ size_t real_start = item_start_next;
+ if (spelling_last_start[level + 1] == '\0')
+ real_start++;
+
+ node_current->first_son =
+ construct_spellings_subset(real_start, item_end, level + 1,
+ node_current);
+
+ if (real_start == item_start_next + 1) {
+ uint16 score_this = static_cast<unsigned char>(
+ spelling_last_start[spelling_size_ - 1]);
+ if (score_this < node_current->score)
+ node_current->score = score_this;
+ }
+ } else {
+ node_current->first_son = NULL;
+ node_current->score = static_cast<unsigned char>(
+ spelling_last_start[spelling_size_ - 1]);
+ }
+
+ if (node_current->score < min_son_score)
+ min_son_score = node_current->score;
+
+ assert(son_pos + 1 == num_of_son);
+
+ bool is_half = false;
+ if (level == 0 && szm_is_enabled(char_for_node)) {
+ node_current->spelling_idx = static_cast<uint16>(char_for_node - 'A' + 1);
+
+ if (char_for_node > 'C')
+ node_current->spelling_idx++;
+ if (char_for_node > 'S')
+ node_current->spelling_idx++;
+
+ h2f_num_[node_current->spelling_idx] = item_end - item_start_next;
+ is_half = true;
+ } else if (level == 1 && char_for_node == 'h') {
+ char ch_level0 = spelling_last_start[0];
+ uint16 part_id = 0;
+ if (ch_level0 == 'C')
+ part_id = 'C' - 'A' + 1 + 1;
+ else if (ch_level0 == 'S')
+ part_id = 'S' - 'A' + 1 + 2;
+ else if (ch_level0 == 'Z')
+ part_id = 'Z' - 'A' + 1 + 3;
+ if (0 != part_id) {
+ node_current->spelling_idx = part_id;
+ h2f_num_[node_current->spelling_idx] = item_end - item_start_next;
+ is_half = true;
+ }
+ }
+ if (is_half) {
+ if (h2f_num_[node_current->spelling_idx] > 0)
+ h2f_start_[node_current->spelling_idx] =
+ item_start_next + kFullSplIdStart;
+ else
+ h2f_start_[node_current->spelling_idx] = 0;
+ }
+
+ parent->num_of_son = num_of_son;
+ parent->score = min_son_score;
+ return first_son;
+}
+
+bool SpellingTrie::save_spl_trie(FILE *fp) {
+ if (NULL == fp || NULL == spelling_buf_)
+ return false;
+
+ if (fwrite(&spelling_size_, sizeof(uint32), 1, fp) != 1)
+ return false;
+
+ if (fwrite(&spelling_num_, sizeof(uint32), 1, fp) != 1)
+ return false;
+
+ if (fwrite(&score_amplifier_, sizeof(float), 1, fp) != 1)
+ return false;
+
+ if (fwrite(&average_score_, sizeof(unsigned char), 1, fp) != 1)
+ return false;
+
+ if (fwrite(spelling_buf_, sizeof(char) * spelling_size_,
+ spelling_num_, fp) != spelling_num_)
+ return false;
+
+ return true;
+}
+
+bool SpellingTrie::load_spl_trie(QFile *fp) {
+ if (NULL == fp)
+ return false;
+
+ if (fp->read((char *)&spelling_size_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+ if (fp->read((char *)&spelling_num_, sizeof(uint32)) != sizeof(uint32))
+ return false;
+
+ if (fp->read((char *)&score_amplifier_, sizeof(float)) != sizeof(float))
+ return false;
+
+ if (fp->read((char *)&average_score_, sizeof(unsigned char)) != sizeof(unsigned char))
+ return false;
+
+ if (NULL != spelling_buf_)
+ delete [] spelling_buf_;
+
+ spelling_buf_ = new char[spelling_size_ * spelling_num_];
+ if (NULL == spelling_buf_)
+ return false;
+
+ if (fp->read((char *)spelling_buf_, spelling_size_ * spelling_num_) != spelling_size_ * spelling_num_)
+ return false;
+
+ return construct(spelling_buf_, spelling_size_, spelling_num_,
+ score_amplifier_, average_score_);
+}
+
+bool SpellingTrie::build_f2h() {
+ if (NULL != f2h_)
+ delete [] f2h_;
+ f2h_ = new uint16[spelling_num_];
+ if (NULL == f2h_)
+ return false;
+
+ for (uint16 hid = 0; hid < kFullSplIdStart; hid++) {
+ for (uint16 fid = h2f_start_[hid];
+ fid < h2f_start_[hid] + h2f_num_[hid]; fid++)
+ f2h_[fid - kFullSplIdStart] = hid;
+ }
+
+ return true;
+}
+
+size_t SpellingTrie::get_spelling_num() {
+ return spelling_num_;
+}
+
+uint8 SpellingTrie::get_ym_id(const char *ym_str) {
+ if (NULL == ym_str || NULL == ym_buf_)
+ return 0;
+
+ for (uint8 pos = 0; pos < ym_num_; pos++)
+ if (strcmp(ym_buf_ + ym_size_ * pos, ym_str) == 0)
+ return pos + 1;
+
+ return 0;
+}
+
+const char* SpellingTrie::get_spelling_str(uint16 splid) {
+ splstr_queried_[0] = '\0';
+
+ if (splid >= kFullSplIdStart) {
+ splid -= kFullSplIdStart;
+ snprintf(splstr_queried_, spelling_size_, "%s",
+ spelling_buf_ + splid * spelling_size_);
+ } else {
+ if (splid == 'C' - 'A' + 1 + 1) {
+ snprintf(splstr_queried_, spelling_size_, "%s", "Ch");
+ } else if (splid == 'S' - 'A' + 1 + 2) {
+ snprintf(splstr_queried_, spelling_size_, "%s", "Sh");
+ } else if (splid == 'Z' - 'A' + 1 + 3) {
+ snprintf(splstr_queried_, spelling_size_, "%s", "Zh");
+ } else {
+ if (splid > 'C' - 'A' + 1)
+ splid--;
+ if (splid > 'S' - 'A' + 1)
+ splid--;
+ splstr_queried_[0] = 'A' + splid - 1;
+ splstr_queried_[1] = '\0';
+ }
+ }
+ return splstr_queried_;
+}
+
+const char16* SpellingTrie::get_spelling_str16(uint16 splid) {
+ splstr16_queried_[0] = '\0';
+
+ if (splid >= kFullSplIdStart) {
+ splid -= kFullSplIdStart;
+ for (size_t pos = 0; pos < spelling_size_; pos++) {
+ splstr16_queried_[pos] = static_cast<char16>
+ (spelling_buf_[splid * spelling_size_ + pos]);
+ }
+ } else {
+ if (splid == 'C' - 'A' + 1 + 1) {
+ splstr16_queried_[0] = static_cast<char16>('C');
+ splstr16_queried_[1] = static_cast<char16>('h');
+ splstr16_queried_[2] = static_cast<char16>('\0');
+ } else if (splid == 'S' - 'A' + 1 + 2) {
+ splstr16_queried_[0] = static_cast<char16>('S');
+ splstr16_queried_[1] = static_cast<char16>('h');
+ splstr16_queried_[2] = static_cast<char16>('\0');
+ } else if (splid == 'Z' - 'A' + 1 + 3) {
+ splstr16_queried_[0] = static_cast<char16>('Z');
+ splstr16_queried_[1] = static_cast<char16>('h');
+ splstr16_queried_[2] = static_cast<char16>('\0');
+ } else {
+ if (splid > 'C' - 'A' + 1)
+ splid--;
+ if (splid > 'S' - 'A' + 1)
+ splid--;
+ splstr16_queried_[0] = 'A' + splid - 1;
+ splstr16_queried_[1] = '\0';
+ }
+ }
+ return splstr16_queried_;
+}
+
+size_t SpellingTrie::get_spelling_str16(uint16 splid, char16 *splstr16,
+ size_t splstr16_len) {
+ if (NULL == splstr16 || splstr16_len < kMaxPinyinSize + 1) return 0;
+
+ if (splid >= kFullSplIdStart) {
+ splid -= kFullSplIdStart;
+ for (size_t pos = 0; pos <= kMaxPinyinSize; pos++) {
+ splstr16[pos] = static_cast<char16>
+ (spelling_buf_[splid * spelling_size_ + pos]);
+ if (static_cast<char16>('\0') == splstr16[pos]) {
+ return pos;
+ }
+ }
+ } else {
+ if (splid == 'C' - 'A' + 1 + 1) {
+ splstr16[0] = static_cast<char16>('C');
+ splstr16[1] = static_cast<char16>('h');
+ splstr16[2] = static_cast<char16>('\0');
+ return 2;
+ } else if (splid == 'S' - 'A' + 1 + 2) {
+ splstr16[0] = static_cast<char16>('S');
+ splstr16[1] = static_cast<char16>('h');
+ splstr16[2] = static_cast<char16>('\0');
+ return 2;
+ } else if (splid == 'Z' - 'A' + 1 + 3) {
+ splstr16[0] = static_cast<char16>('Z');
+ splstr16[1] = static_cast<char16>('h');
+ splstr16[2] = static_cast<char16>('\0');
+ return 2;
+ } else {
+ if (splid > 'C' - 'A' + 1)
+ splid--;
+ if (splid > 'S' - 'A' + 1)
+ splid--;
+ splstr16[0] = 'A' + splid - 1;
+ splstr16[1] = '\0';
+ return 1;
+ }
+ }
+
+ // Not reachable.
+ return 0;
+}
+
+} // namespace ime_pinyin
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/splparser.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/splparser.cpp
index d75aec6a..d75aec6a 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/splparser.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/splparser.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/sync.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/sync.cpp
index 91e27b88..91e27b88 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/sync.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/sync.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/userdict.cpp
index 4687da2d..4687da2d 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/userdict.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/utf16char.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/utf16char.cpp
index fadb6cf2..fadb6cf2 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/utf16char.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/utf16char.cpp
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/utf16reader.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/utf16reader.cpp
index d8e5de59..d8e5de59 100644
--- a/src/virtualkeyboard/3rdparty/pinyin/share/utf16reader.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/utf16reader.cpp
diff --git a/src/plugins/pinyin/3rdparty/pinyin/update-patches.sh b/src/plugins/pinyin/3rdparty/pinyin/update-patches.sh
new file mode 100644
index 00000000..ed67686a
--- /dev/null
+++ b/src/plugins/pinyin/3rdparty/pinyin/update-patches.sh
@@ -0,0 +1,40 @@
+#!/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$
+##
+#############################################################################
+
+REV_FILTER=". :!./patches :!./update-patches.sh :!./pinyin.pro :!./qt_attribution.json"
+REV_LIST=$(git rev-list --reverse 59208edaaf40be982904a6c8cad4eab2d14f938e..HEAD -- $REV_FILTER)
+N=5
+
+for REV in $REV_LIST; do
+ if [ $N -gt 0 ]; then
+ git format-patch -1 --start-number $N -o patches $REV -- $REV_FILTER
+ fi
+ N=$((N+1))
+done
diff --git a/src/plugins/pinyin/pinyin.pro b/src/plugins/pinyin/pinyin.pro
new file mode 100644
index 00000000..fda9a573
--- /dev/null
+++ b/src/plugins/pinyin/pinyin.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ 3rdparty/pinyin \
+ plugin
+
+plugin.depends += 3rdparty/pinyin
diff --git a/src/plugins/pinyin/plugin/pinyin.json b/src/plugins/pinyin/plugin/pinyin.json
new file mode 100644
index 00000000..6bb19d11
--- /dev/null
+++ b/src/plugins/pinyin/plugin/pinyin.json
@@ -0,0 +1,6 @@
+{
+ "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
new file mode 100644
index 00000000..4d9890f4
--- /dev/null
+++ b/src/plugins/pinyin/plugin/pinyindecoderservice.cpp
@@ -0,0 +1,236 @@
+/****************************************************************************
+**
+** 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;
+}
+
+QVector<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);
+
+ QVector<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);
+ QVector<QChar> candidateBuf;
+ candidateBuf.resize(kMaxSearchSteps + 1);
+ if (!im_get_candidate(size_t(index), (char16 *)candidateBuf.data(), candidateBuf.length() - 1))
+ return QString();
+ candidateBuf.last() = 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
new file mode 100644
index 00000000..24e08721
--- /dev/null
+++ b/src/plugins/pinyin/plugin/pinyindecoderservice_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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);
+ QVector<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
new file mode 100644
index 00000000..35d481c8
--- /dev/null
+++ b/src/plugins/pinyin/plugin/pinyininputmethod.cpp
@@ -0,0 +1,501 @@
+/****************************************************************************
+**
+** 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 == Qt::Key_Apostrophe) {
+ if (surface.isEmpty())
+ return false;
+ if (surface.endsWith(ch))
+ return true;
+ }
+ surface.append(ch);
+ return true;
+ }
+
+ bool removeSpellingChar()
+ {
+ if (surface.isEmpty())
+ return false;
+ QVector<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);
+ QVector<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
new file mode 100644
index 00000000..b5eb242a
--- /dev/null
+++ b/src/plugins/pinyin/plugin/pinyininputmethod_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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);
+ 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();
+
+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
new file mode 100644
index 00000000..6edef332
--- /dev/null
+++ b/src/plugins/pinyin/plugin/pinyinplugin.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..21146b75
--- /dev/null
+++ b/src/plugins/pinyin/plugin/pinyinplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/pinyin/plugin/plugin.pro b/src/plugins/pinyin/plugin/plugin.pro
new file mode 100644
index 00000000..f66c887e
--- /dev/null
+++ b/src/plugins/pinyin/plugin/plugin.pro
@@ -0,0 +1,59 @@
+TARGET = qtvirtualkeyboard_pinyin
+QT += qml virtualkeyboard
+
+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
+
+include(../../../config.pri)
+
+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
new file mode 100644
index 00000000..b5e8abb5
--- /dev/null
+++ b/src/plugins/plugins.pro
@@ -0,0 +1,19 @@
+TEMPLATE = subdirs
+
+include(../config.pri)
+
+hangul: SUBDIRS += hangul
+hunspell: SUBDIRS += hunspell
+lipi-toolkit: {
+ SUBDIRS += lipi-toolkit
+ !disable-hunspell: lipi-toolkit.depends += hunspell
+}
+openwnn: SUBDIRS += openwnn
+pinyin: SUBDIRS += pinyin
+t9write: SUBDIRS += t9write
+tcime: SUBDIRS += tcime
+myscript: SUBDIRS += myscript
+thai: {
+ SUBDIRS += thai
+ !disable-hunspell: thai.depends += hunspell
+}
diff --git a/src/plugins/t9write/3rdparty/t9write/t9write-build.pri b/src/plugins/t9write/3rdparty/t9write/t9write-build.pri
new file mode 100644
index 00000000..a39291fa
--- /dev/null
+++ b/src/plugins/t9write/3rdparty/t9write/t9write-build.pri
@@ -0,0 +1,83 @@
+#
+# 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
new file mode 100644
index 00000000..b86319ea
--- /dev/null
+++ b/src/plugins/t9write/3rdparty/t9write/t9write.pro
@@ -0,0 +1,26 @@
+TARGET = qtt9write_db
+CONFIG += static
+
+HEADERS += $$files(api/*)
+
+T9WRITE_RESOURCE_FILES = \
+ $$files(data/arabic/*.bin) \
+ $$files(data/hebrew/*.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/virtualkeyboard/3rdparty/t9write/unpack.py b/src/plugins/t9write/3rdparty/t9write/unpack.py
index d3a67923..d3a67923 100644
--- a/src/virtualkeyboard/3rdparty/t9write/unpack.py
+++ b/src/plugins/t9write/3rdparty/t9write/unpack.py
diff --git a/src/plugins/t9write/plugin/plugin.pro b/src/plugins/t9write/plugin/plugin.pro
new file mode 100644
index 00000000..0f68f8c4
--- /dev/null
+++ b/src/plugins/t9write/plugin/plugin.pro
@@ -0,0 +1,116 @@
+TARGET = qtvirtualkeyboard_t9write
+QT += qml virtualkeyboard-private
+
+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(../../../config.pri)
+include(../3rdparty/t9write/t9write-build.pri)
+
+equals(T9WRITE_FOUND, 0): \
+ 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
+t9write-alphabetic {
+ contains(CONFIG, lang-en(_GB)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback
+ contains(CONFIG, lang-en(_US)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback
+ contains(CONFIG, lang-ar.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ar_AR/handwriting.qml
+ contains(CONFIG, lang-bg.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/bg_BG/handwriting.qml
+ contains(CONFIG, lang-cs.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/cs_CZ/handwriting.qml
+ contains(CONFIG, lang-da.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/da_DK/handwriting.fallback
+ contains(CONFIG, lang-de.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/de_DE/handwriting.fallback
+ contains(CONFIG, lang-el.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/el_GR/handwriting.qml
+ contains(CONFIG, lang-es(_ES)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/es_ES/handwriting.qml
+ contains(CONFIG, lang-es(_MX)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/es_MX/handwriting.qml
+ contains(CONFIG, lang-et.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/et_EE/handwriting.fallback
+ contains(CONFIG, lang-fa.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fa_FA/handwriting.qml
+ contains(CONFIG, lang-fi.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fi_FI/handwriting.fallback
+ contains(CONFIG, lang-fr(_FR)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fr_FR/handwriting.fallback
+ contains(CONFIG, lang-fr(_CA)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fr_CA/handwriting.fallback
+ contains(CONFIG, lang-he.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/he_IL/handwriting.qml
+ contains(CONFIG, lang-hr.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hr_HR/handwriting.qml
+ contains(CONFIG, lang-hu.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hu_HU/handwriting.qml
+ contains(CONFIG, lang-id.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback
+ contains(CONFIG, lang-it.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/it_IT/handwriting.fallback
+ contains(CONFIG, lang-ms.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback
+ contains(CONFIG, lang-nb.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nb_NO/handwriting.fallback
+ contains(CONFIG, lang-nl.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback
+ contains(CONFIG, lang-pl.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pl_PL/handwriting.fallback
+ contains(CONFIG, lang-pt(_BR)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pt_BR/handwriting.fallback
+ contains(CONFIG, lang-pt(_PT)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pt_PT/handwriting.fallback
+ contains(CONFIG, lang-ro.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ro_RO/handwriting.qml
+ contains(CONFIG, lang-ru.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ru_RU/handwriting.fallback
+ contains(CONFIG, lang-sk.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sk_SK/handwriting.fallback
+ contains(CONFIG, lang-sl.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sl_SI/handwriting.fallback
+ contains(CONFIG, lang-sq.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sq_AL/handwriting.fallback
+ contains(CONFIG, lang-sr.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sr_SP/handwriting.qml
+ contains(CONFIG, lang-sv.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sv_SE/handwriting.fallback
+ contains(CONFIG, lang-tr.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/tr_TR/handwriting.fallback
+ contains(CONFIG, lang-uk.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/uk_UA/handwriting.fallback
+ contains(CONFIG, lang-vi.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/vi_VN/handwriting.fallback
+}
+t9write-cjk {
+ contains(CONFIG, lang-ja.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ja_JP/handwriting.qml
+ contains(CONFIG, lang-ko.*): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ko_KR/handwriting.qml
+ contains(CONFIG, lang-zh(_CN)?): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/zh_CN/handwriting.qml
+ contains(CONFIG, 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
+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
+ }
+}
+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
new file mode 100644
index 00000000..ac71f7cc
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9write.json
@@ -0,0 +1,6 @@
+{
+ "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
new file mode 100644
index 00000000..c052b4c7
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9write_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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 "t9write_api_version.h"
+#ifdef HAVE_T9WRITE_ALPHABETIC
+#include "decuma_hwr.h"
+#endif
+#ifdef HAVE_T9WRITE_CJK
+#include "decuma_hwr_cjk.h"
+#endif
+#include "decumaFunctionalSupport.h"
+
+#if defined(HAVE_T9WRITE_CJK) && defined(HAVE_T9WRITE_ALPHABETIC)
+#define DECUMA_API(FUNC_NAME) (cjk ? decumaCJK ## FUNC_NAME : decuma ## FUNC_NAME)
+#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
new file mode 100644
index 00000000..5a17ae6d
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9writedictionary.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..d728a583
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9writedictionary_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..5ea1fd42
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9writeinputmethod.cpp
@@ -0,0 +1,2134 @@
+/****************************************************************************
+**
+** 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),
+ dictionaryLock(QMutex::Recursive),
+ 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:
+ 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::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();
+
+ QString dictionary;
+ QDirIterator it(dir, QDirIterator::NoIteratorFlags);
+ while (it.hasNext()) {
+ QString fileEntry = it.next();
+
+ if (!fileEntry.contains(QLatin1String("_") + languageCountry[0].toUpper()))
+ 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)
+ {
+ QMutexLocker 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)
+ {
+ QMutexLocker 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();
+
+ if (!initEngine(mapLocaleToEngineMode(locale)))
+ return false;
+
+ DECUMA_UINT32 language = mapToDecumaLanguage(locale, inputMode);
+ if (language == DECUMA_LANG_GSMDEFAULT) {
+ qCCritical(lcT9Write) << "Language is not supported" << locale.name();
+ 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)
+ {
+#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)
+#endif
+
+#ifdef HAVE_T9WRITE_ALPHABETIC
+ switch (locale.script()) {
+ case QLocale::ArabicScript:
+ return T9WriteInputMethod::EngineMode::Arabic;
+ case QLocale::HebrewScript:
+ return T9WriteInputMethod::EngineMode::Hebrew;
+ 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;
+ }
+
+ 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;
+
+ 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.
+ */
+ QMutexLocker 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;
+ } else {
+ sessionSettings.baseline = 0;
+ sessionSettings.helpline = 0;
+ sessionSettings.topline = 0;
+ sessionSettings.supportLineSet = baselineAndTopline;
+ }
+
+ 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("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_STATUS status = DECUMA_API(NoteSelectedCandidate)(decumaSession, resultIndex);
+ Q_UNUSED(status)
+ Q_ASSERT(status == decumaNoError);
+ }
+
+ 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("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;
+ QVector<DECUMA_UINT32> languageCategories;
+ QVector<DECUMA_UINT32> symbolCategories;
+ QScopedPointer<T9WriteWorker> worker;
+ QList<QVirtualKeyboardTrace *> traceList;
+ int traceListHardLimit;
+ QMutex 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;
+ 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;
+#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) {
+ QMutexLocker 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
+ QMutexLocker 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)
+{
+ 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();
+ }
+ }
+ 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
new file mode 100644
index 00000000..fe4b1b5a
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9writeinputmethod_p.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** 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,
+ 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
new file mode 100644
index 00000000..25c1366f
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9writeplugin.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..570aea46
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9writeplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..be9b4d9e
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9writeworker.cpp
@@ -0,0 +1,404 @@
+/****************************************************************************
+**
+** 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)
+{
+ qCDebug(lcT9Write) << "T9WriteRecognitionTask():" << "boostLevel:" << boostLevel << "stringStart:" << stringStart;
+}
+
+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
new file mode 100644
index 00000000..5657ebb4
--- /dev/null
+++ b/src/plugins/t9write/plugin/t9writeworker_p.h
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** 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 <QVector>
+
+#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;
+ QVector<DECUMA_HWR_RESULT> results;
+ DECUMA_UINT16 numResults;
+ int instantGesture;
+ const int id;
+ const int maxResults;
+ const int maxCharsPerWord;
+
+private:
+ QVector<DECUMA_UNICODE> _chars;
+ QVector<DECUMA_INT16> _symbolChars;
+ QVector<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
new file mode 100644
index 00000000..5b59353a
--- /dev/null
+++ b/src/plugins/t9write/t9write.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ 3rdparty/t9write \
+ plugin
+
+plugin.depends += 3rdparty/t9write
diff --git a/src/virtualkeyboard/3rdparty/tcime/COPYING b/src/plugins/tcime/3rdparty/tcime/COPYING
index 72844840..72844840 100644
--- a/src/virtualkeyboard/3rdparty/tcime/COPYING
+++ b/src/plugins/tcime/3rdparty/tcime/COPYING
diff --git a/src/plugins/tcime/3rdparty/tcime/cangjiedictionary.cpp b/src/plugins/tcime/3rdparty/tcime/cangjiedictionary.cpp
new file mode 100644
index 00000000..7326b839
--- /dev/null
+++ b/src/plugins/tcime/3rdparty/tcime/cangjiedictionary.cpp
@@ -0,0 +1,141 @@
+/*
+ * Qt implementation of TCIME library
+ * This file is part of the Qt Virtual Keyboard module.
+ * Contact: http://www.qt.io/licensing/
+ *
+ * Copyright (C) 2015 The Qt Company
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "cangjiedictionary.h"
+#include "cangjietable.h"
+
+using namespace tcime;
+
+bool CangjieDictionary::_simplified = false;
+
+CangjieDictionary::CangjieDictionary() :
+ WordDictionary(),
+ _collator(QLocale(QLatin1String("zh_TW")))
+{
+}
+
+bool CangjieDictionary::simplified() const
+{
+ return _simplified;
+}
+
+void CangjieDictionary::setSimplified(bool simplified)
+{
+ _simplified = simplified;
+}
+
+QStringList CangjieDictionary::getWords(const QString &input) const
+{
+ // Look up the index in the dictionary for the specified input.
+ int primaryIndex = CangjieTable::getPrimaryIndex(input);
+ if (primaryIndex < 0 || primaryIndex >= dictionary().size())
+ return QStringList();
+
+ // [25 * 26] char[] array; each primary entry points to a char[]
+ // containing words with the same primary index; then words can be looked up
+ // by their secondary index stored at the beginning of each char[].
+ const DictionaryEntry &data = dictionary()[primaryIndex];
+ if (data.isEmpty())
+ return QStringList();
+
+ if (_simplified)
+ // Sort words of this primary index for simplified-cangjie.
+ return sortWords(data);
+
+ int secondaryIndex = CangjieTable::getSecondaryIndex(input);
+ if (secondaryIndex < 0)
+ return QStringList();
+
+ // Find words match this secondary index for cangjie.
+ return searchWords(secondaryIndex, data);
+}
+
+class DictionaryComparator
+{
+public:
+ explicit DictionaryComparator(const std::vector<QCollatorSortKey> &sortKeys) :
+ sortKeys(sortKeys)
+ {}
+
+ bool operator()(int a, int b)
+ {
+ return sortKeys[a] < sortKeys[b];
+ }
+
+private:
+ const std::vector<QCollatorSortKey> &sortKeys;
+};
+
+QStringList CangjieDictionary::sortWords(const DictionaryEntry &data) const
+{
+ int length = data.size() / 2;
+ std::vector<QCollatorSortKey> sortKeys;
+ QVector<int> keys;
+ sortKeys.reserve(length);
+ keys.reserve(length);
+ for (int i = 0; i < length; ++i) {
+ sortKeys.push_back(_collator.sortKey(data[length + i]));
+ keys.append(i);
+ }
+ DictionaryComparator dictionaryComparator(sortKeys);
+ std::sort(keys.begin(), keys.end(), dictionaryComparator);
+
+ QStringList words;
+ for (int i = 0; i < length; ++i)
+ words.append(data[length + keys[i]]);
+
+ return words;
+}
+
+QStringList CangjieDictionary::searchWords(int secondaryIndex, const DictionaryEntry &data) const
+{
+ int length = data.size() / 2;
+
+ DictionaryEntry::ConstIterator start = data.constBegin();
+ DictionaryEntry::ConstIterator end = start + length;
+ DictionaryEntry::ConstIterator rangeStart = qBinaryFind(start, end, (DictionaryWord)secondaryIndex);
+ if (rangeStart == end)
+ return QStringList();
+
+ // There may be more than one words with the same index; look up words with
+ // the same secondary index.
+ while (rangeStart != start) {
+ if (*(rangeStart - 1) != (DictionaryWord)secondaryIndex)
+ break;
+ rangeStart--;
+ }
+
+ DictionaryEntry::ConstIterator rangeEnd = rangeStart + 1;
+ while (rangeEnd != end) {
+ if (*rangeEnd != (DictionaryWord)secondaryIndex)
+ break;
+ rangeEnd++;
+ }
+
+ QStringList words;
+ words.reserve(rangeEnd - rangeStart);
+ for (DictionaryEntry::ConstIterator rangeIndex = rangeStart; rangeIndex < rangeEnd; ++rangeIndex) {
+ DictionaryEntry::ConstIterator item(rangeIndex + length);
+ words.append(*item);
+ }
+
+ return words;
+}
diff --git a/src/virtualkeyboard/3rdparty/tcime/cangjiedictionary.h b/src/plugins/tcime/3rdparty/tcime/cangjiedictionary.h
index b87013a9..b87013a9 100644
--- a/src/virtualkeyboard/3rdparty/tcime/cangjiedictionary.h
+++ b/src/plugins/tcime/3rdparty/tcime/cangjiedictionary.h
diff --git a/src/virtualkeyboard/3rdparty/tcime/cangjietable.cpp b/src/plugins/tcime/3rdparty/tcime/cangjietable.cpp
index ee8ae4f8..ee8ae4f8 100644
--- a/src/virtualkeyboard/3rdparty/tcime/cangjietable.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/cangjietable.cpp
diff --git a/src/virtualkeyboard/3rdparty/tcime/cangjietable.h b/src/plugins/tcime/3rdparty/tcime/cangjietable.h
index 54adced3..54adced3 100644
--- a/src/virtualkeyboard/3rdparty/tcime/cangjietable.h
+++ b/src/plugins/tcime/3rdparty/tcime/cangjietable.h
diff --git a/src/virtualkeyboard/3rdparty/tcime/data/java/dict_cangjie.dat b/src/plugins/tcime/3rdparty/tcime/data/java/dict_cangjie.dat
index 1c692c48..1c692c48 100644
--- a/src/virtualkeyboard/3rdparty/tcime/data/java/dict_cangjie.dat
+++ b/src/plugins/tcime/3rdparty/tcime/data/java/dict_cangjie.dat
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/tcime/data/java/dict_phrases.dat b/src/plugins/tcime/3rdparty/tcime/data/java/dict_phrases.dat
index 0b34ee1f..0b34ee1f 100644
--- a/src/virtualkeyboard/3rdparty/tcime/data/java/dict_phrases.dat
+++ b/src/plugins/tcime/3rdparty/tcime/data/java/dict_phrases.dat
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/tcime/data/java/dict_zhuyin.dat b/src/plugins/tcime/3rdparty/tcime/data/java/dict_zhuyin.dat
index 3587635e..3587635e 100644
--- a/src/virtualkeyboard/3rdparty/tcime/data/java/dict_zhuyin.dat
+++ b/src/plugins/tcime/3rdparty/tcime/data/java/dict_zhuyin.dat
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/tcime/data/qt/dict_cangjie.dat b/src/plugins/tcime/3rdparty/tcime/data/qt/dict_cangjie.dat
index f99ed965..f99ed965 100644
--- a/src/virtualkeyboard/3rdparty/tcime/data/qt/dict_cangjie.dat
+++ b/src/plugins/tcime/3rdparty/tcime/data/qt/dict_cangjie.dat
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/tcime/data/qt/dict_phrases.dat b/src/plugins/tcime/3rdparty/tcime/data/qt/dict_phrases.dat
index 463301f9..463301f9 100644
--- a/src/virtualkeyboard/3rdparty/tcime/data/qt/dict_phrases.dat
+++ b/src/plugins/tcime/3rdparty/tcime/data/qt/dict_phrases.dat
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/tcime/data/qt/dict_zhuyin.dat b/src/plugins/tcime/3rdparty/tcime/data/qt/dict_zhuyin.dat
index 6aee7de5..6aee7de5 100644
--- a/src/virtualkeyboard/3rdparty/tcime/data/qt/dict_zhuyin.dat
+++ b/src/plugins/tcime/3rdparty/tcime/data/qt/dict_zhuyin.dat
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/tcime/phrasedictionary.cpp b/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp
index cdeaecdd..cdeaecdd 100644
--- a/src/virtualkeyboard/3rdparty/tcime/phrasedictionary.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp
diff --git a/src/virtualkeyboard/3rdparty/tcime/phrasedictionary.h b/src/plugins/tcime/3rdparty/tcime/phrasedictionary.h
index 06fe9578..06fe9578 100644
--- a/src/virtualkeyboard/3rdparty/tcime/phrasedictionary.h
+++ b/src/plugins/tcime/3rdparty/tcime/phrasedictionary.h
diff --git a/src/virtualkeyboard/3rdparty/tcime/qt_attribution.json b/src/plugins/tcime/3rdparty/tcime/qt_attribution.json
index 717f87ac..717f87ac 100644
--- a/src/virtualkeyboard/3rdparty/tcime/qt_attribution.json
+++ b/src/plugins/tcime/3rdparty/tcime/qt_attribution.json
diff --git a/src/plugins/tcime/3rdparty/tcime/tcime.pro b/src/plugins/tcime/3rdparty/tcime/tcime.pro
new file mode 100644
index 00000000..d9fc4f2e
--- /dev/null
+++ b/src/plugins/tcime/3rdparty/tcime/tcime.pro
@@ -0,0 +1,37 @@
+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/virtualkeyboard/3rdparty/tcime/tools/dict2qt.class b/src/plugins/tcime/3rdparty/tcime/tools/dict2qt.class
index d1e70d8e..d1e70d8e 100644
--- a/src/virtualkeyboard/3rdparty/tcime/tools/dict2qt.class
+++ b/src/plugins/tcime/3rdparty/tcime/tools/dict2qt.class
Binary files differ
diff --git a/src/virtualkeyboard/3rdparty/tcime/tools/dict2qt.java b/src/plugins/tcime/3rdparty/tcime/tools/dict2qt.java
index 6dd81212..6dd81212 100644
--- a/src/virtualkeyboard/3rdparty/tcime/tools/dict2qt.java
+++ b/src/plugins/tcime/3rdparty/tcime/tools/dict2qt.java
diff --git a/src/virtualkeyboard/3rdparty/tcime/worddictionary.cpp b/src/plugins/tcime/3rdparty/tcime/worddictionary.cpp
index 6bc0a9e2..6bc0a9e2 100644
--- a/src/virtualkeyboard/3rdparty/tcime/worddictionary.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/worddictionary.cpp
diff --git a/src/virtualkeyboard/3rdparty/tcime/worddictionary.h b/src/plugins/tcime/3rdparty/tcime/worddictionary.h
index 3f1ea43e..3f1ea43e 100644
--- a/src/virtualkeyboard/3rdparty/tcime/worddictionary.h
+++ b/src/plugins/tcime/3rdparty/tcime/worddictionary.h
diff --git a/src/virtualkeyboard/3rdparty/tcime/zhuyindictionary.cpp b/src/plugins/tcime/3rdparty/tcime/zhuyindictionary.cpp
index 1cf303c1..1cf303c1 100644
--- a/src/virtualkeyboard/3rdparty/tcime/zhuyindictionary.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/zhuyindictionary.cpp
diff --git a/src/virtualkeyboard/3rdparty/tcime/zhuyindictionary.h b/src/plugins/tcime/3rdparty/tcime/zhuyindictionary.h
index c9469b72..c9469b72 100644
--- a/src/virtualkeyboard/3rdparty/tcime/zhuyindictionary.h
+++ b/src/plugins/tcime/3rdparty/tcime/zhuyindictionary.h
diff --git a/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp b/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
new file mode 100644
index 00000000..8198122a
--- /dev/null
+++ b/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
@@ -0,0 +1,161 @@
+/*
+ * Qt implementation of TCIME library
+ * This file is part of the Qt Virtual Keyboard module.
+ * Contact: http://www.qt.io/licensing/
+ *
+ * Copyright (C) 2015 The Qt Company
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "zhuyintable.h"
+#include <QStringList>
+
+using namespace tcime;
+
+const int ZhuyinTable::INITIALS_SIZE = 22;
+const QList<QChar> ZhuyinTable::yiEndingFinals = QList<QChar>()
+ << 0x311a << 0x311b << 0x311d << 0x311e << 0x3120 << 0x3121 << 0x3122
+ << 0x3123 << 0x3124 << 0x3125;
+const QList<QChar> ZhuyinTable::wuEndingFinals = QList<QChar>()
+ << 0x311a << 0x311b << 0x311e << 0x311f << 0x3122 << 0x3123 << 0x3124
+ << 0x3125;
+const QList<QChar> ZhuyinTable::yuEndingFinals = QList<QChar>()
+ << 0x311d << 0x3122 << 0x3123 << 0x3125;
+const int ZhuyinTable::YI_FINALS_INDEX = 14;
+const int ZhuyinTable::WU_FINALS_INDEX = 25;
+const int ZhuyinTable::YU_FINALS_INDEX = 34;
+const QChar ZhuyinTable::YI_FINALS = 0x3127;
+const QChar ZhuyinTable::WU_FINALS = 0x3128;
+const QChar ZhuyinTable::YU_FINALS = 0x3129;
+const QList<QChar> ZhuyinTable::tones = QList<QChar>()
+ << ZhuyinTable::DEFAULT_TONE << 0x02d9 << 0x02ca << 0x02c7 << 0x02cb;
+const QChar ZhuyinTable::DEFAULT_TONE = QLatin1Char(' ');
+
+int ZhuyinTable::getInitials(const QChar &initials)
+{
+ // Calculate the index by its distance to the first initials 'ㄅ' (b).
+ int index = initials.unicode() - 0x3105 + 1;
+ if (index >= ZhuyinTable::INITIALS_SIZE)
+ // Syllables starting with finals can still be valid.
+ return 0;
+
+ return (index >= 0) ? index : -1;
+}
+
+int ZhuyinTable::getFinals(const QString &finals)
+{
+ if (finals.length() == 0)
+ // Syllables ending with no finals can still be valid.
+ return 0;
+
+ if (finals.length() > 2)
+ return -1;
+
+ // Compute the index instead of direct lookup the whole array to save
+ // traversing time. First calculate the distance to the first finals
+ // 'ㄚ' (a).
+ const QChar firstFinal = finals.at(0);
+ int index = firstFinal.unicode() - 0x311a + 1;
+ if (index < YI_FINALS_INDEX)
+ return index;
+
+ // Check 'ㄧ' (yi), 'ㄨ' (wu) , and 'ㄩ' (yu) group finals.
+ QList<QChar> endingFinals;
+ if (firstFinal == YI_FINALS) {
+ index = YI_FINALS_INDEX;
+ endingFinals = yiEndingFinals;
+ } else if (firstFinal == WU_FINALS) {
+ index = WU_FINALS_INDEX;
+ endingFinals = wuEndingFinals;
+ } else if (firstFinal == YU_FINALS) {
+ index = YU_FINALS_INDEX;
+ endingFinals = yuEndingFinals;
+ } else {
+ return -1;
+ }
+
+ if (finals.length() == 1)
+ return index;
+
+ for (int i = 0; i < endingFinals.size(); ++i) {
+ if (finals.at(1) == endingFinals[i])
+ return index + i + 1;
+ }
+ return -1;
+}
+
+int ZhuyinTable::getSyllablesIndex(const QString &syllables)
+{
+ if (syllables.isEmpty())
+ return -1;
+
+ int initials = getInitials(syllables.at(0));
+ if (initials < 0)
+ return -1;
+
+ // Strip out initials before getting finals column-index.
+ int finals = getFinals((initials != 0) ? syllables.mid(1) : syllables);
+ if (finals < 0)
+ return -1;
+
+ return (finals * INITIALS_SIZE + initials);
+}
+
+int ZhuyinTable::getTones(const QChar &c)
+{
+ for (int i = 0; i < tones.size(); ++i) {
+ if (tones[i] == c)
+ return i;
+ }
+ // Treat all other characters as the default tone with the index 0.
+ return 0;
+}
+
+int ZhuyinTable::getTonesCount()
+{
+ return tones.size();
+}
+
+bool ZhuyinTable::isTone(const QChar &c)
+{
+ for (int i = 0; i < tones.size(); ++i) {
+ if (tones[i] == c)
+ return true;
+ }
+ return false;
+}
+
+bool ZhuyinTable::isYiWuYuFinals(const QChar &c)
+{
+ ushort unicode = c.unicode();
+ return unicode == YI_FINALS || unicode == WU_FINALS || unicode == YU_FINALS;
+}
+
+QStringList ZhuyinTable::stripTones(const QString &input)
+{
+ const int last = input.length() - 1;
+ if (last < 0)
+ return QStringList();
+
+ QChar tone = input.at(last);
+ if (isTone(tone)) {
+ QString syllables = input.left(last);
+ if (syllables.length() <= 0)
+ return QStringList();
+ return QStringList() << syllables << QString(tone);
+ }
+ // Treat the tone-less input as the default tone (tone-0).
+ return QStringList() << input << QString(DEFAULT_TONE);
+}
diff --git a/src/virtualkeyboard/3rdparty/tcime/zhuyintable.h b/src/plugins/tcime/3rdparty/tcime/zhuyintable.h
index 8512574e..8512574e 100644
--- a/src/virtualkeyboard/3rdparty/tcime/zhuyintable.h
+++ b/src/plugins/tcime/3rdparty/tcime/zhuyintable.h
diff --git a/src/plugins/tcime/plugin/plugin.pro b/src/plugins/tcime/plugin/plugin.pro
new file mode 100644
index 00000000..9ac49798
--- /dev/null
+++ b/src/plugins/tcime/plugin/plugin.pro
@@ -0,0 +1,65 @@
+TARGET = qtvirtualkeyboard_tcime
+QT += qml virtualkeyboard
+
+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
+
+include(../../../config.pri)
+
+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
+
+cangjie: DEFINES += HAVE_TCIME_CANGJIE
+zhuyin: DEFINES += HAVE_TCIME_ZHUYIN
+QMAKE_USE += tcime
+!no-bundle-tcime {
+ TCIME_FILES += ../3rdparty/tcime/data/qt/dict_phrases.dat
+ cangjie: TCIME_FILES += \
+ ../3rdparty/tcime/data/qt/dict_cangjie.dat
+ 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
+ cangjie: tcime_data.files += \
+ $$PWD/../3rdparty/tcime/data/qt/dict_cangjie.dat
+ 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
new file mode 100644
index 00000000..421ae0cc
--- /dev/null
+++ b/src/plugins/tcime/plugin/tcime.json
@@ -0,0 +1,6 @@
+{
+ "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
new file mode 100644
index 00000000..a8ba9a4e
--- /dev/null
+++ b/src/plugins/tcime/plugin/tcimeplugin.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..124c7db4
--- /dev/null
+++ b/src/plugins/tcime/plugin/tcimeplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/tcime/plugin/tcinputmethod.cpp b/src/plugins/tcime/plugin/tcinputmethod.cpp
new file mode 100644
index 00000000..abbbdd36
--- /dev/null
+++ b/src/plugins/tcime/plugin/tcinputmethod.cpp
@@ -0,0 +1,554 @@
+/****************************************************************************
+**
+** 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 defined(HAVE_TCIME_CANGJIE)
+#include "cangjiedictionary.h"
+#include "cangjietable.h"
+#endif
+#if defined(HAVE_TCIME_ZHUYIN)
+#include "zhuyindictionary.h"
+#include "zhuyintable.h"
+#endif
+#include "phrasedictionary.h"
+#include <QLoggingCategory>
+
+#include <QLibraryInfo>
+#include <QFileInfo>
+
+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 defined(HAVE_TCIME_CANGJIE)
+ case QVirtualKeyboardInputEngine::InputMode::Cangjie:
+ accept = composeCangjie(ic, c);
+ break;
+#endif
+#if defined(HAVE_TCIME_ZHUYIN)
+ case QVirtualKeyboardInputEngine::InputMode::Zhuyin:
+ accept = composeZhuyin(ic, c);
+ break;
+#endif
+ default:
+ accept = false;
+ break;
+ }
+ return accept;
+ }
+
+#if defined(HAVE_TCIME_CANGJIE)
+ bool composeCangjie(QVirtualKeyboardInputContext *ic, const QChar &c)
+ {
+ bool accept = false;
+ if (!input.contains(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 defined(HAVE_TCIME_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;
+
+ QStringList pair = ZhuyinTable::stripTones(input);
+ if (pair.isEmpty())
+ // 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 = 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(QString(c)) > 0) {
+ // Replace the finals in the decomposed of syllables and tones.
+ QList<QChar> decomposed = decomposeZhuyin();
+ if (ZhuyinTable::isYiWuYuFinals(c)) {
+ decomposed[1] = c;
+ } else {
+ decomposed[2] = c;
+ }
+
+ // Compose back the text after the finals replacement.
+ input.clear();
+ for (int i = 0; i < decomposed.length(); ++i) {
+ if (!decomposed[i].isNull())
+ input.append(decomposed[i]);
+ }
+ } 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;
+ }
+
+ QList<QChar> decomposeZhuyin()
+ {
+ QList<QChar> results = QList<QChar>() << 0 << 0 << 0 << 0;
+ QStringList pair = ZhuyinTable::stripTones(input);
+ if (!pair.isEmpty()) {
+ // Decompose tones.
+ QChar tone = pair[1].at(0);
+ if (tone != ZhuyinTable::DEFAULT_TONE)
+ results[3] = tone;
+
+ // Decompose initials.
+ QString syllables = 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 defined(HAVE_TCIME_CANGJIE)
+ CangjieDictionary cangjieDictionary;
+#endif
+#if defined(HAVE_TCIME_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 defined(HAVE_TCIME_CANGJIE)
+ Q_D(const TCInputMethod);
+ return d->cangjieDictionary.simplified();
+#else
+ return false;
+#endif
+}
+
+void TCInputMethod::setSimplified(bool simplified)
+{
+ qCDebug(lcTCIme) << "TCInputMethod::setSimplified(): " << simplified;
+#if defined(HAVE_TCIME_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 defined(HAVE_TCIME_ZHUYIN)
+ << QVirtualKeyboardInputEngine::InputMode::Zhuyin
+#endif
+#if defined(HAVE_TCIME_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 defined(HAVE_TCIME_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 defined(HAVE_TCIME_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 defined(HAVE_TCIME_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 defined(HAVE_TCIME_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
new file mode 100644
index 00000000..5915c3ab
--- /dev/null
+++ b/src/plugins/tcime/plugin/tcinputmethod_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** 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/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);
+ 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();
+
+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
new file mode 100644
index 00000000..558d431a
--- /dev/null
+++ b/src/plugins/tcime/tcime.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ 3rdparty/tcime \
+ plugin
+
+plugin.depends += 3rdparty/tcime
diff --git a/src/plugins/thai/plugin/plugin.pro b/src/plugins/thai/plugin/plugin.pro
new file mode 100644
index 00000000..81f05b4b
--- /dev/null
+++ b/src/plugins/thai/plugin/plugin.pro
@@ -0,0 +1,47 @@
+TARGET = qtvirtualkeyboard_thai
+QT += qml virtualkeyboard
+
+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
+
+include(../../../config.pri)
+
+!disable-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
new file mode 100644
index 00000000..aac036cb
--- /dev/null
+++ b/src/plugins/thai/plugin/thai.json
@@ -0,0 +1,6 @@
+{
+ "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
new file mode 100644
index 00000000..57dc8a67
--- /dev/null
+++ b/src/plugins/thai/plugin/thaiinputmethod.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..12ab5d3b
--- /dev/null
+++ b/src/plugins/thai/plugin/thaiinputmethod_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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);
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode);
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase);
+#endif
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/thai/plugin/thaiplugin.cpp b/src/plugins/thai/plugin/thaiplugin.cpp
new file mode 100644
index 00000000..1f9428fc
--- /dev/null
+++ b/src/plugins/thai/plugin/thaiplugin.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..d3ab2728
--- /dev/null
+++ b/src/plugins/thai/plugin/thaiplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/thai/thai.pro b/src/plugins/thai/thai.pro
new file mode 100644
index 00000000..b6e92972
--- /dev/null
+++ b/src/plugins/thai/thai.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ plugin
diff --git a/src/settings/plugins.qmltypes b/src/settings/plugins.qmltypes
new file mode 100644
index 00000000..4ad5e4ae
--- /dev/null
+++ b/src/settings/plugins.qmltypes
@@ -0,0 +1,50 @@
+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.Settings 2.2'
+
+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
new file mode 100644
index 00000000..ac07347d
--- /dev/null
+++ b/src/settings/qmldir
@@ -0,0 +1,5 @@
+module QtQuick.VirtualKeyboard.Settings
+plugin qtquickvirtualkeyboardsettingsplugin
+classname QtQuickVirtualKeyboardSettingsPlugin
+typeinfo plugins.qmltypes
+depends QtQuick 2.0
diff --git a/src/settings/qtquickvirtualkeyboardsettingsplugin.cpp b/src/settings/qtquickvirtualkeyboardsettingsplugin.cpp
new file mode 100644
index 00000000..131696e1
--- /dev/null
+++ b/src/settings/qtquickvirtualkeyboardsettingsplugin.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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"));
+}
+
+QT_END_NAMESPACE
diff --git a/src/settings/qtquickvirtualkeyboardsettingsplugin.h b/src/settings/qtquickvirtualkeyboardsettingsplugin.h
new file mode 100644
index 00000000..22ebef32
--- /dev/null
+++ b/src/settings/qtquickvirtualkeyboardsettingsplugin.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** 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);
+};
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKVIRTUALKEYBOARDSETTINGSPLUGIN_H
+
diff --git a/src/settings/settings.pro b/src/settings/settings.pro
new file mode 100644
index 00000000..ec5a5147
--- /dev/null
+++ b/src/settings/settings.pro
@@ -0,0 +1,23 @@
+TARGET = qtquickvirtualkeyboardsettingsplugin
+TARGETPATH = QtQuick/VirtualKeyboard/Settings
+IMPORT_VERSION = 2.2
+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/src.pro b/src/src.pro
index fafeb6ec..fc840d28 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -2,38 +2,16 @@ TEMPLATE = subdirs
include(config.pri)
-!disable-hunspell:exists(virtualkeyboard/3rdparty/hunspell/src/hunspell/hunspell.h) {
- SUBDIRS += virtualkeyboard/3rdparty/hunspell
- virtualkeyboard.depends += virtualkeyboard/3rdparty/hunspell
-}
-
-openwnn {
- SUBDIRS += virtualkeyboard/3rdparty/openwnn
- virtualkeyboard.depends += virtualkeyboard/3rdparty/openwnn
-}
-
-pinyin {
- SUBDIRS += virtualkeyboard/3rdparty/pinyin
- virtualkeyboard.depends += virtualkeyboard/3rdparty/pinyin
-}
-
-tcime {
- SUBDIRS += virtualkeyboard/3rdparty/tcime
- virtualkeyboard.depends += virtualkeyboard/3rdparty/tcime
-}
-
-lipi-toolkit {
- SUBDIRS += virtualkeyboard/3rdparty/lipi-toolkit
- virtualkeyboard.depends += virtualkeyboard/3rdparty/lipi-toolkit
-}
-
-t9write {
- SUBDIRS += virtualkeyboard/3rdparty/t9write
- virtualkeyboard.depends += virtualkeyboard/3rdparty/t9write
-}
-
SUBDIRS += \
virtualkeyboard \
- virtualkeyboard/import \
- virtualkeyboard/settings \
- virtualkeyboard/styles
+ import \
+ settings \
+ styles \
+ plugin \
+ plugins
+
+import.depends += virtualkeyboard
+settings.depends += virtualkeyboard
+styles.depends += virtualkeyboard
+plugin.depends += virtualkeyboard
+plugins.depends += virtualkeyboard
diff --git a/src/virtualkeyboard/styles/KeyIcon.qml b/src/styles/KeyIcon.qml
index 645fe11e..645fe11e 100644
--- a/src/virtualkeyboard/styles/KeyIcon.qml
+++ b/src/styles/KeyIcon.qml
diff --git a/src/virtualkeyboard/styles/KeyPanel.qml b/src/styles/KeyPanel.qml
index 4e12b9a8..4e12b9a8 100644
--- a/src/virtualkeyboard/styles/KeyPanel.qml
+++ b/src/styles/KeyPanel.qml
diff --git a/src/styles/KeyboardStyle.qml b/src/styles/KeyboardStyle.qml
new file mode 100644
index 00000000..c3a6f4dd
--- /dev/null
+++ b/src/styles/KeyboardStyle.qml
@@ -0,0 +1,530 @@
+/****************************************************************************
+**
+** 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 KeyboardStyle
+ \inqmlmodule QtQuick.VirtualKeyboard.Styles
+ \brief Provides a styling interface for the Virtual Keyboard.
+ \ingroup qtvirtualkeyboard-styles-qml
+
+ The style type provides the style definitions that are used by
+ the InputPanel to decorate the virtual keyboard.
+
+ The design size specifies the aspect ratio of the virtual keyboard.
+ Styles are scalable according to \l scaleHint, which is
+ calculated from the keyboard's actual height and design height.
+*/
+
+QtObject {
+ /*! The current height of the keyboard. */
+ property real keyboardHeight
+
+ /*! The design width of the keyboard. */
+ property real keyboardDesignWidth
+
+ /*! The design height of the keyboard. */
+ property real keyboardDesignHeight
+
+ /*! The keyboard style scale hint. This value is determined by dividing
+ \l keyboardHeight by \l keyboardDesignHeight. All pixel
+ dimensions must be proportional to this value.
+ */
+ readonly property real scaleHint: keyboardHeight / keyboardDesignHeight
+
+ /*!
+ The distance between the left-most keys and the left edge of the
+ keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
+ width.
+ */
+ property real keyboardRelativeLeftMargin: 0
+
+ /*!
+ The distance between the right-most keys and the right edge of the
+ keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
+ width.
+
+ This value is proportional to the keyboard's width.
+ */
+ property real keyboardRelativeRightMargin: 0
+
+ /*!
+ The distance between the top-most keys and the top edge of the
+ keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
+ height.
+ */
+ property real keyboardRelativeTopMargin: 0
+
+ /*!
+ The distance between the bottom-most keys and the bottom edge of the
+ keyboard container, expressed as a percentage (\c 0.0 - \c 1.0) of the
+ keyboard's height.
+ */
+ property real keyboardRelativeBottomMargin: 0
+
+ /*! Template for the keyboard background.
+
+ Example:
+ \code
+ keyboardBackground: Rectangle {
+ color: "black"
+ }
+ \endcode
+ */
+ property Component keyboardBackground: null
+
+ /*! Template for the regular keys.
+
+ \note The delegate must be based on the KeyPanel type.
+
+ Example:
+ \code
+ keyPanel: KeyPanel {
+ Rectangle {
+ anchors.fill: parent
+ ...
+ Text {
+ anchors.fill: parent
+ text: control.displayText
+ ...
+ }
+ }
+ }
+ \endcode
+ */
+ property Component keyPanel: null
+
+ /*! Template for the backspace key.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component backspaceKeyPanel: null
+
+ /*! Template for the language key.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component languageKeyPanel: null
+
+ /*! Template for the enter key.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component enterKeyPanel: null
+
+ /*! Template for the hide key.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component hideKeyPanel: null
+
+ /*! Template for the shift key.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component shiftKeyPanel: null
+
+ /*! Template for the space key.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component spaceKeyPanel: null
+
+ /*! Template for the symbol mode key.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component symbolKeyPanel: null
+
+ /*! Template for the generic mode key.
+
+ This template provides a visualization of the key in which the state
+ can be on or off. This template is used in situations where the key label
+ will remain the same regardless of status.
+
+ The current state is available in the \c control.mode property.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component modeKeyPanel: null
+
+ /*! Template for the handwriting mode key.
+
+ \note The delegate must be based on the KeyPanel type.
+ */
+ property Component handwritingKeyPanel: null
+
+ /*!
+ Number of pixels between the top of each key and the bottom of the
+ characterPreviewDelegate.
+ */
+ property real characterPreviewMargin: 0
+
+ /*! Template for the character preview popup.
+
+ If the delegate contains the \c text property, the property is updated
+ with the display text when the component becomes active.
+
+ \code
+ property string text
+ \endcode
+
+ Example:
+ \code
+ characterPreviewDelegate: Item {
+ property string text
+ id: characterPreview
+ Rectangle {
+ id: characterPreviewBackground
+ anchors.fill: parent
+ ...
+ Text {
+ text: characterPreview.text
+ anchors.fill: parent
+ ...
+ }
+ }
+ }
+ \endcode
+ */
+ property Component characterPreviewDelegate: null
+
+ /*! Width of the alternate keys list item. */
+ property real alternateKeysListItemWidth: 0
+
+ /*! Height of the alternate keys list item. */
+ property real alternateKeysListItemHeight: 0
+
+ /*! Top margin for the alternate keys list panel. */
+ property real alternateKeysListTopMargin: 0
+
+ /*! Bottom margin for the alternate keys list panel. */
+ property real alternateKeysListBottomMargin: 0
+
+ /*! Left margin for the alternate keys list panel. */
+ property real alternateKeysListLeftMargin: 0
+
+ /*! Right margin for the alternate keys list panel. */
+ property real alternateKeysListRightMargin: 0
+
+ /*! Template for the alternative keys list item.
+
+ \note The delegate is used in a \l ListView.
+ */
+ property Component alternateKeysListDelegate: null
+
+ /*! Template for the alternative keys list highlight.
+
+ \note The delegate is used as \c ListView.highlight.
+ */
+ property Component alternateKeysListHighlight: null
+
+ /*! Template for the alternative keys list background. */
+ property Component alternateKeysListBackground: null
+
+ /*! Selection list height. */
+ property real selectionListHeight: 0
+
+ /*! Template for the selection list item.
+
+ \note The delegate is used in a \l ListView.
+ \note The delegate must be based on the \l SelectionListItem type.
+
+ The following properties are available to the item:
+ \list
+ \li \c display Display text for the current item.
+ \li \c wordCompletionLength Word completion length measured from the end of the display text.
+ \li \c dictionary Dictionary type of the word, see QVirtualKeyboardSelectionListModel::DictionaryType.
+ \li \c canRemoveSuggestion A boolean indicating if the word can be removed from dictionary.
+ \endlist
+ */
+ property Component selectionListDelegate: null
+
+ /*! Template for the selection list highlight.
+
+ \note The delegate is used as \c ListView.highlight.
+ */
+ property Component selectionListHighlight: null
+
+ /*! Template for the selection list background. */
+ property Component selectionListBackground: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 1.3
+
+ This property holds the transition to apply to items that
+ are added to the selection list view.
+ */
+ property Transition selectionListAdd
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 1.3
+
+ This property holds the transition to apply to items that
+ are removed from the selection list view.
+ */
+ property Transition selectionListRemove
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 1.1
+
+ Template for the navigation highlight item.
+
+ This item is used in \l {Configuration Options}{arrow-key-navigation}
+ mode to highlight the navigation focus on the keyboard.
+
+ The item is typically a transparent rectangle with a
+ high contrast border.
+ */
+ property Component navigationHighlight: null
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ Template for the trace input key.
+
+ \note The delegate must be based on the TraceInputKeyPanel type.
+ */
+ property Component traceInputKeyPanelDelegate: null
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ Template for rendering a Trace object.
+
+ \note The delegate must be based on the TraceCanvas type.
+ */
+ property Component traceCanvasDelegate: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ Template for the popup list item.
+
+ \note The delegate is used in a \l ListView.
+ \note The delegate must be based on the \l SelectionListItem type.
+
+ The following properties are available to the item:
+ \list
+ \li \c display Display text for the current item.
+ \li \c wordCompletionLength Word completion length measured from the end of the display text.
+ \li \c dictionary Dictionary type of the word, see QVirtualKeyboardSelectionListModel::DictionaryType.
+ \li \c canRemoveSuggestion A boolean indicating if the word can be removed from dictionary.
+ \endlist
+ */
+ property Component popupListDelegate: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ Template for the popup list highlight.
+
+ \note The delegate is used as \c ListView.highlight.
+ */
+ property Component popupListHighlight: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ Template for the popup list background.
+ */
+ property Component popupListBackground: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ This property holds the transition to apply to items that
+ are added to the popup list view.
+ */
+ property Transition popupListAdd
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ This property holds the transition to apply to items that
+ are removed from the popup list view.
+ */
+ property Transition popupListRemove
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ This property determines whether a popup list will be shown when the
+ language key is clicked. If this property is \c false, clicking the
+ language key cycles through the available languages one at a time.
+
+ The default value is \c false.
+ */
+ property bool languagePopupListEnabled: false
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ Template for the language list item.
+
+ \note The delegate is used in a \l ListView.
+ \note The delegate must be based on the \l SelectionListItem type.
+
+ The following properties are available to the item:
+ \list
+ \li \c displayName Display name of the language.
+ \endlist
+ */
+ property Component languageListDelegate: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ Template for the language list highlight.
+
+ \note The delegate is used as \c ListView.highlight.
+ */
+ property Component languageListHighlight: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ Template for the language list background.
+ */
+ property Component languageListBackground: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ This property holds the transition to apply to items that
+ are added to the language list view.
+ */
+ property Transition languageListAdd
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ This property holds the transition to apply to items that
+ are removed from the language list view.
+ */
+ property Transition languageListRemove
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.1
+
+ This item is used to indicate where the bounds of the text selection is
+ and to be able to interactively move the start or end of the selection.
+ The same item is used for both start and end selection.
+
+ Selection handles are currently only supported for the
+ \l {Integration Method}{application-based integration method}.
+ */
+ property Component selectionHandle: null
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the delegate for the background of the full screen
+ input container.
+ */
+ property Component fullScreenInputContainerBackground: null
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the delegate for the background of the full screen
+ input.
+ */
+ property Component fullScreenInputBackground: null
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the margins around the full screen input field.
+
+ The default value is \c 0.
+ */
+ property real fullScreenInputMargins: 0
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the padding around the full screen input content.
+
+ The default value is \c 0.
+ */
+ property real fullScreenInputPadding: 0
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the delegate for the cursor in the full screen input
+ field.
+
+ The delegate should toggle the visibility of the cursor according to
+ the \c {parent.blinkStatus} property defined for the full screen input
+ field. For example:
+
+ \code
+ fullScreenInputCursor: Rectangle {
+ width: 1
+ color: "#000"
+ visible: parent.blinkStatus
+ }
+ \endcode
+ */
+ property Component fullScreenInputCursor: null
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the \c font for the full screen input field.
+ */
+ property font fullScreenInputFont
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the password mask character for the full screen
+ input field.
+ */
+ property string fullScreenInputPasswordCharacter: "\u2022"
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the text color for the full screen input field.
+
+ The default color is black.
+ */
+ property color fullScreenInputColor: "#000"
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the selection color for the full screen input
+ field.
+
+ The default color is semi-transparent black.
+ */
+ property color fullScreenInputSelectionColor: Qt.rgba(0, 0, 0, 0.15)
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 2.2
+
+ This property holds the selected text color for the full screen input
+ field.
+
+ The default color is set to \c fullScreenInputColor.
+ */
+ property color fullScreenInputSelectedTextColor: fullScreenInputColor
+}
diff --git a/src/styles/SelectionListItem.qml b/src/styles/SelectionListItem.qml
new file mode 100644
index 00000000..c480659f
--- /dev/null
+++ b/src/styles/SelectionListItem.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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 SelectionListItem
+ \inqmlmodule QtQuick.VirtualKeyboard.Styles
+ \brief A base type for selection list item delegates.
+ \ingroup qtvirtualkeyboard-styles-qml
+
+ The SelectionListItem enables mouse handling for the selection list item
+ delegates.
+*/
+
+Item {
+ id: selectionListItem
+ height: parent.height
+
+ /*!
+ \since QtQuick.VirtualKeyboard.Styles 1.1
+
+ Sets the sound effect to be played on touch event.
+ */
+ property url soundEffect
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ onClicked: {
+ if (index === -1)
+ return
+ selectionListItem.ListView.view.currentIndex = index
+ selectionListItem.ListView.view.model.selectItem(index)
+ }
+ onPressAndHold: {
+ if (index === -1)
+ return
+ if (typeof selectionListItem.ListView.view.longPressItem != "function")
+ return
+ selectionListItem.ListView.view.longPressItem(index)
+ }
+ }
+}
diff --git a/src/styles/TraceCanvas.qml b/src/styles/TraceCanvas.qml
new file mode 100644
index 00000000..ce8f03a7
--- /dev/null
+++ b/src/styles/TraceCanvas.qml
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** 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 "TraceUtils.js" as TraceUtils
+
+/*!
+ \qmltype TraceCanvas
+ \inqmlmodule QtQuick.VirtualKeyboard.Styles
+ \brief A specialized Canvas type for rendering Trace objects.
+ \ingroup qtvirtualkeyboard-styles-qml
+ \inherits Canvas
+ \since QtQuick.VirtualKeyboard 2.0
+
+ This type provides capabilities for rendering Trace objects on the screen.
+
+ To make the Trace rendering available in the keyboard, this type must be
+ declared as the \l {KeyboardStyle::traceCanvasDelegate}
+ {KeyboardStyle.traceCanvasDelegate} component.
+
+ \code
+ traceCanvasDelegate: TraceCanvas {
+ }
+ \endcode
+
+ Custom drawing attributes can be initialized in the Canvas.available
+ signal. For example:
+
+ \code
+ onAvailableChanged: {
+ if (!available)
+ return;
+ var ctx = getContext("2d")
+ ctx.lineWidth = 8 * scaleHint
+ ctx.lineCap = "round"
+ ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
+ ctx.fillStyle = ctx.strokeStyle
+ }
+ \endcode
+
+ The type offers built-in options for Trace rendering. Currently
+ the following rendering options are available:
+
+ \list
+ \li \c renderSmoothedLine Renders smoothed line with round corners (the default)
+ \endlist
+
+ The rendering function can be changed with the renderFunction property.
+
+ \code
+ renderFunction: renderSmoothedLine
+ \endcode
+
+ Custom rendering function is also supported. Consider the following example:
+
+ \code
+ renderFunction: renderCustomLine
+
+ function renderCustomLine() {
+ getContext("2d")
+ var points = trace.points()
+
+ ...
+ }
+ \endcode
+*/
+
+Canvas {
+ id: canvas
+
+ /*! Provides access to \l Trace object.
+ */
+ property var trace
+
+ /*! Enables auto destruction mode.
+
+ If enabled, this item will be destroyed when the \c trace object is
+ destroyed.
+
+ The default value is false.
+ */
+ property bool autoDestroy
+
+ /*! Specifies the approximate delay in milliseconds, counted from the beginning of the
+ auto destruction, before the object is to be destroyed.
+
+ This delay makes it possible, for example, to animate the item before destruction.
+
+ The default value is 0.
+ */
+ property int autoDestroyDelay
+
+ /*! This property defines the rendering function.
+
+ The default value is \c renderSmoothedLine
+ */
+ property var renderFunction: renderSmoothedLine
+
+ property int __renderPos
+
+ property bool __renderingEnabled
+
+ /*! Renders smoothed line with round corners.
+
+ This function is incremental and renders only the new part added to the Trace.
+
+ This function does not alter any of the canvas attributes (i.e. they can be set elsewhere.)
+ */
+ function renderSmoothedLine() {
+ __renderPos = TraceUtils.renderSmoothedLine(getContext("2d"), trace, __renderPos)
+ }
+
+ onTraceChanged: if (trace === null && autoDestroy) destroy(autoDestroyDelay)
+
+ onAvailableChanged: {
+ __renderingEnabled = available
+ if (__renderingEnabled)
+ requestAnimationFrame(renderFunction)
+ }
+
+ Connections {
+ target: canvas.__renderingEnabled && trace ? trace : null
+ onLengthChanged: if (renderFunction) canvas.requestAnimationFrame(renderFunction)
+ onFinalChanged: if (renderFunction) canvas.requestAnimationFrame(renderFunction)
+ }
+
+ opacity: trace ? trace.opacity : 1.0
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 1500
+ easing.type: Easing.InOutQuad
+ }
+ }
+}
diff --git a/src/virtualkeyboard/styles/TraceInputKeyPanel.qml b/src/styles/TraceInputKeyPanel.qml
index d128a12b..d128a12b 100644
--- a/src/virtualkeyboard/styles/TraceInputKeyPanel.qml
+++ b/src/styles/TraceInputKeyPanel.qml
diff --git a/src/styles/TraceUtils.js b/src/styles/TraceUtils.js
new file mode 100644
index 00000000..c02ce5e9
--- /dev/null
+++ b/src/styles/TraceUtils.js
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+.pragma library
+
+function renderSmoothedLine(ctx, trace, renderPos) {
+
+ if (!trace)
+ return renderPos
+
+ if (renderPos >= trace.length)
+ return renderPos
+
+ // Fetch points and draw the initial "dot"
+ var points, tp
+ if (renderPos === 0) {
+ points = trace.points()
+ tp = points[renderPos++]
+ ctx.beginPath()
+ ctx.moveTo(tp.x, tp.y)
+ ctx.lineTo(tp.x, tp.y + 0.000001)
+ ctx.stroke()
+ } else {
+ points = trace.points(renderPos - 1)
+ }
+
+ // Draw smoothed line using quadratic curve
+ var i = 1
+ if (i + 1 < points.length) {
+ var pt1, pt2
+ if (renderPos === 1) {
+ tp = points[i - 1]
+ } else {
+ pt1 = points[i - 1]
+ pt2 = points[i]
+ tp = Qt.point((pt1.x + pt2.x) / 2, (pt1.y + pt2.y) / 2)
+ }
+ ctx.beginPath()
+ ctx.moveTo(tp.x, tp.y)
+ while (i + 1 < points.length) {
+ pt1 = points[i++]
+ pt2 = points[i]
+ tp = Qt.point((pt1.x + pt2.x) / 2, (pt1.y + pt2.y) / 2)
+ ctx.quadraticCurveTo(pt1.x, pt1.y, tp.x, tp.y)
+ ctx.moveTo(tp.x, tp.y)
+ }
+ ctx.stroke()
+ }
+
+ // Draw the remainder of the line
+ if (trace.final) {
+ if (i < points.length) {
+ tp = points[i - 1]
+ ctx.beginPath()
+ ctx.moveTo(tp.x, tp.y)
+ tp = points[i++]
+ ctx.lineTo(tp.x, tp.y)
+ ctx.stroke()
+ }
+ }
+
+ return renderPos + i - 1
+}
diff --git a/src/styles/plugins.qmltypes b/src/styles/plugins.qmltypes
new file mode 100644
index 00000000..37266bb0
--- /dev/null
+++ b/src/styles/plugins.qmltypes
@@ -0,0 +1,1804 @@
+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.2'
+
+Module {
+ dependencies: []
+ Component {
+ prototype: "QObject"
+ 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" }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ prototype: "QObject"
+ 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" }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ prototype: "QObject"
+ 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" }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ prototype: "QObject"
+ 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" }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ 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.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: "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 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.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.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 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/SelectionListItem 1.0"
+ exports: ["QtQuick.VirtualKeyboard.Styles/SelectionListItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "soundEffect"; type: "QUrl" }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ prototype: "QObject"
+ 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" }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ prototype: "QObject"
+ 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" }
+ Property { name: "available"; type: "bool"; isReadonly: true }
+ Property { name: "contextType"; type: "string" }
+ Property { name: "context"; type: "QQmlV4Handle"; isReadonly: true }
+ Property { name: "canvasSize"; type: "QSizeF" }
+ Property { name: "tileSize"; type: "QSize" }
+ Property { name: "canvasWindow"; type: "QRectF" }
+ Property { name: "renderTarget"; type: "RenderTarget" }
+ Property { name: "renderStrategy"; type: "RenderStrategy" }
+ Signal {
+ name: "paint"
+ Parameter { name: "region"; type: "QRect" }
+ }
+ Signal { name: "painted" }
+ Signal { name: "imageLoaded" }
+ Method {
+ name: "loadImage"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "unloadImage"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageLoaded"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageLoading"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageError"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "getContext"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "requestAnimationFrame"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "cancelRequestAnimationFrame"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "requestPaint" }
+ Method {
+ name: "markDirty"
+ Parameter { name: "dirtyRect"; type: "QRectF" }
+ }
+ Method { name: "markDirty" }
+ Method {
+ name: "save"
+ type: "bool"
+ Parameter { name: "filename"; type: "string" }
+ }
+ Method {
+ name: "toDataURL"
+ type: "string"
+ Parameter { name: "type"; type: "string" }
+ }
+ Method { name: "toDataURL"; type: "string" }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ prototype: "QObject"
+ 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" }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+}
diff --git a/src/styles/qmldir b/src/styles/qmldir
new file mode 100644
index 00000000..6f4705fc
--- /dev/null
+++ b/src/styles/qmldir
@@ -0,0 +1,5 @@
+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
new file mode 100644
index 00000000..f090974e
--- /dev/null
+++ b/src/styles/qtquickvirtualkeyboardstylesplugin.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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 "qtquickvirtualkeyboardstylesplugin.h"
+#include "svgimageprovider.h"
+
+#include <qqml.h>
+#include <QtCore/QLibraryInfo>
+#include <QtVirtualKeyboard/private/qvirtualkeyboard_staticplugin_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmlmodule QtQuick.VirtualKeyboard.Styles 2.2
+ \title Qt Quick Virtual Keyboard Styles QML Types
+ \ingroup qmlmodules
+
+ \brief Provides styling for Qt Virtual Keyboard.
+
+ The QML types can be imported into your application using the following
+ import statements in your .qml file:
+
+ \code
+ import QtQuick.VirtualKeyboard.Styles 2.2
+ \endcode
+*/
+
+void QtQuickVirtualKeyboardStylesPlugin::registerTypes(const char *uri)
+{
+#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");
+}
+
+void QtQuickVirtualKeyboardStylesPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
+{
+ Q_UNUSED(uri)
+ engine->addImageProvider(QStringLiteral("qtvkbsvg"), new SvgImageProvider());
+}
+
+QT_END_NAMESPACE
diff --git a/src/styles/qtquickvirtualkeyboardstylesplugin.h b/src/styles/qtquickvirtualkeyboardstylesplugin.h
new file mode 100644
index 00000000..e9c89ddf
--- /dev/null
+++ b/src/styles/qtquickvirtualkeyboardstylesplugin.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** 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 QTQUICKVIRTUALKEYBOARDSTYLESPLUGIN_H
+#define QTQUICKVIRTUALKEYBOARDSTYLESPLUGIN_H
+
+#include <QQmlExtensionPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickVirtualKeyboardStylesPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ QtQuickVirtualKeyboardStylesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri);
+ void initializeEngine(QQmlEngine *engine, const char *uri);
+};
+
+QT_END_NAMESPACE
+
+#endif // STYLES_PLUGIN_H
+
diff --git a/src/styles/styles.pro b/src/styles/styles.pro
new file mode 100644
index 00000000..aa7280e2
--- /dev/null
+++ b/src/styles/styles.pro
@@ -0,0 +1,34 @@
+TARGET = qtquickvirtualkeyboardstylesplugin
+TARGETPATH = QtQuick/VirtualKeyboard/Styles
+IMPORT_VERSION = 2.2
+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/virtualkeyboard/styles/styles.qrc b/src/styles/styles.qrc
index 819d4771..819d4771 100644
--- a/src/virtualkeyboard/styles/styles.qrc
+++ b/src/styles/styles.qrc
diff --git a/src/styles/svgimageprovider.cpp b/src/styles/svgimageprovider.cpp
new file mode 100644
index 00000000..d4e16d80
--- /dev/null
+++ b/src/styles/svgimageprovider.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** 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 "svgimageprovider.h"
+#include <QImage>
+#include <QPixmap>
+#include <QSvgRenderer>
+#include <QPainter>
+
+SvgImageProvider::SvgImageProvider() :
+ QQuickImageProvider(QQuickImageProvider::Pixmap)
+{
+}
+
+SvgImageProvider::~SvgImageProvider()
+{
+}
+
+QPixmap SvgImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
+{
+ QSize imageSize(-1, -1);
+ QUrl request(id);
+ QString imagePath = QLatin1String(":/") + request.path();
+ if (request.hasQuery()) {
+ const QString query = request.query();
+ const QStringList paramList = query.split(QLatin1Char('&'), QString::SkipEmptyParts);
+ QVariantMap params;
+ for (const QString &param : paramList) {
+ QStringList keyValue = param.split(QLatin1Char('='), QString::SkipEmptyParts);
+ if (keyValue.length() == 2)
+ params[keyValue[0]] = keyValue[1];
+ }
+ const auto widthIt = params.constFind(QLatin1String("width"));
+ if (widthIt != params.cend()) {
+ bool ok = false;
+ int value = widthIt.value().toInt(&ok);
+ if (ok)
+ imageSize.setWidth(value);
+ }
+ const auto heightIt = params.constFind(QLatin1String("height"));
+ if (heightIt != params.cend()) {
+ bool ok = false;
+ int value = heightIt.value().toInt(&ok);
+ if (ok)
+ imageSize.setHeight(value);
+ }
+ } else {
+ imageSize = requestedSize;
+ }
+
+ QPixmap image;
+ if ((imageSize.width() > 0 || imageSize.height() > 0) && imagePath.endsWith(QLatin1String(".svg"))) {
+ QSvgRenderer renderer(imagePath);
+ QSize defaultSize(renderer.defaultSize());
+ if (defaultSize.isEmpty())
+ return image;
+ if (imageSize.width() <= 0 && imageSize.height() > 0) {
+ double aspectRatio = (double)defaultSize.width() / (double)defaultSize.height();
+ imageSize.setWidth(qRound(imageSize.height() * aspectRatio));
+ } else if (imageSize.width() > 0 && imageSize.height() <= 0) {
+ double aspectRatio = (double)defaultSize.width() / (double)defaultSize.height();
+ imageSize.setHeight(qRound(imageSize.width() / aspectRatio));
+ }
+ image = QPixmap(imageSize);
+ image.fill(Qt::transparent);
+ QPainter painter(&image);
+ renderer.render(&painter, image.rect());
+ } else {
+ image = QPixmap(imagePath);
+ imageSize = image.size();
+ }
+
+ QPixmap result;
+ if (requestedSize.isValid() && requestedSize != imageSize)
+ result = image.scaled(requestedSize, Qt::KeepAspectRatio);
+ else
+ result = image;
+
+ *size = result.size();
+
+ return result;
+}
diff --git a/src/virtualkeyboard/styles/svgimageprovider.h b/src/styles/svgimageprovider.h
index 476689bf..476689bf 100644
--- a/src/virtualkeyboard/styles/svgimageprovider.h
+++ b/src/styles/svgimageprovider.h
diff --git a/src/virtualkeyboard/3rdparty/openwnn/openwnn.pro b/src/virtualkeyboard/3rdparty/openwnn/openwnn.pro
deleted file mode 100644
index 9d9fc9b5..00000000
--- a/src/virtualkeyboard/3rdparty/openwnn/openwnn.pro
+++ /dev/null
@@ -1,56 +0,0 @@
-TARGET = qtopenwnn
-
-VERSION = 1.3.6
-CONFIG += static
-CONFIG += warn_off
-
-MODULE_INCLUDEPATH = $$PWD/wnnEngine/include
-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
-
-load(qt_helper_lib)
-
-CONFIG += qt
-QT = core-private
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp b/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp
deleted file mode 100644
index 82022c8e..00000000
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/composingtext.cpp
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * Qt implementation of OpenWnn library
- * This file is part of the Qt Virtual Keyboard module.
- * Contact: http://www.qt.io/licensing/
- *
- * Copyright (C) 2015 The Qt Company
- * Copyright (C) 2008-2012 OMRON SOFTWARE Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "composingtext.h"
-
-#include <QtCore/private/qobject_p.h>
-
-class ComposingTextPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(ComposingText)
-public:
- ComposingTextPrivate(ComposingText *q_ptr) :
- QObjectPrivate(),
- q_ptr(q_ptr)
- {
- memset(mCursor, 0, sizeof(mCursor));
- }
-
- void modifyUpper(ComposingText::TextLayer layer, int mod_from, int mod_len, int org_len)
- {
- Q_Q(ComposingText);
- if (layer >= (ComposingText::MAX_LAYER - 1)) {
- /* no layer above */
- return;
- }
-
- ComposingText::TextLayer uplayer = (ComposingText::TextLayer)(layer + 1);
- QList<StrSegment> &strUplayer = mStringLayer[uplayer];
- if (strUplayer.size() <= 0) {
- /*
- * if there is no element on above layer,
- * add a element includes whole elements of the lower layer.
- */
- strUplayer.append(StrSegment(q->toString(layer), 0, mStringLayer[layer].size() - 1));
- modifyUpper(uplayer, 0, 1, 0);
- return;
- }
-
- int mod_to = mod_from + ((mod_len == 0) ? 0 : (mod_len - 1));
- int org_to = mod_from + ((org_len == 0) ? 0 : (org_len - 1));
- StrSegment &last = strUplayer[strUplayer.size() - 1];
- if (last.to < mod_from) {
- /* add at the tail */
- last.to = mod_to;
- last.string = q->toString(layer, last.from, last.to);
- modifyUpper(uplayer, strUplayer.size()-1, 1, 1);
- return;
- }
-
- int uplayer_mod_from = -1;
- int uplayer_org_to = -1;
- for (int i = 0; i < strUplayer.size(); i++) {
- const StrSegment &ss = strUplayer.at(i);
- if (ss.from > mod_from) {
- if (ss.to <= org_to) {
- /* the segment is included */
- if (uplayer_mod_from < 0) {
- uplayer_mod_from = i;
- }
- uplayer_org_to = i;
- } else {
- /* included in this segment */
- uplayer_org_to = i;
- break;
- }
- } else {
- if (org_len == 0 && ss.from == mod_from) {
- /* when an element is added */
- uplayer_mod_from = i - 1;
- uplayer_org_to = i - 1;
- break;
- } else {
- /* start from this segment */
- uplayer_mod_from = i;
- uplayer_org_to = i;
- if (ss.to >= org_to) {
- break;
- }
- }
- }
- }
-
- int diff = mod_len - org_len;
- if (uplayer_mod_from >= 0) {
- /* update an element */
- StrSegment &ss = strUplayer[uplayer_mod_from];
- int last_to = ss.to;
- int next = uplayer_mod_from + 1;
- for (int i = next; i <= uplayer_org_to; i++) {
- const StrSegment &ss2 = strUplayer.at(next);
- if (last_to > ss2.to) {
- last_to = ss2.to;
- }
- strUplayer.removeAt(next);
- }
- ss.to = (last_to < mod_to)? mod_to : (last_to + diff);
-
- ss.string = q->toString(layer, ss.from, ss.to);
-
- for (int i = next; i < strUplayer.size(); i++) {
- StrSegment &ss2 = strUplayer[i];
- ss2.from += diff;
- ss2.to += diff;
- }
-
- modifyUpper(uplayer, uplayer_mod_from, 1, uplayer_org_to - uplayer_mod_from + 1);
- } else {
- /* add an element at the head */
- strUplayer.insert(0, StrSegment(q->toString(layer, mod_from, mod_to), mod_from, mod_to));
- for (int i = 1; i < strUplayer.size(); i++) {
- StrSegment &ss = strUplayer[i];
- ss.from += diff;
- ss.to += diff;
- }
- modifyUpper(uplayer, 0, 1, 0);
- }
- }
-
- void deleteStrSegment0(ComposingText::TextLayer layer, int from, int to, int diff)
- {
- QList<StrSegment> &strLayer = mStringLayer[layer];
- if (diff != 0) {
- for (int i = to + 1; i < strLayer.size(); i++) {
- StrSegment &ss = strLayer[i];
- ss.from -= diff;
- ss.to -= diff;
- }
- }
- for (int i = from; i <= to; i++) {
- strLayer.removeAt(from);
- }
- }
-
- void replaceStrSegment0(ComposingText::TextLayer layer, const QList<StrSegment> &str, int from, int to)
- {
- QList<StrSegment> &strLayer = mStringLayer[layer];
-
- if (from < 0 || from > strLayer.size()) {
- from = strLayer.size();
- }
- if (to < 0 || to > strLayer.size()) {
- to = strLayer.size();
- }
- for (int i = from; i <= to; i++) {
- strLayer.removeAt(from);
- }
- for (int i = str.size() - 1; i >= 0; i--) {
- strLayer.insert(from, str.at(i));
- }
-
- modifyUpper(layer, from, str.size(), to - from + 1);
- }
-
- ComposingText *q_ptr;
- QList<StrSegment> mStringLayer[ComposingText::MAX_LAYER];
- int mCursor[ComposingText::MAX_LAYER];
-
-};
-
-ComposingText::ComposingText(QObject *parent) :
- QObject(*new ComposingTextPrivate(this), parent)
-{
-
-}
-
-ComposingText::~ComposingText()
-{
-
-}
-
-StrSegment ComposingText::getStrSegment(TextLayer layer, int pos) const
-{
- Q_D(const ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return StrSegment();
-
- const QList<StrSegment> &strLayer = d->mStringLayer[layer];
- if (pos < 0) {
- pos = strLayer.size() - 1;
- }
- if (pos >= strLayer.size() || pos < 0) {
- return StrSegment();
- }
- return strLayer.at(pos);
-}
-
-void ComposingText::debugout() const
-{
- Q_D(const ComposingText);
- for (int i = LAYER0; i < MAX_LAYER; i++) {
- QString tmp;
- for (QList<StrSegment>::ConstIterator it = d->mStringLayer[i].constBegin();
- it != d->mStringLayer[i].constEnd(); it++) {
- tmp += QString("(%1,%2,%3)").arg(it->string).arg(it->from).arg(it->to);
- }
- }
-}
-
-QString ComposingText::toString(TextLayer layer, int from, int to) const
-{
- Q_D(const ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return QString();
-
- QString buf;
- const QList<StrSegment> &strLayer = d->mStringLayer[layer];
-
- for (int i = from; i <= to; i++) {
- const StrSegment &ss = strLayer.at(i);
- buf.append(ss.string);
- }
- return buf;
-}
-
-QString ComposingText::toString(TextLayer layer) const
-{
- Q_D(const ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return QString();
-
- return toString(layer, 0, d->mStringLayer[layer].size() - 1);
-}
-
-void ComposingText::insertStrSegment(TextLayer layer, const StrSegment& str)
-{
- Q_D(ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return;
-
- int cursor = d->mCursor[layer];
- d->mStringLayer[layer].insert(cursor, str);
- d->modifyUpper(layer, cursor, 1, 0);
- setCursor(layer, cursor + 1);
-}
-
-void ComposingText::insertStrSegment(TextLayer layer1, TextLayer layer2, const StrSegment &str)
-{
- Q_D(ComposingText);
-
- if (layer1 < LAYER0 || layer1 >= MAX_LAYER || layer2 < LAYER0 || layer2 >= MAX_LAYER)
- return;
-
- d->mStringLayer[layer1].insert(d->mCursor[layer1], str);
- d->mCursor[layer1]++;
-
- for (int i = (int)layer1 + 1; i <= (int)layer2; i++) {
- int pos = d->mCursor[i - 1] - 1;
- StrSegment tmp(str.string, pos, pos);
- QList<StrSegment> &strLayer = d->mStringLayer[i];
- strLayer.insert(d->mCursor[i], tmp);
- d->mCursor[i]++;
- for (int j = d->mCursor[i]; j < strLayer.size(); j++) {
- StrSegment &ss = strLayer[j];
- ss.from++;
- ss.to++;
- }
- }
- int cursor = d->mCursor[layer2];
- d->modifyUpper(layer2, cursor - 1, 1, 0);
- setCursor(layer2, cursor);
-}
-
-void ComposingText::replaceStrSegment(TextLayer layer, const QList<StrSegment> &str, int num)
-{
- Q_D(ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return;
-
- int cursor = d->mCursor[layer];
- d->replaceStrSegment0(layer, str, cursor - num, cursor - 1);
- setCursor(layer, cursor + str.size() - num);
-}
-
-void ComposingText::deleteStrSegment(TextLayer layer, int from, int to)
-{
- Q_D(ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return;
-
- int fromL[3] = { -1, -1, -1 };
- int toL[3] = { -1, -1, -1 };
-
- QList<StrSegment> &strLayer2 = d->mStringLayer[LAYER2];
- QList<StrSegment> &strLayer1 = d->mStringLayer[LAYER1];
-
- if (layer == LAYER2) {
- fromL[LAYER2] = from;
- toL[LAYER2] = to;
- fromL[LAYER1] = strLayer2.at(from).from;
- toL[LAYER1] = strLayer2.at(to).to;
- fromL[LAYER0] = strLayer1.at(fromL[LAYER1]).from;
- toL[LAYER0] = strLayer1.at(toL[LAYER1]).to;
- } else if (layer == LAYER1) {
- fromL[LAYER1] = from;
- toL[LAYER1] = to;
- fromL[LAYER0] = strLayer1.at(from).from;
- toL[LAYER0] = strLayer1.at(to).to;
- } else {
- fromL[LAYER0] = from;
- toL[LAYER0] = to;
- }
-
- int diff = to - from + 1;
- for (int lv = LAYER0; lv < MAX_LAYER; lv++) {
- if (fromL[lv] >= 0) {
- d->deleteStrSegment0((TextLayer)lv, fromL[lv], toL[lv], diff);
- } else {
- int boundary_from = -1;
- int boundary_to = -1;
- QList<StrSegment> &strLayer = d->mStringLayer[lv];
- for (int i = 0; i < strLayer.size(); i++) {
- const StrSegment &ss = strLayer.at(i);
- if ((ss.from >= fromL[lv-1] && ss.from <= toL[lv-1]) ||
- (ss.to >= fromL[lv-1] && ss.to <= toL[lv-1]) ) {
- if (fromL[lv] < 0) {
- fromL[lv] = i;
- boundary_from = ss.from;
- }
- toL[lv] = i;
- boundary_to = ss.to;
- } else if (ss.from <= fromL[lv-1] && ss.to >= toL[lv-1]) {
- boundary_from = ss.from;
- boundary_to = ss.to;
- fromL[lv] = i;
- toL[lv] = i;
- break;
- } else if (ss.from > toL[lv-1]) {
- break;
- }
- }
- if (boundary_from != fromL[lv-1] || boundary_to != toL[lv-1]) {
- d->deleteStrSegment0((TextLayer)lv, fromL[lv] + 1, toL[lv], diff);
- boundary_to -= diff;
- QList<StrSegment> tmp = QList<StrSegment>() <<
- StrSegment(toString((TextLayer)(lv - 1)), boundary_from, boundary_to);
- d->replaceStrSegment0((TextLayer)lv, tmp, fromL[lv], fromL[lv]);
- return;
- } else {
- d->deleteStrSegment0((TextLayer)lv, fromL[lv], toL[lv], diff);
- }
- }
- diff = toL[lv] - fromL[lv] + 1;
- }
-}
-
-int ComposingText::deleteAt(TextLayer layer, bool rightside)
-{
- Q_D(ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return 0;
-
- int cursor = d->mCursor[layer];
- QList<StrSegment> &strLayer = d->mStringLayer[layer];
-
- if (!rightside && cursor > 0) {
- deleteStrSegment(layer, cursor - 1, cursor - 1);
- setCursor(layer, cursor - 1);
- } else if (rightside && cursor < strLayer.size()) {
- deleteStrSegment(layer, cursor, cursor);
- setCursor(layer, cursor);
- }
- return strLayer.size();
-}
-
-QList<StrSegment> ComposingText::getStringLayer(TextLayer layer) const
-{
- Q_D(const ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return QList<StrSegment>();
-
- return d->mStringLayer[layer];
-}
-
-int ComposingText::included(TextLayer layer, int pos)
-{
- Q_D(ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER - 1)
- return 0;
-
- if (pos == 0) {
- return 0;
- }
- int uplayer = (TextLayer)(layer + 1);
- int i;
- QList<StrSegment> &strLayer = d->mStringLayer[uplayer];
- for (i = 0; i < strLayer.size(); i++) {
- const StrSegment &ss = strLayer.at(i);
- if (ss.from <= pos && pos <= ss.to) {
- break;
- }
- }
- return i;
-}
-
-int ComposingText::setCursor(TextLayer layer, int pos)
-{
- Q_D(ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return -1;
-
- if (pos > d->mStringLayer[layer].size()) {
- pos = d->mStringLayer[layer].size();
- }
- if (pos < 0) {
- pos = 0;
- }
- if (layer == ComposingText::LAYER0) {
- d->mCursor[ComposingText::LAYER0] = pos;
- d->mCursor[ComposingText::LAYER1] = included(ComposingText::LAYER0, pos);
- d->mCursor[ComposingText::LAYER2] = included(ComposingText::LAYER1, d->mCursor[ComposingText::LAYER1]);
- } else if (layer == ComposingText::LAYER1) {
- d->mCursor[ComposingText::LAYER2] = included(ComposingText::LAYER1, pos);
- d->mCursor[ComposingText::LAYER1] = pos;
- d->mCursor[ComposingText::LAYER0] = (pos > 0) ? d->mStringLayer[ComposingText::LAYER1].at(pos - 1).to + 1 : 0;
- } else {
- d->mCursor[ComposingText::LAYER2] = pos;
- d->mCursor[ComposingText::LAYER1] = (pos > 0) ? d->mStringLayer[ComposingText::LAYER2].at(pos - 1).to + 1 : 0;
- d->mCursor[ComposingText::LAYER0] = (d->mCursor[ComposingText::LAYER1] > 0) ? d->mStringLayer[ComposingText::LAYER1].at(d->mCursor[ComposingText::LAYER1] - 1).to + 1 : 0;
- }
- return pos;
-}
-
-int ComposingText::moveCursor(TextLayer layer, int diff)
-{
- Q_D(ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return -1;
-
- int c = d->mCursor[layer] + diff;
-
- return setCursor(layer, c);
-}
-
-int ComposingText::getCursor(TextLayer layer) const
-{
- Q_D(const ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return -1;
-
- return d->mCursor[layer];
-}
-
-int ComposingText::size(TextLayer layer) const
-{
- Q_D(const ComposingText);
-
- if (layer < LAYER0 || layer >= MAX_LAYER)
- return 0;
-
- return d->mStringLayer[layer].size();
-}
-
-void ComposingText::clear()
-{
- Q_D(ComposingText);
- for (int i = 0; i < MAX_LAYER; i++) {
- d->mStringLayer[i].clear();
- d->mCursor[i] = 0;
- }
-}
diff --git a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp b/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
deleted file mode 100644
index dbcb7c37..00000000
--- a/src/virtualkeyboard/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Qt implementation of OpenWnn library
- * This file is part of the Qt Virtual Keyboard module.
- * Contact: http://www.qt.io/licensing/
- *
- * Copyright (C) 2015 The Qt Company
- * Copyright (C) 2008-2012 OMRON SOFTWARE Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "openwnnenginejajp.h"
-#include "openwnndictionary.h"
-#include "openwnnclauseconverterjajp.h"
-#include "wnnword.h"
-#include "kanaconverter.h"
-#include <QtCore/private/qobject_p.h>
-
-class OpenWnnEngineJAJPPrivate : public QObjectPrivate
-{
-public:
- OpenWnnEngineJAJPPrivate() :
- QObjectPrivate(),
- mDictType(OpenWnnEngineJAJP::DIC_LANG_INIT),
- mKeyboardType(OpenWnnEngineJAJP::KEYBOARD_QWERTY),
- mOutputNum(0),
- mGetCandidateFrom(0),
- mExactMatchMode(false),
- mSingleClauseMode(false)
- {
- /* clear dictionary settings */
- mDictionaryJP.clearDictionary();
- mDictionaryJP.clearApproxPattern();
-
- mClauseConverter.setDictionary(&mDictionaryJP);
- mKanaConverter.setDictionary(&mDictionaryJP);
- }
-
- void setDictionaryForPrediction(int strlen)
- {
- OpenWnnDictionary &dict = mDictionaryJP;
-
- dict.clearDictionary();
-
- if (mDictType != OpenWnnEngineJAJP::DIC_LANG_JP_EISUKANA) {
- dict.clearApproxPattern();
- if (strlen == 0) {
- dict.setDictionary(2, 245, 245);
- dict.setDictionary(3, 100, 244);
-
- dict.setDictionary(OpenWnnDictionary::INDEX_LEARN_DICTIONARY, OpenWnnEngineJAJP::FREQ_LEARN, OpenWnnEngineJAJP::FREQ_LEARN);
- } else {
- dict.setDictionary(0, 100, 400);
- if (strlen > 1) {
- dict.setDictionary(1, 100, 400);
- }
- dict.setDictionary(2, 245, 245);
- dict.setDictionary(3, 100, 244);
-
- dict.setDictionary(OpenWnnDictionary::INDEX_USER_DICTIONARY, OpenWnnEngineJAJP::FREQ_USER, OpenWnnEngineJAJP::FREQ_USER);
- dict.setDictionary(OpenWnnDictionary::INDEX_LEARN_DICTIONARY, OpenWnnEngineJAJP::FREQ_LEARN, OpenWnnEngineJAJP::FREQ_LEARN);
- if (mKeyboardType != OpenWnnEngineJAJP::KEYBOARD_QWERTY) {
- dict.setApproxPattern(OpenWnnDictionary::APPROX_PATTERN_JAJP_12KEY_NORMAL);
- }
- }
- }
- }
-
- QSharedPointer<WnnWord> getCandidate(int index)
- {
- QSharedPointer<WnnWord> word;
-
- if (mGetCandidateFrom == 0) {
- if (mDictType == OpenWnnEngineJAJP::DIC_LANG_JP_EISUKANA) {
- /* skip to Kana conversion if EISU-KANA conversion mode */
- mGetCandidateFrom = 2;
- } else if (mSingleClauseMode) {
- /* skip to single clause conversion if single clause conversion mode */
- mGetCandidateFrom = 1;
- } else {
- if (mConvResult.size() < OpenWnnEngineJAJP::PREDICT_LIMIT) {
- /* get prefix matching words from the dictionaries */
- while (index >= mConvResult.size()) {
- if ((word = mDictionaryJP.getNextWord()) == NULL) {
- mGetCandidateFrom = 1;
- break;
- }
- if (!mExactMatchMode || mInputHiragana.compare(word->stroke) == 0) {
- addCandidate(word);
- if (mConvResult.size() >= OpenWnnEngineJAJP::PREDICT_LIMIT) {
- mGetCandidateFrom = 1;
- break;
- }
- }
- }
- } else {
- mGetCandidateFrom = 1;
- }
- }
- }
-
- /* get candidates by single clause conversion */
- if (mGetCandidateFrom == 1) {
- QList<WnnClause> convResult = mClauseConverter.convert(mInputHiragana);
- if (!convResult.isEmpty()) {
- for (QList<WnnClause>::ConstIterator it = convResult.constBegin();
- it != convResult.constEnd(); it++) {
- addCandidate(QSharedPointer<WnnWord>::create(*it));
- }
- }
- /* end of candidates by single clause conversion */
- mGetCandidateFrom = 2;
- }
-
- /* get candidates from Kana converter */
- if (mGetCandidateFrom == 2) {
- QList<WnnWord> addCandidateList = mKanaConverter.createPseudoCandidateList(mInputHiragana, mInputRomaji);
-
- for (QList<WnnWord>::ConstIterator it = addCandidateList.constBegin();
- it != addCandidateList.constEnd(); it++) {
- addCandidate(QSharedPointer<WnnWord>::create(*it));
- }
-
- mGetCandidateFrom = 3;
- }
-
- if (index >= mConvResult.size()) {
- return QSharedPointer<WnnWord>();
- }
- return mConvResult.at(index);
- }
-
- bool addCandidate(QSharedPointer<WnnWord> word)
- {
- if (word.isNull() || word->candidate.isEmpty() || mCandTable.contains(word->candidate)
- || word->candidate.length() > OpenWnnEngineJAJP::MAX_OUTPUT_LENGTH) {
- return false;
- }
- /*
- if (mFilter != NULL && !mFilter->isAllowed(word)) {
- return false;
- }
- */
- mCandTable.insert(word->candidate, word);
- mConvResult.append(word);
- return true;
- }
-
- void clearCandidates()
- {
- mConvResult.clear();
- mCandTable.clear();
- mOutputNum = 0;
- mInputHiragana.clear();
- mInputRomaji.clear();
- mGetCandidateFrom = 0;
- mSingleClauseMode = false;
- }
-
- int setSearchKey(const ComposingText &text, int maxLen)
- {
- QString input = text.toString(ComposingText::LAYER1);
- if (0 <= maxLen && maxLen <= input.length()) {
- input = input.mid(0, maxLen);
- mExactMatchMode = true;
- } else {
- mExactMatchMode = false;
- }
-
- if (input.length() == 0) {
- mInputHiragana = "";
- mInputRomaji = "";
- return 0;
- }
-
- mInputHiragana = input;
- mInputRomaji = text.toString(ComposingText::LAYER0);
-
- return input.length();
- }
-
- void clearPreviousWord()
- {
- mPreviousWord.reset();
- }
-
- OpenWnnEngineJAJP::DictionaryType mDictType;
- OpenWnnEngineJAJP::KeyboardType mKeyboardType;
- OpenWnnDictionary mDictionaryJP;
- QList<QSharedPointer<WnnWord> > mConvResult;
- QMap<QString, QSharedPointer<WnnWord> > mCandTable;
- QString mInputHiragana;
- QString mInputRomaji;
- int mOutputNum;
- int mGetCandidateFrom;
- QSharedPointer<WnnWord> mPreviousWord;
- OpenWnnClauseConverterJAJP mClauseConverter;
- KanaConverter mKanaConverter;
- bool mExactMatchMode;
- bool mSingleClauseMode;
- QSharedPointer<WnnSentence> mConvertSentence;
-};
-
-OpenWnnEngineJAJP::OpenWnnEngineJAJP(QObject *parent) :
- QObject(*new OpenWnnEngineJAJPPrivate(), parent)
-{
-
-}
-
-OpenWnnEngineJAJP::~OpenWnnEngineJAJP()
-{
-}
-
-bool OpenWnnEngineJAJP::setDictionary(DictionaryType type)
-{
- Q_D(OpenWnnEngineJAJP);
- d->mDictType = type;
- return true;
-}
-
-int OpenWnnEngineJAJP::predict(const ComposingText &text, int minLen, int maxLen)
-{
- Q_D(OpenWnnEngineJAJP);
- Q_UNUSED(minLen)
-
- d->clearCandidates();
-
- /* set mInputHiragana and mInputRomaji */
- int len = d->setSearchKey(text, maxLen);
-
- /* set dictionaries by the length of input */
- d->setDictionaryForPrediction(len);
-
- /* search dictionaries */
- d->mDictionaryJP.setInUseState(true);
-
- if (len == 0) {
- /* search by previously selected word */
- if (d->mPreviousWord.isNull())
- return -1;
- return d->mDictionaryJP.searchWord(OpenWnnDictionary::SEARCH_LINK, OpenWnnDictionary::ORDER_BY_FREQUENCY,
- d->mInputHiragana, *d->mPreviousWord);
- } else {
- if (d->mExactMatchMode) {
- /* exact matching */
- d->mDictionaryJP.searchWord(OpenWnnDictionary::SEARCH_EXACT, OpenWnnDictionary::ORDER_BY_FREQUENCY,
- d->mInputHiragana);
- } else {
- /* prefix matching */
- d->mDictionaryJP.searchWord(OpenWnnDictionary::SEARCH_PREFIX, OpenWnnDictionary::ORDER_BY_FREQUENCY,
- d->mInputHiragana);
- }
- return 1;
- }
-}
-
-int OpenWnnEngineJAJP::convert(ComposingText &text)
-{
- Q_D(OpenWnnEngineJAJP);
-
- d->clearCandidates();
-
- d->mDictionaryJP.setInUseState(true);
-
- int cursor = text.getCursor(ComposingText::LAYER1);
- QString input;
- QSharedPointer<WnnClause> head;
- if (cursor > 0) {
- /* convert previous part from cursor */
- input = text.toString(ComposingText::LAYER1, 0, cursor - 1);
- QList<WnnClause> headCandidates = d->mClauseConverter.convert(input);
- if (headCandidates.isEmpty()) {
- return 0;
- }
- head = QSharedPointer<WnnClause>::create(input, headCandidates.first());
-
- /* set the rest of input string */
- input = text.toString(ComposingText::LAYER1, cursor, text.size(ComposingText::LAYER1) - 1);
- } else {
- /* set whole of input string */
- input = text.toString(ComposingText::LAYER1);
- }
-
- QSharedPointer<WnnSentence> sentence;
- if (input.length() != 0) {
- sentence = d->mClauseConverter.consecutiveClauseConvert(input);
- }
- if (!head.isNull()) {
- sentence = QSharedPointer<WnnSentence>::create(*head, sentence.data());
- }
- if (sentence.isNull()) {
- return 0;
- }
-
- QList<StrSegment> ss;
- int pos = 0;
- for (QList<WnnClause>::ConstIterator it = sentence->elements.constBegin();
- it != sentence->elements.constEnd(); it++) {
- const WnnClause &clause = *it;
- int len = clause.stroke.length();
- ss.append(StrSegment(clause, pos, pos + len - 1));
- pos += len;
- }
- text.setCursor(ComposingText::LAYER2, text.size(ComposingText::LAYER2));
- text.replaceStrSegment(ComposingText::LAYER2, ss,
- text.getCursor(ComposingText::LAYER2));
- d->mConvertSentence = sentence;
-
- return 0;
-}
-
-QSharedPointer<WnnWord> OpenWnnEngineJAJP::getNextCandidate()
-{
- Q_D(OpenWnnEngineJAJP);
-
- if (d->mInputHiragana.isEmpty()) {
- return QSharedPointer<WnnWord>();
- }
- QSharedPointer<WnnWord> word = d->getCandidate(d->mOutputNum);
- if (!word.isNull()) {
- d->mOutputNum++;
- }
- return word;
-}
-
-bool OpenWnnEngineJAJP::learn(WnnWord &word)
-{
- Q_D(OpenWnnEngineJAJP);
-
- int ret = -1;
- if (word.partOfSpeech.right == 0) {
- word.partOfSpeech = d->mDictionaryJP.getPOS(OpenWnnDictionary::POS_TYPE_MEISI);
- }
-
- OpenWnnDictionary &dict = d->mDictionaryJP;
- if (word.isSentence()) {
- const WnnSentence *sentence = static_cast<const WnnSentence *>(&word);
- for (QList<WnnClause>::ConstIterator clauses = sentence->elements.constBegin();
- clauses != sentence->elements.constEnd(); clauses++) {
- const WnnWord &wd = *clauses;
- ret = dict.learnWord(wd, d->mPreviousWord.data());
- d->mPreviousWord.reset(static_cast<WnnWord *>(new WnnSentence(*sentence)));
- if (ret != 0) {
- break;
- }
- }
- } else {
- ret = dict.learnWord(word, d->mPreviousWord.data());
- d->mPreviousWord = QSharedPointer<WnnWord>::create(word);
- d->mClauseConverter.setDictionary(&dict);
- }
-
- return (ret == 0);
-}
-
-void OpenWnnEngineJAJP::breakSequence()
-{
- Q_D(OpenWnnEngineJAJP);
-
- d->clearPreviousWord();
-}
-
-int OpenWnnEngineJAJP::makeCandidateListOf(int clausePosition)
-{
- Q_D(OpenWnnEngineJAJP);
-
- d->clearCandidates();
-
- if ((d->mConvertSentence == NULL) || (d->mConvertSentence->elements.size() <= clausePosition)) {
- return 0;
- }
- d->mSingleClauseMode = true;
- const WnnClause &clause = d->mConvertSentence->elements.at(clausePosition);
- d->mInputHiragana = clause.stroke;
- d->mInputRomaji = clause.candidate;
-
- return 1;
-}
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/dictlist.h b/src/virtualkeyboard/3rdparty/pinyin/include/dictlist.h
deleted file mode 100644
index 27fa6d8e..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/include/dictlist.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef PINYINIME_INCLUDE_DICTLIST_H__
-#define PINYINIME_INCLUDE_DICTLIST_H__
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "./dictdef.h"
-#include "./searchutility.h"
-#include "./spellingtrie.h"
-#include "./utf16char.h"
-
-namespace ime_pinyin {
-
-class DictList {
- private:
- bool initialized_;
-
- const SpellingTrie *spl_trie_;
-
- // Number of SingCharItem. The first is blank, because id 0 is invalid.
- uint32 scis_num_;
- char16 *scis_hz_;
- SpellingId *scis_splid_;
-
- // The large memory block to store the word list.
- char16 *buf_;
-
- // Starting position of those words whose lengths are i+1, counted in
- // char16
- uint32 start_pos_[kMaxLemmaSize + 1];
-
- uint32 start_id_[kMaxLemmaSize + 1];
-
- int (*cmp_func_[kMaxLemmaSize])(const void *, const void *);
-
- bool alloc_resource(size_t buf_size, size_t scim_num);
-
- void free_resource();
-
-#ifdef ___BUILD_MODEL___
- // Calculate the requsted memory, including the start_pos[] buffer.
- size_t calculate_size(const LemmaEntry *lemma_arr, size_t lemma_num);
-
- void fill_scis(const SingleCharItem *scis, size_t scis_num);
-
- // Copy the related content to the inner buffer
- // It should be called after calculate_size()
- void fill_list(const LemmaEntry *lemma_arr, size_t lemma_num);
-
- // Find the starting position for the buffer of those 2-character Chinese word
- // whose first character is the given Chinese character.
- char16* find_pos2_startedbyhz(char16 hz_char);
-#endif
-
- // Find the starting position for the buffer of those words whose lengths are
- // word_len. The given parameter cmp_func decides how many characters from
- // beginning will be used to compare.
- char16* find_pos_startedbyhzs(const char16 last_hzs[],
- size_t word_Len,
- int (*cmp_func)(const void *, const void *));
-
- public:
-
- DictList();
- ~DictList();
-
- bool save_list(FILE *fp);
- bool load_list(FILE *fp);
-
-#ifdef ___BUILD_MODEL___
- // Init the list from the LemmaEntry array.
- // lemma_arr should have been sorted by the hanzi_str, and have been given
- // ids from 1
- bool init_list(const SingleCharItem *scis, size_t scis_num,
- const LemmaEntry *lemma_arr, size_t lemma_num);
-#endif
-
- // Get the hanzi string for the given id
- uint16 get_lemma_str(LemmaIdType id_hz, char16 *str_buf, uint16 str_max);
-
- void convert_to_hanzis(char16 *str, uint16 str_len);
-
- void convert_to_scis_ids(char16 *str, uint16 str_len);
-
- // last_hzs stores the last n Chinese characters history, its length should be
- // less or equal than kMaxPredictSize.
- // hzs_len specifies the length(<= kMaxPredictSize).
- // predict_buf is used to store the result.
- // buf_len specifies the buffer length.
- // b4_used specifies how many items before predict_buf have been used.
- // Returned value is the number of newly added items.
- size_t predict(const char16 last_hzs[], uint16 hzs_len,
- NPredictItem *npre_items, size_t npre_max,
- size_t b4_used);
-
- // If half_splid is a valid half spelling id, return those full spelling
- // ids which share this half id.
- uint16 get_splids_for_hanzi(char16 hanzi, uint16 half_splid,
- uint16 *splids, uint16 max_splids);
-
- LemmaIdType get_lemma_id(const char16 *str, uint16 str_len);
-};
-}
-
-#endif // PINYINIME_INCLUDE_DICTLIST_H__
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/dicttrie.h b/src/virtualkeyboard/3rdparty/pinyin/include/dicttrie.h
deleted file mode 100644
index 75b7ee05..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/include/dicttrie.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef PINYINIME_INCLUDE_DICTTRIE_H__
-#define PINYINIME_INCLUDE_DICTTRIE_H__
-
-#include <stdlib.h>
-#include "./atomdictbase.h"
-#include "./dictdef.h"
-#include "./dictlist.h"
-#include "./searchutility.h"
-
-namespace ime_pinyin {
-
-class DictTrie : AtomDictBase {
- private:
- struct ParsingMark {
- size_t node_offset:24;
- size_t node_num:8; // Number of nodes with this spelling id given
- // by spl_id. If spl_id is a Shengmu, for nodes
- // in the first layer of DictTrie, it equals to
- // SpellingTrie::shm2full_num(); but for those
- // nodes which are not in the first layer,
- // node_num < SpellingTrie::shm2full_num().
- // For a full spelling id, node_num = 1;
- };
-
- // Used to indicate an extended mile stone.
- // An extended mile stone is used to mark a partial match in the dictionary
- // trie to speed up further potential extending.
- // For example, when the user inputs "w", a mile stone is created to mark the
- // partial match status, so that when user inputs another char 'm', it will be
- // faster to extend search space based on this mile stone.
- //
- // For partial match status of "wm", there can be more than one sub mile
- // stone, for example, "wm" can be matched to "wanm", "wom", ..., etc, so
- // there may be more one parsing mark used to mark these partial matchings.
- // A mile stone records the starting position in the mark list and number of
- // marks.
- struct MileStone {
- uint16 mark_start;
- uint16 mark_num;
- };
-
- DictList* dict_list_;
-
- const SpellingTrie *spl_trie_;
-
- LmaNodeLE0* root_; // Nodes for root and the first layer.
- LmaNodeGE1* nodes_ge1_; // Nodes for other layers.
-
- // An quick index from spelling id to the LmaNodeLE0 node buffer, or
- // to the root_ buffer.
- // Index length:
- // SpellingTrie::get_instance().get_spelling_num() + 1. The last one is used
- // to get the end.
- // All Shengmu ids are not indexed because they will be converted into
- // corresponding full ids.
- // So, given an id splid, the son is:
- // root_[splid_le0_index_[splid - kFullSplIdStart]]
- uint16 *splid_le0_index_;
-
- uint32 lma_node_num_le0_;
- uint32 lma_node_num_ge1_;
-
- // The first part is for homophnies, and the last top_lma_num_ items are
- // lemmas with highest scores.
- unsigned char *lma_idx_buf_;
- uint32 lma_idx_buf_len_; // The total size of lma_idx_buf_ in byte.
- uint32 total_lma_num_; // Total number of lemmas in this dictionary.
- uint32 top_lmas_num_; // Number of lemma with highest scores.
-
- // Parsing mark list used to mark the detailed extended statuses.
- ParsingMark *parsing_marks_;
- // The position for next available mark.
- uint16 parsing_marks_pos_;
-
- // Mile stone list used to mark the extended status.
- MileStone *mile_stones_;
- // The position for the next available mile stone. We use positions (except 0)
- // as handles.
- MileStoneHandle mile_stones_pos_;
-
- // Get the offset of sons for a node.
- inline size_t get_son_offset(const LmaNodeGE1 *node);
-
- // Get the offset of homonious ids for a node.
- inline size_t get_homo_idx_buf_offset(const LmaNodeGE1 *node);
-
- // Get the lemma id by the offset.
- inline LemmaIdType get_lemma_id(size_t id_offset);
-
- void free_resource(bool free_dict_list);
-
- bool load_dict(FILE *fp);
-
- // Given a LmaNodeLE0 node, extract the lemmas specified by it, and fill
- // them into the lpi_items buffer.
- // This function is called by the search engine.
- size_t fill_lpi_buffer(LmaPsbItem lpi_items[], size_t max_size,
- LmaNodeLE0 *node);
-
- // Given a LmaNodeGE1 node, extract the lemmas specified by it, and fill
- // them into the lpi_items buffer.
- // This function is called by inner functions extend_dict0(), extend_dict1()
- // and extend_dict2().
- size_t fill_lpi_buffer(LmaPsbItem lpi_items[], size_t max_size,
- size_t homo_buf_off, LmaNodeGE1 *node,
- uint16 lma_len);
-
- // Extend in the trie from level 0.
- MileStoneHandle extend_dict0(MileStoneHandle from_handle,
- const DictExtPara *dep, LmaPsbItem *lpi_items,
- size_t lpi_max, size_t *lpi_num);
-
- // Extend in the trie from level 1.
- MileStoneHandle extend_dict1(MileStoneHandle from_handle,
- const DictExtPara *dep, LmaPsbItem *lpi_items,
- size_t lpi_max, size_t *lpi_num);
-
- // Extend in the trie from level 2.
- MileStoneHandle extend_dict2(MileStoneHandle from_handle,
- const DictExtPara *dep, LmaPsbItem *lpi_items,
- size_t lpi_max, size_t *lpi_num);
-
- // Try to extend the given spelling id buffer, and if the given id_lemma can
- // be successfully gotten, return true;
- // The given spelling ids are all valid full ids.
- bool try_extend(const uint16 *splids, uint16 splid_num, LemmaIdType id_lemma);
-
-#ifdef ___BUILD_MODEL___
- bool save_dict(FILE *fp);
-#endif // ___BUILD_MODEL___
-
- static const int kMaxMileStone = 100;
- static const int kMaxParsingMark = 600;
- static const MileStoneHandle kFirstValidMileStoneHandle = 1;
-
- friend class DictParser;
- friend class DictBuilder;
-
- public:
-
- DictTrie();
- ~DictTrie();
-
-#ifdef ___BUILD_MODEL___
- // Construct the tree from the file fn_raw.
- // fn_validhzs provide the valid hanzi list. If fn_validhzs is
- // NULL, only chars in GB2312 will be included.
- bool build_dict(const char *fn_raw, const char *fn_validhzs);
-
- // Save the binary dictionary
- // Actually, the SpellingTrie/DictList instance will be also saved.
- bool save_dict(const char *filename);
-#endif // ___BUILD_MODEL___
-
- void convert_to_hanzis(char16 *str, uint16 str_len);
-
- void convert_to_scis_ids(char16 *str, uint16 str_len);
-
- // Load a binary dictionary
- // The SpellingTrie instance/DictList will be also loaded
- bool load_dict(const char *filename, LemmaIdType start_id,
- LemmaIdType end_id);
- bool load_dict_fd(int sys_fd, long start_offset, long length,
- LemmaIdType start_id, LemmaIdType end_id);
- bool close_dict() {return true;}
- size_t number_of_lemmas() {return 0;}
-
- void reset_milestones(uint16 from_step, MileStoneHandle from_handle);
-
- MileStoneHandle extend_dict(MileStoneHandle from_handle,
- const DictExtPara *dep,
- LmaPsbItem *lpi_items,
- size_t lpi_max, size_t *lpi_num);
-
- size_t get_lpis(const uint16 *splid_str, uint16 splid_str_len,
- LmaPsbItem *lpi_items, size_t lpi_max);
-
- uint16 get_lemma_str(LemmaIdType id_lemma, char16 *str_buf, uint16 str_max);
-
- uint16 get_lemma_splids(LemmaIdType id_lemma, uint16 *splids,
- uint16 splids_max, bool arg_valid);
-
- size_t predict(const char16 *last_hzs, uint16 hzs_len,
- NPredictItem *npre_items, size_t npre_max,
- size_t b4_used);
-
- LemmaIdType put_lemma(char16 /*lemma_str*/[], uint16 /*splids*/[],
- uint16 /*lemma_len*/, uint16 /*count*/) {return 0;}
-
- LemmaIdType update_lemma(LemmaIdType /*lemma_id*/, int16 /*delta_count*/,
- bool /*selected*/) {return 0;}
-
- LemmaIdType get_lemma_id(char16 /*lemma_str*/[], uint16 /*splids*/[],
- uint16 /*lemma_len*/) {return 0;}
-
- LmaScoreType get_lemma_score(LemmaIdType /*lemma_id*/) {return 0;}
-
- LmaScoreType get_lemma_score(char16 /*lemma_str*/[], uint16 /*splids*/[],
- uint16 /*lemma_len*/) {return 0;}
-
- bool remove_lemma(LemmaIdType /*lemma_id*/) {return false;}
-
- size_t get_total_lemma_count() {return 0;}
- void set_total_lemma_count_of_others(size_t count);
-
- void flush_cache() {}
-
- LemmaIdType get_lemma_id(const char16 lemma_str[], uint16 lemma_len);
-
- // Fill the lemmas with highest scores to the prediction buffer.
- // his_len is the history length to fill in the prediction buffer.
- size_t predict_top_lmas(size_t his_len, NPredictItem *npre_items,
- size_t npre_max, size_t b4_used);
-};
-}
-
-#endif // PINYINIME_INCLUDE_DICTTRIE_H__
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/ngram.h b/src/virtualkeyboard/3rdparty/pinyin/include/ngram.h
deleted file mode 100644
index 7adb46d8..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/include/ngram.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef PINYINIME_INCLUDE_NGRAM_H__
-#define PINYINIME_INCLUDE_NGRAM_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "./dictdef.h"
-
-namespace ime_pinyin {
-
-typedef unsigned char CODEBOOK_TYPE;
-
-static const size_t kCodeBookSize = 256;
-
-class NGram {
- public:
- // The maximum score of a lemma item.
- static const LmaScoreType kMaxScore = 0x3fff;
-
- // In order to reduce the storage size, the original log value is amplified by
- // kScoreAmplifier, and we use LmaScoreType to store.
- // After this process, an item with a lower score has a higher frequency.
- static const int kLogValueAmplifier = -800;
-
- // System words' total frequency. It is not the real total frequency, instead,
- // It is only used to adjust system lemmas' scores when the user dictionary's
- // total frequency changes.
- // In this version, frequencies of system lemmas are fixed. We are considering
- // to make them changable in next version.
- static const size_t kSysDictTotalFreq = 100000000;
-
- private:
-
- static NGram* instance_;
-
- bool initialized_;
- uint32 idx_num_;
-
- size_t total_freq_none_sys_;
-
- // Score compensation for system dictionary lemmas.
- // Because after user adds some user lemmas, the total frequency changes, and
- // we use this value to normalize the score.
- float sys_score_compensation_;
-
-#ifdef ___BUILD_MODEL___
- double *freq_codes_df_;
-#endif
- LmaScoreType *freq_codes_;
- CODEBOOK_TYPE *lma_freq_idx_;
-
- public:
- NGram();
- ~NGram();
-
- static NGram& get_instance();
-
- bool save_ngram(FILE *fp);
- bool load_ngram(FILE *fp);
-
- // Set the total frequency of all none system dictionaries.
- void set_total_freq_none_sys(size_t freq_none_sys);
-
- float get_uni_psb(LemmaIdType lma_id);
-
- // Convert a probability to score. Actually, the score will be limited to
- // kMaxScore, but at runtime, we also need float expression to get accurate
- // value of the score.
- // After the conversion, a lower score indicates a higher probability of the
- // item.
- static float convert_psb_to_score(double psb);
-
-#ifdef ___BUILD_MODEL___
- // For constructing the unigram mode model.
- bool build_unigram(LemmaEntry *lemma_arr, size_t num,
- LemmaIdType next_idx_unused);
-#endif
-};
-}
-
-#endif // PINYINIME_INCLUDE_NGRAM_H__
diff --git a/src/virtualkeyboard/3rdparty/pinyin/include/spellingtrie.h b/src/virtualkeyboard/3rdparty/pinyin/include/spellingtrie.h
deleted file mode 100644
index 03510ed3..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/include/spellingtrie.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef PINYINIME_INCLUDE_SPELLINGTRIE_H__
-#define PINYINIME_INCLUDE_SPELLINGTRIE_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "./dictdef.h"
-
-namespace ime_pinyin {
-
-static const unsigned short kFullSplIdStart = kHalfSpellingIdNum + 1;
-
-// Node used for the trie of spellings
-struct SpellingNode {
- SpellingNode *first_son;
- // The spelling id for each node. If you need more bits to store
- // spelling id, please adjust this structure.
- uint16 spelling_idx:11;
- uint16 num_of_son:5;
- char char_this_node;
- unsigned char score;
-};
-
-class SpellingTrie {
- private:
- static const int kMaxYmNum = 64;
- static const size_t kValidSplCharNum = 26;
-
- static const uint16 kHalfIdShengmuMask = 0x01;
- static const uint16 kHalfIdYunmuMask = 0x02;
- static const uint16 kHalfIdSzmMask = 0x04;
-
- // Map from half spelling id to single char.
- // For half ids of Zh/Ch/Sh, map to z/c/s (low case) respectively.
- // For example, 1 to 'A', 2 to 'B', 3 to 'C', 4 to 'c', 5 to 'D', ...,
- // 28 to 'Z', 29 to 'z'.
- // [0] is not used to achieve better efficiency.
- static const char kHalfId2Sc_[kFullSplIdStart + 1];
-
- static unsigned char char_flags_[];
- static SpellingTrie* instance_;
-
- // The spelling table
- char *spelling_buf_;
-
- // The size of longest spelling string, includes '\0' and an extra char to
- // store score. For example, "zhuang" is the longgest item in Pinyin list,
- // so spelling_size_ is 8.
- // Structure: The string ended with '\0' + score char.
- // An item with a lower score has a higher probability.
- uint32 spelling_size_;
-
- // Number of full spelling ids.
- uint32 spelling_num_;
-
- float score_amplifier_;
- unsigned char average_score_;
-
- // The Yunmu id list for the spelling ids (for half ids of Shengmu,
- // the Yunmu id is 0).
- // The length of the list is spelling_num_ + kFullSplIdStart,
- // so that spl_ym_ids_[splid] is the Yunmu id of the splid.
- uint8 *spl_ym_ids_;
-
- // The Yunmu table.
- // Each Yunmu will be assigned with Yunmu id from 1.
- char *ym_buf_;
- size_t ym_size_; // The size of longest Yunmu string, '\0'included.
- size_t ym_num_;
-
- // The spelling string just queried
- char *splstr_queried_;
-
- // The spelling string just queried
- char16 *splstr16_queried_;
-
- // The root node of the spelling tree
- SpellingNode* root_;
-
- // If a none qwerty key such as a fnction key like ENTER is given, this node
- // will be used to indicate that this is not a QWERTY node.
- SpellingNode* dumb_node_;
-
- // If a splitter key is pressed, this node will be used to indicate that this
- // is a splitter key.
- SpellingNode* splitter_node_;
-
- // Used to get the first level sons.
- SpellingNode* level1_sons_[kValidSplCharNum];
-
- // The full spl_id range for specific half id.
- // h2f means half to full.
- // A half id can be a ShouZiMu id (id to represent the first char of a full
- // spelling, including Shengmu and Yunmu), or id of zh/ch/sh.
- // [1..kFullSplIdStart-1] is the arrange of half id.
- uint16 h2f_start_[kFullSplIdStart];
- uint16 h2f_num_[kFullSplIdStart];
-
- // Map from full id to half id.
- uint16 *f2h_;
-
-#ifdef ___BUILD_MODEL___
- // How many node used to build the trie.
- size_t node_num_;
-#endif
-
- SpellingTrie();
-
- void free_son_trie(SpellingNode* node);
-
- // Construct a subtree using a subset of the spelling array (from
- // item_star to item_end).
- // Member spelliing_buf_ and spelling_size_ should be valid.
- // parent is used to update its num_of_son and score.
- SpellingNode* construct_spellings_subset(size_t item_start, size_t item_end,
- size_t level, SpellingNode *parent);
- bool build_f2h();
-
- // The caller should guarantee ch >= 'A' && ch <= 'Z'
- bool is_shengmu_char(char ch) const;
-
- // The caller should guarantee ch >= 'A' && ch <= 'Z'
- bool is_yunmu_char(char ch) const;
-
-#ifdef ___BUILD_MODEL___
- // Given a spelling string, return its Yunmu string.
- // The caller guaratees spl_str is valid.
- const char* get_ym_str(const char *spl_str);
-
- // Build the Yunmu list, and the mapping relation between the full ids and the
- // Yunmu ids. This functin is called after the spelling trie is built.
- bool build_ym_info();
-#endif
-
- friend class SpellingParser;
- friend class SmartSplParser;
- friend class SmartSplParser2;
-
- public:
- ~SpellingTrie();
-
- inline static bool is_valid_spl_char(char ch) {
- return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
- }
-
- // The caller guarantees that the two chars are valid spelling chars.
- inline static bool is_same_spl_char(char ch1, char ch2) {
- return ch1 == ch2 || ch1 - ch2 == 'a' - 'A' || ch2 - ch1 == 'a' - 'A';
- }
-
- // Construct the tree from the input pinyin array
- // The given string list should have been sorted.
- // score_amplifier is used to convert a possibility value into score.
- // average_score is the average_score of all spellings. The dumb node is
- // assigned with this score.
- bool construct(const char* spelling_arr, size_t item_size, size_t item_num,
- float score_amplifier, unsigned char average_score);
-
- // Test if the given id is a valid spelling id.
- // If function returns true, the given splid may be updated like this:
- // When 'A' is not enabled in ShouZiMu mode, the parsing result for 'A' is
- // first given as a half id 1, but because 'A' is a one-char Yunmu and
- // it is a valid id, it needs to updated to its corresponding full id.
- bool if_valid_id_update(uint16 *splid) const;
-
- // Test if the given id is a half id.
- bool is_half_id(uint16 splid) const;
-
- bool is_full_id(uint16 splid) const;
-
- // Test if the given id is a one-char Yunmu id (obviously, it is also a half
- // id), such as 'A', 'E' and 'O'.
- bool is_half_id_yunmu(uint16 splid) const;
-
- // Test if this char is a ShouZiMu char. This ShouZiMu char may be not enabled.
- // For Pinyin, only i/u/v is not a ShouZiMu char.
- // The caller should guarantee that ch >= 'A' && ch <= 'Z'
- bool is_szm_char(char ch) const;
-
- // Test If this char is enabled in ShouZiMu mode.
- // The caller should guarantee that ch >= 'A' && ch <= 'Z'
- bool szm_is_enabled(char ch) const;
-
- // Enable/disable Shengmus in ShouZiMu mode(using the first char of a spelling
- // to input).
- void szm_enable_shm(bool enable);
-
- // Enable/disable Yunmus in ShouZiMu mode.
- void szm_enable_ym(bool enable);
-
- // Test if this char is enabled in ShouZiMu mode.
- // The caller should guarantee ch >= 'A' && ch <= 'Z'
- bool is_szm_enabled(char ch) const;
-
- // Return the number of full ids for the given half id.
- uint16 half2full_num(uint16 half_id) const;
-
- // Return the number of full ids for the given half id, and fill spl_id_start
- // to return the first full id.
- uint16 half_to_full(uint16 half_id, uint16 *spl_id_start) const;
-
- // Return the corresponding half id for the given full id.
- // Not frequently used, low efficient.
- // Return 0 if fails.
- uint16 full_to_half(uint16 full_id) const;
-
- // To test whether a half id is compatible with a full id.
- // Generally, when half_id == full_to_half(full_id), return true.
- // But for "Zh, Ch, Sh", if fussy mode is on, half id for 'Z' is compatible
- // with a full id like "Zhe". (Fussy mode is not ready).
- bool half_full_compatible(uint16 half_id, uint16 full_id) const;
-
- static const SpellingTrie* get_cpinstance();
-
- static SpellingTrie& get_instance();
-
- // Save to the file stream
- bool save_spl_trie(FILE *fp);
-
- // Load from the file stream
- bool load_spl_trie(FILE *fp);
-
- // Get the number of spellings
- size_t get_spelling_num();
-
- // Return the Yunmu id for the given Yunmu string.
- // If the string is not valid, return 0;
- uint8 get_ym_id(const char* ym_str);
-
- // Get the readonly Pinyin string for a given spelling id
- const char* get_spelling_str(uint16 splid);
-
- // Get the readonly Pinyin string for a given spelling id
- const char16* get_spelling_str16(uint16 splid);
-
- // Get Pinyin string for a given spelling id. Return the length of the
- // string, and fill-in '\0' at the end.
- size_t get_spelling_str16(uint16 splid, char16 *splstr16,
- size_t splstr16_len);
-};
-}
-
-#endif // PINYINIME_INCLUDE_SPELLINGTRIE_H__
diff --git a/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro b/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro
deleted file mode 100644
index 9ad9a318..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro
+++ /dev/null
@@ -1,59 +0,0 @@
-TARGET = qtpinyin
-
-VERSION = 1.0.0
-CONFIG += static
-CONFIG += warn_off
-
-MODULE_INCLUDEPATH = $$PWD/include
-
-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
-
-OTHER_FILES +=\
- data/rawdict_utf16_65105_freq.txt \
- data/valid_utf16.txt
-
-load(qt_helper_lib)
-
-# On Windows, the library uses Qt for platform abstraction.
-win32 {
- CONFIG += qt
- QT = core
-} else {
- CONFIG *= thread
-}
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/dictlist.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/dictlist.cpp
deleted file mode 100644
index 64d8d085..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/share/dictlist.cpp
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include "../include/dictlist.h"
-#include "../include/mystdlib.h"
-#include "../include/ngram.h"
-#include "../include/searchutility.h"
-
-namespace ime_pinyin {
-
-DictList::DictList() {
- initialized_ = false;
- scis_num_ = 0;
- scis_hz_ = NULL;
- scis_splid_ = NULL;
- buf_ = NULL;
- spl_trie_ = SpellingTrie::get_cpinstance();
-
- assert(kMaxLemmaSize == 8);
- cmp_func_[0] = cmp_hanzis_1;
- cmp_func_[1] = cmp_hanzis_2;
- cmp_func_[2] = cmp_hanzis_3;
- cmp_func_[3] = cmp_hanzis_4;
- cmp_func_[4] = cmp_hanzis_5;
- cmp_func_[5] = cmp_hanzis_6;
- cmp_func_[6] = cmp_hanzis_7;
- cmp_func_[7] = cmp_hanzis_8;
-}
-
-DictList::~DictList() {
- free_resource();
-}
-
-bool DictList::alloc_resource(size_t buf_size, size_t scis_num) {
- // Allocate memory
- buf_ = static_cast<char16*>(malloc(buf_size * sizeof(char16)));
- if (NULL == buf_)
- return false;
-
- scis_num_ = scis_num;
-
- scis_hz_ = static_cast<char16*>(malloc(scis_num_ * sizeof(char16)));
- if (NULL == scis_hz_)
- return false;
-
- scis_splid_ = static_cast<SpellingId*>
- (malloc(scis_num_ * sizeof(SpellingId)));
-
- if (NULL == scis_splid_)
- return false;
-
- return true;
-}
-
-void DictList::free_resource() {
- if (NULL != buf_)
- free(buf_);
- buf_ = NULL;
-
- if (NULL != scis_hz_)
- free(scis_hz_);
- scis_hz_ = NULL;
-
- if (NULL != scis_splid_)
- free(scis_splid_);
- scis_splid_ = NULL;
-}
-
-#ifdef ___BUILD_MODEL___
-bool DictList::init_list(const SingleCharItem *scis, size_t scis_num,
- const LemmaEntry *lemma_arr, size_t lemma_num) {
- if (NULL == scis || 0 == scis_num || NULL == lemma_arr || 0 == lemma_num)
- return false;
-
- initialized_ = false;
-
- if (NULL != buf_)
- free(buf_);
-
- // calculate the size
- size_t buf_size = calculate_size(lemma_arr, lemma_num);
- if (0 == buf_size)
- return false;
-
- if (!alloc_resource(buf_size, scis_num))
- return false;
-
- fill_scis(scis, scis_num);
-
- // Copy the related content from the array to inner buffer
- fill_list(lemma_arr, lemma_num);
-
- initialized_ = true;
- return true;
-}
-
-size_t DictList::calculate_size(const LemmaEntry* lemma_arr, size_t lemma_num) {
- size_t last_hz_len = 0;
- size_t list_size = 0;
- size_t id_num = 0;
-
- for (size_t i = 0; i < lemma_num; i++) {
- if (0 == i) {
- last_hz_len = lemma_arr[i].hz_str_len;
-
- assert(last_hz_len > 0);
- assert(lemma_arr[0].idx_by_hz == 1);
-
- id_num++;
- start_pos_[0] = 0;
- start_id_[0] = id_num;
-
- last_hz_len = 1;
- list_size += last_hz_len;
- } else {
- size_t current_hz_len = lemma_arr[i].hz_str_len;
-
- assert(current_hz_len >= last_hz_len);
-
- if (current_hz_len == last_hz_len) {
- list_size += current_hz_len;
- id_num++;
- } else {
- for (size_t len = last_hz_len; len < current_hz_len - 1; len++) {
- start_pos_[len] = start_pos_[len - 1];
- start_id_[len] = start_id_[len - 1];
- }
-
- start_pos_[current_hz_len - 1] = list_size;
-
- id_num++;
- start_id_[current_hz_len - 1] = id_num;
-
- last_hz_len = current_hz_len;
- list_size += current_hz_len;
- }
- }
- }
-
- for (size_t i = last_hz_len; i <= kMaxLemmaSize; i++) {
- if (0 == i) {
- start_pos_[0] = 0;
- start_id_[0] = 1;
- } else {
- start_pos_[i] = list_size;
- start_id_[i] = id_num;
- }
- }
-
- return start_pos_[kMaxLemmaSize];
-}
-
-void DictList::fill_scis(const SingleCharItem *scis, size_t scis_num) {
- assert(scis_num_ == scis_num);
-
- for (size_t pos = 0; pos < scis_num_; pos++) {
- scis_hz_[pos] = scis[pos].hz;
- scis_splid_[pos] = scis[pos].splid;
- }
-}
-
-void DictList::fill_list(const LemmaEntry* lemma_arr, size_t lemma_num) {
- size_t current_pos = 0;
-
- utf16_strncpy(buf_, lemma_arr[0].hanzi_str,
- lemma_arr[0].hz_str_len);
-
- current_pos = lemma_arr[0].hz_str_len;
-
- size_t id_num = 1;
-
- for (size_t i = 1; i < lemma_num; i++) {
- utf16_strncpy(buf_ + current_pos, lemma_arr[i].hanzi_str,
- lemma_arr[i].hz_str_len);
-
- id_num++;
- current_pos += lemma_arr[i].hz_str_len;
- }
-
- assert(current_pos == start_pos_[kMaxLemmaSize]);
- assert(id_num == start_id_[kMaxLemmaSize]);
-}
-
-char16* DictList::find_pos2_startedbyhz(char16 hz_char) {
- char16 *found_2w = static_cast<char16*>
- (mybsearch(&hz_char, buf_ + start_pos_[1],
- (start_pos_[2] - start_pos_[1]) / 2,
- sizeof(char16) * 2, cmp_hanzis_1));
- if (NULL == found_2w)
- return NULL;
-
- while (found_2w > buf_ + start_pos_[1] && *found_2w == *(found_2w - 1))
- found_2w -= 2;
-
- return found_2w;
-}
-#endif // ___BUILD_MODEL___
-
-char16* DictList::find_pos_startedbyhzs(const char16 last_hzs[],
- size_t word_len, int (*cmp_func)(const void *, const void *)) {
- char16 *found_w = static_cast<char16*>
- (mybsearch(last_hzs, buf_ + start_pos_[word_len - 1],
- (start_pos_[word_len] - start_pos_[word_len - 1])
- / word_len,
- sizeof(char16) * word_len, cmp_func));
-
- if (NULL == found_w)
- return NULL;
-
- while (found_w > buf_ + start_pos_[word_len -1] &&
- cmp_func(found_w, found_w - word_len) == 0)
- found_w -= word_len;
-
- return found_w;
-}
-
-size_t DictList::predict(const char16 last_hzs[], uint16 hzs_len,
- NPredictItem *npre_items, size_t npre_max,
- size_t b4_used) {
- assert(hzs_len <= kMaxPredictSize && hzs_len > 0);
-
- // 1. Prepare work
- int (*cmp_func)(const void *, const void *) = cmp_func_[hzs_len - 1];
-
- NGram& ngram = NGram::get_instance();
-
- size_t item_num = 0;
-
- // 2. Do prediction
- for (uint16 pre_len = 1; pre_len <= kMaxPredictSize + 1 - hzs_len;
- pre_len++) {
- uint16 word_len = hzs_len + pre_len;
- char16 *w_buf = find_pos_startedbyhzs(last_hzs, word_len, cmp_func);
- if (NULL == w_buf)
- continue;
- while (w_buf < buf_ + start_pos_[word_len] &&
- cmp_func(w_buf, last_hzs) == 0 &&
- item_num < npre_max) {
- memset(npre_items + item_num, 0, sizeof(NPredictItem));
- utf16_strncpy(npre_items[item_num].pre_hzs, w_buf + hzs_len, pre_len);
- npre_items[item_num].psb =
- ngram.get_uni_psb((size_t)(w_buf - buf_ - start_pos_[word_len - 1])
- / word_len + start_id_[word_len - 1]);
- npre_items[item_num].his_len = hzs_len;
- item_num++;
- w_buf += word_len;
- }
- }
-
- size_t new_num = 0;
- for (size_t i = 0; i < item_num; i++) {
- // Try to find it in the existing items
- size_t e_pos;
- for (e_pos = 1; e_pos <= b4_used; e_pos++) {
- if (utf16_strncmp((*(npre_items - e_pos)).pre_hzs, npre_items[i].pre_hzs,
- kMaxPredictSize) == 0)
- break;
- }
- if (e_pos <= b4_used)
- continue;
-
- // If not found, append it to the buffer
- npre_items[new_num] = npre_items[i];
- new_num++;
- }
-
- return new_num;
-}
-
-uint16 DictList::get_lemma_str(LemmaIdType id_lemma, char16 *str_buf,
- uint16 str_max) {
- if (!initialized_ || id_lemma >= start_id_[kMaxLemmaSize] || NULL == str_buf
- || str_max <= 1)
- return 0;
-
- // Find the range
- for (uint16 i = 0; i < kMaxLemmaSize; i++) {
- if (i + 1 > str_max - 1)
- return 0;
- if (start_id_[i] <= id_lemma && start_id_[i + 1] > id_lemma) {
- size_t id_span = id_lemma - start_id_[i];
-
- uint16 *buf = buf_ + start_pos_[i] + id_span * (i + 1);
- for (uint16 len = 0; len <= i; len++) {
- str_buf[len] = buf[len];
- }
- str_buf[i+1] = (char16)'\0';
- return i + 1;
- }
- }
- return 0;
-}
-
-uint16 DictList::get_splids_for_hanzi(char16 hanzi, uint16 half_splid,
- uint16 *splids, uint16 max_splids) {
- char16 *hz_found = static_cast<char16*>
- (mybsearch(&hanzi, scis_hz_, scis_num_, sizeof(char16), cmp_hanzis_1));
- assert(NULL != hz_found && hanzi == *hz_found);
-
- // Move to the first one.
- while (hz_found > scis_hz_ && hanzi == *(hz_found - 1))
- hz_found--;
-
- // First try to found if strict comparison result is not zero.
- char16 *hz_f = hz_found;
- bool strict = false;
- while (hz_f < scis_hz_ + scis_num_ && hanzi == *hz_f) {
- uint16 pos = hz_f - scis_hz_;
- if (0 == half_splid || scis_splid_[pos].half_splid == half_splid) {
- strict = true;
- }
- hz_f++;
- }
-
- uint16 found_num = 0;
- while (hz_found < scis_hz_ + scis_num_ && hanzi == *hz_found) {
- uint16 pos = hz_found - scis_hz_;
- if (0 == half_splid ||
- (strict && scis_splid_[pos].half_splid == half_splid) ||
- (!strict && spl_trie_->half_full_compatible(half_splid,
- scis_splid_[pos].full_splid))) {
- assert(found_num + 1 < max_splids);
- splids[found_num] = scis_splid_[pos].full_splid;
- found_num++;
- }
- hz_found++;
- }
-
- return found_num;
-}
-
-LemmaIdType DictList::get_lemma_id(const char16 *str, uint16 str_len) {
- if (NULL == str || str_len > kMaxLemmaSize)
- return 0;
-
- char16 *found = find_pos_startedbyhzs(str, str_len, cmp_func_[str_len - 1]);
- if (NULL == found)
- return 0;
-
- assert(found > buf_);
- assert(static_cast<size_t>(found - buf_) >= start_pos_[str_len - 1]);
- return static_cast<LemmaIdType>
- (start_id_[str_len - 1] +
- (found - buf_ - start_pos_[str_len - 1]) / str_len);
-}
-
-void DictList::convert_to_hanzis(char16 *str, uint16 str_len) {
- assert(NULL != str);
-
- for (uint16 str_pos = 0; str_pos < str_len; str_pos++) {
- str[str_pos] = scis_hz_[str[str_pos]];
- }
-}
-
-void DictList::convert_to_scis_ids(char16 *str, uint16 str_len) {
- assert(NULL != str);
-
- for (uint16 str_pos = 0; str_pos < str_len; str_pos++) {
- str[str_pos] = 0x100;
- }
-}
-
-bool DictList::save_list(FILE *fp) {
- if (!initialized_ || NULL == fp)
- return false;
-
- if (NULL == buf_ || 0 == start_pos_[kMaxLemmaSize] ||
- NULL == scis_hz_ || NULL == scis_splid_ || 0 == scis_num_)
- return false;
-
- if (fwrite(&scis_num_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fwrite(start_pos_, sizeof(uint32), kMaxLemmaSize + 1, fp) !=
- kMaxLemmaSize + 1)
- return false;
-
- if (fwrite(start_id_, sizeof(uint32), kMaxLemmaSize + 1, fp) !=
- kMaxLemmaSize + 1)
- return false;
-
- if (fwrite(scis_hz_, sizeof(char16), scis_num_, fp) != scis_num_)
- return false;
-
- if (fwrite(scis_splid_, sizeof(SpellingId), scis_num_, fp) != scis_num_)
- return false;
-
- if (fwrite(buf_, sizeof(char16), start_pos_[kMaxLemmaSize], fp) !=
- start_pos_[kMaxLemmaSize])
- return false;
-
- return true;
-}
-
-bool DictList::load_list(FILE *fp) {
- if (NULL == fp)
- return false;
-
- initialized_ = false;
-
- if (fread(&scis_num_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fread(start_pos_, sizeof(uint32), kMaxLemmaSize + 1, fp) !=
- kMaxLemmaSize + 1)
- return false;
-
- if (fread(start_id_, sizeof(uint32), kMaxLemmaSize + 1, fp) !=
- kMaxLemmaSize + 1)
- return false;
-
- free_resource();
-
- if (!alloc_resource(start_pos_[kMaxLemmaSize], scis_num_))
- return false;
-
- if (fread(scis_hz_, sizeof(char16), scis_num_, fp) != scis_num_)
- return false;
-
- if (fread(scis_splid_, sizeof(SpellingId), scis_num_, fp) != scis_num_)
- return false;
-
- if (fread(buf_, sizeof(char16), start_pos_[kMaxLemmaSize], fp) !=
- start_pos_[kMaxLemmaSize])
- return false;
-
- initialized_ = true;
- return true;
-}
-} // namespace ime_pinyin
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/dicttrie.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/dicttrie.cpp
deleted file mode 100644
index 0cdd0982..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/share/dicttrie.cpp
+++ /dev/null
@@ -1,941 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include "../include/dicttrie.h"
-#include "../include/dictbuilder.h"
-#include "../include/lpicache.h"
-#include "../include/mystdlib.h"
-#include "../include/ngram.h"
-
-namespace ime_pinyin {
-
-DictTrie::DictTrie() {
- spl_trie_ = SpellingTrie::get_cpinstance();
-
- root_ = NULL;
- splid_le0_index_ = NULL;
- lma_node_num_le0_ = 0;
- nodes_ge1_ = NULL;
- lma_node_num_ge1_ = 0;
- lma_idx_buf_ = NULL;
- lma_idx_buf_len_ = 0;
- total_lma_num_ = 0;
- top_lmas_num_ = 0;
- dict_list_ = NULL;
-
- parsing_marks_ = NULL;
- mile_stones_ = NULL;
- reset_milestones(0, kFirstValidMileStoneHandle);
-}
-
-DictTrie::~DictTrie() {
- free_resource(true);
-}
-
-void DictTrie::free_resource(bool free_dict_list) {
- if (NULL != root_)
- free(root_);
- root_ = NULL;
-
- if (NULL != splid_le0_index_)
- free(splid_le0_index_);
- splid_le0_index_ = NULL;
-
- if (NULL != nodes_ge1_)
- free(nodes_ge1_);
- nodes_ge1_ = NULL;
-
- if (NULL != lma_idx_buf_)
- free(lma_idx_buf_);
- lma_idx_buf_ = NULL;
-
- if (free_dict_list) {
- if (NULL != dict_list_) {
- delete dict_list_;
- }
- dict_list_ = NULL;
- }
-
- if (parsing_marks_)
- delete [] parsing_marks_;
- parsing_marks_ = NULL;
-
- if (mile_stones_)
- delete [] mile_stones_;
- mile_stones_ = NULL;
-
- reset_milestones(0, kFirstValidMileStoneHandle);
-}
-
-inline size_t DictTrie::get_son_offset(const LmaNodeGE1 *node) {
- return ((size_t)node->son_1st_off_l + ((size_t)node->son_1st_off_h << 16));
-}
-
-inline size_t DictTrie::get_homo_idx_buf_offset(const LmaNodeGE1 *node) {
- return ((size_t)node->homo_idx_buf_off_l +
- ((size_t)node->homo_idx_buf_off_h << 16));
-}
-
-inline LemmaIdType DictTrie::get_lemma_id(size_t id_offset) {
- LemmaIdType id = 0;
- for (uint16 pos = kLemmaIdSize - 1; pos > 0; pos--)
- id = (id << 8) + lma_idx_buf_[id_offset * kLemmaIdSize + pos];
- id = (id << 8) + lma_idx_buf_[id_offset * kLemmaIdSize];
- return id;
-}
-
-#ifdef ___BUILD_MODEL___
-bool DictTrie::build_dict(const char* fn_raw, const char* fn_validhzs) {
- DictBuilder* dict_builder = new DictBuilder();
-
- free_resource(true);
-
- return dict_builder->build_dict(fn_raw, fn_validhzs, this);
-}
-
-bool DictTrie::save_dict(FILE *fp) {
- if (NULL == fp)
- return false;
-
- if (fwrite(&lma_node_num_le0_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fwrite(&lma_node_num_ge1_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fwrite(&lma_idx_buf_len_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fwrite(&top_lmas_num_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fwrite(root_, sizeof(LmaNodeLE0), lma_node_num_le0_, fp)
- != lma_node_num_le0_)
- return false;
-
- if (fwrite(nodes_ge1_, sizeof(LmaNodeGE1), lma_node_num_ge1_, fp)
- != lma_node_num_ge1_)
- return false;
-
- if (fwrite(lma_idx_buf_, sizeof(unsigned char), lma_idx_buf_len_, fp) !=
- lma_idx_buf_len_)
- return false;
-
- return true;
-}
-
-bool DictTrie::save_dict(const char *filename) {
- if (NULL == filename)
- return false;
-
- if (NULL == root_ || NULL == dict_list_)
- return false;
-
- SpellingTrie &spl_trie = SpellingTrie::get_instance();
- NGram &ngram = NGram::get_instance();
-
- FILE *fp = fopen(filename, "wb");
- if (NULL == fp)
- return false;
-
- if (!spl_trie.save_spl_trie(fp) || !dict_list_->save_list(fp) ||
- !save_dict(fp) || !ngram.save_ngram(fp)) {
- fclose(fp);
- return false;
- }
-
- fclose(fp);
- return true;
-}
-#endif // ___BUILD_MODEL___
-
-bool DictTrie::load_dict(FILE *fp) {
- if (NULL == fp)
- return false;
- if (fread(&lma_node_num_le0_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fread(&lma_node_num_ge1_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fread(&lma_idx_buf_len_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fread(&top_lmas_num_, sizeof(uint32), 1, fp) != 1 ||
- top_lmas_num_ >= lma_idx_buf_len_)
- return false;
-
- free_resource(false);
-
- root_ = static_cast<LmaNodeLE0*>
- (malloc(lma_node_num_le0_ * sizeof(LmaNodeLE0)));
- nodes_ge1_ = static_cast<LmaNodeGE1*>
- (malloc(lma_node_num_ge1_ * sizeof(LmaNodeGE1)));
- lma_idx_buf_ = (unsigned char*)malloc(lma_idx_buf_len_);
- total_lma_num_ = lma_idx_buf_len_ / kLemmaIdSize;
-
- size_t buf_size = SpellingTrie::get_instance().get_spelling_num() + 1;
- assert(lma_node_num_le0_ <= buf_size);
- splid_le0_index_ = static_cast<uint16*>(malloc(buf_size * sizeof(uint16)));
-
- // Init the space for parsing.
- parsing_marks_ = new ParsingMark[kMaxParsingMark];
- mile_stones_ = new MileStone[kMaxMileStone];
- reset_milestones(0, kFirstValidMileStoneHandle);
-
- if (NULL == root_ || NULL == nodes_ge1_ || NULL == lma_idx_buf_ ||
- NULL == splid_le0_index_ || NULL == parsing_marks_ ||
- NULL == mile_stones_) {
- free_resource(false);
- return false;
- }
-
- if (fread(root_, sizeof(LmaNodeLE0), lma_node_num_le0_, fp)
- != lma_node_num_le0_)
- return false;
-
- if (fread(nodes_ge1_, sizeof(LmaNodeGE1), lma_node_num_ge1_, fp)
- != lma_node_num_ge1_)
- return false;
-
- if (fread(lma_idx_buf_, sizeof(unsigned char), lma_idx_buf_len_, fp) !=
- lma_idx_buf_len_)
- return false;
-
- // The quick index for the first level sons
- uint16 last_splid = kFullSplIdStart;
- size_t last_pos = 0;
- for (size_t i = 1; i < lma_node_num_le0_; i++) {
- for (uint16 splid = last_splid; splid < root_[i].spl_idx; splid++)
- splid_le0_index_[splid - kFullSplIdStart] = last_pos;
-
- splid_le0_index_[root_[i].spl_idx - kFullSplIdStart] =
- static_cast<uint16>(i);
- last_splid = root_[i].spl_idx;
- last_pos = i;
- }
-
- for (uint16 splid = last_splid + 1;
- splid < buf_size + kFullSplIdStart; splid++) {
- assert(static_cast<size_t>(splid - kFullSplIdStart) < buf_size);
- splid_le0_index_[splid - kFullSplIdStart] = last_pos + 1;
- }
-
- return true;
-}
-
-bool DictTrie::load_dict(const char *filename, LemmaIdType start_id,
- LemmaIdType end_id) {
- if (NULL == filename || end_id <= start_id)
- return false;
-
- FILE *fp = fopen(filename, "rb");
- if (NULL == fp)
- return false;
-
- free_resource(true);
-
- dict_list_ = new DictList();
- if (NULL == dict_list_) {
- fclose(fp);
- return false;
- }
-
- SpellingTrie &spl_trie = SpellingTrie::get_instance();
- NGram &ngram = NGram::get_instance();
-
- if (!spl_trie.load_spl_trie(fp) || !dict_list_->load_list(fp) ||
- !load_dict(fp) || !ngram.load_ngram(fp) ||
- total_lma_num_ > end_id - start_id + 1) {
- free_resource(true);
- fclose(fp);
- return false;
- }
-
- fclose(fp);
- return true;
-}
-
-bool DictTrie::load_dict_fd(int sys_fd, long start_offset,
- long length, LemmaIdType start_id,
- LemmaIdType end_id) {
- if (start_offset < 0 || length <= 0 || end_id <= start_id)
- return false;
-
- FILE *fp = fdopen(sys_fd, "rb");
- if (NULL == fp)
- return false;
-
- if (-1 == fseek(fp, start_offset, SEEK_SET)) {
- fclose(fp);
- return false;
- }
-
- free_resource(true);
-
- dict_list_ = new DictList();
- if (NULL == dict_list_) {
- fclose(fp);
- return false;
- }
-
- SpellingTrie &spl_trie = SpellingTrie::get_instance();
- NGram &ngram = NGram::get_instance();
-
- if (!spl_trie.load_spl_trie(fp) || !dict_list_->load_list(fp) ||
- !load_dict(fp) || !ngram.load_ngram(fp) ||
- ftell(fp) < start_offset + length ||
- total_lma_num_ > end_id - start_id + 1) {
- free_resource(true);
- fclose(fp);
- return false;
- }
-
- fclose(fp);
- return true;
-}
-
-size_t DictTrie::fill_lpi_buffer(LmaPsbItem lpi_items[], size_t lpi_max,
- LmaNodeLE0 *node) {
- size_t lpi_num = 0;
- NGram& ngram = NGram::get_instance();
- for (size_t homo = 0; homo < (size_t)node->num_of_homo; homo++) {
- lpi_items[lpi_num].id = get_lemma_id(node->homo_idx_buf_off +
- homo);
- lpi_items[lpi_num].lma_len = 1;
- lpi_items[lpi_num].psb =
- static_cast<LmaScoreType>(ngram.get_uni_psb(lpi_items[lpi_num].id));
- lpi_num++;
- if (lpi_num >= lpi_max)
- break;
- }
-
- return lpi_num;
-}
-
-size_t DictTrie::fill_lpi_buffer(LmaPsbItem lpi_items[], size_t lpi_max,
- size_t homo_buf_off, LmaNodeGE1 *node,
- uint16 lma_len) {
- size_t lpi_num = 0;
- NGram& ngram = NGram::get_instance();
- for (size_t homo = 0; homo < (size_t)node->num_of_homo; homo++) {
- lpi_items[lpi_num].id = get_lemma_id(homo_buf_off + homo);
- lpi_items[lpi_num].lma_len = lma_len;
- lpi_items[lpi_num].psb =
- static_cast<LmaScoreType>(ngram.get_uni_psb(lpi_items[lpi_num].id));
- lpi_num++;
- if (lpi_num >= lpi_max)
- break;
- }
-
- return lpi_num;
-}
-
-void DictTrie::reset_milestones(uint16 from_step, MileStoneHandle from_handle) {
- if (0 == from_step) {
- parsing_marks_pos_ = 0;
- mile_stones_pos_ = kFirstValidMileStoneHandle;
- } else {
- if (from_handle > 0 && from_handle < mile_stones_pos_) {
- mile_stones_pos_ = from_handle;
-
- MileStone *mile_stone = mile_stones_ + from_handle;
- parsing_marks_pos_ = mile_stone->mark_start;
- }
- }
-}
-
-MileStoneHandle DictTrie::extend_dict(MileStoneHandle from_handle,
- const DictExtPara *dep,
- LmaPsbItem *lpi_items, size_t lpi_max,
- size_t *lpi_num) {
- if (NULL == dep)
- return 0;
-
- // from LmaNodeLE0 (root) to LmaNodeLE0
- if (0 == from_handle) {
- assert(0 == dep->splids_extended);
- return extend_dict0(from_handle, dep, lpi_items, lpi_max, lpi_num);
- }
-
- // from LmaNodeLE0 to LmaNodeGE1
- if (1 == dep->splids_extended)
- return extend_dict1(from_handle, dep, lpi_items, lpi_max, lpi_num);
-
- // From LmaNodeGE1 to LmaNodeGE1
- return extend_dict2(from_handle, dep, lpi_items, lpi_max, lpi_num);
-}
-
-MileStoneHandle DictTrie::extend_dict0(MileStoneHandle from_handle,
- const DictExtPara *dep,
- LmaPsbItem *lpi_items,
- size_t lpi_max, size_t *lpi_num) {
- assert(NULL != dep && 0 == from_handle);
- *lpi_num = 0;
- MileStoneHandle ret_handle = 0;
-
- uint16 splid = dep->splids[dep->splids_extended];
- uint16 id_start = dep->id_start;
- uint16 id_num = dep->id_num;
-
- LpiCache& lpi_cache = LpiCache::get_instance();
- bool cached = lpi_cache.is_cached(splid);
-
- // 2. Begin exgtending
- // 2.1 Get the LmaPsbItem list
- LmaNodeLE0 *node = root_;
- size_t son_start = splid_le0_index_[id_start - kFullSplIdStart];
- size_t son_end = splid_le0_index_[id_start + id_num - kFullSplIdStart];
- for (size_t son_pos = son_start; son_pos < son_end; son_pos++) {
- assert(1 == node->son_1st_off);
- LmaNodeLE0 *son = root_ + son_pos;
- assert(son->spl_idx >= id_start && son->spl_idx < id_start + id_num);
-
- if (!cached && *lpi_num < lpi_max) {
- bool need_lpi = true;
- if (spl_trie_->is_half_id_yunmu(splid) && son_pos != son_start)
- need_lpi = false;
-
- if (need_lpi)
- *lpi_num += fill_lpi_buffer(lpi_items + (*lpi_num),
- lpi_max - *lpi_num, son);
- }
-
- // If necessary, fill in a new mile stone.
- if (son->spl_idx == id_start) {
- if (mile_stones_pos_ < kMaxMileStone &&
- parsing_marks_pos_ < kMaxParsingMark) {
- parsing_marks_[parsing_marks_pos_].node_offset = son_pos;
- parsing_marks_[parsing_marks_pos_].node_num = id_num;
- mile_stones_[mile_stones_pos_].mark_start = parsing_marks_pos_;
- mile_stones_[mile_stones_pos_].mark_num = 1;
- ret_handle = mile_stones_pos_;
- parsing_marks_pos_++;
- mile_stones_pos_++;
- }
- }
-
- if (son->spl_idx >= id_start + id_num -1)
- break;
- }
-
- // printf("----- parsing marks: %d, mile stone: %d \n", parsing_marks_pos_,
- // mile_stones_pos_);
- return ret_handle;
-}
-
-MileStoneHandle DictTrie::extend_dict1(MileStoneHandle from_handle,
- const DictExtPara *dep,
- LmaPsbItem *lpi_items,
- size_t lpi_max, size_t *lpi_num) {
- assert(NULL != dep && from_handle > 0 && from_handle < mile_stones_pos_);
-
- MileStoneHandle ret_handle = 0;
-
- // 1. If this is a half Id, get its corresponding full starting Id and
- // number of full Id.
- size_t ret_val = 0;
-
- uint16 id_start = dep->id_start;
- uint16 id_num = dep->id_num;
-
- // 2. Begin extending.
- MileStone *mile_stone = mile_stones_ + from_handle;
-
- for (uint16 h_pos = 0; h_pos < mile_stone->mark_num; h_pos++) {
- ParsingMark p_mark = parsing_marks_[mile_stone->mark_start + h_pos];
- uint16 ext_num = p_mark.node_num;
- for (uint16 ext_pos = 0; ext_pos < ext_num; ext_pos++) {
- LmaNodeLE0 *node = root_ + p_mark.node_offset + ext_pos;
- size_t found_start = 0;
- size_t found_num = 0;
- for (size_t son_pos = 0; son_pos < (size_t)node->num_of_son; son_pos++) {
- assert(node->son_1st_off <= lma_node_num_ge1_);
- LmaNodeGE1 *son = nodes_ge1_ + node->son_1st_off + son_pos;
- if (son->spl_idx >= id_start
- && son->spl_idx < id_start + id_num) {
- if (*lpi_num < lpi_max) {
- size_t homo_buf_off = get_homo_idx_buf_offset(son);
- *lpi_num += fill_lpi_buffer(lpi_items + (*lpi_num),
- lpi_max - *lpi_num, homo_buf_off, son,
- 2);
- }
-
- // If necessary, fill in the new DTMI
- if (0 == found_num) {
- found_start = son_pos;
- }
- found_num++;
- }
- if (son->spl_idx >= id_start + id_num - 1 || son_pos ==
- (size_t)node->num_of_son - 1) {
- if (found_num > 0) {
- if (mile_stones_pos_ < kMaxMileStone &&
- parsing_marks_pos_ < kMaxParsingMark) {
- parsing_marks_[parsing_marks_pos_].node_offset =
- node->son_1st_off + found_start;
- parsing_marks_[parsing_marks_pos_].node_num = found_num;
- if (0 == ret_val)
- mile_stones_[mile_stones_pos_].mark_start =
- parsing_marks_pos_;
- parsing_marks_pos_++;
- }
-
- ret_val++;
- }
- break;
- } // for son_pos
- } // for ext_pos
- } // for h_pos
- }
-
- if (ret_val > 0) {
- mile_stones_[mile_stones_pos_].mark_num = ret_val;
- ret_handle = mile_stones_pos_;
- mile_stones_pos_++;
- ret_val = 1;
- }
-
- // printf("----- parsing marks: %d, mile stone: %d \n", parsing_marks_pos_,
- // mile_stones_pos_);
- return ret_handle;
-}
-
-MileStoneHandle DictTrie::extend_dict2(MileStoneHandle from_handle,
- const DictExtPara *dep,
- LmaPsbItem *lpi_items,
- size_t lpi_max, size_t *lpi_num) {
- assert(NULL != dep && from_handle > 0 && from_handle < mile_stones_pos_);
-
- MileStoneHandle ret_handle = 0;
-
- // 1. If this is a half Id, get its corresponding full starting Id and
- // number of full Id.
- size_t ret_val = 0;
-
- uint16 id_start = dep->id_start;
- uint16 id_num = dep->id_num;
-
- // 2. Begin extending.
- MileStone *mile_stone = mile_stones_ + from_handle;
-
- for (uint16 h_pos = 0; h_pos < mile_stone->mark_num; h_pos++) {
- ParsingMark p_mark = parsing_marks_[mile_stone->mark_start + h_pos];
- uint16 ext_num = p_mark.node_num;
- for (uint16 ext_pos = 0; ext_pos < ext_num; ext_pos++) {
- LmaNodeGE1 *node = nodes_ge1_ + p_mark.node_offset + ext_pos;
- size_t found_start = 0;
- size_t found_num = 0;
-
- for (size_t son_pos = 0; son_pos < (size_t)node->num_of_son; son_pos++) {
- assert(node->son_1st_off_l > 0 || node->son_1st_off_h > 0);
- LmaNodeGE1 *son = nodes_ge1_ + get_son_offset(node) + son_pos;
- if (son->spl_idx >= id_start
- && son->spl_idx < id_start + id_num) {
- if (*lpi_num < lpi_max) {
- size_t homo_buf_off = get_homo_idx_buf_offset(son);
- *lpi_num += fill_lpi_buffer(lpi_items + (*lpi_num),
- lpi_max - *lpi_num, homo_buf_off, son,
- dep->splids_extended + 1);
- }
-
- // If necessary, fill in the new DTMI
- if (0 == found_num) {
- found_start = son_pos;
- }
- found_num++;
- }
- if (son->spl_idx >= id_start + id_num - 1 || son_pos ==
- (size_t)node->num_of_son - 1) {
- if (found_num > 0) {
- if (mile_stones_pos_ < kMaxMileStone &&
- parsing_marks_pos_ < kMaxParsingMark) {
- parsing_marks_[parsing_marks_pos_].node_offset =
- get_son_offset(node) + found_start;
- parsing_marks_[parsing_marks_pos_].node_num = found_num;
- if (0 == ret_val)
- mile_stones_[mile_stones_pos_].mark_start =
- parsing_marks_pos_;
- parsing_marks_pos_++;
- }
-
- ret_val++;
- }
- break;
- }
- } // for son_pos
- } // for ext_pos
- } // for h_pos
-
- if (ret_val > 0) {
- mile_stones_[mile_stones_pos_].mark_num = ret_val;
- ret_handle = mile_stones_pos_;
- mile_stones_pos_++;
- }
-
- // printf("----- parsing marks: %d, mile stone: %d \n", parsing_marks_pos_,
- // mile_stones_pos_);
- return ret_handle;
-}
-
-bool DictTrie::try_extend(const uint16 *splids, uint16 splid_num,
- LemmaIdType id_lemma) {
- if (0 == splid_num || NULL == splids)
- return false;
-
- void *node = root_ + splid_le0_index_[splids[0] - kFullSplIdStart];
-
- for (uint16 pos = 1; pos < splid_num; pos++) {
- if (1 == pos) {
- LmaNodeLE0 *node_le0 = reinterpret_cast<LmaNodeLE0*>(node);
- LmaNodeGE1 *node_son;
- uint16 son_pos;
- for (son_pos = 0; son_pos < static_cast<uint16>(node_le0->num_of_son);
- son_pos++) {
- assert(node_le0->son_1st_off <= lma_node_num_ge1_);
- node_son = nodes_ge1_ + node_le0->son_1st_off
- + son_pos;
- if (node_son->spl_idx == splids[pos])
- break;
- }
- if (son_pos < node_le0->num_of_son)
- node = reinterpret_cast<void*>(node_son);
- else
- return false;
- } else {
- LmaNodeGE1 *node_ge1 = reinterpret_cast<LmaNodeGE1*>(node);
- LmaNodeGE1 *node_son;
- uint16 son_pos;
- for (son_pos = 0; son_pos < static_cast<uint16>(node_ge1->num_of_son);
- son_pos++) {
- assert(node_ge1->son_1st_off_l > 0 || node_ge1->son_1st_off_h > 0);
- node_son = nodes_ge1_ + get_son_offset(node_ge1) + son_pos;
- if (node_son->spl_idx == splids[pos])
- break;
- }
- if (son_pos < node_ge1->num_of_son)
- node = reinterpret_cast<void*>(node_son);
- else
- return false;
- }
- }
-
- if (1 == splid_num) {
- LmaNodeLE0* node_le0 = reinterpret_cast<LmaNodeLE0*>(node);
- size_t num_of_homo = (size_t)node_le0->num_of_homo;
- for (size_t homo_pos = 0; homo_pos < num_of_homo; homo_pos++) {
- LemmaIdType id_this = get_lemma_id(node_le0->homo_idx_buf_off + homo_pos);
- char16 str[2];
- get_lemma_str(id_this, str, 2);
- if (id_this == id_lemma)
- return true;
- }
- } else {
- LmaNodeGE1* node_ge1 = reinterpret_cast<LmaNodeGE1*>(node);
- size_t num_of_homo = (size_t)node_ge1->num_of_homo;
- for (size_t homo_pos = 0; homo_pos < num_of_homo; homo_pos++) {
- size_t node_homo_off = get_homo_idx_buf_offset(node_ge1);
- if (get_lemma_id(node_homo_off + homo_pos) == id_lemma)
- return true;
- }
- }
-
- return false;
-}
-
-size_t DictTrie::get_lpis(const uint16* splid_str, uint16 splid_str_len,
- LmaPsbItem* lma_buf, size_t max_lma_buf) {
- if (splid_str_len > kMaxLemmaSize)
- return 0;
-
-#define MAX_EXTENDBUF_LEN 200
-
- size_t* node_buf1[MAX_EXTENDBUF_LEN]; // use size_t for data alignment
- size_t* node_buf2[MAX_EXTENDBUF_LEN];
- LmaNodeLE0** node_fr_le0 =
- reinterpret_cast<LmaNodeLE0**>(node_buf1); // Nodes from.
- LmaNodeLE0** node_to_le0 =
- reinterpret_cast<LmaNodeLE0**>(node_buf2); // Nodes to.
- LmaNodeGE1** node_fr_ge1 = NULL;
- LmaNodeGE1** node_to_ge1 = NULL;
- size_t node_fr_num = 1;
- size_t node_to_num = 0;
- node_fr_le0[0] = root_;
- if (NULL == node_fr_le0[0])
- return 0;
-
- size_t spl_pos = 0;
-
- while (spl_pos < splid_str_len) {
- uint16 id_num = 1;
- uint16 id_start = splid_str[spl_pos];
- // If it is a half id
- if (spl_trie_->is_half_id(splid_str[spl_pos])) {
- id_num = spl_trie_->half_to_full(splid_str[spl_pos], &id_start);
- assert(id_num > 0);
- }
-
- // Extend the nodes
- if (0 == spl_pos) { // From LmaNodeLE0 (root) to LmaNodeLE0 nodes
- for (size_t node_fr_pos = 0; node_fr_pos < node_fr_num; node_fr_pos++) {
- LmaNodeLE0 *node = node_fr_le0[node_fr_pos];
- assert(node == root_ && 1 == node_fr_num);
- size_t son_start = splid_le0_index_[id_start - kFullSplIdStart];
- size_t son_end =
- splid_le0_index_[id_start + id_num - kFullSplIdStart];
- for (size_t son_pos = son_start; son_pos < son_end; son_pos++) {
- assert(1 == node->son_1st_off);
- LmaNodeLE0 *node_son = root_ + son_pos;
- assert(node_son->spl_idx >= id_start
- && node_son->spl_idx < id_start + id_num);
- if (node_to_num < MAX_EXTENDBUF_LEN) {
- node_to_le0[node_to_num] = node_son;
- node_to_num++;
- }
- // id_start + id_num - 1 is the last one, which has just been
- // recorded.
- if (node_son->spl_idx >= id_start + id_num - 1)
- break;
- }
- }
-
- spl_pos++;
- if (spl_pos >= splid_str_len || node_to_num == 0)
- break;
- // Prepare the nodes for next extending
- // next time, from LmaNodeLE0 to LmaNodeGE1
- LmaNodeLE0** node_tmp = node_fr_le0;
- node_fr_le0 = node_to_le0;
- node_to_le0 = NULL;
- node_to_ge1 = reinterpret_cast<LmaNodeGE1**>(node_tmp);
- } else if (1 == spl_pos) { // From LmaNodeLE0 to LmaNodeGE1 nodes
- for (size_t node_fr_pos = 0; node_fr_pos < node_fr_num; node_fr_pos++) {
- LmaNodeLE0 *node = node_fr_le0[node_fr_pos];
- for (size_t son_pos = 0; son_pos < (size_t)node->num_of_son;
- son_pos++) {
- assert(node->son_1st_off <= lma_node_num_ge1_);
- LmaNodeGE1 *node_son = nodes_ge1_ + node->son_1st_off
- + son_pos;
- if (node_son->spl_idx >= id_start
- && node_son->spl_idx < id_start + id_num) {
- if (node_to_num < MAX_EXTENDBUF_LEN) {
- node_to_ge1[node_to_num] = node_son;
- node_to_num++;
- }
- }
- // id_start + id_num - 1 is the last one, which has just been
- // recorded.
- if (node_son->spl_idx >= id_start + id_num - 1)
- break;
- }
- }
-
- spl_pos++;
- if (spl_pos >= splid_str_len || node_to_num == 0)
- break;
- // Prepare the nodes for next extending
- // next time, from LmaNodeGE1 to LmaNodeGE1
- node_fr_ge1 = node_to_ge1;
- node_to_ge1 = reinterpret_cast<LmaNodeGE1**>(node_fr_le0);
- node_fr_le0 = NULL;
- node_to_le0 = NULL;
- } else { // From LmaNodeGE1 to LmaNodeGE1 nodes
- for (size_t node_fr_pos = 0; node_fr_pos < node_fr_num; node_fr_pos++) {
- LmaNodeGE1 *node = node_fr_ge1[node_fr_pos];
- for (size_t son_pos = 0; son_pos < (size_t)node->num_of_son;
- son_pos++) {
- assert(node->son_1st_off_l > 0 || node->son_1st_off_h > 0);
- LmaNodeGE1 *node_son = nodes_ge1_
- + get_son_offset(node) + son_pos;
- if (node_son->spl_idx >= id_start
- && node_son->spl_idx < id_start + id_num) {
- if (node_to_num < MAX_EXTENDBUF_LEN) {
- node_to_ge1[node_to_num] = node_son;
- node_to_num++;
- }
- }
- // id_start + id_num - 1 is the last one, which has just been
- // recorded.
- if (node_son->spl_idx >= id_start + id_num - 1)
- break;
- }
- }
-
- spl_pos++;
- if (spl_pos >= splid_str_len || node_to_num == 0)
- break;
- // Prepare the nodes for next extending
- // next time, from LmaNodeGE1 to LmaNodeGE1
- LmaNodeGE1 **node_tmp = node_fr_ge1;
- node_fr_ge1 = node_to_ge1;
- node_to_ge1 = node_tmp;
- }
-
- // The number of node for next extending
- node_fr_num = node_to_num;
- node_to_num = 0;
- } // while
-
- if (0 == node_to_num)
- return 0;
-
- NGram &ngram = NGram::get_instance();
- size_t lma_num = 0;
-
- // If the length is 1, and the splid is a one-char Yunmu like 'a', 'o', 'e',
- // only those candidates for the full matched one-char id will be returned.
- if (1 == splid_str_len && spl_trie_->is_half_id_yunmu(splid_str[0]))
- node_to_num = node_to_num > 0 ? 1 : 0;
-
- for (size_t node_pos = 0; node_pos < node_to_num; node_pos++) {
- size_t num_of_homo = 0;
- if (spl_pos <= 1) { // Get from LmaNodeLE0 nodes
- LmaNodeLE0* node_le0 = node_to_le0[node_pos];
- num_of_homo = (size_t)node_le0->num_of_homo;
- for (size_t homo_pos = 0; homo_pos < num_of_homo; homo_pos++) {
- size_t ch_pos = lma_num + homo_pos;
- lma_buf[ch_pos].id =
- get_lemma_id(node_le0->homo_idx_buf_off + homo_pos);
- lma_buf[ch_pos].lma_len = 1;
- lma_buf[ch_pos].psb =
- static_cast<LmaScoreType>(ngram.get_uni_psb(lma_buf[ch_pos].id));
-
- if (lma_num + homo_pos >= max_lma_buf - 1)
- break;
- }
- } else { // Get from LmaNodeGE1 nodes
- LmaNodeGE1* node_ge1 = node_to_ge1[node_pos];
- num_of_homo = (size_t)node_ge1->num_of_homo;
- for (size_t homo_pos = 0; homo_pos < num_of_homo; homo_pos++) {
- size_t ch_pos = lma_num + homo_pos;
- size_t node_homo_off = get_homo_idx_buf_offset(node_ge1);
- lma_buf[ch_pos].id = get_lemma_id(node_homo_off + homo_pos);
- lma_buf[ch_pos].lma_len = splid_str_len;
- lma_buf[ch_pos].psb =
- static_cast<LmaScoreType>(ngram.get_uni_psb(lma_buf[ch_pos].id));
-
- if (lma_num + homo_pos >= max_lma_buf - 1)
- break;
- }
- }
-
- lma_num += num_of_homo;
- if (lma_num >= max_lma_buf) {
- lma_num = max_lma_buf;
- break;
- }
- }
- return lma_num;
-}
-
-uint16 DictTrie::get_lemma_str(LemmaIdType id_lemma, char16 *str_buf,
- uint16 str_max) {
- return dict_list_->get_lemma_str(id_lemma, str_buf, str_max);
-}
-
-uint16 DictTrie::get_lemma_splids(LemmaIdType id_lemma, uint16 *splids,
- uint16 splids_max, bool arg_valid) {
- char16 lma_str[kMaxLemmaSize + 1];
- uint16 lma_len = get_lemma_str(id_lemma, lma_str, kMaxLemmaSize + 1);
- assert((!arg_valid && splids_max >= lma_len) || lma_len == splids_max);
-
- uint16 spl_mtrx[kMaxLemmaSize * 5];
- uint16 spl_start[kMaxLemmaSize + 1];
- spl_start[0] = 0;
- uint16 try_num = 1;
-
- for (uint16 pos = 0; pos < lma_len; pos++) {
- uint16 cand_splids_this = 0;
- if (arg_valid && spl_trie_->is_full_id(splids[pos])) {
- spl_mtrx[spl_start[pos]] = splids[pos];
- cand_splids_this = 1;
- } else {
- cand_splids_this = dict_list_->get_splids_for_hanzi(lma_str[pos],
- arg_valid ? splids[pos] : 0, spl_mtrx + spl_start[pos],
- kMaxLemmaSize * 5 - spl_start[pos]);
- assert(cand_splids_this > 0);
- }
- spl_start[pos + 1] = spl_start[pos] + cand_splids_this;
- try_num *= cand_splids_this;
- }
-
- for (uint16 try_pos = 0; try_pos < try_num; try_pos++) {
- uint16 mod = 1;
- for (uint16 pos = 0; pos < lma_len; pos++) {
- uint16 radix = spl_start[pos + 1] - spl_start[pos];
- splids[pos] = spl_mtrx[ spl_start[pos] + try_pos / mod % radix];
- mod *= radix;
- }
-
- if (try_extend(splids, lma_len, id_lemma))
- return lma_len;
- }
-
- return 0;
-}
-
-void DictTrie::set_total_lemma_count_of_others(size_t count) {
- NGram& ngram = NGram::get_instance();
- ngram.set_total_freq_none_sys(count);
-}
-
-void DictTrie::convert_to_hanzis(char16 *str, uint16 str_len) {
- return dict_list_->convert_to_hanzis(str, str_len);
-}
-
-void DictTrie::convert_to_scis_ids(char16 *str, uint16 str_len) {
- return dict_list_->convert_to_scis_ids(str, str_len);
-}
-
-LemmaIdType DictTrie::get_lemma_id(const char16 lemma_str[], uint16 lemma_len) {
- if (NULL == lemma_str || lemma_len > kMaxLemmaSize)
- return 0;
-
- return dict_list_->get_lemma_id(lemma_str, lemma_len);
-}
-
-size_t DictTrie::predict_top_lmas(size_t his_len, NPredictItem *npre_items,
- size_t npre_max, size_t b4_used) {
- NGram &ngram = NGram::get_instance();
-
- size_t item_num = 0;
- size_t top_lmas_id_offset = lma_idx_buf_len_ / kLemmaIdSize - top_lmas_num_;
- size_t top_lmas_pos = 0;
- while (item_num < npre_max && top_lmas_pos < top_lmas_num_) {
- memset(npre_items + item_num, 0, sizeof(NPredictItem));
- LemmaIdType top_lma_id = get_lemma_id(top_lmas_id_offset + top_lmas_pos);
- top_lmas_pos += 1;
- if (dict_list_->get_lemma_str(top_lma_id,
- npre_items[item_num].pre_hzs,
- kMaxLemmaSize - 1) == 0) {
- continue;
- }
- npre_items[item_num].psb = ngram.get_uni_psb(top_lma_id);
- npre_items[item_num].his_len = his_len;
- item_num++;
- }
- return item_num;
-}
-
-size_t DictTrie::predict(const char16 *last_hzs, uint16 hzs_len,
- NPredictItem *npre_items, size_t npre_max,
- size_t b4_used) {
- return dict_list_->predict(last_hzs, hzs_len, npre_items, npre_max, b4_used);
-}
-} // namespace ime_pinyin
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/ngram.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/ngram.cpp
deleted file mode 100644
index 6aec850b..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/share/ngram.cpp
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include "../include/mystdlib.h"
-#include "../include/ngram.h"
-
-namespace ime_pinyin {
-
-#define ADD_COUNT 0.3
-
-int comp_double(const void *p1, const void *p2) {
- if (*static_cast<const double*>(p1) < *static_cast<const double*>(p2))
- return -1;
- if (*static_cast<const double*>(p1) > *static_cast<const double*>(p2))
- return 1;
- return 0;
-}
-
-inline double distance(double freq, double code) {
- // return fabs(freq - code);
- return freq * fabs(log(freq) - log(code));
-}
-
-// Find the index of the code value which is nearest to the given freq
-int qsearch_nearest(double code_book[], double freq, int start, int end) {
- if (start == end)
- return start;
-
- if (start + 1 == end) {
- if (distance(freq, code_book[end]) > distance(freq, code_book[start]))
- return start;
- return end;
- }
-
- int mid = (start + end) / 2;
-
- if (code_book[mid] > freq)
- return qsearch_nearest(code_book, freq, start, mid);
- else
- return qsearch_nearest(code_book, freq, mid, end);
-}
-
-size_t update_code_idx(double freqs[], size_t num, double code_book[],
- CODEBOOK_TYPE *code_idx) {
- size_t changed = 0;
- for (size_t pos = 0; pos < num; pos++) {
- CODEBOOK_TYPE idx;
- idx = qsearch_nearest(code_book, freqs[pos], 0, kCodeBookSize - 1);
- if (idx != code_idx[pos])
- changed++;
- code_idx[pos] = idx;
- }
- return changed;
-}
-
-double recalculate_kernel(double freqs[], size_t num, double code_book[],
- CODEBOOK_TYPE *code_idx) {
- double ret = 0;
-
- size_t *item_num = new size_t[kCodeBookSize];
- assert(item_num);
- memset(item_num, 0, sizeof(size_t) * kCodeBookSize);
-
- double *cb_new = new double[kCodeBookSize];
- assert(cb_new);
- memset(cb_new, 0, sizeof(double) * kCodeBookSize);
-
- for (size_t pos = 0; pos < num; pos++) {
- ret += distance(freqs[pos], code_book[code_idx[pos]]);
-
- cb_new[code_idx[pos]] += freqs[pos];
- item_num[code_idx[pos]] += 1;
- }
-
- for (size_t code = 0; code < kCodeBookSize; code++) {
- assert(item_num[code] > 0);
- code_book[code] = cb_new[code] / item_num[code];
- }
-
- delete [] item_num;
- delete [] cb_new;
-
- return ret;
-}
-
-void iterate_codes(double freqs[], size_t num, double code_book[],
- CODEBOOK_TYPE *code_idx) {
- size_t iter_num = 0;
- double delta_last = 0;
- do {
- size_t changed = update_code_idx(freqs, num, code_book, code_idx);
-
- double delta = recalculate_kernel(freqs, num, code_book, code_idx);
-
- if (kPrintDebug0) {
- printf("---Unigram codebook iteration: %d : %d, %.9f\n",
- iter_num, changed, delta);
- }
- iter_num++;
-
- if (iter_num > 1 &&
- (delta == 0 || fabs(delta_last - delta)/fabs(delta) < 0.000000001))
- break;
- delta_last = delta;
- } while (true);
-}
-
-
-NGram* NGram::instance_ = NULL;
-
-NGram::NGram() {
- initialized_ = false;
- idx_num_ = 0;
- lma_freq_idx_ = NULL;
- sys_score_compensation_ = 0;
-
-#ifdef ___BUILD_MODEL___
- freq_codes_df_ = NULL;
-#endif
- freq_codes_ = NULL;
-}
-
-NGram::~NGram() {
- if (NULL != lma_freq_idx_)
- free(lma_freq_idx_);
-
-#ifdef ___BUILD_MODEL___
- if (NULL != freq_codes_df_)
- free(freq_codes_df_);
-#endif
-
- if (NULL != freq_codes_)
- free(freq_codes_);
-}
-
-NGram& NGram::get_instance() {
- if (NULL == instance_)
- instance_ = new NGram();
- return *instance_;
-}
-
-bool NGram::save_ngram(FILE *fp) {
- if (!initialized_ || NULL == fp)
- return false;
-
- if (0 == idx_num_ || NULL == freq_codes_ || NULL == lma_freq_idx_)
- return false;
-
- if (fwrite(&idx_num_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fwrite(freq_codes_, sizeof(LmaScoreType), kCodeBookSize, fp) !=
- kCodeBookSize)
- return false;
-
- if (fwrite(lma_freq_idx_, sizeof(CODEBOOK_TYPE), idx_num_, fp) != idx_num_)
- return false;
-
- return true;
-}
-
-bool NGram::load_ngram(FILE *fp) {
- if (NULL == fp)
- return false;
-
- initialized_ = false;
-
- if (fread(&idx_num_, sizeof(uint32), 1, fp) != 1 )
- return false;
-
- if (NULL != lma_freq_idx_)
- free(lma_freq_idx_);
-
- if (NULL != freq_codes_)
- free(freq_codes_);
-
- lma_freq_idx_ = static_cast<CODEBOOK_TYPE*>
- (malloc(idx_num_ * sizeof(CODEBOOK_TYPE)));
- freq_codes_ = static_cast<LmaScoreType*>
- (malloc(kCodeBookSize * sizeof(LmaScoreType)));
-
- if (NULL == lma_freq_idx_ || NULL == freq_codes_)
- return false;
-
- if (fread(freq_codes_, sizeof(LmaScoreType), kCodeBookSize, fp) !=
- kCodeBookSize)
- return false;
-
- if (fread(lma_freq_idx_, sizeof(CODEBOOK_TYPE), idx_num_, fp) != idx_num_)
- return false;
-
- initialized_ = true;
-
- total_freq_none_sys_ = 0;
- return true;
-}
-
-void NGram::set_total_freq_none_sys(size_t freq_none_sys) {
- total_freq_none_sys_ = freq_none_sys;
- if (0 == total_freq_none_sys_) {
- sys_score_compensation_ = 0;
- } else {
- double factor = static_cast<double>(kSysDictTotalFreq) / (
- kSysDictTotalFreq + total_freq_none_sys_);
- sys_score_compensation_ = static_cast<float>(
- log(factor) * kLogValueAmplifier);
- }
-}
-
-// The caller makes sure this oject is initialized.
-float NGram::get_uni_psb(LemmaIdType lma_id) {
- return static_cast<float>(freq_codes_[lma_freq_idx_[lma_id]]) +
- sys_score_compensation_;
-}
-
-float NGram::convert_psb_to_score(double psb) {
- float score = static_cast<float>(
- log(psb) * static_cast<double>(kLogValueAmplifier));
- if (score > static_cast<float>(kMaxScore)) {
- score = static_cast<float>(kMaxScore);
- }
- return score;
-}
-
-#ifdef ___BUILD_MODEL___
-bool NGram::build_unigram(LemmaEntry *lemma_arr, size_t lemma_num,
- LemmaIdType next_idx_unused) {
- if (NULL == lemma_arr || 0 == lemma_num || next_idx_unused <= 1)
- return false;
-
- double total_freq = 0;
- double *freqs = new double[next_idx_unused];
- if (NULL == freqs)
- return false;
-
- freqs[0] = ADD_COUNT;
- total_freq += freqs[0];
- LemmaIdType idx_now = 0;
- for (size_t pos = 0; pos < lemma_num; pos++) {
- if (lemma_arr[pos].idx_by_hz == idx_now)
- continue;
- idx_now++;
-
- assert(lemma_arr[pos].idx_by_hz == idx_now);
-
- freqs[idx_now] = lemma_arr[pos].freq;
- if (freqs[idx_now] <= 0)
- freqs[idx_now] = 0.3;
-
- total_freq += freqs[idx_now];
- }
-
- double max_freq = 0;
- idx_num_ = idx_now + 1;
- assert(idx_now + 1 == next_idx_unused);
-
- for (size_t pos = 0; pos < idx_num_; pos++) {
- freqs[pos] = freqs[pos] / total_freq;
- assert(freqs[pos] > 0);
- if (freqs[pos] > max_freq)
- max_freq = freqs[pos];
- }
-
- // calculate the code book
- if (NULL == freq_codes_df_)
- freq_codes_df_ = new double[kCodeBookSize];
- assert(freq_codes_df_);
- memset(freq_codes_df_, 0, sizeof(double) * kCodeBookSize);
-
- if (NULL == freq_codes_)
- freq_codes_ = new LmaScoreType[kCodeBookSize];
- assert(freq_codes_);
- memset(freq_codes_, 0, sizeof(LmaScoreType) * kCodeBookSize);
-
- size_t freq_pos = 0;
- for (size_t code_pos = 0; code_pos < kCodeBookSize; code_pos++) {
- bool found = true;
-
- while (found) {
- found = false;
- double cand = freqs[freq_pos];
- for (size_t i = 0; i < code_pos; i++)
- if (freq_codes_df_[i] == cand) {
- found = true;
- break;
- }
- if (found)
- freq_pos++;
- }
-
- freq_codes_df_[code_pos] = freqs[freq_pos];
- freq_pos++;
- }
-
- myqsort(freq_codes_df_, kCodeBookSize, sizeof(double), comp_double);
-
- if (NULL == lma_freq_idx_)
- lma_freq_idx_ = new CODEBOOK_TYPE[idx_num_];
- assert(lma_freq_idx_);
-
- iterate_codes(freqs, idx_num_, freq_codes_df_, lma_freq_idx_);
-
- delete [] freqs;
-
- if (kPrintDebug0) {
- printf("\n------Language Model Unigram Codebook------\n");
- }
-
- for (size_t code_pos = 0; code_pos < kCodeBookSize; code_pos++) {
- double log_score = log(freq_codes_df_[code_pos]);
- float final_score = convert_psb_to_score(freq_codes_df_[code_pos]);
- if (kPrintDebug0) {
- printf("code:%d, probability:%.9f, log score:%.3f, final score: %.3f\n",
- code_pos, freq_codes_df_[code_pos], log_score, final_score);
- }
- freq_codes_[code_pos] = static_cast<LmaScoreType>(final_score);
- }
-
- initialized_ = true;
- return true;
-}
-#endif
-
-} // namespace ime_pinyin
diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp
deleted file mode 100644
index e01c89a5..00000000
--- a/src/virtualkeyboard/3rdparty/pinyin/share/spellingtrie.cpp
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include "../include/dictdef.h"
-
-#ifdef _WIN32
-#define snprintf _snprintf
-#endif
-
-#ifdef ___BUILD_MODEL___
-#include "../include/spellingtable.h"
-#endif
-
-#include "../include/spellingtrie.h"
-
-namespace ime_pinyin {
-
-SpellingTrie* SpellingTrie::instance_ = NULL;
-
-// z/c/s is for Zh/Ch/Sh
-const char SpellingTrie::kHalfId2Sc_[kFullSplIdStart + 1] =
- "0ABCcDEFGHIJKLMNOPQRSsTUVWXYZz";
-
-// Bit 0 : is it a Shengmu char?
-// Bit 1 : is it a Yunmu char? (one char is a Yunmu)
-// Bit 2 : is it enabled in ShouZiMu(first char) mode?
-unsigned char SpellingTrie::char_flags_[] = {
- // a b c d e f g
- 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01,
- // h i j k l m n
- 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
- // o p q r s t
- 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
- // u v w x y z
- 0x00, 0x00, 0x01, 0x01, 0x01, 0x01
-};
-
-int compare_spl(const void* p1, const void* p2) {
- return strcmp((const char*)(p1), (const char*)(p2));
-}
-
-SpellingTrie::SpellingTrie() {
- spelling_buf_ = NULL;
- spelling_size_ = 0;
- spelling_num_ = 0;
- spl_ym_ids_ = NULL;
- splstr_queried_ = NULL;
- splstr16_queried_ = NULL;
- root_ = NULL;
- dumb_node_ = NULL;
- splitter_node_ = NULL;
- instance_ = NULL;
- ym_buf_ = NULL;
- f2h_ = NULL;
-
- szm_enable_shm(true);
- szm_enable_ym(true);
-
-#ifdef ___BUILD_MODEL___
- node_num_ = 0;
-#endif
-}
-
-SpellingTrie::~SpellingTrie() {
- if (NULL != spelling_buf_)
- delete [] spelling_buf_;
-
- if (NULL != splstr_queried_)
- delete [] splstr_queried_;
-
- if (NULL != splstr16_queried_)
- delete [] splstr16_queried_;
-
- if (NULL != spl_ym_ids_)
- delete [] spl_ym_ids_;
-
- if (NULL != root_) {
- free_son_trie(root_);
- delete root_;
- }
-
- if (NULL != dumb_node_) {
- delete [] dumb_node_;
- }
-
- if (NULL != splitter_node_) {
- delete [] splitter_node_;
- }
-
- if (NULL != instance_) {
- delete instance_;
- instance_ = NULL;
- }
-
- if (NULL != ym_buf_)
- delete [] ym_buf_;
-
- if (NULL != f2h_)
- delete [] f2h_;
-}
-
-bool SpellingTrie::if_valid_id_update(uint16 *splid) const {
- if (NULL == splid || 0 == *splid)
- return false;
-
- if (*splid >= kFullSplIdStart)
- return true;
- if (*splid < kFullSplIdStart) {
- char ch = kHalfId2Sc_[*splid];
- if (ch > 'Z') {
- return true;
- } else {
- if (szm_is_enabled(ch)) {
- return true;
- } else if (is_yunmu_char(ch)) {
- assert(h2f_num_[*splid] > 0);
- *splid = h2f_start_[*splid];
- return true;
- }
- }
- }
- return false;
-}
-
-bool SpellingTrie::is_half_id(uint16 splid) const {
- if (0 == splid || splid >= kFullSplIdStart)
- return false;
-
- return true;
-}
-
-bool SpellingTrie::is_full_id(uint16 splid) const {
- if (splid < kFullSplIdStart || splid >= kFullSplIdStart + spelling_num_)
- return false;
- return true;
-}
-
-bool SpellingTrie::half_full_compatible(uint16 half_id, uint16 full_id) const {
- uint16 half_fr_full = full_to_half(full_id);
-
- if (half_fr_full == half_id)
- return true;
-
- // &~0x20 is used to conver the char to upper case.
- // So that Zh/Ch/Sh(whose char is z/c/s) can be matched with Z/C/S.
- char ch_f = (kHalfId2Sc_[half_fr_full] & (~0x20));
- char ch_h = kHalfId2Sc_[half_id];
- if (ch_f == ch_h)
- return true;
-
- return false;
-}
-
-bool SpellingTrie::is_half_id_yunmu(uint16 splid) const {
- if (0 == splid || splid >= kFullSplIdStart)
- return false;
-
- char ch = kHalfId2Sc_[splid];
- // If ch >= 'a', that means the half id is one of Zh/Ch/Sh
- if (ch >= 'a') {
- return false;
- }
-
- return char_flags_[ch - 'A'] & kHalfIdYunmuMask;
-}
-
-bool SpellingTrie::is_shengmu_char(char ch) const {
- return char_flags_[ch - 'A'] & kHalfIdShengmuMask;
-}
-
-bool SpellingTrie::is_yunmu_char(char ch) const {
- return char_flags_[ch - 'A'] & kHalfIdYunmuMask;
-}
-
-bool SpellingTrie::is_szm_char(char ch) const {
- return is_shengmu_char(ch) || is_yunmu_char(ch);
-}
-
-bool SpellingTrie::szm_is_enabled(char ch) const {
- return char_flags_[ch - 'A'] & kHalfIdSzmMask;
-}
-
-void SpellingTrie::szm_enable_shm(bool enable) {
- if (enable) {
- for (char ch = 'A'; ch <= 'Z'; ch++) {
- if (is_shengmu_char(ch))
- char_flags_[ch - 'A'] = char_flags_[ch - 'A'] | kHalfIdSzmMask;
- }
- } else {
- for (char ch = 'A'; ch <= 'Z'; ch++) {
- if (is_shengmu_char(ch))
- char_flags_[ch - 'A'] = char_flags_[ch - 'A'] & (kHalfIdSzmMask ^ 0xff);
- }
- }
-}
-
-void SpellingTrie::szm_enable_ym(bool enable) {
- if (enable) {
- for (char ch = 'A'; ch <= 'Z'; ch++) {
- if (is_yunmu_char(ch))
- char_flags_[ch - 'A'] = char_flags_[ch - 'A'] | kHalfIdSzmMask;
- }
- } else {
- for (char ch = 'A'; ch <= 'Z'; ch++) {
- if (is_yunmu_char(ch))
- char_flags_[ch - 'A'] = char_flags_[ch - 'A'] & (kHalfIdSzmMask ^ 0xff);
- }
- }
-}
-
-bool SpellingTrie::is_szm_enabled(char ch) const {
- return char_flags_[ch - 'A'] & kHalfIdSzmMask;
-}
-
-const SpellingTrie* SpellingTrie::get_cpinstance() {
- return &get_instance();
-}
-
-SpellingTrie& SpellingTrie::get_instance() {
- if (NULL == instance_)
- instance_ = new SpellingTrie();
-
- return *instance_;
-}
-
-uint16 SpellingTrie::half2full_num(uint16 half_id) const {
- if (NULL == root_ || half_id >= kFullSplIdStart)
- return 0;
- return h2f_num_[half_id];
-}
-
-uint16 SpellingTrie::half_to_full(uint16 half_id, uint16 *spl_id_start) const {
- if (NULL == spl_id_start || NULL == root_ || half_id >= kFullSplIdStart)
- return 0;
-
- *spl_id_start = h2f_start_[half_id];
- return h2f_num_[half_id];
-}
-
-uint16 SpellingTrie::full_to_half(uint16 full_id) const {
- if (NULL == root_ || full_id < kFullSplIdStart ||
- full_id > spelling_num_ + kFullSplIdStart)
- return 0;
-
- return f2h_[full_id - kFullSplIdStart];
-}
-
-void SpellingTrie::free_son_trie(SpellingNode* node) {
- if (NULL == node)
- return;
-
- for (size_t pos = 0; pos < node->num_of_son; pos++) {
- free_son_trie(node->first_son + pos);
- }
-
- if (NULL != node->first_son)
- delete [] node->first_son;
-}
-
-bool SpellingTrie::construct(const char* spelling_arr, size_t item_size,
- size_t item_num, float score_amplifier,
- unsigned char average_score) {
- if (spelling_arr == NULL)
- return false;
-
- memset(h2f_start_, 0, sizeof(uint16) * kFullSplIdStart);
- memset(h2f_num_, 0, sizeof(uint16) * kFullSplIdStart);
-
- // If the arr is the same as the buf, means this function is called by
- // load_table(), the table data are ready; otherwise the array should be
- // saved.
- if (spelling_arr != spelling_buf_) {
- if (NULL != spelling_buf_)
- delete [] spelling_buf_;
- spelling_buf_ = new char[item_size * item_num];
- if (NULL == spelling_buf_)
- return false;
- memcpy(spelling_buf_, spelling_arr, sizeof(char) * item_size * item_num);
- }
-
- spelling_size_ = item_size;
- spelling_num_ = item_num;
-
- score_amplifier_ = score_amplifier;
- average_score_ = average_score;
-
- if (NULL != splstr_queried_)
- delete [] splstr_queried_;
- splstr_queried_ = new char[spelling_size_];
- if (NULL == splstr_queried_)
- return false;
-
- if (NULL != splstr16_queried_)
- delete [] splstr16_queried_;
- splstr16_queried_ = new char16[spelling_size_];
- if (NULL == splstr16_queried_)
- return false;
-
- // First, sort the buf to ensure they are in ascendant order
- qsort(spelling_buf_, spelling_num_, spelling_size_, compare_spl);
-
-#ifdef ___BUILD_MODEL___
- node_num_ = 1;
-#endif
-
- root_ = new SpellingNode();
- memset(root_, 0, sizeof(SpellingNode));
-
- dumb_node_ = new SpellingNode();
- memset(dumb_node_, 0, sizeof(SpellingNode));
- dumb_node_->score = average_score_;
-
- splitter_node_ = new SpellingNode();
- memset(splitter_node_, 0, sizeof(SpellingNode));
- splitter_node_->score = average_score_;
-
- memset(level1_sons_, 0, sizeof(SpellingNode*) * kValidSplCharNum);
-
- root_->first_son = construct_spellings_subset(0, spelling_num_, 0, root_);
-
- // Root's score should be cleared.
- root_->score = 0;
-
- if (NULL == root_->first_son)
- return false;
-
- h2f_start_[0] = h2f_num_[0] = 0;
-
- if (!build_f2h())
- return false;
-
-#ifdef ___BUILD_MODEL___
- if (kPrintDebug0) {
- printf("---SpellingTrie Nodes: %d\n", (int)node_num_);
- }
- return build_ym_info();
-#else
- return true;
-#endif
-}
-
-#ifdef ___BUILD_MODEL___
-const char* SpellingTrie::get_ym_str(const char *spl_str) {
- bool start_ZCS = false;
- if (is_shengmu_char(*spl_str)) {
- if ('Z' == *spl_str || 'C' == *spl_str || 'S' == *spl_str)
- start_ZCS = true;
- spl_str += 1;
- if (start_ZCS && 'h' == *spl_str)
- spl_str += 1;
- }
- return spl_str;
-}
-
-bool SpellingTrie::build_ym_info() {
- bool sucess;
- SpellingTable *spl_table = new SpellingTable();
-
- sucess = spl_table->init_table(kMaxPinyinSize - 1, 2 * kMaxYmNum, false);
- assert(sucess);
-
- for (uint16 pos = 0; pos < spelling_num_; pos++) {
- const char *spl_str = spelling_buf_ + spelling_size_ * pos;
- spl_str = get_ym_str(spl_str);
- if ('\0' != spl_str[0]) {
- sucess = spl_table->put_spelling(spl_str, 0);
- assert(sucess);
- }
- }
-
- size_t ym_item_size; // '\0' is included
- size_t ym_num;
- const char* ym_buf;
- ym_buf = spl_table->arrange(&ym_item_size, &ym_num);
-
- if (NULL != ym_buf_)
- delete [] ym_buf_;
- ym_buf_ = new char[ym_item_size * ym_num];
- if (NULL == ym_buf_) {
- delete spl_table;
- return false;
- }
-
- memcpy(ym_buf_, ym_buf, sizeof(char) * ym_item_size * ym_num);
- ym_size_ = ym_item_size;
- ym_num_ = ym_num;
-
- delete spl_table;
-
- // Generate the maping from the spelling ids to the Yunmu ids.
- if (spl_ym_ids_)
- delete spl_ym_ids_;
- spl_ym_ids_ = new uint8[spelling_num_ + kFullSplIdStart];
- if (NULL == spl_ym_ids_)
- return false;
-
- memset(spl_ym_ids_, 0, sizeof(uint8) * (spelling_num_ + kFullSplIdStart));
-
- for (uint16 id = 1; id < spelling_num_ + kFullSplIdStart; id++) {
- const char *str = get_spelling_str(id);
-
- str = get_ym_str(str);
- if ('\0' != str[0]) {
- uint8 ym_id = get_ym_id(str);
- spl_ym_ids_[id] = ym_id;
- assert(ym_id > 0);
- } else {
- spl_ym_ids_[id] = 0;
- }
- }
- return true;
-}
-#endif
-
-SpellingNode* SpellingTrie::construct_spellings_subset(
- size_t item_start, size_t item_end, size_t level, SpellingNode* parent) {
- if (level >= spelling_size_ || item_end <= item_start || NULL == parent)
- return NULL;
-
- SpellingNode *first_son = NULL;
- uint16 num_of_son = 0;
- unsigned char min_son_score = 255;
-
- const char *spelling_last_start = spelling_buf_ + spelling_size_ * item_start;
- char char_for_node = spelling_last_start[level];
- assert((char_for_node >= 'A' && char_for_node <= 'Z') ||
- 'h' == char_for_node);
-
- // Scan the array to find how many sons
- for (size_t i = item_start + 1; i < item_end; i++) {
- const char *spelling_current = spelling_buf_ + spelling_size_ * i;
- char char_current = spelling_current[level];
- if (char_current != char_for_node) {
- num_of_son++;
- char_for_node = char_current;
- }
- }
- num_of_son++;
-
- // Allocate memory
-#ifdef ___BUILD_MODEL___
- node_num_ += num_of_son;
-#endif
- first_son = new SpellingNode[num_of_son];
- memset(first_son, 0, sizeof(SpellingNode)*num_of_son);
-
- // Now begin construct tree
- size_t son_pos = 0;
-
- spelling_last_start = spelling_buf_ + spelling_size_ * item_start;
- char_for_node = spelling_last_start[level];
-
- bool spelling_endable = true;
- if (spelling_last_start[level + 1] != '\0')
- spelling_endable = false;
-
- size_t item_start_next = item_start;
-
- for (size_t i = item_start + 1; i < item_end; i++) {
- const char *spelling_current = spelling_buf_ + spelling_size_ * i;
- char char_current = spelling_current[level];
- assert(is_valid_spl_char(char_current));
-
- if (char_current != char_for_node) {
- // Construct a node
- SpellingNode *node_current = first_son + son_pos;
- node_current->char_this_node = char_for_node;
-
- // For quick search in the first level
- if (0 == level)
- level1_sons_[char_for_node - 'A'] = node_current;
-
- if (spelling_endable) {
- node_current->spelling_idx = kFullSplIdStart + item_start_next;
- }
-
- if (spelling_last_start[level + 1] != '\0' || i - item_start_next > 1) {
- size_t real_start = item_start_next;
- if (spelling_last_start[level + 1] == '\0')
- real_start++;
-
- node_current->first_son =
- construct_spellings_subset(real_start, i, level + 1,
- node_current);
-
- if (real_start == item_start_next + 1) {
- uint16 score_this = static_cast<unsigned char>(
- spelling_last_start[spelling_size_ - 1]);
- if (score_this < node_current->score)
- node_current->score = score_this;
- }
- } else {
- node_current->first_son = NULL;
- node_current->score = static_cast<unsigned char>(
- spelling_last_start[spelling_size_ - 1]);
- }
-
- if (node_current->score < min_son_score)
- min_son_score = node_current->score;
-
- bool is_half = false;
- if (level == 0 && is_szm_char(char_for_node)) {
- node_current->spelling_idx =
- static_cast<uint16>(char_for_node - 'A' + 1);
-
- if (char_for_node > 'C')
- node_current->spelling_idx++;
- if (char_for_node > 'S')
- node_current->spelling_idx++;
-
- h2f_num_[node_current->spelling_idx] = i - item_start_next;
- is_half = true;
- } else if (level == 1 && char_for_node == 'h') {
- char ch_level0 = spelling_last_start[0];
- uint16 part_id = 0;
- if (ch_level0 == 'C')
- part_id = 'C' - 'A' + 1 + 1;
- else if (ch_level0 == 'S')
- part_id = 'S' - 'A' + 1 + 2;
- else if (ch_level0 == 'Z')
- part_id = 'Z' - 'A' + 1 + 3;
- if (0 != part_id) {
- node_current->spelling_idx = part_id;
- h2f_num_[node_current->spelling_idx] = i - item_start_next;
- is_half = true;
- }
- }
-
- if (is_half) {
- if (h2f_num_[node_current->spelling_idx] > 0)
- h2f_start_[node_current->spelling_idx] =
- item_start_next + kFullSplIdStart;
- else
- h2f_start_[node_current->spelling_idx] = 0;
- }
-
- // for next sibling
- spelling_last_start = spelling_current;
- char_for_node = char_current;
- item_start_next = i;
- spelling_endable = true;
- if (spelling_current[level + 1] != '\0')
- spelling_endable = false;
-
- son_pos++;
- }
- }
-
- // the last one
- SpellingNode *node_current = first_son + son_pos;
- node_current->char_this_node = char_for_node;
-
- // For quick search in the first level
- if (0 == level)
- level1_sons_[char_for_node - 'A'] = node_current;
-
- if (spelling_endable) {
- node_current->spelling_idx = kFullSplIdStart + item_start_next;
- }
-
- if (spelling_last_start[level + 1] != '\0' ||
- item_end - item_start_next > 1) {
- size_t real_start = item_start_next;
- if (spelling_last_start[level + 1] == '\0')
- real_start++;
-
- node_current->first_son =
- construct_spellings_subset(real_start, item_end, level + 1,
- node_current);
-
- if (real_start == item_start_next + 1) {
- uint16 score_this = static_cast<unsigned char>(
- spelling_last_start[spelling_size_ - 1]);
- if (score_this < node_current->score)
- node_current->score = score_this;
- }
- } else {
- node_current->first_son = NULL;
- node_current->score = static_cast<unsigned char>(
- spelling_last_start[spelling_size_ - 1]);
- }
-
- if (node_current->score < min_son_score)
- min_son_score = node_current->score;
-
- assert(son_pos + 1 == num_of_son);
-
- bool is_half = false;
- if (level == 0 && szm_is_enabled(char_for_node)) {
- node_current->spelling_idx = static_cast<uint16>(char_for_node - 'A' + 1);
-
- if (char_for_node > 'C')
- node_current->spelling_idx++;
- if (char_for_node > 'S')
- node_current->spelling_idx++;
-
- h2f_num_[node_current->spelling_idx] = item_end - item_start_next;
- is_half = true;
- } else if (level == 1 && char_for_node == 'h') {
- char ch_level0 = spelling_last_start[0];
- uint16 part_id = 0;
- if (ch_level0 == 'C')
- part_id = 'C' - 'A' + 1 + 1;
- else if (ch_level0 == 'S')
- part_id = 'S' - 'A' + 1 + 2;
- else if (ch_level0 == 'Z')
- part_id = 'Z' - 'A' + 1 + 3;
- if (0 != part_id) {
- node_current->spelling_idx = part_id;
- h2f_num_[node_current->spelling_idx] = item_end - item_start_next;
- is_half = true;
- }
- }
- if (is_half) {
- if (h2f_num_[node_current->spelling_idx] > 0)
- h2f_start_[node_current->spelling_idx] =
- item_start_next + kFullSplIdStart;
- else
- h2f_start_[node_current->spelling_idx] = 0;
- }
-
- parent->num_of_son = num_of_son;
- parent->score = min_son_score;
- return first_son;
-}
-
-bool SpellingTrie::save_spl_trie(FILE *fp) {
- if (NULL == fp || NULL == spelling_buf_)
- return false;
-
- if (fwrite(&spelling_size_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fwrite(&spelling_num_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fwrite(&score_amplifier_, sizeof(float), 1, fp) != 1)
- return false;
-
- if (fwrite(&average_score_, sizeof(unsigned char), 1, fp) != 1)
- return false;
-
- if (fwrite(spelling_buf_, sizeof(char) * spelling_size_,
- spelling_num_, fp) != spelling_num_)
- return false;
-
- return true;
-}
-
-bool SpellingTrie::load_spl_trie(FILE *fp) {
- if (NULL == fp)
- return false;
-
- if (fread(&spelling_size_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fread(&spelling_num_, sizeof(uint32), 1, fp) != 1)
- return false;
-
- if (fread(&score_amplifier_, sizeof(float), 1, fp) != 1)
- return false;
-
- if (fread(&average_score_, sizeof(unsigned char), 1, fp) != 1)
- return false;
-
- if (NULL != spelling_buf_)
- delete [] spelling_buf_;
-
- spelling_buf_ = new char[spelling_size_ * spelling_num_];
- if (NULL == spelling_buf_)
- return false;
-
- if (fread(spelling_buf_, sizeof(char) * spelling_size_,
- spelling_num_, fp) != spelling_num_)
- return false;
-
- return construct(spelling_buf_, spelling_size_, spelling_num_,
- score_amplifier_, average_score_);
-}
-
-bool SpellingTrie::build_f2h() {
- if (NULL != f2h_)
- delete [] f2h_;
- f2h_ = new uint16[spelling_num_];
- if (NULL == f2h_)
- return false;
-
- for (uint16 hid = 0; hid < kFullSplIdStart; hid++) {
- for (uint16 fid = h2f_start_[hid];
- fid < h2f_start_[hid] + h2f_num_[hid]; fid++)
- f2h_[fid - kFullSplIdStart] = hid;
- }
-
- return true;
-}
-
-size_t SpellingTrie::get_spelling_num() {
- return spelling_num_;
-}
-
-uint8 SpellingTrie::get_ym_id(const char *ym_str) {
- if (NULL == ym_str || NULL == ym_buf_)
- return 0;
-
- for (uint8 pos = 0; pos < ym_num_; pos++)
- if (strcmp(ym_buf_ + ym_size_ * pos, ym_str) == 0)
- return pos + 1;
-
- return 0;
-}
-
-const char* SpellingTrie::get_spelling_str(uint16 splid) {
- splstr_queried_[0] = '\0';
-
- if (splid >= kFullSplIdStart) {
- splid -= kFullSplIdStart;
- snprintf(splstr_queried_, spelling_size_, "%s",
- spelling_buf_ + splid * spelling_size_);
- } else {
- if (splid == 'C' - 'A' + 1 + 1) {
- snprintf(splstr_queried_, spelling_size_, "%s", "Ch");
- } else if (splid == 'S' - 'A' + 1 + 2) {
- snprintf(splstr_queried_, spelling_size_, "%s", "Sh");
- } else if (splid == 'Z' - 'A' + 1 + 3) {
- snprintf(splstr_queried_, spelling_size_, "%s", "Zh");
- } else {
- if (splid > 'C' - 'A' + 1)
- splid--;
- if (splid > 'S' - 'A' + 1)
- splid--;
- splstr_queried_[0] = 'A' + splid - 1;
- splstr_queried_[1] = '\0';
- }
- }
- return splstr_queried_;
-}
-
-const char16* SpellingTrie::get_spelling_str16(uint16 splid) {
- splstr16_queried_[0] = '\0';
-
- if (splid >= kFullSplIdStart) {
- splid -= kFullSplIdStart;
- for (size_t pos = 0; pos < spelling_size_; pos++) {
- splstr16_queried_[pos] = static_cast<char16>
- (spelling_buf_[splid * spelling_size_ + pos]);
- }
- } else {
- if (splid == 'C' - 'A' + 1 + 1) {
- splstr16_queried_[0] = static_cast<char16>('C');
- splstr16_queried_[1] = static_cast<char16>('h');
- splstr16_queried_[2] = static_cast<char16>('\0');
- } else if (splid == 'S' - 'A' + 1 + 2) {
- splstr16_queried_[0] = static_cast<char16>('S');
- splstr16_queried_[1] = static_cast<char16>('h');
- splstr16_queried_[2] = static_cast<char16>('\0');
- } else if (splid == 'Z' - 'A' + 1 + 3) {
- splstr16_queried_[0] = static_cast<char16>('Z');
- splstr16_queried_[1] = static_cast<char16>('h');
- splstr16_queried_[2] = static_cast<char16>('\0');
- } else {
- if (splid > 'C' - 'A' + 1)
- splid--;
- if (splid > 'S' - 'A' + 1)
- splid--;
- splstr16_queried_[0] = 'A' + splid - 1;
- splstr16_queried_[1] = '\0';
- }
- }
- return splstr16_queried_;
-}
-
-size_t SpellingTrie::get_spelling_str16(uint16 splid, char16 *splstr16,
- size_t splstr16_len) {
- if (NULL == splstr16 || splstr16_len < kMaxPinyinSize + 1) return 0;
-
- if (splid >= kFullSplIdStart) {
- splid -= kFullSplIdStart;
- for (size_t pos = 0; pos <= kMaxPinyinSize; pos++) {
- splstr16[pos] = static_cast<char16>
- (spelling_buf_[splid * spelling_size_ + pos]);
- if (static_cast<char16>('\0') == splstr16[pos]) {
- return pos;
- }
- }
- } else {
- if (splid == 'C' - 'A' + 1 + 1) {
- splstr16[0] = static_cast<char16>('C');
- splstr16[1] = static_cast<char16>('h');
- splstr16[2] = static_cast<char16>('\0');
- return 2;
- } else if (splid == 'S' - 'A' + 1 + 2) {
- splstr16[0] = static_cast<char16>('S');
- splstr16[1] = static_cast<char16>('h');
- splstr16[2] = static_cast<char16>('\0');
- return 2;
- } else if (splid == 'Z' - 'A' + 1 + 3) {
- splstr16[0] = static_cast<char16>('Z');
- splstr16[1] = static_cast<char16>('h');
- splstr16[2] = static_cast<char16>('\0');
- return 2;
- } else {
- if (splid > 'C' - 'A' + 1)
- splid--;
- if (splid > 'S' - 'A' + 1)
- splid--;
- splstr16[0] = 'A' + splid - 1;
- splstr16[1] = '\0';
- return 1;
- }
- }
-
- // Not reachable.
- return 0;
-}
-
-} // namespace ime_pinyin
diff --git a/src/virtualkeyboard/3rdparty/t9write/t9write-build.pri b/src/virtualkeyboard/3rdparty/t9write/t9write-build.pri
deleted file mode 100644
index f810badf..00000000
--- a/src/virtualkeyboard/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-x86/shared
- T9WRITE_BUILD_STATIC_DIR = lib/linux-x86/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/virtualkeyboard/3rdparty/t9write/t9write.pro b/src/virtualkeyboard/3rdparty/t9write/t9write.pro
deleted file mode 100644
index d64f831d..00000000
--- a/src/virtualkeyboard/3rdparty/t9write/t9write.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-TARGET = qtt9write_db
-
-CONFIG += static
-
-T9WRITE_RESOURCE_FILES = \
- $$files(data/arabic/*.bin) \
- $$files(data/hebrew/*.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
-
-include(../../generateresource.pri)
-
-RESOURCES += $$generate_resource(t9write_db.qrc, $$T9WRITE_RESOURCE_FILES, /QtQuick/VirtualKeyboard/T9Write)
-
-load(qt_helper_lib)
-
-# Needed for resources
-CONFIG += qt
-QT = core
diff --git a/src/virtualkeyboard/3rdparty/tcime/cangjiedictionary.cpp b/src/virtualkeyboard/3rdparty/tcime/cangjiedictionary.cpp
deleted file mode 100644
index 1a50d371..00000000
--- a/src/virtualkeyboard/3rdparty/tcime/cangjiedictionary.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Qt implementation of TCIME library
- * This file is part of the Qt Virtual Keyboard module.
- * Contact: http://www.qt.io/licensing/
- *
- * Copyright (C) 2015 The Qt Company
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "cangjiedictionary.h"
-#include "cangjietable.h"
-
-using namespace tcime;
-
-bool CangjieDictionary::_simplified = false;
-
-CangjieDictionary::CangjieDictionary() :
- WordDictionary(),
- _collator(QLocale("zh_TW"))
-{
-}
-
-bool CangjieDictionary::simplified() const
-{
- return _simplified;
-}
-
-void CangjieDictionary::setSimplified(bool simplified)
-{
- _simplified = simplified;
-}
-
-QStringList CangjieDictionary::getWords(const QString &input) const
-{
- // Look up the index in the dictionary for the specified input.
- int primaryIndex = CangjieTable::getPrimaryIndex(input);
- if (primaryIndex < 0 || primaryIndex >= dictionary().size())
- return QStringList();
-
- // [25 * 26] char[] array; each primary entry points to a char[]
- // containing words with the same primary index; then words can be looked up
- // by their secondary index stored at the beginning of each char[].
- const DictionaryEntry &data = dictionary()[primaryIndex];
- if (data.isEmpty())
- return QStringList();
-
- if (_simplified)
- // Sort words of this primary index for simplified-cangjie.
- return sortWords(data);
-
- int secondaryIndex = CangjieTable::getSecondaryIndex(input);
- if (secondaryIndex < 0)
- return QStringList();
-
- // Find words match this secondary index for cangjie.
- return searchWords(secondaryIndex, data);
-}
-
-class DictionaryComparator
-{
-public:
- explicit DictionaryComparator(const std::vector<QCollatorSortKey> &sortKeys) :
- sortKeys(sortKeys)
- {}
-
- bool operator()(int a, int b)
- {
- return sortKeys[a] < sortKeys[b];
- }
-
-private:
- const std::vector<QCollatorSortKey> &sortKeys;
-};
-
-QStringList CangjieDictionary::sortWords(const DictionaryEntry &data) const
-{
- int length = data.size() / 2;
- std::vector<QCollatorSortKey> sortKeys;
- QVector<int> keys;
- sortKeys.reserve(length);
- keys.reserve(length);
- for (int i = 0; i < length; ++i) {
- sortKeys.push_back(_collator.sortKey(data[length + i]));
- keys.append(i);
- }
- DictionaryComparator dictionaryComparator(sortKeys);
- std::sort(keys.begin(), keys.end(), dictionaryComparator);
-
- QStringList words;
- for (int i = 0; i < length; ++i)
- words.append(data[length + keys[i]]);
-
- return words;
-}
-
-QStringList CangjieDictionary::searchWords(int secondaryIndex, const DictionaryEntry &data) const
-{
- int length = data.size() / 2;
-
- DictionaryEntry::ConstIterator start = data.constBegin();
- DictionaryEntry::ConstIterator end = start + length;
- DictionaryEntry::ConstIterator rangeStart = qBinaryFind(start, end, (DictionaryWord)secondaryIndex);
- if (rangeStart == end)
- return QStringList();
-
- // There may be more than one words with the same index; look up words with
- // the same secondary index.
- while (rangeStart != start) {
- if (*(rangeStart - 1) != (DictionaryWord)secondaryIndex)
- break;
- rangeStart--;
- }
-
- DictionaryEntry::ConstIterator rangeEnd = rangeStart + 1;
- while (rangeEnd != end) {
- if (*rangeEnd != (DictionaryWord)secondaryIndex)
- break;
- rangeEnd++;
- }
-
- QStringList words;
- words.reserve(rangeEnd - rangeStart);
- for (DictionaryEntry::ConstIterator rangeIndex = rangeStart; rangeIndex < rangeEnd; ++rangeIndex) {
- DictionaryEntry::ConstIterator item(rangeIndex + length);
- words.append(*item);
- }
-
- return words;
-}
diff --git a/src/virtualkeyboard/3rdparty/tcime/tcime.pro b/src/virtualkeyboard/3rdparty/tcime/tcime.pro
deleted file mode 100644
index d593beef..00000000
--- a/src/virtualkeyboard/3rdparty/tcime/tcime.pro
+++ /dev/null
@@ -1,30 +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
-
-MODULE_INCLUDEPATH = $$PWD
-
-load(qt_helper_lib)
-
-CONFIG += qt
-QT = core
diff --git a/src/virtualkeyboard/3rdparty/tcime/zhuyintable.cpp b/src/virtualkeyboard/3rdparty/tcime/zhuyintable.cpp
deleted file mode 100644
index c405b1e3..00000000
--- a/src/virtualkeyboard/3rdparty/tcime/zhuyintable.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Qt implementation of TCIME library
- * This file is part of the Qt Virtual Keyboard module.
- * Contact: http://www.qt.io/licensing/
- *
- * Copyright (C) 2015 The Qt Company
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "zhuyintable.h"
-#include <QStringList>
-
-using namespace tcime;
-
-const int ZhuyinTable::INITIALS_SIZE = 22;
-const QList<QChar> ZhuyinTable::yiEndingFinals = QList<QChar>()
- << 0x311a << 0x311b << 0x311d << 0x311e << 0x3120 << 0x3121 << 0x3122
- << 0x3123 << 0x3124 << 0x3125;
-const QList<QChar> ZhuyinTable::wuEndingFinals = QList<QChar>()
- << 0x311a << 0x311b << 0x311e << 0x311f << 0x3122 << 0x3123 << 0x3124
- << 0x3125;
-const QList<QChar> ZhuyinTable::yuEndingFinals = QList<QChar>()
- << 0x311d << 0x3122 << 0x3123 << 0x3125;
-const int ZhuyinTable::YI_FINALS_INDEX = 14;
-const int ZhuyinTable::WU_FINALS_INDEX = 25;
-const int ZhuyinTable::YU_FINALS_INDEX = 34;
-const QChar ZhuyinTable::YI_FINALS = 0x3127;
-const QChar ZhuyinTable::WU_FINALS = 0x3128;
-const QChar ZhuyinTable::YU_FINALS = 0x3129;
-const QList<QChar> ZhuyinTable::tones = QList<QChar>()
- << ZhuyinTable::DEFAULT_TONE << 0x02d9 << 0x02ca << 0x02c7 << 0x02cb;
-const QChar ZhuyinTable::DEFAULT_TONE = QChar(' ');
-
-int ZhuyinTable::getInitials(const QChar &initials)
-{
- // Calculate the index by its distance to the first initials 'ㄅ' (b).
- int index = initials.unicode() - 0x3105 + 1;
- if (index >= ZhuyinTable::INITIALS_SIZE)
- // Syllables starting with finals can still be valid.
- return 0;
-
- return (index >= 0) ? index : -1;
-}
-
-int ZhuyinTable::getFinals(const QString &finals)
-{
- if (finals.length() == 0)
- // Syllables ending with no finals can still be valid.
- return 0;
-
- if (finals.length() > 2)
- return -1;
-
- // Compute the index instead of direct lookup the whole array to save
- // traversing time. First calculate the distance to the first finals
- // 'ㄚ' (a).
- const QChar firstFinal = finals.at(0);
- int index = firstFinal.unicode() - 0x311a + 1;
- if (index < YI_FINALS_INDEX)
- return index;
-
- // Check 'ㄧ' (yi), 'ㄨ' (wu) , and 'ㄩ' (yu) group finals.
- QList<QChar> endingFinals;
- if (firstFinal == YI_FINALS) {
- index = YI_FINALS_INDEX;
- endingFinals = yiEndingFinals;
- } else if (firstFinal == WU_FINALS) {
- index = WU_FINALS_INDEX;
- endingFinals = wuEndingFinals;
- } else if (firstFinal == YU_FINALS) {
- index = YU_FINALS_INDEX;
- endingFinals = yuEndingFinals;
- } else {
- return -1;
- }
-
- if (finals.length() == 1)
- return index;
-
- for (int i = 0; i < endingFinals.size(); ++i) {
- if (finals.at(1) == endingFinals[i])
- return index + i + 1;
- }
- return -1;
-}
-
-int ZhuyinTable::getSyllablesIndex(const QString &syllables)
-{
- if (syllables.isEmpty())
- return -1;
-
- int initials = getInitials(syllables.at(0));
- if (initials < 0)
- return -1;
-
- // Strip out initials before getting finals column-index.
- int finals = getFinals((initials != 0) ? syllables.mid(1) : syllables);
- if (finals < 0)
- return -1;
-
- return (finals * INITIALS_SIZE + initials);
-}
-
-int ZhuyinTable::getTones(const QChar &c)
-{
- for (int i = 0; i < tones.size(); ++i) {
- if (tones[i] == c)
- return i;
- }
- // Treat all other characters as the default tone with the index 0.
- return 0;
-}
-
-int ZhuyinTable::getTonesCount()
-{
- return tones.size();
-}
-
-bool ZhuyinTable::isTone(const QChar &c)
-{
- for (int i = 0; i < tones.size(); ++i) {
- if (tones[i] == c)
- return true;
- }
- return false;
-}
-
-bool ZhuyinTable::isYiWuYuFinals(const QChar &c)
-{
- ushort unicode = c.unicode();
- return unicode == YI_FINALS || unicode == WU_FINALS || unicode == YU_FINALS;
-}
-
-QStringList ZhuyinTable::stripTones(const QString &input)
-{
- const int last = input.length() - 1;
- if (last < 0)
- return QStringList();
-
- QChar tone = input.at(last);
- if (isTone(tone)) {
- QString syllables = input.left(last);
- if (syllables.length() <= 0)
- return QStringList();
- return QStringList() << syllables << QString(tone);
- }
- // Treat the tone-less input as the default tone (tone-0).
- return QStringList() << input << QString(DEFAULT_TONE);
-}
diff --git a/src/virtualkeyboard/abstractinputmethod.cpp b/src/virtualkeyboard/abstractinputmethod.cpp
deleted file mode 100644
index dece2c7f..00000000
--- a/src/virtualkeyboard/abstractinputmethod.cpp
+++ /dev/null
@@ -1,331 +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 "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::AbstractInputMethodPrivate
- \internal
-*/
-
-AbstractInputMethodPrivate::AbstractInputMethodPrivate() :
- QObjectPrivate(),
- inputEngine(0)
-{
-}
-
-/*!
- \class QtVirtualKeyboard::AbstractInputMethod
- \internal
-
- \inmodule qtvirtualkeyboard
-
- \brief The base class for input methods.
-
- Use this class if you want to implement a custom input
- method using C/C++ language.
-*/
-
-/*!
- Constructs an input method with \a dd as the private data
- from the derived class and \a parent as the parent.
-*/
-AbstractInputMethod::AbstractInputMethod(AbstractInputMethodPrivate &dd, QObject *parent) :
- QObject(dd, parent)
-{
-}
-
-/*!
- Constructs an input method with \a parent.
-*/
-AbstractInputMethod::AbstractInputMethod(QObject *parent) :
- QObject(*new AbstractInputMethodPrivate(), parent)
-{
-}
-
-/*!
- Destroys the input method and frees all allocated resources.
-*/
-AbstractInputMethod::~AbstractInputMethod()
-{
-}
-
-/*!
- Returns the input context associated with the input method.
- This method returns \c NULL if the input method is not active.
-*/
-InputContext *AbstractInputMethod::inputContext() const
-{
- Q_D(const AbstractInputMethod);
- return d->inputEngine ? d->inputEngine->inputContext() : 0;
-}
-
-/*!
- Returns the input engine associated with the input method.
- This method returns \c NULL if the input method is not active.
-*/
-InputEngine *AbstractInputMethod::inputEngine() const
-{
- Q_D(const AbstractInputMethod);
- return d->inputEngine;
-}
-
-/*!
- This method is called by the input engine when the input method needs
- to be reset. The input method must reset its internal state only. The main
- difference to the update() method is that reset() modifies only
- the input method state, i.e. it must not modify the input context.
-*/
-void AbstractInputMethod::reset()
-{
-}
-
-/*!
- This method is called by the input engine when the input method needs to be
- updated. The input method must close the current pre-edit text and
- restore its internal state to the default.
-*/
-void AbstractInputMethod::update()
-{
-}
-
-/*!
- \internal
- Called by the input engine when the input method is activated and
- deactivated.
-*/
-void AbstractInputMethod::setInputEngine(InputEngine *inputEngine)
-{
- Q_D(AbstractInputMethod);
- if (d->inputEngine) {
- d->inputEngine->disconnect(this, SLOT(reset()));
- d->inputEngine->disconnect(this, SLOT(update()));
- }
- d->inputEngine = inputEngine;
- if (d->inputEngine) {
- connect(d->inputEngine, SIGNAL(inputMethodReset()), SLOT(reset()));
- connect(d->inputEngine, SIGNAL(inputMethodUpdate()), SLOT(update()));
- }
-}
-
-QList<SelectionListModel::Type> AbstractInputMethod::selectionLists()
-{
- return QList<SelectionListModel::Type>();
-}
-
-int AbstractInputMethod::selectionListItemCount(SelectionListModel::Type type)
-{
- Q_UNUSED(type)
- return 0;
-}
-
-QVariant AbstractInputMethod::selectionListData(SelectionListModel::Type type, int index, int role)
-{
- Q_UNUSED(type)
- Q_UNUSED(index)
- switch (role) {
- case SelectionListModel::DisplayRole:
- return QVariant("");
- case SelectionListModel::WordCompletionLengthRole:
- return QVariant(0);
- }
- return QVariant();
-}
-
-void AbstractInputMethod::selectionListItemSelected(SelectionListModel::Type type, int index)
-{
- Q_UNUSED(type)
- Q_UNUSED(index)
-}
-
-/*!
- \since QtQuick.VirtualKeyboard 2.0
-
- Returns list of supported pattern recognition modes.
-
- This method is called by the input engine to query the list of
- supported pattern recognition modes.
-*/
-QList<InputEngine::PatternRecognitionMode> AbstractInputMethod::patternRecognitionModes() const
-{
- return QList<InputEngine::PatternRecognitionMode>();
-}
-
-/*!
- \since QtQuick.VirtualKeyboard 2.0
-
- This method is called when a trace interaction starts with the specified \a patternRecognitionMode.
- The trace is uniquely identified by the \a traceId.
- The \a traceCaptureDeviceInfo provides information about the source device and the
- \a traceScreenInfo provides information about the screen context.
-
- If the input method accepts the event and wants to capture the trace input, it must return
- a new Trace object. This object must remain valid until the traceEnd() method is called. If the
- Trace is rendered on screen, it remains there until the Trace object is destroyed.
-*/
-Trace *AbstractInputMethod::traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
-{
- Q_UNUSED(traceId)
- Q_UNUSED(patternRecognitionMode)
- Q_UNUSED(traceCaptureDeviceInfo)
- Q_UNUSED(traceScreenInfo)
- return 0;
-}
-
-/*!
- \since QtQuick.VirtualKeyboard 2.0
-
- This method is called when the trace interaction ends. The input method should destroy the \a trace object
- at some point after this function is called. See the \l Trace API how to access the gathered
- data.
-
- The method returns \c true if the trace interaction is accepted.
-*/
-bool AbstractInputMethod::traceEnd(Trace *trace)
-{
- Q_UNUSED(trace)
- return false;
-}
-
-/*!
- \since QtQuick.VirtualKeyboard 2.0
-
- This function attempts to reselect a word located at the \a cursorPosition.
- The \a reselectFlags define the rules for how the word should be selected in
- relation to the cursor position.
-
- The function returns \c true if the word was successfully reselected.
-*/
-bool AbstractInputMethod::reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags)
-{
- Q_UNUSED(cursorPosition)
- Q_UNUSED(reselectFlags)
- return false;
-}
-
-/*!
- \fn QList<QtVirtualKeyboard::InputEngine::InputMode> QtVirtualKeyboard::AbstractInputMethod::inputModes(const QString& locale)
-
- Returns the list of input modes for \a locale.
-*/
-
-/*!
- \fn bool QtVirtualKeyboard::AbstractInputMethod::setInputMode(const QString& locale, InputEngine::InputMode inputMode)
-
- Sets the \a inputMode and \a locale for this input method. Returns \c true
- if successful.
-*/
-
-/*!
- \fn bool QtVirtualKeyboard::AbstractInputMethod::setTextCase(InputEngine::TextCase textCase)
-
- Updates the \a textCase for this input method. The method returns \c true
- if successful.
-*/
-
-/*!
- \fn bool QtVirtualKeyboard::AbstractInputMethod::keyEvent(Qt::Key key, const QString& text, Qt::KeyboardModifiers modifiers)
-
- The purpose of this method is to handle the key events generated by the the
- input engine.
-
- The \a key parameter specifies the code of the key to handle. The key code
- does not distinguish between capital and non-capital letters. The \a
- text parameter contains the Unicode text for the key. The \a modifiers
- parameter contains the key modifiers that apply to key.
-
- This method returns \c true if the key event was successfully handled.
- If the return value is \c false, the key event is redirected to the default
- input method for further processing.
-*/
-
-/*!
- \fn QList<SelectionListModel::Type> QtVirtualKeyboard::AbstractInputMethod::selectionLists()
-
- Returns the list of selection lists used by this input method.
-
- This method is called by input engine when the input method is being
- activated and every time the input method hints are updated. The input method
- can reserve selection lists by returning the desired selection list types.
-
- The input method may request the input engine to update the selection lists
- at any time by emitting selectionListsChanged() signal. This signal will
- trigger a call to this method, allowing the input method to update the selection
- list types.
-*/
-
-/*!
- \fn int QtVirtualKeyboard::AbstractInputMethod::selectionListItemCount(SelectionListModel::Type type)
-
- Returns the number of items in the selection list identified by \a type.
-*/
-
-/*!
- \fn QVariant QtVirtualKeyboard::AbstractInputMethod::selectionListData(SelectionListModel::Type type, int index, int role)
-
- Returns item data for the selection list identified by \a type. The \a role
- parameter specifies which data is requested. The \a index parameter is a
- zero based index into the list.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::AbstractInputMethod::selectionListItemSelected(SelectionListModel::Type type, int index)
-
- This method is called when an item at \a index has been selected by the
- user. The selection list is identified by the \a type parameter.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::AbstractInputMethod::selectionListChanged(int type)
-
- The input method emits this signal when the contents of the selection list
- has changed. The \a type parameter specifies which selection list has
- changed.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::AbstractInputMethod::selectionListActiveItemChanged(int type, int index)
-
- The input method emits this signal when the current \a index has changed
- in the selection list identified by \a type.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::AbstractInputMethod::selectionListsChanged()
- \since QtQuick.VirtualKeyboard 2.2
-
- The input method emits this signal when the selection list types have
- changed. This signal will trigger a call to selectionLists() method,
- allowing the input method to update the selection list types.
-*/
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/abstractinputmethod.h b/src/virtualkeyboard/abstractinputmethod.h
deleted file mode 100644
index f3157145..00000000
--- a/src/virtualkeyboard/abstractinputmethod.h
+++ /dev/null
@@ -1,96 +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 ABSTRACTINPUTMETHOD_H
-#define ABSTRACTINPUTMETHOD_H
-
-#include "inputengine.h"
-#include "selectionlistmodel.h"
-#include <QtCore/private/qobject_p.h>
-
-namespace QtVirtualKeyboard {
-
-class AbstractInputMethodPrivate : public QObjectPrivate
-{
-public:
- AbstractInputMethodPrivate();
-
- InputEngine *inputEngine;
-};
-
-class AbstractInputMethod : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(AbstractInputMethod)
-
-protected:
- AbstractInputMethod(AbstractInputMethodPrivate &dd, QObject *parent = 0);
-public:
- explicit AbstractInputMethod(QObject *parent = 0);
- ~AbstractInputMethod();
-
- InputContext *inputContext() const;
- InputEngine *inputEngine() const;
-
- virtual QList<InputEngine::InputMode> inputModes(const QString &locale) = 0;
- virtual bool setInputMode(const QString &locale, InputEngine::InputMode inputMode) = 0;
- virtual bool setTextCase(InputEngine::TextCase textCase) = 0;
-
- virtual bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) = 0;
-
- virtual QList<SelectionListModel::Type> selectionLists();
- virtual int selectionListItemCount(SelectionListModel::Type type);
- virtual QVariant selectionListData(SelectionListModel::Type type, int index, int role);
- virtual void selectionListItemSelected(SelectionListModel::Type type, int index);
-
- virtual QList<InputEngine::PatternRecognitionMode> patternRecognitionModes() const;
- virtual Trace *traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
- virtual bool traceEnd(Trace *trace);
-
- virtual bool reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags);
-
-signals:
- void selectionListChanged(int type);
- void selectionListActiveItemChanged(int type, int index);
- void selectionListsChanged();
-
-public slots:
- virtual void reset();
- virtual void update();
-
-private:
- void setInputEngine(InputEngine *inputEngine);
-
- friend class InputEngine;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/abstractinputpanel.cpp b/src/virtualkeyboard/abstractinputpanel.cpp
index 41c72d58..7fbbeb55 100644
--- a/src/virtualkeyboard/abstractinputpanel.cpp
+++ b/src/virtualkeyboard/abstractinputpanel.cpp
@@ -27,15 +27,16 @@
**
****************************************************************************/
-#include "abstractinputpanel.h"
+#include <QtVirtualKeyboard/private/abstractinputpanel_p.h>
#include <QtCore/QRect>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
/*!
\class QtVirtualKeyboard::AbstractInputPanel
\internal
- \inmodule qtvirtualkeyboard
+ \inmodule QtVirtualKeyboard
\brief Base class for an input panel.
@@ -121,3 +122,4 @@ void AbstractInputPanel::destroyView()
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/abstractinputpanel.h b/src/virtualkeyboard/abstractinputpanel.h
deleted file mode 100644
index efce0234..00000000
--- a/src/virtualkeyboard/abstractinputpanel.h
+++ /dev/null
@@ -1,59 +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 ABSTRACTINPUTPANEL_H
-#define ABSTRACTINPUTPANEL_H
-
-#include <QObject>
-
-namespace QtVirtualKeyboard {
-
-class AbstractInputPanel : public QObject
-{
- Q_OBJECT
-protected:
- AbstractInputPanel(QObjectPrivate &dd, QObject *parent = 0);
-public:
- explicit AbstractInputPanel(QObject *parent = 0);
- ~AbstractInputPanel();
-
- virtual void show() = 0;
- virtual void hide() = 0;
- virtual bool isVisible() const = 0;
-
- virtual void setInputRect(const QRect &inputRect);
-
-public slots:
- virtual void createView();
- virtual void destroyView();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // ABSTRACTINPUTPANEL_H
diff --git a/src/virtualkeyboard/abstractinputpanel_p.h b/src/virtualkeyboard/abstractinputpanel_p.h
new file mode 100644
index 00000000..08a19fc6
--- /dev/null
+++ b/src/virtualkeyboard/abstractinputpanel_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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 ABSTRACTINPUTPANEL_P_H
+#define ABSTRACTINPUTPANEL_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/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class QVIRTUALKEYBOARD_EXPORT AbstractInputPanel : public QObject
+{
+ Q_OBJECT
+protected:
+ AbstractInputPanel(QObjectPrivate &dd, QObject *parent = nullptr);
+public:
+ explicit AbstractInputPanel(QObject *parent = nullptr);
+ ~AbstractInputPanel();
+
+ virtual void show() = 0;
+ virtual void hide() = 0;
+ virtual bool isVisible() const = 0;
+
+ virtual void setInputRect(const QRect &inputRect);
+
+public slots:
+ virtual void createView();
+ virtual void destroyView();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // ABSTRACTINPUTPANEL_P_H
diff --git a/src/virtualkeyboard/appinputpanel.cpp b/src/virtualkeyboard/appinputpanel.cpp
index 94834cd1..95987fb2 100644
--- a/src/virtualkeyboard/appinputpanel.cpp
+++ b/src/virtualkeyboard/appinputpanel.cpp
@@ -27,8 +27,10 @@
**
****************************************************************************/
-#include "appinputpanel.h"
+#include <QtVirtualKeyboard/private/appinputpanel_p.h>
+#include <QtVirtualKeyboard/private/appinputpanel_p_p.h>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
AppInputPanel::AppInputPanel(AppInputPanelPrivate &dd, QObject *parent) :
@@ -68,3 +70,4 @@ bool AppInputPanel::isVisible() const
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/appinputpanel.h b/src/virtualkeyboard/appinputpanel.h
deleted file mode 100644
index 5df05008..00000000
--- a/src/virtualkeyboard/appinputpanel.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef APPINPUTPANEL_H
-#define APPINPUTPANEL_H
-
-#include "abstractinputpanel.h"
-#include <QtCore/private/qobject_p.h>
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::AppInputPanelPrivate
- \internal
-*/
-
-class AppInputPanelPrivate : public QObjectPrivate
-{
-public:
- AppInputPanelPrivate() :
- QObjectPrivate(),
- visible(false)
- {
- }
-
- bool visible;
-};
-
-/*!
- \class QtVirtualKeyboard::AppInputPanel
- \internal
-*/
-
-class AppInputPanel : public AbstractInputPanel
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(AppInputPanel)
-
-protected:
- AppInputPanel(AppInputPanelPrivate &dd, QObject *parent = 0);
-
-public:
- explicit AppInputPanel(QObject *parent = 0);
- ~AppInputPanel();
-
- void show();
- void hide();
- bool isVisible() const;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // APPINPUTPANEL_H
diff --git a/src/virtualkeyboard/appinputpanel_p.h b/src/virtualkeyboard/appinputpanel_p.h
new file mode 100644
index 00000000..d1db9dad
--- /dev/null
+++ b/src/virtualkeyboard/appinputpanel_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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 APPINPUTPANEL_P_H
+#define APPINPUTPANEL_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/abstractinputpanel_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class AppInputPanelPrivate;
+
+/*!
+ \class QtVirtualKeyboard::AppInputPanel
+ \internal
+*/
+
+class QVIRTUALKEYBOARD_EXPORT AppInputPanel : public AbstractInputPanel
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(AppInputPanel)
+
+protected:
+ AppInputPanel(AppInputPanelPrivate &dd, QObject *parent = nullptr);
+
+public:
+ explicit AppInputPanel(QObject *parent = nullptr);
+ ~AppInputPanel();
+
+ void show();
+ void hide();
+ bool isVisible() const;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // APPINPUTPANEL_P_H
diff --git a/src/virtualkeyboard/appinputpanel_p_p.h b/src/virtualkeyboard/appinputpanel_p_p.h
new file mode 100644
index 00000000..f41c9b72
--- /dev/null
+++ b/src/virtualkeyboard/appinputpanel_p_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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 APPINPUTPANEL_P_P_H
+#define APPINPUTPANEL_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 <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::AppInputPanelPrivate
+ \internal
+*/
+
+class QVIRTUALKEYBOARD_EXPORT AppInputPanelPrivate : public QObjectPrivate
+{
+public:
+ AppInputPanelPrivate() :
+ QObjectPrivate(),
+ visible(false)
+ {
+ }
+
+ bool visible;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // APPINPUTPANEL_P_P_H
diff --git a/src/virtualkeyboard/content/HandwritingInputPanel.qml b/src/virtualkeyboard/content/HandwritingInputPanel.qml
index b91c59c7..940fe915 100644
--- a/src/virtualkeyboard/content/HandwritingInputPanel.qml
+++ b/src/virtualkeyboard/content/HandwritingInputPanel.qml
@@ -108,12 +108,12 @@ Item {
enabled: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
objectName: "hwrInputArea"
anchors.fill: parent
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
canvasType: "fullscreen"
}
Binding {
- target: InputContext
+ target: InputContext.priv
property: "keyboardRectangle"
value: Qt.rect(hwrInputArea.x, hwrInputArea.y, hwrInputArea.width, hwrInputArea.height)
when: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml
index c88cccc2..b32ac340 100644
--- a/src/virtualkeyboard/content/InputPanel.qml
+++ b/src/virtualkeyboard/content/InputPanel.qml
@@ -114,9 +114,6 @@ Item {
/*! \internal */
readonly property bool __isRootItem: inputPanel.parent != null && inputPanel.parent.parent == null
- LayoutMirroring.enabled: false
- LayoutMirroring.childrenInherit: true
-
SelectionControl {
objectName: "selectionControl"
x: -parent.x
@@ -138,7 +135,7 @@ Item {
}
Binding {
- target: InputContext
+ target: InputContext.priv
property: "keyboardRectangle"
value: mapToItem(null,
__isRootItem ? keyboard.x : x,
diff --git a/src/virtualkeyboard/content/components/AlternativeKeys.qml b/src/virtualkeyboard/content/components/AlternativeKeys.qml
index a1fcfe14..7879f006 100644
--- a/src/virtualkeyboard/content/components/AlternativeKeys.qml
+++ b/src/virtualkeyboard/content/components/AlternativeKeys.qml
@@ -37,6 +37,8 @@ Item {
property int keyCode
property point origin
signal clicked
+ LayoutMirroring.enabled: false
+ LayoutMirroring.childrenInherit: true
z: 1
visible: active
diff --git a/src/virtualkeyboard/content/components/EnterKey.qml b/src/virtualkeyboard/content/components/EnterKey.qml
index 74b3984c..9f7c04da 100644
--- a/src/virtualkeyboard/content/components/EnterKey.qml
+++ b/src/virtualkeyboard/content/components/EnterKey.qml
@@ -45,13 +45,13 @@ BaseKey {
/*! This property holds the action id for the enter key.
*/
- readonly property int actionId: InputContext.hasEnterKeyAction(InputContext.inputItem) ? InputContext.inputItem.EnterKeyAction.actionId : EnterKeyAction.None
+ readonly property int actionId: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.actionId : EnterKeyAction.None
text: "\n"
- displayText: InputContext.hasEnterKeyAction(InputContext.inputItem) ? InputContext.inputItem.EnterKeyAction.label : ""
+ 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.hasEnterKeyAction(InputContext.inputItem) ? InputContext.inputItem.EnterKeyAction.enabled : 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/virtualkeyboard/content/components/HideKeyboardKey.qml b/src/virtualkeyboard/content/components/HideKeyboardKey.qml
index e9de1002..ab38fbc2 100644
--- a/src/virtualkeyboard/content/components/HideKeyboardKey.qml
+++ b/src/virtualkeyboard/content/components/HideKeyboardKey.qml
@@ -43,6 +43,6 @@ import QtQuick.VirtualKeyboard 2.1
BaseKey {
functionKey: true
- onClicked: InputContext.hideInputPanel()
+ 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
index c4463a8e..6ac04422 100644
--- a/src/virtualkeyboard/content/components/InputModeKey.qml
+++ b/src/virtualkeyboard/content/components/InputModeKey.qml
@@ -39,7 +39,7 @@ import QtQuick.VirtualKeyboard 2.3
\brief Input mode key for keyboard layouts.
- This key toggles between available \l {InputEngine::inputModes} {InputEngine.inputModes}.
+ This key toggles between available \l {QVirtualKeyboardInputEngine::inputModes} {InputEngine.inputModes}.
*/
Key {
@@ -55,26 +55,26 @@ Key {
/*!
List of input mode names.
- The default list contains all known input modes for \l {InputEngine::inputMode} {InputEngine.inputMode}.
+ The default list contains all known input modes for \l {QVirtualKeyboardInputEngine::inputMode} {InputEngine.inputMode}.
*/
property var inputModeNameList: [
- "ABC", // InputEngine.Latin
- "123", // InputEngine.Numeric
- "123", // InputEngine.Dialable
- "拼音", // InputEngine.Pinyin
- "倉頡", // InputEngine.Cangjie
- "注音", // InputEngine.Zhuyin
- "한글", // InputEngine.Hangul
- "あ", // InputEngine.Hiragana
- "カ", // InputEngine.Katakana
- "全角", // InputEngine.FullwidthLatin
- "ΑΒΓ", // InputEngine.Greek
- "АБВ", // InputEngine.Cyrillic
- "\u0623\u200C\u0628\u200C\u062C", // InputEngine.Arabic
- "\u05D0\u05D1\u05D2", // InputEngine.Hebrew
- "中文", // InputEngine.ChineseHandwriting
- "日本語", // InputEngine.JapaneseHandwriting
- "한국어", // InputEngine.KoreanHandwriting
+ "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
]
/*!
diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml
index 47e6d9cb..00c7a926 100644
--- a/src/virtualkeyboard/content/components/Keyboard.qml
+++ b/src/virtualkeyboard/content/components/Keyboard.qml
@@ -30,9 +30,10 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Window 2.2
-import QtQuick.VirtualKeyboard 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 {
@@ -73,7 +74,7 @@ Item {
property var plainInputMethod: PlainInputMethod {}
property var customInputMethod: null
property var customInputMethodSharedLayouts: []
- property int defaultInputMode: InputEngine.Latin
+ property int defaultInputMode: InputEngine.InputMode.Latin
property bool inputMethodNeedsReset: true
property bool inputModeNeedsReset: true
property bool navigationModeActive: false
@@ -82,7 +83,7 @@ Item {
function initDefaultInputMethod() {
try {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.1; HunspellInputMethod {}', keyboard, "defaultInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; DefaultInputMethod {}', keyboard, "defaultInputMethod")
} catch (e) { }
return plainInputMethod
}
@@ -126,7 +127,7 @@ Item {
}
onInputLocaleChanged: {
if (Qt.locale(inputLocale).name !== "C")
- InputContext.locale = inputLocale
+ InputContext.priv.locale = inputLocale
}
onLayoutChanged: hideLanguagePopup()
onLayoutTypeChanged: {
@@ -150,21 +151,25 @@ Item {
Connections {
target: InputContext
+ onInputMethodHintsChanged: {
+ if (InputContext.priv.focus)
+ updateInputMethod()
+ }
+ }
+ Connections {
+ target: InputContext.priv
onInputItemChanged: {
keyboard.hideLanguagePopup()
if (active && symbolMode && !preferNumbers)
symbolMode = false
}
onFocusChanged: {
- if (InputContext.focus)
- updateInputMethod()
- }
- onInputMethodHintsChanged: {
- if (InputContext.focus)
+ if (InputContext.priv.focus)
updateInputMethod()
}
onNavigationKeyPressed: {
var initialKey
+ var direction = wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ? 1 : -1
switch (key) {
case Qt.Key_Left:
if (keyboard.navigationModeActive && !keyboardInputArea.initialKey) {
@@ -184,18 +189,26 @@ Item {
}
break
}
+ if (wordCandidateContextMenu.active) {
+ hideWordCandidateContextMenu()
+ break
+ }
if (wordCandidateView.count) {
- if (wordCandidateView.currentIndex > 0) {
+ 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
- if (!keyboardInputArea.navigateToNextKey(-1, -1, false)) {
- keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(-1, -1, true)
- } else {
- keyboardInputArea.navigateToNextKey(1, 1, false)
- }
+ 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
}
@@ -203,14 +216,18 @@ Item {
initialKey = keyboardInputArea.initialKey
if (!keyboardInputArea.navigateToNextKey(-1, 0, false)) {
keyboardInputArea.initialKey = initialKey
- if (!keyboardInputArea.navigateToNextKey(0, -1, false)) {
+ if (!keyboardInputArea.navigateToNextKey(0, -1 * direction, false)) {
if (wordCandidateView.count) {
- if (wordCandidateView.currentIndex === -1)
- wordCandidateView.incrementCurrentIndex()
+ if (wordCandidateView.count) {
+ wordCandidateView.currentIndex =
+ wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ?
+ (wordCandidateView.count - 1) : 0
+ break
+ }
break
}
keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(0, -1, true)
+ keyboardInputArea.navigateToNextKey(0, -1 * direction, true)
}
keyboardInputArea.navigateToNextKey(-1, 0, true)
}
@@ -230,6 +247,14 @@ Item {
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
@@ -262,18 +287,26 @@ Item {
}
break
}
+ if (wordCandidateContextMenu.active) {
+ hideWordCandidateContextMenu()
+ break
+ }
if (wordCandidateView.count) {
- if (wordCandidateView.currentIndex + 1 < 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
- if (!keyboardInputArea.navigateToNextKey(1, 1, false)) {
- keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(1, 1, true)
- } else {
- keyboardInputArea.navigateToNextKey(-1, -1, false)
- }
+ 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
}
@@ -281,14 +314,15 @@ Item {
initialKey = keyboardInputArea.initialKey
if (!keyboardInputArea.navigateToNextKey(1, 0, false)) {
keyboardInputArea.initialKey = initialKey
- if (!keyboardInputArea.navigateToNextKey(0, 1, false)) {
+ if (!keyboardInputArea.navigateToNextKey(0, 1 * direction, false)) {
if (wordCandidateView.count) {
- if (wordCandidateView.currentIndex === -1)
- wordCandidateView.incrementCurrentIndex()
+ wordCandidateView.currentIndex =
+ wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ?
+ 0 : (wordCandidateView.count - 1)
break
}
keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(0, 1, true)
+ keyboardInputArea.navigateToNextKey(0, 1 * direction, true)
}
keyboardInputArea.navigateToNextKey(1, 0, true)
}
@@ -308,6 +342,16 @@ Item {
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
@@ -331,22 +375,16 @@ Item {
keyboardInputArea.reset()
keyboardInputArea.navigateToNextKey(0, 0, false)
}
- } else if (alternativeKeys.active) {
- if (!isAutoRepeat) {
- alternativeKeys.clicked()
- 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 (wordCandidateView.count > 0) {
- wordCandidateView.model.selectItem(wordCandidateView.currentIndex)
- if (!InputContext.preeditText.length)
- keyboardInputArea.navigateToNextKey(0, 1, true)
+ } else if (!wordCandidateContextMenu.active && wordCandidateView.count > 0) {
+ if (!isAutoRepeat) {
+ pressAndHoldTimer.restart()
+ }
}
break
default:
@@ -361,13 +399,35 @@ Item {
languagePopupList.model.selectItem(languagePopupList.currentIndex)
break
}
- if (!languagePopupListActive && !alternativeKeys.active && keyboard.activeKey && !isAutoRepeat) {
+ 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:
@@ -385,7 +445,7 @@ Item {
keyboard.symbolMode = false
} else if (key === Qt.Key_Space) {
var surroundingText = InputContext.surroundingText.trim()
- if (InputContext.shiftHandler.sentenceEndingCharacters.indexOf(surroundingText.charAt(surroundingText.length-1)) >= 0)
+ if (InputContext.priv.shiftHandler.sentenceEndingCharacters.indexOf(surroundingText.charAt(surroundingText.length-1)) >= 0)
keyboard.symbolMode = false
}
}
@@ -412,10 +472,13 @@ Item {
keyboard.y + alternativeKeys.listView.y - verticalMargin,
alternativeKeys.listView.width + horizontalMargin * 2,
alternativeKeys.listView.height + verticalMargin * 2)
+ property bool openedByNavigationKeyLongPress
onVisibleChanged: {
if (visible)
- InputContext.previewRectangle = Qt.binding(function() {return previewRect})
- InputContext.previewVisible = visible
+ InputContext.priv.previewRectangle = Qt.binding(function() {return previewRect})
+ else
+ openedByNavigationKeyLongPress = false
+ InputContext.priv.previewVisible = visible
}
}
Timer {
@@ -427,6 +490,7 @@ Item {
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) {
InputContext.inputEngine.virtualKeyCancel()
keyboardInputArea.dragSymbolMode = true
@@ -444,6 +508,9 @@ Item {
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
}
}
}
@@ -471,19 +538,19 @@ Item {
characterPreview.height)
}
Binding {
- target: InputContext
+ target: InputContext.priv
property: "previewRectangle"
value: characterPreview.previewRect
when: characterPreview.visible
}
Binding {
- target: InputContext
+ target: InputContext.priv
property: "previewRectangle"
value: languagePopupList.previewRect
when: languagePopupListActive
}
Binding {
- target: InputContext
+ target: InputContext.priv
property: "previewVisible"
value: characterPreview.visible || languagePopupListActive
}
@@ -507,6 +574,8 @@ Item {
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
}
@@ -578,7 +647,7 @@ Item {
SelectionControl {
objectName: "fullScreenModeSelectionControl"
- inputContext: InputContext.shadow
+ inputContext: InputContext.priv.shadow
anchors.top: shadowInputControl.top
anchors.left: shadowInputControl.left
enabled: keyboard.enabled && fullScreenMode
@@ -622,10 +691,11 @@ Item {
else
wordCandidateViewAutoHideTimer.stop()
wordCandidateView.empty = empty
+ keyboard.hideWordCandidateContextMenu()
}
}
Connections {
- target: InputContext
+ target: InputContext.priv
onInputItemChanged: wordCandidateViewAutoHideTimer.stop()
}
Connections {
@@ -666,6 +736,10 @@ Item {
}
}
}
+
+ function longPressItem(index) {
+ return keyboard.showWordCandidateContextMenu(index)
+ }
}
Item {
@@ -728,6 +802,8 @@ Item {
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
@@ -1014,8 +1090,11 @@ Item {
}
Item {
+ id: languagePopup
z: 1
anchors.fill: parent
+ LayoutMirroring.enabled: false
+ LayoutMirroring.childrenInherit: true
MouseArea {
onPressed: keyboard.hideLanguagePopup()
@@ -1023,13 +1102,19 @@ Item {
enabled: languagePopupList.enabled
}
- LanguagePopupList {
+ 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,
@@ -1060,48 +1145,173 @@ Item {
}
}
}
- }
- function showLanguagePopup(parentItem, customLayoutsOnly) {
- if (!languagePopupList.enabled) {
- var locales = keyboard.listLocales(customLayoutsOnly, parent.externalLanguageSwitchEnabled)
- if (parent.externalLanguageSwitchEnabled) {
- var currentIndex = 0
+ function show(locales, parentItem, customLayoutsOnly) {
+ if (!languagePopupList.enabled) {
+ languageListModel.clear()
for (var i = 0; i < locales.length; i++) {
- if (locales[i] === keyboard.locale) {
- currentIndex = i
- break
- }
+ languageListModel.append({localeName: locales[i].name, displayName: locales[i].locale.nativeLanguageName, localeIndex: locales[i].index})
+ if (locales[i].index === keyboard.localeIndex)
+ languagePopupList.currentIndex = i
}
- parent.externalLanguageSwitch(locales, currentIndex)
- return
+ 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)})
}
- languageListModel.clear()
- for (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.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
+ }
}
- 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)})
+ parent.externalLanguageSwitch(locales, currentIndex)
+ return
}
- languagePopupList.enabled = true
+ languagePopup.show(locales, parentItem, customLayoutsOnly)
}
function hideLanguagePopup() {
- if (languagePopupList.enabled) {
- languagePopupList.enabled = false
- languagePopupList.anchors.leftMargin = undefined
- languagePopupList.anchors.topMargin = undefined
- languageListModel.clear()
+ 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.focus)
+ if (!InputContext.priv.focus)
return
// Reset the custom input method if it is not included in the list of shared layouts
@@ -1160,19 +1370,19 @@ Item {
// Update input mode automatically in handwriting mode
if (keyboard.handwritingMode) {
- if (keyboard.dialableCharactersOnly && inputModes.indexOf(InputEngine.Dialable) !== -1)
- inputMode = InputEngine.Dialable
- else if ((keyboard.formattedNumbersOnly || keyboard.digitsOnly) && inputModes.indexOf(InputEngine.Numeric) !== -1)
- inputMode = InputEngine.Numeric
+ 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.Latin
+ inputMode = InputEngine.InputMode.Latin
if (preferNumbers)
- inputMode = InputEngine.Numeric
+ inputMode = InputEngine.InputMode.Numeric
}
// Make sure the input mode is supported by the current input method
@@ -1187,7 +1397,7 @@ Item {
}
// Clear the toggle shift timer
- InputContext.shiftHandler.clearToggleShiftTimer()
+ InputContext.priv.shiftHandler.clearToggleShiftTimer()
}
function updateLayout() {
@@ -1228,48 +1438,49 @@ Item {
}
}
- function updateAvailableLocaleIndices() {
- // Update list of all available locales
- var baseLayoutIndex = findLocale("en_GB", -1)
- var newIndices = []
- var newAvailableLocales = []
+ function filterLocaleIndices(filterCb) {
+ var localeIndices = []
for (var i = 0; i < layoutsModel.count; i++) {
- var localeName = layoutsModel.get(i, "fileName")
- if (isValidLocale(i) && newIndices.indexOf(i) === -1 && findLayout(localeName, "main")) {
- newIndices.push(i)
- newAvailableLocales.push(localeName)
+ 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) {
- if (baseLayoutIndex !== -1) {
- newIndices.push(baseLayoutIndex)
- newAvailableLocales.push("en_GB")
- } else {
- for (i = 0; i < layoutsModel.count; i++) {
- localeName = layoutsModel.get(i, "fileName")
- if (Qt.locale(localeName).name !== "C" && findLayout(localeName, "main")) {
- newIndices.push(i)
- newAvailableLocales.push(localeName)
- break
- }
- }
- }
+ 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.updateAvailableLocales(newAvailableLocales)
+ InputContext.priv.updateAvailableLocales(newAvailableLocales)
// Update list of custom locale indices
newIndices = []
for (i = 0; i < availableLocaleIndices.length; i++) {
if (availableLocaleIndices[i] === localeIndex ||
- ((availableLocaleIndices[i] !== baseLayoutIndex ||
- (layoutType === "handwriting" && availableLocaleIndices.indexOf(baseLayoutIndex) !== -1)) &&
- layoutExists(layoutsModel.get(availableLocaleIndices[i], "fileName"), layoutType)))
+ layoutExists(layoutsModel.get(availableLocaleIndices[i], "fileName"), layoutType))
newIndices.push(availableLocaleIndices[i])
}
availableCustomLocaleIndices = newIndices
@@ -1326,7 +1537,16 @@ Item {
return (languageMatch != -1) ? languageMatch : defaultValue
}
- function isValidLocale(localeNameOrIndex) {
+ 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)
@@ -1336,10 +1556,18 @@ Item {
localeName = localeNameOrIndex
}
+ if (!localeName)
+ return false
+
+ if (localeName === "fallback")
+ return false
+
if (Qt.locale(localeName).name === "C")
return false
- if (VirtualKeyboardSettings.activeLocales.length > 0 && VirtualKeyboardSettings.activeLocales.indexOf(localeName) === -1)
+ if (ignoreActiveLocales !== true &&
+ VirtualKeyboardSettings.activeLocales.length > 0 &&
+ VirtualKeyboardSettings.activeLocales.indexOf(localeName) === -1)
return false
return true
@@ -1351,22 +1579,34 @@ Item {
return layoutsModel.folder + "/" + localeName + "/" + layoutType + ".qml"
}
+ function getFallbackFile(localeName, layoutType) {
+ if (localeName === "" || layoutType === "")
+ return ""
+ return layoutsModel.folder + "/" + localeName + "/" + layoutType + ".fallback"
+ }
+
function layoutExists(localeName, layoutType) {
- return InputContext.fileExists(getLayoutFile(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.fileExists(layoutFile))
- return layoutFile
- layoutFile = getLayoutFile("en_GB", layoutType)
- if (InputContext.fileExists(layoutFile))
+ 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 VirtualKeyboardInputMethods.indexOf("HandwritingInputMethod") !== -1 && layoutExists(locale, "handwriting")
+ return InputContext.priv.inputMethods.indexOf("HandwritingInputMethod") !== -1 && layoutExists(locale, "handwriting")
}
function setHandwritingMode(enabled, resetInputMode) {
diff --git a/src/virtualkeyboard/content/components/LanguagePopupList.qml b/src/virtualkeyboard/content/components/LanguagePopupList.qml
deleted file mode 100644
index 2c8b8c99..00000000
--- a/src/virtualkeyboard/content/components/LanguagePopupList.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.1
-
-ListView {
- id: languagePopupList
- objectName: "languagePopupList"
-
- property int maxVisibleItems: 5
- readonly property int preferredVisibleItems: count < maxVisibleItems ? count : maxVisibleItems
- readonly property real contentWidth: contentItem.childrenRect.width
-
- 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.languageListDelegate
- highlight: keyboard.style.languageListHighlight ? keyboard.style.languageListHighlight : defaultHighlight
- highlightMoveDuration: 0
- highlightResizeDuration: 0
- add: keyboard.style.languageListAdd
- remove: keyboard.style.languageListRemove
- keyNavigationWraps: true
-
- onCurrentItemChanged: if (currentItem) keyboard.soundEffect.register(currentItem.soundEffect)
-
- Component {
- id: defaultHighlight
- Item {}
- }
-
- Loader {
- sourceComponent: keyboard.style.languageListBackground
- anchors.fill: parent
- z: -1
- }
-}
diff --git a/src/virtualkeyboard/content/components/MultitapInputMethod.qml b/src/virtualkeyboard/content/components/MultitapInputMethod.qml
index b0aa8129..3c14a544 100644
--- a/src/virtualkeyboard/content/components/MultitapInputMethod.qml
+++ b/src/virtualkeyboard/content/components/MultitapInputMethod.qml
@@ -34,8 +34,8 @@ InputMethod {
property string multitapSequence
property int multitapIndex: -1
- onMultitapSequenceChanged: selectionListChanged(SelectionListModel.WordCandidateList)
- onMultitapIndexChanged: selectionListActiveItemChanged(SelectionListModel.WordCandidateList, multitapIndex)
+ onMultitapSequenceChanged: selectionListChanged(SelectionListModel.Type.WordCandidateList)
+ onMultitapIndexChanged: selectionListActiveItemChanged(SelectionListModel.Type.WordCandidateList, multitapIndex)
property variant multiTapTimer: Timer {
interval: 1200
@@ -45,7 +45,7 @@ InputMethod {
}
function inputModes(locale) {
- return [InputEngine.Latin, InputEngine.Numeric, InputEngine.Dialable];
+ return [InputEngine.InputMode.Latin, InputEngine.InputMode.Numeric, InputEngine.InputMode.Dialable];
}
function setInputMode(locale, inputMode) {
@@ -105,7 +105,7 @@ InputMethod {
}
function selectionLists() {
- return [SelectionListModel.WordCandidateList];
+ return [SelectionListModel.Type.WordCandidateList];
}
function selectionListItemCount(type) {
@@ -115,7 +115,7 @@ InputMethod {
function selectionListData(type, index, role) {
var result = null
switch (role) {
- case SelectionListModel.DisplayRole:
+ case SelectionListModel.Role.Display:
result = multitapSequence.charAt(index)
break
default:
diff --git a/src/virtualkeyboard/content/components/PopupList.qml b/src/virtualkeyboard/content/components/PopupList.qml
new file mode 100644
index 00000000..dcd02ee1
--- /dev/null
+++ b/src/virtualkeyboard/content/components/PopupList.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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/ShadowInputControl.qml b/src/virtualkeyboard/content/components/ShadowInputControl.qml
index b935d5c6..a059c40e 100644
--- a/src/virtualkeyboard/content/components/ShadowInputControl.qml
+++ b/src/virtualkeyboard/content/components/ShadowInputControl.qml
@@ -40,8 +40,8 @@ Item {
anchors.fill: parent
}
- onXChanged: InputContext.shadow.updateSelectionProperties()
- onYChanged: InputContext.shadow.updateSelectionProperties()
+ onXChanged: InputContext.priv.shadow.updateSelectionProperties()
+ onYChanged: InputContext.priv.shadow.updateSelectionProperties()
Loader {
sourceComponent: keyboard.style.fullScreenInputContainerBackground
@@ -61,7 +61,7 @@ Item {
flickableDirection: Flickable.HorizontalFlick
interactive: contentWidth > width
contentWidth: shadowInput.width
- onContentXChanged: InputContext.shadow.updateSelectionProperties()
+ onContentXChanged: InputContext.priv.shadow.updateSelectionProperties()
function ensureVisible(rectangle) {
if (contentX >= rectangle.x)
@@ -113,7 +113,7 @@ Item {
onTriggered: {
var anchorPosition = shadowInput.getAnchorPosition()
if (anchorPosition !== InputContext.anchorPosition || shadowInput.cursorPosition !== InputContext.cursorPosition)
- InputContext.forceCursorPosition(anchorPosition, shadowInput.cursorPosition)
+ InputContext.priv.forceCursorPosition(anchorPosition, shadowInput.cursorPosition)
}
}
@@ -130,7 +130,7 @@ Item {
}
Binding {
- target: InputContext.shadow
+ target: InputContext.priv.shadow
property: "inputItem"
value: shadowInput
when: VirtualKeyboardSettings.fullScreenMode
diff --git a/src/virtualkeyboard/content/components/ShiftKey.qml b/src/virtualkeyboard/content/components/ShiftKey.qml
index d7705d9f..d31a601a 100644
--- a/src/virtualkeyboard/content/components/ShiftKey.qml
+++ b/src/virtualkeyboard/content/components/ShiftKey.qml
@@ -44,9 +44,9 @@ import QtQuick.VirtualKeyboard 2.1
BaseKey {
id: shiftKey
key: Qt.Key_Shift
- enabled: InputContext.shiftHandler.toggleShiftEnabled
- highlighted: InputContext.capsLock
+ enabled: InputContext.priv.shiftHandler.toggleShiftEnabled
+ highlighted: InputContext.capsLockActive
functionKey: true
keyPanelDelegate: keyboard.style ? keyboard.style.shiftKeyPanel : undefined
- onClicked: InputContext.shiftHandler.toggleShift()
+ onClicked: InputContext.priv.shiftHandler.toggleShift()
}
diff --git a/src/virtualkeyboard/content/components/TraceInputArea.qml b/src/virtualkeyboard/content/components/TraceInputArea.qml
index cdc4ecdd..10527861 100644
--- a/src/virtualkeyboard/content/components/TraceInputArea.qml
+++ b/src/virtualkeyboard/content/components/TraceInputArea.qml
@@ -52,9 +52,9 @@ MultiPointTouchArea {
/*! Pattern recognition mode of this input area.
- The default value is \l {QtVirtualKeyboard::InputEngine::PatternRecognitionDisabled} {InputEngine.PatternRecognitionDisabled}.
+ The default value is \l {InputEngine::PatternRecognitionMode::None} {InputEngine.PatternRecognitionMode.None}.
*/
- property int patternRecognitionMode: InputEngine.PatternRecognitionDisabled
+ property int patternRecognitionMode: InputEngine.PatternRecognitionMode.None
/*! List of horizontal rulers in the input area.
@@ -127,7 +127,7 @@ MultiPointTouchArea {
canvasType: traceInputArea.canvasType
})
- enabled: patternRecognitionMode !== InputEngine.PatternRecognitionDisabled && InputContext.inputEngine.patternRecognitionModes.indexOf(patternRecognitionMode) !== -1
+ enabled: patternRecognitionMode !== InputEngine.PatternRecognitionMode.None && InputContext.inputEngine.patternRecognitionModes.indexOf(patternRecognitionMode) !== -1
onPressed: {
if (!keyboard.style.traceCanvasDelegate)
@@ -165,7 +165,7 @@ MultiPointTouchArea {
for (var i = 0; i < touchPoints.length; i++) {
var traceCanvas = findTraceCanvasById(touchPoints[i].pointId)
if (traceCanvas) {
- traceCanvas.trace.isFinal = true
+ traceCanvas.trace.final = true
__traceCanvasList.splice(__traceCanvasList.indexOf(traceCanvas), 1)
InputContext.inputEngine.traceEnd(traceCanvas.trace)
}
@@ -176,8 +176,8 @@ MultiPointTouchArea {
for (var i = 0; i < touchPoints.length; i++) {
var traceCanvas = findTraceCanvasById(touchPoints[i].pointId)
if (traceCanvas) {
- traceCanvas.trace.isFinal = true
- traceCanvas.trace.isCanceled = true
+ 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
index 444208e9..f380eb9e 100644
--- a/src/virtualkeyboard/content/components/TraceInputKey.qml
+++ b/src/virtualkeyboard/content/components/TraceInputKey.qml
@@ -57,7 +57,7 @@ Item {
/*! Pattern recognition mode of this input area.
- The default value is \l {QtVirtualKeyboard::InputEngine::PatternRecognitionDisabled} {InputEngine.PatternRecognitionDisabled}.
+ The default value is \l {InputEngine::PatternRecognitionMode::None} {InputEngine.PatternRecognitionMode.None}.
*/
property alias patternRecognitionMode: traceInputArea.patternRecognitionMode
diff --git a/src/virtualkeyboard/content/components/WordCandidatePopupList.qml b/src/virtualkeyboard/content/components/WordCandidatePopupList.qml
index 7740cbf9..e255142a 100644
--- a/src/virtualkeyboard/content/components/WordCandidatePopupList.qml
+++ b/src/virtualkeyboard/content/components/WordCandidatePopupList.qml
@@ -28,12 +28,11 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick.VirtualKeyboard 2.3
-ListView {
+PopupList {
id: wordCandidatePopupList
- property int maxVisibleItems: 5
readonly property int preferredVisibleItems: {
if (!currentItem)
return 0
@@ -43,13 +42,10 @@ ListView {
--result
return result
}
- readonly property real contentWidth: contentItem.childrenRect.width
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
- clip: true
- visible: enabled && count > 0
height: currentItem ? currentItem.height * preferredVisibleItems + (spacing * preferredVisibleItems - 1) : 0
Binding {
target: wordCandidatePopupList
@@ -66,19 +62,9 @@ ListView {
value: Math.round(wordCandidatePopupList.flipVertical ? Qt.inputMethod.cursorRectangle.y - wordCandidatePopupList.height : Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height)
when: wordCandidatePopupList.visible
}
- orientation: ListView.Vertical
- snapMode: ListView.SnapToItem
- delegate: keyboard.style.popupListDelegate
- highlight: keyboard.style.popupListHighlight ? keyboard.style.popupListHighlight : null
- highlightMoveDuration: 0
- highlightResizeDuration: 0
- add: keyboard.style.popupListAdd
- remove: keyboard.style.popupListRemove
- keyNavigationWraps: true
model: enabled ? InputContext.inputEngine.wordCandidateListModel : null
onContentWidthChanged: viewResizeTimer.restart()
- onCurrentItemChanged: if (currentItem) keyboard.soundEffect.register(currentItem.soundEffect)
Timer {
id: viewResizeTimer
@@ -92,10 +78,4 @@ ListView {
onActiveItemChanged: wordCandidatePopupList.currentIndex = index
onItemSelected: if (wordCandidatePopupList.currentItem) keyboard.soundEffect.play(wordCandidatePopupList.currentItem.soundEffect)
}
-
- Loader {
- sourceComponent: keyboard.style.popupListBackground
- anchors.fill: parent
- z: -1
- }
}
diff --git a/src/virtualkeyboard/content/content.qrc b/src/virtualkeyboard/content/content.qrc
deleted file mode 100644
index d29dbe33..00000000
--- a/src/virtualkeyboard/content/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/LanguagePopupList.qml</file>
- <file>components/SelectionControl.qml</file>
- <file>components/ShadowInputControl.qml</file>
- <file>components/InputModeKey.qml</file>
- </qresource>
-</RCC>
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/dialpad.fallback b/src/virtualkeyboard/content/layouts/ar_AR/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ar_AR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/digits.qml b/src/virtualkeyboard/content/layouts/ar_AR/digits.qml
index e6c663b0..6d7047f4 100644
--- a/src/virtualkeyboard/content/layouts/ar_AR/digits.qml
+++ b/src/virtualkeyboard/content/layouts/ar_AR/digits.qml
@@ -30,10 +30,11 @@
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.Numeric
+ inputMode: InputEngine.InputMode.Numeric
KeyboardColumn {
Layout.fillWidth: false
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml b/src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml
index f84d47dc..f82e4b6c 100644
--- a/src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml
@@ -33,11 +33,11 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
- inputMode: InputEngine.Arabic
- readonly property bool alphabeticInputMode: [InputEngine.Latin, InputEngine.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1
+ inputMode: InputEngine.InputMode.Arabic
+ readonly property bool alphabeticInputMode: [InputEngine.InputMode.Latin, InputEngine.InputMode.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1
KeyboardRow {
Layout.preferredHeight: 3
@@ -46,7 +46,7 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
alphabeticInputMode ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
@@ -73,19 +73,19 @@ KeyboardLayout {
InputModeKey {
weight: 217
inputModeNameList: [
- "ABC", // InputEngine.Latin
- "\u0660\u0661\u0662", // InputEngine.Numeric
- "123", // InputEngine.Dialable
- "", // InputEngine.Pinyin
- "", // InputEngine.Cangjie
- "", // InputEngine.Zhuyin
- "", // InputEngine.Hangul
- "", // InputEngine.Hiragana
- "", // InputEngine.Katakana
- "", // InputEngine.FullwidthLatin
- "", // InputEngine.Greek
- "", // InputEngine.Cyrillic
- "\u0623\u200C\u0628\u200C\u062C", // InputEngine.Arabic
+ "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 {
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/main.qml b/src/virtualkeyboard/content/layouts/ar_AR/main.qml
index e79847ec..a7f0e5b9 100644
--- a/src/virtualkeyboard/content/layouts/ar_AR/main.qml
+++ b/src/virtualkeyboard/content/layouts/ar_AR/main.qml
@@ -31,8 +31,8 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.3
KeyboardLayoutLoader {
- inputMode: InputEngine.Arabic
- sourceComponent: InputContext.shift ? page2 : page1
+ inputMode: InputEngine.InputMode.Arabic
+ sourceComponent: InputContext.shiftActive ? page2 : page1
Component {
id: page1
KeyboardLayout {
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/numbers.qml b/src/virtualkeyboard/content/layouts/ar_AR/numbers.qml
index 62f019d2..fe709489 100644
--- a/src/virtualkeyboard/content/layouts/ar_AR/numbers.qml
+++ b/src/virtualkeyboard/content/layouts/ar_AR/numbers.qml
@@ -30,10 +30,11 @@
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.Numeric
+ inputMode: InputEngine.InputMode.Numeric
KeyboardRow {
Layout.fillWidth: false
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/dialpad.fallback b/src/virtualkeyboard/content/layouts/bg_BG/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/bg_BG/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/digits.fallback b/src/virtualkeyboard/content/layouts/bg_BG/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/bg_BG/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml b/src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml
index 782f3217..16f078cb 100644
--- a/src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
@@ -44,9 +44,9 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.Cyrillic ? [] :
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Cyrillic ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
}
}
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/main.qml b/src/virtualkeyboard/content/layouts/bg_BG/main.qml
index f9dad187..2e958aa8 100644
--- a/src/virtualkeyboard/content/layouts/bg_BG/main.qml
+++ b/src/virtualkeyboard/content/layouts/bg_BG/main.qml
@@ -32,7 +32,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayoutLoader {
sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.Cyrillic ? cyrillicLayout : latinLayout
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? cyrillicLayout : latinLayout
Component {
id: cyrillicLayout
KeyboardLayout {
@@ -117,7 +117,7 @@ KeyboardLayoutLoader {
KeyboardRow {
keyWeight: 156
InputModeKey {
- inputModes: [InputEngine.Cyrillic, InputEngine.Latin]
+ inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
}
Key {
text: "з"
@@ -293,7 +293,7 @@ KeyboardLayoutLoader {
keyWeight: 156
InputModeKey {
enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
- inputModes: [InputEngine.Cyrillic, InputEngine.Latin]
+ inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
}
Key {
key: Qt.Key_Z
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/numbers.fallback b/src/virtualkeyboard/content/layouts/bg_BG/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/bg_BG/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/symbols.fallback b/src/virtualkeyboard/content/layouts/bg_BG/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/bg_BG/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/symbols.qml b/src/virtualkeyboard/content/layouts/bg_BG/symbols.qml
deleted file mode 100644
index a649017b..00000000
--- a/src/virtualkeyboard/content/layouts/bg_BG/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.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.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/cs_CZ/dialpad.fallback b/src/virtualkeyboard/content/layouts/cs_CZ/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/cs_CZ/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/digits.fallback b/src/virtualkeyboard/content/layouts/cs_CZ/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/cs_CZ/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml b/src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml
index a8d3b59b..caf820ae 100644
--- a/src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml
@@ -33,10 +33,10 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
KeyboardRow {
Layout.preferredHeight: 3
@@ -45,7 +45,7 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
}
}
}
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/main.qml b/src/virtualkeyboard/content/layouts/cs_CZ/main.qml
index 1a4057e8..4d328bff 100644
--- a/src/virtualkeyboard/content/layouts/cs_CZ/main.qml
+++ b/src/virtualkeyboard/content/layouts/cs_CZ/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/numbers.fallback b/src/virtualkeyboard/content/layouts/cs_CZ/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/cs_CZ/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/symbols.fallback b/src/virtualkeyboard/content/layouts/cs_CZ/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/cs_CZ/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/symbols.qml b/src/virtualkeyboard/content/layouts/cs_CZ/symbols.qml
deleted file mode 100644
index 76c06493..00000000
--- a/src/virtualkeyboard/content/layouts/cs_CZ/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_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- 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: 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/da_DK/dialpad.fallback b/src/virtualkeyboard/content/layouts/da_DK/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/da_DK/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/digits.fallback b/src/virtualkeyboard/content/layouts/da_DK/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/da_DK/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/handwriting.fallback b/src/virtualkeyboard/content/layouts/da_DK/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/da_DK/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/handwriting.qml b/src/virtualkeyboard/content/layouts/da_DK/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/da_DK/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/da_DK/main.qml b/src/virtualkeyboard/content/layouts/da_DK/main.qml
index d4284387..b03860e6 100644
--- a/src/virtualkeyboard/content/layouts/da_DK/main.qml
+++ b/src/virtualkeyboard/content/layouts/da_DK/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/da_DK/numbers.fallback b/src/virtualkeyboard/content/layouts/da_DK/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/da_DK/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/symbols.fallback b/src/virtualkeyboard/content/layouts/da_DK/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/da_DK/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/symbols.qml b/src/virtualkeyboard/content/layouts/da_DK/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/da_DK/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: "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/de_DE/dialpad.fallback b/src/virtualkeyboard/content/layouts/de_DE/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/de_DE/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/digits.fallback b/src/virtualkeyboard/content/layouts/de_DE/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/de_DE/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/handwriting.fallback b/src/virtualkeyboard/content/layouts/de_DE/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/de_DE/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/handwriting.qml b/src/virtualkeyboard/content/layouts/de_DE/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/de_DE/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/de_DE/main.qml b/src/virtualkeyboard/content/layouts/de_DE/main.qml
index 578fb808..bd91ec50 100644
--- a/src/virtualkeyboard/content/layouts/de_DE/main.qml
+++ b/src/virtualkeyboard/content/layouts/de_DE/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/de_DE/numbers.fallback b/src/virtualkeyboard/content/layouts/de_DE/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/de_DE/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/symbols.fallback b/src/virtualkeyboard/content/layouts/de_DE/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/de_DE/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/symbols.qml b/src/virtualkeyboard/content/layouts/de_DE/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/de_DE/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: "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/el_GR/dialpad.fallback b/src/virtualkeyboard/content/layouts/el_GR/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/el_GR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/el_GR/digits.fallback b/src/virtualkeyboard/content/layouts/el_GR/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/el_GR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/el_GR/handwriting.qml b/src/virtualkeyboard/content/layouts/el_GR/handwriting.qml
index 03747a85..b010ecf4 100644
--- a/src/virtualkeyboard/content/layouts/el_GR/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/el_GR/handwriting.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
@@ -44,9 +44,9 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.Greek ? [] :
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Greek ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
}
}
diff --git a/src/virtualkeyboard/content/layouts/el_GR/main.qml b/src/virtualkeyboard/content/layouts/el_GR/main.qml
index 50b5fec1..d9fbaf9e 100644
--- a/src/virtualkeyboard/content/layouts/el_GR/main.qml
+++ b/src/virtualkeyboard/content/layouts/el_GR/main.qml
@@ -32,7 +32,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayoutLoader {
sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.Greek ? greekLayout : latinLayout
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Greek ? greekLayout : latinLayout
Component {
id: greekLayout
KeyboardLayout {
@@ -114,7 +114,7 @@ KeyboardLayoutLoader {
KeyboardRow {
keyWeight: 156
InputModeKey {
- inputModes: [InputEngine.Greek, InputEngine.Latin]
+ inputModes: [InputEngine.InputMode.Greek, InputEngine.InputMode.Latin]
}
Key {
text: "ζ"
@@ -287,7 +287,7 @@ KeyboardLayoutLoader {
KeyboardRow {
keyWeight: 156
InputModeKey {
- inputModes: [InputEngine.Greek, InputEngine.Latin]
+ inputModes: [InputEngine.InputMode.Greek, InputEngine.InputMode.Latin]
}
Key {
key: Qt.Key_Z
diff --git a/src/virtualkeyboard/content/layouts/el_GR/numbers.fallback b/src/virtualkeyboard/content/layouts/el_GR/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/el_GR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/el_GR/symbols.fallback b/src/virtualkeyboard/content/layouts/el_GR/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/el_GR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/el_GR/symbols.qml b/src/virtualkeyboard/content/layouts/el_GR/symbols.qml
deleted file mode 100644
index b5eda063..00000000
--- a/src/virtualkeyboard/content/layouts/el_GR/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.Greek ? "ΑΒΓ" : "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.Greek ? "ΑΒΓ" : "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/en_GB/dialpad.fallback b/src/virtualkeyboard/content/layouts/en_GB/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_GB/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/dialpad.qml b/src/virtualkeyboard/content/layouts/en_GB/dialpad.qml
deleted file mode 100644
index 95a40db9..00000000
--- a/src/virtualkeyboard/content/layouts/en_GB/dialpad.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
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.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/en_GB/digits.fallback b/src/virtualkeyboard/content/layouts/en_GB/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_GB/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/digits.qml b/src/virtualkeyboard/content/layouts/en_GB/digits.qml
deleted file mode 100644
index 5a59d3f3..00000000
--- a/src/virtualkeyboard/content/layouts/en_GB/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
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.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/en_GB/handwriting.fallback b/src/virtualkeyboard/content/layouts/en_GB/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_GB/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/handwriting.qml b/src/virtualkeyboard/content/layouts/en_GB/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/en_GB/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/en_GB/main.fallback b/src/virtualkeyboard/content/layouts/en_GB/main.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_GB/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/main.qml b/src/virtualkeyboard/content/layouts/en_GB/main.qml
deleted file mode 100644
index 0c6370ae..00000000
--- a/src/virtualkeyboard/content/layouts/en_GB/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.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/en_GB/numbers.fallback b/src/virtualkeyboard/content/layouts/en_GB/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_GB/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/numbers.qml b/src/virtualkeyboard/content/layouts/en_GB/numbers.qml
deleted file mode 100644
index 88491ac5..00000000
--- a/src/virtualkeyboard/content/layouts/en_GB/numbers.qml
+++ /dev/null
@@ -1,183 +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 {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.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/en_GB/symbols.fallback b/src/virtualkeyboard/content/layouts/en_GB/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_GB/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/symbols.qml b/src/virtualkeyboard/content/layouts/en_GB/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/en_GB/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: "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/en_US/dialpad.fallback b/src/virtualkeyboard/content/layouts/en_US/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_US/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/digits.fallback b/src/virtualkeyboard/content/layouts/en_US/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_US/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/handwriting.fallback b/src/virtualkeyboard/content/layouts/en_US/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_US/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/main.fallback b/src/virtualkeyboard/content/layouts/en_US/main.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_US/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/numbers.fallback b/src/virtualkeyboard/content/layouts/en_US/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_US/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/symbols.fallback b/src/virtualkeyboard/content/layouts/en_US/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/en_US/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_ES/dialpad.fallback b/src/virtualkeyboard/content/layouts/es_ES/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_ES/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_ES/digits.fallback b/src/virtualkeyboard/content/layouts/es_ES/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_ES/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_ES/handwriting.qml b/src/virtualkeyboard/content/layouts/es_ES/handwriting.qml
index 0b929162..d4896408 100644
--- a/src/virtualkeyboard/content/layouts/es_ES/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/es_ES/handwriting.qml
@@ -33,10 +33,10 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
KeyboardRow {
Layout.preferredHeight: 3
@@ -45,7 +45,7 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
}
}
}
diff --git a/src/virtualkeyboard/content/layouts/es_ES/main.qml b/src/virtualkeyboard/content/layouts/es_ES/main.qml
index 528d1f18..b98980bb 100644
--- a/src/virtualkeyboard/content/layouts/es_ES/main.qml
+++ b/src/virtualkeyboard/content/layouts/es_ES/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/es_ES/numbers.fallback b/src/virtualkeyboard/content/layouts/es_ES/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_ES/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_MX/dialpad.fallback b/src/virtualkeyboard/content/layouts/es_MX/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_MX/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_MX/digits.fallback b/src/virtualkeyboard/content/layouts/es_MX/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_MX/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_MX/handwriting.qml b/src/virtualkeyboard/content/layouts/es_MX/handwriting.qml
new file mode 100644
index 00000000..d4896408
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_MX/handwriting.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..b98980bb
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_MX/main.qml
@@ -0,0 +1,211 @@
+/****************************************************************************
+**
+** 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/numbers.fallback b/src/virtualkeyboard/content/layouts/es_MX/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_MX/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_MX/symbols.qml b/src/virtualkeyboard/content/layouts/es_MX/symbols.qml
new file mode 100644
index 00000000..17bd3c36
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/es_MX/symbols.qml
@@ -0,0 +1,378 @@
+/****************************************************************************
+**
+** 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/dialpad.fallback b/src/virtualkeyboard/content/layouts/et_EE/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/et_EE/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/et_EE/digits.fallback b/src/virtualkeyboard/content/layouts/et_EE/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/et_EE/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/et_EE/handwriting.fallback b/src/virtualkeyboard/content/layouts/et_EE/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/et_EE/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/et_EE/handwriting.qml b/src/virtualkeyboard/content/layouts/et_EE/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/et_EE/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/et_EE/main.qml b/src/virtualkeyboard/content/layouts/et_EE/main.qml
index 0deff352..4d62e93e 100644
--- a/src/virtualkeyboard/content/layouts/et_EE/main.qml
+++ b/src/virtualkeyboard/content/layouts/et_EE/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/et_EE/numbers.fallback b/src/virtualkeyboard/content/layouts/et_EE/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/et_EE/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/et_EE/symbols.fallback b/src/virtualkeyboard/content/layouts/et_EE/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/et_EE/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/et_EE/symbols.qml b/src/virtualkeyboard/content/layouts/et_EE/symbols.qml
deleted file mode 100644
index 49f6e709..00000000
--- a/src/virtualkeyboard/content/layouts/et_EE/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.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: "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/fa_FA/dialpad.fallback b/src/virtualkeyboard/content/layouts/fa_FA/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fa_FA/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/digits.qml b/src/virtualkeyboard/content/layouts/fa_FA/digits.qml
index d001c2db..ed92201f 100644
--- a/src/virtualkeyboard/content/layouts/fa_FA/digits.qml
+++ b/src/virtualkeyboard/content/layouts/fa_FA/digits.qml
@@ -30,10 +30,11 @@
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.Numeric
+ inputMode: InputEngine.InputMode.Numeric
KeyboardColumn {
Layout.fillWidth: false
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml b/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml
index 006df195..1a43b05e 100644
--- a/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml
@@ -33,11 +33,11 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
- inputMode: InputEngine.Arabic
- readonly property bool alphabeticInputMode: [InputEngine.Latin, InputEngine.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1
+ inputMode: InputEngine.InputMode.Arabic
+ readonly property bool alphabeticInputMode: [InputEngine.InputMode.Latin, InputEngine.InputMode.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1
KeyboardRow {
Layout.preferredHeight: 3
@@ -46,7 +46,7 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
alphabeticInputMode ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
@@ -73,19 +73,19 @@ KeyboardLayout {
InputModeKey {
weight: 217
inputModeNameList: [
- "ABC", // InputEngine.Latin
- "\u0660\u0661\u0662", // InputEngine.Numeric
- "123", // InputEngine.Dialable
- "", // InputEngine.Pinyin
- "", // InputEngine.Cangjie
- "", // InputEngine.Zhuyin
- "", // InputEngine.Hangul
- "", // InputEngine.Hiragana
- "", // InputEngine.Katakana
- "", // InputEngine.FullwidthLatin
- "", // InputEngine.Greek
- "", // InputEngine.Cyrillic
- "\u0627\u200C\u0628\u200C\u067E", // InputEngine.Arabic
+ "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 {
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/main.qml b/src/virtualkeyboard/content/layouts/fa_FA/main.qml
index e73665a8..0450c772 100644
--- a/src/virtualkeyboard/content/layouts/fa_FA/main.qml
+++ b/src/virtualkeyboard/content/layouts/fa_FA/main.qml
@@ -31,8 +31,8 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.3
KeyboardLayoutLoader {
- inputMode: InputEngine.Arabic
- sourceComponent: InputContext.shift ? page2 : page1
+ inputMode: InputEngine.InputMode.Arabic
+ sourceComponent: InputContext.shiftActive ? page2 : page1
Component {
id: page1
KeyboardLayout {
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/numbers.qml b/src/virtualkeyboard/content/layouts/fa_FA/numbers.qml
index 79228726..e32a1e71 100644
--- a/src/virtualkeyboard/content/layouts/fa_FA/numbers.qml
+++ b/src/virtualkeyboard/content/layouts/fa_FA/numbers.qml
@@ -30,10 +30,11 @@
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.Numeric
+ inputMode: InputEngine.InputMode.Numeric
KeyboardRow {
Layout.fillWidth: false
diff --git a/src/virtualkeyboard/content/layouts/fallback/dialpad.qml b/src/virtualkeyboard/content/layouts/fallback/dialpad.qml
new file mode 100644
index 00000000..89f6873a
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fallback/dialpad.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..432984a1
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fallback/digits.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..1da3fc8e
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fallback/handwriting.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..c9a736f2
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fallback/main.qml
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..7fd0a2ab
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fallback/numbers.qml
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..26d62951
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fallback/symbols.qml
@@ -0,0 +1,376 @@
+/****************************************************************************
+**
+** 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/dialpad.fallback b/src/virtualkeyboard/content/layouts/fi_FI/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fi_FI/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/digits.fallback b/src/virtualkeyboard/content/layouts/fi_FI/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fi_FI/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/handwriting.fallback b/src/virtualkeyboard/content/layouts/fi_FI/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fi_FI/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/handwriting.qml b/src/virtualkeyboard/content/layouts/fi_FI/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/fi_FI/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/fi_FI/main.qml b/src/virtualkeyboard/content/layouts/fi_FI/main.qml
index b90a43cf..a3a8a86f 100644
--- a/src/virtualkeyboard/content/layouts/fi_FI/main.qml
+++ b/src/virtualkeyboard/content/layouts/fi_FI/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/numbers.fallback b/src/virtualkeyboard/content/layouts/fi_FI/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fi_FI/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/symbols.fallback b/src/virtualkeyboard/content/layouts/fi_FI/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fi_FI/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/symbols.qml b/src/virtualkeyboard/content/layouts/fi_FI/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/fi_FI/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: "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/fr_CA/dialpad.fallback b/src/virtualkeyboard/content/layouts/fr_CA/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_CA/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/digits.fallback b/src/virtualkeyboard/content/layouts/fr_CA/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_CA/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/handwriting.fallback b/src/virtualkeyboard/content/layouts/fr_CA/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_CA/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/main.qml b/src/virtualkeyboard/content/layouts/fr_CA/main.qml
new file mode 100644
index 00000000..8866dfd7
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_CA/main.qml
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** 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_CA/numbers.fallback b/src/virtualkeyboard/content/layouts/fr_CA/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_CA/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/symbols.fallback b/src/virtualkeyboard/content/layouts/fr_CA/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_CA/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/dialpad.fallback b/src/virtualkeyboard/content/layouts/fr_FR/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_FR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/digits.fallback b/src/virtualkeyboard/content/layouts/fr_FR/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_FR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/handwriting.fallback b/src/virtualkeyboard/content/layouts/fr_FR/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_FR/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/handwriting.qml b/src/virtualkeyboard/content/layouts/fr_FR/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/fr_FR/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/fr_FR/main.qml b/src/virtualkeyboard/content/layouts/fr_FR/main.qml
index 375b589f..753d8e67 100644
--- a/src/virtualkeyboard/content/layouts/fr_FR/main.qml
+++ b/src/virtualkeyboard/content/layouts/fr_FR/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/numbers.fallback b/src/virtualkeyboard/content/layouts/fr_FR/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_FR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/symbols.fallback b/src/virtualkeyboard/content/layouts/fr_FR/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/fr_FR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/symbols.qml b/src/virtualkeyboard/content/layouts/fr_FR/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/fr_FR/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: "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/he_IL/dialpad.fallback b/src/virtualkeyboard/content/layouts/he_IL/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/he_IL/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/he_IL/digits.fallback b/src/virtualkeyboard/content/layouts/he_IL/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/he_IL/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/he_IL/handwriting.qml b/src/virtualkeyboard/content/layouts/he_IL/handwriting.qml
index 321fbd42..66914c71 100644
--- a/src/virtualkeyboard/content/layouts/he_IL/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/he_IL/handwriting.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
@@ -44,9 +44,9 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.Hebrew ? [] :
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Hebrew ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
}
}
diff --git a/src/virtualkeyboard/content/layouts/he_IL/main.qml b/src/virtualkeyboard/content/layouts/he_IL/main.qml
index fde3cb4b..4c47fc56 100644
--- a/src/virtualkeyboard/content/layouts/he_IL/main.qml
+++ b/src/virtualkeyboard/content/layouts/he_IL/main.qml
@@ -32,7 +32,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayoutLoader {
sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.Hebrew ? hebrewLayout : latinLayout
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? hebrewLayout : latinLayout
Component {
id: hebrewLayout
KeyboardLayout {
@@ -122,7 +122,7 @@ KeyboardLayoutLoader {
KeyboardRow {
keyWeight: 156
InputModeKey {
- inputModes: [InputEngine.Hebrew, InputEngine.Latin]
+ inputModes: [InputEngine.InputMode.Hebrew, InputEngine.InputMode.Latin]
}
Key {
text: "\u05D6"
@@ -302,7 +302,7 @@ KeyboardLayoutLoader {
KeyboardRow {
keyWeight: 156
InputModeKey {
- inputModes: [InputEngine.Hebrew, InputEngine.Latin]
+ inputModes: [InputEngine.InputMode.Hebrew, InputEngine.InputMode.Latin]
}
Key {
key: Qt.Key_Z
diff --git a/src/virtualkeyboard/content/layouts/he_IL/numbers.fallback b/src/virtualkeyboard/content/layouts/he_IL/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/he_IL/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/he_IL/symbols.qml b/src/virtualkeyboard/content/layouts/he_IL/symbols.qml
index 866a91a7..f4e58652 100644
--- a/src/virtualkeyboard/content/layouts/he_IL/symbols.qml
+++ b/src/virtualkeyboard/content/layouts/he_IL/symbols.qml
@@ -180,7 +180,7 @@ KeyboardLayoutLoader {
keyWeight: 154
SymbolModeKey {
weight: 217
- displayText: InputContext.inputEngine.inputMode === InputEngine.Hebrew ? "\u05D0\u05D1\u05D2" : "ABC"
+ displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? "\u05D0\u05D1\u05D2" : "ABC"
}
ChangeLanguageKey {
weight: 154
@@ -350,7 +350,7 @@ KeyboardLayoutLoader {
keyWeight: 154
SymbolModeKey {
weight: 217
- displayText: InputContext.inputEngine.inputMode === InputEngine.Hebrew ? "\u05D0\u05D1\u05D2" : "ABC"
+ displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? "\u05D0\u05D1\u05D2" : "ABC"
}
ChangeLanguageKey {
weight: 154
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/dialpad.fallback b/src/virtualkeyboard/content/layouts/hi_IN/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hi_IN/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/digits.fallback b/src/virtualkeyboard/content/layouts/hi_IN/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hi_IN/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/handwriting.qml b/src/virtualkeyboard/content/layouts/hi_IN/handwriting.qml
new file mode 100644
index 00000000..1ae1fa4f
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hi_IN/handwriting.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** 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
index 3d71adb0..aac186eb 100644
--- a/src/virtualkeyboard/content/layouts/hi_IN/main.qml
+++ b/src/virtualkeyboard/content/layouts/hi_IN/main.qml
@@ -31,8 +31,8 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayoutLoader {
- inputMode: InputEngine.Latin
- sourceComponent: InputContext.shift ? page2 : page1
+ inputMode: InputEngine.InputMode.Latin
+ sourceComponent: InputContext.shiftActive ? page2 : page1
Component {
id: page1
KeyboardLayout {
@@ -164,6 +164,9 @@ KeyboardLayoutLoader {
ChangeLanguageKey {
weight: 154
}
+ HandwritingModeKey {
+ weight: 154
+ }
SpaceKey {
weight: 864
}
@@ -312,6 +315,9 @@ KeyboardLayoutLoader {
ChangeLanguageKey {
weight: 154
}
+ HandwritingModeKey {
+ weight: 154
+ }
SpaceKey {
weight: 864
}
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/numbers.fallback b/src/virtualkeyboard/content/layouts/hi_IN/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hi_IN/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/dialpad.fallback b/src/virtualkeyboard/content/layouts/hr_HR/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hr_HR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/digits.fallback b/src/virtualkeyboard/content/layouts/hr_HR/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hr_HR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml b/src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml
index 6f43e6de..968bae8e 100644
--- a/src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml
@@ -33,10 +33,10 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
KeyboardRow {
Layout.preferredHeight: 3
@@ -45,7 +45,7 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
}
}
}
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/main.qml b/src/virtualkeyboard/content/layouts/hr_HR/main.qml
index 6c4c306c..4b4c46d9 100644
--- a/src/virtualkeyboard/content/layouts/hr_HR/main.qml
+++ b/src/virtualkeyboard/content/layouts/hr_HR/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/numbers.fallback b/src/virtualkeyboard/content/layouts/hr_HR/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hr_HR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/symbols.fallback b/src/virtualkeyboard/content/layouts/hr_HR/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hr_HR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/symbols.qml b/src/virtualkeyboard/content/layouts/hr_HR/symbols.qml
deleted file mode 100644
index 76c06493..00000000
--- a/src/virtualkeyboard/content/layouts/hr_HR/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_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- 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: 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/hu_HU/dialpad.fallback b/src/virtualkeyboard/content/layouts/hu_HU/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hu_HU/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/digits.fallback b/src/virtualkeyboard/content/layouts/hu_HU/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hu_HU/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml b/src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml
index a8d3b59b..caf820ae 100644
--- a/src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml
@@ -33,10 +33,10 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
KeyboardRow {
Layout.preferredHeight: 3
@@ -45,7 +45,7 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
}
}
}
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/main.qml b/src/virtualkeyboard/content/layouts/hu_HU/main.qml
index 21a513a3..0834dc04 100644
--- a/src/virtualkeyboard/content/layouts/hu_HU/main.qml
+++ b/src/virtualkeyboard/content/layouts/hu_HU/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/numbers.fallback b/src/virtualkeyboard/content/layouts/hu_HU/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hu_HU/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/symbols.fallback b/src/virtualkeyboard/content/layouts/hu_HU/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/hu_HU/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/symbols.qml b/src/virtualkeyboard/content/layouts/hu_HU/symbols.qml
deleted file mode 100644
index 76c06493..00000000
--- a/src/virtualkeyboard/content/layouts/hu_HU/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_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- 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: 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/id_ID/dialpad.fallback b/src/virtualkeyboard/content/layouts/id_ID/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/id_ID/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/digits.fallback b/src/virtualkeyboard/content/layouts/id_ID/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/id_ID/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/handwriting.fallback b/src/virtualkeyboard/content/layouts/id_ID/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/id_ID/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/main.fallback b/src/virtualkeyboard/content/layouts/id_ID/main.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/id_ID/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/numbers.fallback b/src/virtualkeyboard/content/layouts/id_ID/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/id_ID/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/symbols.fallback b/src/virtualkeyboard/content/layouts/id_ID/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/id_ID/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/dialpad.fallback b/src/virtualkeyboard/content/layouts/it_IT/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/it_IT/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/digits.fallback b/src/virtualkeyboard/content/layouts/it_IT/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/it_IT/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/handwriting.fallback b/src/virtualkeyboard/content/layouts/it_IT/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/it_IT/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/handwriting.qml b/src/virtualkeyboard/content/layouts/it_IT/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/it_IT/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/it_IT/main.qml b/src/virtualkeyboard/content/layouts/it_IT/main.qml
index c051e08f..72d7c03c 100644
--- a/src/virtualkeyboard/content/layouts/it_IT/main.qml
+++ b/src/virtualkeyboard/content/layouts/it_IT/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/it_IT/numbers.fallback b/src/virtualkeyboard/content/layouts/it_IT/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/it_IT/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/symbols.fallback b/src/virtualkeyboard/content/layouts/it_IT/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/it_IT/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/symbols.qml b/src/virtualkeyboard/content/layouts/it_IT/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/it_IT/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: "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/ja_JP/dialpad.fallback b/src/virtualkeyboard/content/layouts/ja_JP/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ja_JP/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/digits.fallback b/src/virtualkeyboard/content/layouts/ja_JP/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ja_JP/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml b/src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml
index 9fe3b191..08a74384 100644
--- a/src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
KeyboardRow {
@@ -43,9 +43,9 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.JapaneseHandwriting ? [] :
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.JapaneseHandwriting ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
}
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/main.qml b/src/virtualkeyboard/content/layouts/ja_JP/main.qml
index 2d765d36..d3fb6ae1 100644
--- a/src/virtualkeyboard/content/layouts/ja_JP/main.qml
+++ b/src/virtualkeyboard/content/layouts/ja_JP/main.qml
@@ -32,10 +32,10 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayoutLoader {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; JapaneseInputMethod {}', parent, "japaneseInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; JapaneseInputMethod {}', parent, "japaneseInputMethod")
}
sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.FullwidthLatin ? page2 : page1
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.FullwidthLatin ? page2 : page1
Component {
id: page1
KeyboardLayout {
@@ -132,16 +132,16 @@ KeyboardLayoutLoader {
InputModeKey {
enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
inputModeNameList: [
- "半角", // InputEngine.Latin
- "", // InputEngine.Numeric
- "", // InputEngine.Dialable
- "", // InputEngine.Pinyin
- "", // InputEngine.Cangjie
- "", // InputEngine.Zhuyin
- "", // InputEngine.Hangul
- "あ", // InputEngine.Hiragana
- "カ", // InputEngine.Katakana
- "全角", // InputEngine.FullwidthLatin
+ "半角", // 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 {
@@ -211,7 +211,7 @@ KeyboardLayoutLoader {
}
SpaceKey {
weight: 556
- text: InputContext.inputEngine.inputMode != InputEngine.Latin ? "\u3000" : " "
+ text: InputContext.inputEngine.inputMode != InputEngine.InputMode.Latin ? "\u3000" : " "
}
Key {
key: Qt.Key_Slash
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/numbers.fallback b/src/virtualkeyboard/content/layouts/ja_JP/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ja_JP/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/symbols.qml b/src/virtualkeyboard/content/layouts/ja_JP/symbols.qml
index bec30ada..66a4985b 100644
--- a/src/virtualkeyboard/content/layouts/ja_JP/symbols.qml
+++ b/src/virtualkeyboard/content/layouts/ja_JP/symbols.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.1
KeyboardLayoutLoader {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.1; JapaneseInputMethod {}', parent, "japaneseInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; JapaneseInputMethod {}', parent, "japaneseInputMethod")
}
sharedLayouts: ['main']
property int page
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/dialpad.fallback b/src/virtualkeyboard/content/layouts/ko_KR/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ko_KR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/digits.fallback b/src/virtualkeyboard/content/layouts/ko_KR/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ko_KR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml b/src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml
index 58fb566b..563239a4 100644
--- a/src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
inputMode: preferredInputMode()
@@ -50,7 +50,7 @@ KeyboardLayout {
function preferredInputMode() {
return InputContext.inputMethodHints &
(Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
- Qt.ImhLatinOnly) ? InputEngine.Latin : InputEngine.KoreanHandwriting
+ Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.KoreanHandwriting
}
KeyboardRow {
@@ -60,9 +60,9 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.KoreanHandwriting ? [] :
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.KoreanHandwriting ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
}
@@ -78,7 +78,7 @@ KeyboardLayout {
}
KeyboardRow {
ShiftKey {
- enabled: InputContext.inputEngine.inputMode !== InputEngine.KoreanHandwriting
+ enabled: InputContext.inputEngine.inputMode !== InputEngine.InputMode.KoreanHandwriting
}
}
}
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/main.qml b/src/virtualkeyboard/content/layouts/ko_KR/main.qml
index 525a0392..54e6ec57 100644
--- a/src/virtualkeyboard/content/layouts/ko_KR/main.qml
+++ b/src/virtualkeyboard/content/layouts/ko_KR/main.qml
@@ -32,9 +32,9 @@ import QtQuick.VirtualKeyboard 2.1
KeyboardLayoutLoader {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.1; HangulInputMethod {}', parent, "hangulInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; HangulInputMethod {}', parent, "hangulInputMethod")
}
- sourceComponent: InputContext.shift ? page2 : page1
+ sourceComponent: InputContext.shiftActive ? page2 : page1
sharedLayouts: ['symbols']
Component {
id: page1
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/numbers.fallback b/src/virtualkeyboard/content/layouts/ko_KR/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ko_KR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/symbols.qml b/src/virtualkeyboard/content/layouts/ko_KR/symbols.qml
index 201810ec..352a69e1 100644
--- a/src/virtualkeyboard/content/layouts/ko_KR/symbols.qml
+++ b/src/virtualkeyboard/content/layouts/ko_KR/symbols.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.1
KeyboardLayoutLoader {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.1; HangulInputMethod {}', parent, "hangulInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; HangulInputMethod {}', parent, "hangulInputMethod")
}
sharedLayouts: ['main']
property bool secondPage
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/dialpad.fallback b/src/virtualkeyboard/content/layouts/ms_MY/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ms_MY/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/digits.fallback b/src/virtualkeyboard/content/layouts/ms_MY/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ms_MY/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/handwriting.fallback b/src/virtualkeyboard/content/layouts/ms_MY/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ms_MY/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/main.fallback b/src/virtualkeyboard/content/layouts/ms_MY/main.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ms_MY/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/numbers.fallback b/src/virtualkeyboard/content/layouts/ms_MY/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ms_MY/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/symbols.fallback b/src/virtualkeyboard/content/layouts/ms_MY/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ms_MY/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/dialpad.fallback b/src/virtualkeyboard/content/layouts/nb_NO/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nb_NO/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/digits.fallback b/src/virtualkeyboard/content/layouts/nb_NO/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nb_NO/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/handwriting.fallback b/src/virtualkeyboard/content/layouts/nb_NO/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nb_NO/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/handwriting.qml b/src/virtualkeyboard/content/layouts/nb_NO/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/nb_NO/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/nb_NO/main.qml b/src/virtualkeyboard/content/layouts/nb_NO/main.qml
index 647f88e0..8580045b 100644
--- a/src/virtualkeyboard/content/layouts/nb_NO/main.qml
+++ b/src/virtualkeyboard/content/layouts/nb_NO/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/numbers.fallback b/src/virtualkeyboard/content/layouts/nb_NO/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nb_NO/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/symbols.fallback b/src/virtualkeyboard/content/layouts/nb_NO/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nb_NO/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/symbols.qml b/src/virtualkeyboard/content/layouts/nb_NO/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/nb_NO/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: "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/nl_NL/dialpad.fallback b/src/virtualkeyboard/content/layouts/nl_NL/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nl_NL/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/digits.fallback b/src/virtualkeyboard/content/layouts/nl_NL/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nl_NL/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/handwriting.fallback b/src/virtualkeyboard/content/layouts/nl_NL/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nl_NL/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/handwriting.qml b/src/virtualkeyboard/content/layouts/nl_NL/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/nl_NL/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/nl_NL/main.fallback b/src/virtualkeyboard/content/layouts/nl_NL/main.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nl_NL/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/main.qml b/src/virtualkeyboard/content/layouts/nl_NL/main.qml
deleted file mode 100644
index 1deb766a..00000000
--- a/src/virtualkeyboard/content/layouts/nl_NL/main.qml
+++ /dev/null
@@ -1,199 +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.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: "yijÿýŷ"
- }
- 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/nl_NL/numbers.fallback b/src/virtualkeyboard/content/layouts/nl_NL/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nl_NL/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/symbols.fallback b/src/virtualkeyboard/content/layouts/nl_NL/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/nl_NL/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/symbols.qml b/src/virtualkeyboard/content/layouts/nl_NL/symbols.qml
deleted file mode 100644
index 49f6e709..00000000
--- a/src/virtualkeyboard/content/layouts/nl_NL/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.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: "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/pl_PL/dialpad.fallback b/src/virtualkeyboard/content/layouts/pl_PL/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pl_PL/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/digits.fallback b/src/virtualkeyboard/content/layouts/pl_PL/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pl_PL/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/handwriting.fallback b/src/virtualkeyboard/content/layouts/pl_PL/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pl_PL/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/handwriting.qml b/src/virtualkeyboard/content/layouts/pl_PL/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/pl_PL/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/pl_PL/main.qml b/src/virtualkeyboard/content/layouts/pl_PL/main.qml
index 72a7b89d..2a7ebfd0 100644
--- a/src/virtualkeyboard/content/layouts/pl_PL/main.qml
+++ b/src/virtualkeyboard/content/layouts/pl_PL/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/numbers.fallback b/src/virtualkeyboard/content/layouts/pl_PL/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pl_PL/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/symbols.fallback b/src/virtualkeyboard/content/layouts/pl_PL/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pl_PL/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/symbols.qml b/src/virtualkeyboard/content/layouts/pl_PL/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/pl_PL/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: "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/pt_BR/dialpad.fallback b/src/virtualkeyboard/content/layouts/pt_BR/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_BR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/digits.fallback b/src/virtualkeyboard/content/layouts/pt_BR/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_BR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/handwriting.fallback b/src/virtualkeyboard/content/layouts/pt_BR/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_BR/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/main.qml b/src/virtualkeyboard/content/layouts/pt_BR/main.qml
new file mode 100644
index 00000000..53ed462f
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_BR/main.qml
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** 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_BR/numbers.fallback b/src/virtualkeyboard/content/layouts/pt_BR/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_BR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/symbols.fallback b/src/virtualkeyboard/content/layouts/pt_BR/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_BR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/dialpad.fallback b/src/virtualkeyboard/content/layouts/pt_PT/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_PT/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/digits.fallback b/src/virtualkeyboard/content/layouts/pt_PT/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_PT/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/handwriting.fallback b/src/virtualkeyboard/content/layouts/pt_PT/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_PT/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/handwriting.qml b/src/virtualkeyboard/content/layouts/pt_PT/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/pt_PT/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/pt_PT/main.qml b/src/virtualkeyboard/content/layouts/pt_PT/main.qml
index 21cbf640..53ed462f 100644
--- a/src/virtualkeyboard/content/layouts/pt_PT/main.qml
+++ b/src/virtualkeyboard/content/layouts/pt_PT/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/numbers.fallback b/src/virtualkeyboard/content/layouts/pt_PT/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_PT/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/symbols.fallback b/src/virtualkeyboard/content/layouts/pt_PT/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/pt_PT/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/symbols.qml b/src/virtualkeyboard/content/layouts/pt_PT/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/pt_PT/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: "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/ro_RO/dialpad.fallback b/src/virtualkeyboard/content/layouts/ro_RO/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ro_RO/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/digits.fallback b/src/virtualkeyboard/content/layouts/ro_RO/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ro_RO/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml b/src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml
index 7826b542..1d5dedb9 100644
--- a/src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml
@@ -33,10 +33,10 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
KeyboardRow {
Layout.preferredHeight: 3
@@ -45,7 +45,7 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
}
}
}
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/main.qml b/src/virtualkeyboard/content/layouts/ro_RO/main.qml
index 3524e572..ea3865eb 100644
--- a/src/virtualkeyboard/content/layouts/ro_RO/main.qml
+++ b/src/virtualkeyboard/content/layouts/ro_RO/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/numbers.fallback b/src/virtualkeyboard/content/layouts/ro_RO/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ro_RO/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/symbols.fallback b/src/virtualkeyboard/content/layouts/ro_RO/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ro_RO/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/symbols.qml b/src/virtualkeyboard/content/layouts/ro_RO/symbols.qml
deleted file mode 100644
index 0196a478..00000000
--- a/src/virtualkeyboard/content/layouts/ro_RO/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_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- 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: 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/ru_RU/dialpad.fallback b/src/virtualkeyboard/content/layouts/ru_RU/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ru_RU/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/digits.fallback b/src/virtualkeyboard/content/layouts/ru_RU/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ru_RU/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/handwriting.fallback b/src/virtualkeyboard/content/layouts/ru_RU/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ru_RU/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/handwriting.qml b/src/virtualkeyboard/content/layouts/ru_RU/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/ru_RU/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/ru_RU/main.qml b/src/virtualkeyboard/content/layouts/ru_RU/main.qml
index 435a4757..87eb2382 100644
--- a/src/virtualkeyboard/content/layouts/ru_RU/main.qml
+++ b/src/virtualkeyboard/content/layouts/ru_RU/main.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -27,188 +27,368 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick 2.10
+import QtQuick.VirtualKeyboard 2.3
-KeyboardLayout {
- inputMode: InputEngine.Latin
- 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
+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
+ }
+ }
}
}
- 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 {
- 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: "ю"
- }
- 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/ru_RU/numbers.fallback b/src/virtualkeyboard/content/layouts/ru_RU/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ru_RU/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/symbols.fallback b/src/virtualkeyboard/content/layouts/ru_RU/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/ru_RU/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/symbols.qml b/src/virtualkeyboard/content/layouts/ru_RU/symbols.qml
deleted file mode 100644
index 43b4d088..00000000
--- a/src/virtualkeyboard/content/layouts/ru_RU/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/sk_SK/dialpad.fallback b/src/virtualkeyboard/content/layouts/sk_SK/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sk_SK/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/digits.fallback b/src/virtualkeyboard/content/layouts/sk_SK/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sk_SK/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/handwriting.fallback b/src/virtualkeyboard/content/layouts/sk_SK/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sk_SK/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/main.qml b/src/virtualkeyboard/content/layouts/sk_SK/main.qml
new file mode 100644
index 00000000..1f739d31
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sk_SK/main.qml
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** 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/sk_SK/numbers.fallback b/src/virtualkeyboard/content/layouts/sk_SK/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sk_SK/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/symbols.fallback b/src/virtualkeyboard/content/layouts/sk_SK/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sk_SK/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/dialpad.fallback b/src/virtualkeyboard/content/layouts/sl_SI/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sl_SI/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/digits.fallback b/src/virtualkeyboard/content/layouts/sl_SI/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sl_SI/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/handwriting.fallback b/src/virtualkeyboard/content/layouts/sl_SI/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sl_SI/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/main.qml b/src/virtualkeyboard/content/layouts/sl_SI/main.qml
new file mode 100644
index 00000000..76293626
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sl_SI/main.qml
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** 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/sl_SI/numbers.fallback b/src/virtualkeyboard/content/layouts/sl_SI/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sl_SI/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/symbols.fallback b/src/virtualkeyboard/content/layouts/sl_SI/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sl_SI/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/dialpad.fallback b/src/virtualkeyboard/content/layouts/sq_AL/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sq_AL/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/digits.fallback b/src/virtualkeyboard/content/layouts/sq_AL/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sq_AL/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/handwriting.fallback b/src/virtualkeyboard/content/layouts/sq_AL/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sq_AL/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/main.qml b/src/virtualkeyboard/content/layouts/sq_AL/main.qml
new file mode 100644
index 00000000..4b50e883
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sq_AL/main.qml
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** 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/sq_AL/numbers.fallback b/src/virtualkeyboard/content/layouts/sq_AL/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sq_AL/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/symbols.fallback b/src/virtualkeyboard/content/layouts/sq_AL/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sq_AL/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/dialpad.fallback b/src/virtualkeyboard/content/layouts/sr_SP/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sr_SP/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/digits.fallback b/src/virtualkeyboard/content/layouts/sr_SP/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sr_SP/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml b/src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml
index 7781e455..6f9cbb98 100644
--- a/src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
@@ -44,9 +44,9 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.Cyrillic ? [] :
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Cyrillic ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
}
}
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/main.qml b/src/virtualkeyboard/content/layouts/sr_SP/main.qml
index d739e79c..acd381ae 100644
--- a/src/virtualkeyboard/content/layouts/sr_SP/main.qml
+++ b/src/virtualkeyboard/content/layouts/sr_SP/main.qml
@@ -32,7 +32,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayoutLoader {
sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.Cyrillic ? cyrillicLayout : latinLayout
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? cyrillicLayout : latinLayout
Component {
id: cyrillicLayout
KeyboardLayout {
@@ -117,7 +117,7 @@ KeyboardLayoutLoader {
KeyboardRow {
keyWeight: 156
InputModeKey {
- inputModes: [InputEngine.Cyrillic, InputEngine.Latin]
+ inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
}
Key {
text: "ѕ"
@@ -287,7 +287,7 @@ KeyboardLayoutLoader {
KeyboardRow {
keyWeight: 156
InputModeKey {
- inputModes: [InputEngine.Cyrillic, InputEngine.Latin]
+ inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
}
Key {
key: Qt.Key_Y
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/numbers.fallback b/src/virtualkeyboard/content/layouts/sr_SP/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sr_SP/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/symbols.fallback b/src/virtualkeyboard/content/layouts/sr_SP/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sr_SP/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/symbols.qml b/src/virtualkeyboard/content/layouts/sr_SP/symbols.qml
deleted file mode 100644
index 42f8f3b6..00000000
--- a/src/virtualkeyboard/content/layouts/sr_SP/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_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- 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.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.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/sv_SE/dialpad.fallback b/src/virtualkeyboard/content/layouts/sv_SE/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sv_SE/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/digits.fallback b/src/virtualkeyboard/content/layouts/sv_SE/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sv_SE/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/handwriting.fallback b/src/virtualkeyboard/content/layouts/sv_SE/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sv_SE/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/handwriting.qml b/src/virtualkeyboard/content/layouts/sv_SE/handwriting.qml
deleted file mode 100644
index d42de535..00000000
--- a/src/virtualkeyboard/content/layouts/sv_SE/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 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
- }
- }
- }
- 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/sv_SE/main.qml b/src/virtualkeyboard/content/layouts/sv_SE/main.qml
index b90a43cf..a3a8a86f 100644
--- a/src/virtualkeyboard/content/layouts/sv_SE/main.qml
+++ b/src/virtualkeyboard/content/layouts/sv_SE/main.qml
@@ -31,7 +31,7 @@ import QtQuick 2.0
import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
keyWeight: 160
KeyboardRow {
Key {
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/numbers.fallback b/src/virtualkeyboard/content/layouts/sv_SE/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sv_SE/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/symbols.fallback b/src/virtualkeyboard/content/layouts/sv_SE/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/sv_SE/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/symbols.qml b/src/virtualkeyboard/content/layouts/sv_SE/symbols.qml
deleted file mode 100644
index 06d815d8..00000000
--- a/src/virtualkeyboard/content/layouts/sv_SE/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: "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/th_TH/dialpad.fallback b/src/virtualkeyboard/content/layouts/th_TH/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/th_TH/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/th_TH/digits.fallback b/src/virtualkeyboard/content/layouts/th_TH/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/th_TH/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/th_TH/handwriting.fallback b/src/virtualkeyboard/content/layouts/th_TH/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/th_TH/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/th_TH/main.qml b/src/virtualkeyboard/content/layouts/th_TH/main.qml
new file mode 100644
index 00000000..60a8ebc0
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/th_TH/main.qml
@@ -0,0 +1,489 @@
+/****************************************************************************
+**
+** 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/numbers.fallback b/src/virtualkeyboard/content/layouts/th_TH/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/th_TH/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/th_TH/symbols.qml b/src/virtualkeyboard/content/layouts/th_TH/symbols.qml
new file mode 100644
index 00000000..53fdcd6e
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/th_TH/symbols.qml
@@ -0,0 +1,376 @@
+/****************************************************************************
+**
+** 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/dialpad.fallback b/src/virtualkeyboard/content/layouts/tr_TR/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/tr_TR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/digits.fallback b/src/virtualkeyboard/content/layouts/tr_TR/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/tr_TR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/handwriting.fallback b/src/virtualkeyboard/content/layouts/tr_TR/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/tr_TR/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/main.qml b/src/virtualkeyboard/content/layouts/tr_TR/main.qml
new file mode 100644
index 00000000..31bf0dc1
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/tr_TR/main.qml
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** 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/tr_TR/numbers.fallback b/src/virtualkeyboard/content/layouts/tr_TR/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/tr_TR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/symbols.fallback b/src/virtualkeyboard/content/layouts/tr_TR/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/tr_TR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/dialpad.fallback b/src/virtualkeyboard/content/layouts/uk_UA/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/uk_UA/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/digits.fallback b/src/virtualkeyboard/content/layouts/uk_UA/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/uk_UA/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/handwriting.fallback b/src/virtualkeyboard/content/layouts/uk_UA/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/uk_UA/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/main.qml b/src/virtualkeyboard/content/layouts/uk_UA/main.qml
new file mode 100644
index 00000000..c2731452
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/uk_UA/main.qml
@@ -0,0 +1,373 @@
+/****************************************************************************
+**
+** 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/uk_UA/numbers.fallback b/src/virtualkeyboard/content/layouts/uk_UA/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/uk_UA/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/symbols.fallback b/src/virtualkeyboard/content/layouts/uk_UA/symbols.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/uk_UA/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/dialpad.fallback b/src/virtualkeyboard/content/layouts/vi_VN/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/vi_VN/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/digits.fallback b/src/virtualkeyboard/content/layouts/vi_VN/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/vi_VN/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/handwriting.fallback b/src/virtualkeyboard/content/layouts/vi_VN/handwriting.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/vi_VN/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/main.qml b/src/virtualkeyboard/content/layouts/vi_VN/main.qml
new file mode 100644
index 00000000..9a5c7e37
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/vi_VN/main.qml
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** 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/numbers.fallback b/src/virtualkeyboard/content/layouts/vi_VN/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/vi_VN/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/symbols.qml b/src/virtualkeyboard/content/layouts/vi_VN/symbols.qml
new file mode 100644
index 00000000..da5281b3
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/vi_VN/symbols.qml
@@ -0,0 +1,376 @@
+/****************************************************************************
+**
+** 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/dialpad.fallback b/src/virtualkeyboard/content/layouts/zh_CN/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/zh_CN/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/digits.fallback b/src/virtualkeyboard/content/layouts/zh_CN/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/zh_CN/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml b/src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml
index 598980d1..fee04320 100644
--- a/src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
inputMode: preferredInputMode()
@@ -50,7 +50,7 @@ KeyboardLayout {
function preferredInputMode() {
return InputContext.inputMethodHints &
(Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
- Qt.ImhLatinOnly) ? InputEngine.Latin : InputEngine.ChineseHandwriting
+ Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.ChineseHandwriting
}
KeyboardRow {
@@ -60,9 +60,9 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.ChineseHandwriting ? [] :
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.ChineseHandwriting ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
}
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/main.qml b/src/virtualkeyboard/content/layouts/zh_CN/main.qml
index 44b0ceb7..349a14c8 100644
--- a/src/virtualkeyboard/content/layouts/zh_CN/main.qml
+++ b/src/virtualkeyboard/content/layouts/zh_CN/main.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.1; PinyinInputMethod {}', parent, "pinyinInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; PinyinInputMethod {}', parent, "pinyinInputMethod")
}
sharedLayouts: ['symbols']
keyWeight: 160
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/numbers.fallback b/src/virtualkeyboard/content/layouts/zh_CN/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/zh_CN/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/symbols.qml b/src/virtualkeyboard/content/layouts/zh_CN/symbols.qml
index 0133387b..4ad06baf 100644
--- a/src/virtualkeyboard/content/layouts/zh_CN/symbols.qml
+++ b/src/virtualkeyboard/content/layouts/zh_CN/symbols.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.1
KeyboardLayoutLoader {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.1; PinyinInputMethod {}', parent, "pinyinInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; PinyinInputMethod {}', parent, "pinyinInputMethod")
}
sharedLayouts: ['main']
property int page
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/dialpad.fallback b/src/virtualkeyboard/content/layouts/zh_TW/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/zh_TW/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/digits.fallback b/src/virtualkeyboard/content/layouts/zh_TW/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/zh_TW/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml b/src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml
index 598980d1..fee04320 100644
--- a/src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml
+++ b/src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayout {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; HandwritingInputMethod {}', parent)
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
}
sharedLayouts: ['symbols']
inputMode: preferredInputMode()
@@ -50,7 +50,7 @@ KeyboardLayout {
function preferredInputMode() {
return InputContext.inputMethodHints &
(Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
- Qt.ImhLatinOnly) ? InputEngine.Latin : InputEngine.ChineseHandwriting
+ Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.ChineseHandwriting
}
KeyboardRow {
@@ -60,9 +60,9 @@ KeyboardLayout {
KeyboardRow {
TraceInputKey {
objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.HandwritingRecoginition
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.ChineseHandwriting ? [] :
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.ChineseHandwriting ? [] :
[Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
}
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/main.qml b/src/virtualkeyboard/content/layouts/zh_TW/main.qml
index 7c5728c7..bd9c1451 100644
--- a/src/virtualkeyboard/content/layouts/zh_TW/main.qml
+++ b/src/virtualkeyboard/content/layouts/zh_TW/main.qml
@@ -33,10 +33,10 @@ import QtQuick.VirtualKeyboard 2.3
KeyboardLayoutLoader {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.3; TCInputMethod {}', parent, "tcInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; TCInputMethod {}', parent, "tcInputMethod")
}
sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.Cangjie ? pageCangjie : pageZhuyin
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cangjie ? pageCangjie : pageZhuyin
Component {
id: pageCangjie
KeyboardLayout {
@@ -201,7 +201,7 @@ KeyboardLayoutLoader {
weight: 154
}
InputModeKey {
- visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.Zhuyin) !== -1
+ visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.InputMode.Zhuyin) !== -1
}
SpaceKey {
weight: 864
@@ -429,7 +429,7 @@ KeyboardLayoutLoader {
weight: 154
}
InputModeKey {
- visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.Cangjie) !== -1
+ visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.InputMode.Cangjie) !== -1
}
SpaceKey {
weight: 864
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/numbers.fallback b/src/virtualkeyboard/content/layouts/zh_TW/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/virtualkeyboard/content/layouts/zh_TW/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/symbols.qml b/src/virtualkeyboard/content/layouts/zh_TW/symbols.qml
index 60d63e3a..3d43ae69 100644
--- a/src/virtualkeyboard/content/layouts/zh_TW/symbols.qml
+++ b/src/virtualkeyboard/content/layouts/zh_TW/symbols.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard 2.1
KeyboardLayoutLoader {
function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.1; TCInputMethod {}', parent, "tcInputMethod")
+ return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; TCInputMethod {}', parent, "tcInputMethod")
}
sharedLayouts: ['main']
property int page
diff --git a/src/virtualkeyboard/content/styles/default/style.qml b/src/virtualkeyboard/content/styles/default/style.qml
index d4b6c119..d561ac28 100644
--- a/src/virtualkeyboard/content/styles/default/style.qml
+++ b/src/virtualkeyboard/content/styles/default/style.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard.Styles 2.1
KeyboardStyle {
id: currentStyle
- readonly property bool compactSelectionList: [InputEngine.Pinyin, InputEngine.Cangjie, InputEngine.Zhuyin].indexOf(InputContext.inputEngine.inputMode) !== -1
+ 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)
@@ -382,8 +382,8 @@ KeyboardStyle {
}
states: [
State {
- name: "capslock"
- when: InputContext.capsLock
+ name: "capsLockActive"
+ when: InputContext.capsLockActive
PropertyChanges {
target: shiftKeyBackground
color: "#5a892e"
@@ -394,8 +394,8 @@ KeyboardStyle {
}
},
State {
- name: "shift"
- when: InputContext.shift
+ name: "shiftActive"
+ when: InputContext.shiftActive
PropertyChanges {
target: shiftKeyIcon
source: resourcePrefix + "images/shift-80c342.svg"
@@ -767,30 +767,30 @@ KeyboardStyle {
anchors.margins: keyBackgroundMargin
Text {
id: hwrInputModeIndicator
- visible: control.patternRecognitionMode === InputEngine.HandwritingRecoginition
+ visible: control.patternRecognitionMode === InputEngine.PatternRecognitionMode.Handwriting
text: {
switch (InputContext.inputEngine.inputMode) {
- case InputEngine.Numeric:
+ case InputEngine.InputMode.Numeric:
if (["ar", "fa"].indexOf(InputContext.locale.substring(0, 2)) !== -1)
return "\u0660\u0661\u0662"
// Fallthrough
- case InputEngine.Dialable:
+ case InputEngine.InputMode.Dialable:
return "123"
- case InputEngine.Greek:
+ case InputEngine.InputMode.Greek:
return "ΑΒΓ"
- case InputEngine.Cyrillic:
+ case InputEngine.InputMode.Cyrillic:
return "АБВ"
- case InputEngine.Arabic:
+ 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.Hebrew:
+ case InputEngine.InputMode.Hebrew:
return "\u05D0\u05D1\u05D2"
- case InputEngine.ChineseHandwriting:
+ case InputEngine.InputMode.ChineseHandwriting:
return "中文"
- case InputEngine.JapaneseHandwriting:
+ case InputEngine.InputMode.JapaneseHandwriting:
return "日本語"
- case InputEngine.KoreanHandwriting:
+ case InputEngine.InputMode.KoreanHandwriting:
return "한국어"
default:
return "Abc"
@@ -805,9 +805,9 @@ KeyboardStyle {
weight: Font.Normal
pixelSize: 44 * scaleHint
capitalization: {
- if (InputContext.capsLock)
+ if (InputContext.capsLockActive)
return Font.AllUppercase
- if (InputContext.shift)
+ if (InputContext.shiftActive)
return Font.MixedCase
return Font.AllLowercase
}
diff --git a/src/virtualkeyboard/content/styles/default/default_style.qrc b/src/virtualkeyboard/content/styles/default/virtualkeyboard_default_style.qrc
index 277e8cde..277e8cde 100644
--- a/src/virtualkeyboard/content/styles/default/default_style.qrc
+++ b/src/virtualkeyboard/content/styles/default/virtualkeyboard_default_style.qrc
diff --git a/src/virtualkeyboard/content/styles/retro/style.qml b/src/virtualkeyboard/content/styles/retro/style.qml
index 53d09399..eb640783 100644
--- a/src/virtualkeyboard/content/styles/retro/style.qml
+++ b/src/virtualkeyboard/content/styles/retro/style.qml
@@ -33,7 +33,7 @@ import QtQuick.VirtualKeyboard.Styles 2.1
KeyboardStyle {
id: currentStyle
- readonly property bool compactSelectionList: [InputEngine.Pinyin, InputEngine.Cangjie, InputEngine.Zhuyin].indexOf(InputContext.inputEngine.inputMode) !== -1
+ 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)
@@ -420,8 +420,8 @@ KeyboardStyle {
scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
states: [
State {
- name: "capslock"
- when: InputContext.capsLock
+ name: "capsLockActive"
+ when: InputContext.capsLockActive
PropertyChanges {
target: shiftKeyBackground
source: resourcePrefix + "images/key154px_capslock.png"
@@ -432,8 +432,8 @@ KeyboardStyle {
}
},
State {
- name: "shift"
- when: InputContext.shift
+ name: "shiftActive"
+ when: InputContext.shiftActive
PropertyChanges {
target: shiftKeyBackground
source: resourcePrefix + "images/key154px_shiftcase.png"
@@ -880,30 +880,30 @@ KeyboardStyle {
}
Text {
id: hwrInputModeIndicator
- visible: control.patternRecognitionMode === InputEngine.HandwritingRecoginition
+ visible: control.patternRecognitionMode === InputEngine.PatternRecognitionMode.Handwriting
text: {
switch (InputContext.inputEngine.inputMode) {
- case InputEngine.Numeric:
+ case InputEngine.InputMode.Numeric:
if (["ar", "fa"].indexOf(InputContext.locale.substring(0, 2)) !== -1)
return "\u0660\u0661\u0662"
// Fallthrough
- case InputEngine.Dialable:
+ case InputEngine.InputMode.Dialable:
return "123"
- case InputEngine.Greek:
+ case InputEngine.InputMode.Greek:
return "ΑΒΓ"
- case InputEngine.Cyrillic:
+ case InputEngine.InputMode.Cyrillic:
return "АБВ"
- case InputEngine.Arabic:
+ 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.Hebrew:
+ case InputEngine.InputMode.Hebrew:
return "\u05D0\u05D1\u05D2"
- case InputEngine.ChineseHandwriting:
+ case InputEngine.InputMode.ChineseHandwriting:
return "中文"
- case InputEngine.JapaneseHandwriting:
+ case InputEngine.InputMode.JapaneseHandwriting:
return "日本語"
- case InputEngine.KoreanHandwriting:
+ case InputEngine.InputMode.KoreanHandwriting:
return "한국어"
default:
return "Abc"
@@ -918,9 +918,9 @@ KeyboardStyle {
weight: Font.Bold
pixelSize: 72 * scaleHint
capitalization: {
- if (InputContext.capsLock)
+ if (InputContext.capsLockActive)
return Font.AllUppercase
- if (InputContext.shift)
+ if (InputContext.shiftActive)
return Font.MixedCase
return Font.AllLowercase
}
diff --git a/src/virtualkeyboard/content/styles/retro/retro_style.qrc b/src/virtualkeyboard/content/styles/retro/virtualkeyboard_retro_style.qrc
index 881755ef..881755ef 100644
--- a/src/virtualkeyboard/content/styles/retro/retro_style.qrc
+++ b/src/virtualkeyboard/content/styles/retro/virtualkeyboard_retro_style.qrc
diff --git a/src/virtualkeyboard/content/virtualkeyboard_content.qrc b/src/virtualkeyboard/content/virtualkeyboard_content.qrc
new file mode 100644
index 00000000..1e6392f4
--- /dev/null
+++ b/src/virtualkeyboard/content/virtualkeyboard_content.qrc
@@ -0,0 +1,35 @@
+<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/defaultinputmethod.cpp b/src/virtualkeyboard/defaultinputmethod.cpp
deleted file mode 100644
index 4d1aa280..00000000
--- a/src/virtualkeyboard/defaultinputmethod.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include "defaultinputmethod.h"
-#include "inputcontext.h"
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::DefaultInputMethod
- \internal
-*/
-
-DefaultInputMethod::DefaultInputMethod(QObject *parent) :
- AbstractInputMethod(parent)
-{
-}
-
-QList<InputEngine::InputMode> DefaultInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale)
- return QList<InputEngine::InputMode>();
-}
-
-bool DefaultInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale)
- Q_UNUSED(inputMode)
- return true;
-}
-
-bool DefaultInputMethod::setTextCase(InputEngine::TextCase textCase)
-{
- Q_UNUSED(textCase)
- return true;
-}
-
-bool DefaultInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- const Qt::KeyboardModifiers mods = (key == Qt::Key_Return) ? Qt::NoModifier : modifiers;
- inputContext()->sendKeyClick(key, text, mods);
- return true;
-}
-
-void DefaultInputMethod::reset()
-{
-}
-
-void DefaultInputMethod::update()
-{
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/defaultinputmethod.h b/src/virtualkeyboard/defaultinputmethod.h
deleted file mode 100644
index 5a26bd4e..00000000
--- a/src/virtualkeyboard/defaultinputmethod.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef DEFAULTINPUTMETHOD_H
-#define DEFAULTINPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-class DefaultInputMethod : public AbstractInputMethod
-{
- Q_OBJECT
-
-public:
- explicit DefaultInputMethod(QObject *parent = 0);
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- void reset();
- void update();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // DEFAULTINPUTMETHOD_H
diff --git a/src/virtualkeyboard/desktopinputpanel.cpp b/src/virtualkeyboard/desktopinputpanel.cpp
index e9a8836a..aee0f100 100644
--- a/src/virtualkeyboard/desktopinputpanel.cpp
+++ b/src/virtualkeyboard/desktopinputpanel.cpp
@@ -27,14 +27,16 @@
**
****************************************************************************/
-#include "desktopinputpanel.h"
-#include "inputview.h"
-#include "platforminputcontext.h"
-#include "inputcontext.h"
+#include <QtVirtualKeyboard/private/desktopinputpanel_p.h>
+#include <QtVirtualKeyboard/private/appinputpanel_p_p.h>
+#include <QtVirtualKeyboard/private/inputview_p.h>
+#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
#include <QGuiApplication>
#include <QQmlEngine>
#include <QScreen>
-#include "virtualkeyboarddebug.h"
+#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
#if defined(QT_VIRTUALKEYBOARD_HAVE_XCB)
#include <xcb/xcb.h>
#include <xcb/xfixes.h>
@@ -43,6 +45,7 @@
#include <QtCore/private/qobject_p.h>
#include <QtCore/QLibraryInfo>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
class DesktopInputPanelPrivate : public AppInputPanelPrivate
@@ -151,7 +154,7 @@ void DesktopInputPanel::createView()
break;
}
d->view->setColor(QColor(Qt::transparent));
- d->view->setSource(QUrl("qrc:///QtQuick/VirtualKeyboard/content/InputPanel.qml"));
+ d->view->setSource(QUrl(QLatin1String("qrc:///QtQuick/VirtualKeyboard/content/InputPanel.qml")));
if (QGuiApplication *app = qGuiApp)
connect(app, SIGNAL(aboutToQuit()), SLOT(destroyView()));
}
@@ -169,12 +172,13 @@ void DesktopInputPanel::repositionView(const QRect &rect)
Q_D(DesktopInputPanel);
VIRTUALKEYBOARD_DEBUG() << "DesktopInputPanel::repositionView():" << rect;
if (d->view && d->view->geometry() != rect) {
- InputContext *inputContext = qobject_cast<PlatformInputContext *>(parent())->inputContext();
+ QVirtualKeyboardInputContext *inputContext = qobject_cast<PlatformInputContext *>(parent())->inputContext();
if (inputContext) {
inputContext->setAnimating(true);
if (!d->previewBindingActive) {
- connect(inputContext, SIGNAL(previewRectangleChanged()), SLOT(previewRectangleChanged()));
- connect(inputContext, SIGNAL(previewVisibleChanged()), SLOT(previewVisibleChanged()));
+ QVirtualKeyboardInputContextPrivate *inputContextPrivate = inputContext->priv();
+ QObject::connect(inputContextPrivate, &QVirtualKeyboardInputContextPrivate::previewRectangleChanged, this, &DesktopInputPanel::previewRectangleChanged);
+ QObject::connect(inputContextPrivate, &QVirtualKeyboardInputContextPrivate::previewVisibleChanged, this, &DesktopInputPanel::previewVisibleChanged);
d->previewBindingActive = true;
}
}
@@ -197,17 +201,17 @@ void DesktopInputPanel::focusWindowChanged(QWindow *focusWindow)
void DesktopInputPanel::focusWindowVisibleChanged(bool visible)
{
if (!visible) {
- InputContext *inputContext = qobject_cast<PlatformInputContext *>(parent())->inputContext();
+ QVirtualKeyboardInputContext *inputContext = qobject_cast<PlatformInputContext *>(parent())->inputContext();
if (inputContext)
- inputContext->hideInputPanel();
+ inputContext->priv()->hideInputPanel();
}
}
void DesktopInputPanel::previewRectangleChanged()
{
Q_D(DesktopInputPanel);
- InputContext *inputContext = qobject_cast<PlatformInputContext *>(parent())->inputContext();
- d->previewRect = inputContext->previewRectangle();
+ QVirtualKeyboardInputContext *inputContext = qobject_cast<PlatformInputContext *>(parent())->inputContext();
+ d->previewRect = inputContext->priv()->previewRectangle();
if (d->previewVisible)
updateInputRegion();
}
@@ -215,8 +219,8 @@ void DesktopInputPanel::previewRectangleChanged()
void DesktopInputPanel::previewVisibleChanged()
{
Q_D(DesktopInputPanel);
- InputContext *inputContext = qobject_cast<PlatformInputContext *>(parent())->inputContext();
- d->previewVisible = inputContext->previewVisible();
+ QVirtualKeyboardInputContext *inputContext = qobject_cast<PlatformInputContext *>(parent())->inputContext();
+ d->previewVisible = inputContext->priv()->previewVisible();
if (d->view->isVisible())
updateInputRegion();
}
@@ -277,3 +281,4 @@ void DesktopInputPanel::updateInputRegion()
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/desktopinputpanel.h b/src/virtualkeyboard/desktopinputpanel.h
deleted file mode 100644
index 0828bb64..00000000
--- a/src/virtualkeyboard/desktopinputpanel.h
+++ /dev/null
@@ -1,74 +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 DESKTOPINPUTPANEL_H
-#define DESKTOPINPUTPANEL_H
-
-#include "appinputpanel.h"
-
-QT_BEGIN_NAMESPACE
-class QWindow;
-QT_END_NAMESPACE
-
-namespace QtVirtualKeyboard {
-
-class DesktopInputPanelPrivate;
-
-class DesktopInputPanel : public AppInputPanel
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(DesktopInputPanel)
-public:
- explicit DesktopInputPanel(QObject *parent = 0);
- ~DesktopInputPanel();
-
- void show();
- void hide();
- bool isVisible() const;
-
- void setInputRect(const QRect &inputRect);
-
-public slots:
- void createView();
- void destroyView();
-
-protected slots:
- void repositionView(const QRect &rect);
- void focusWindowChanged(QWindow *focusWindow);
- void focusWindowVisibleChanged(bool visible);
- void previewRectangleChanged();
- void previewVisibleChanged();
-
-protected:
- void updateInputRegion();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // DESKTOPINPUTPANEL_H
diff --git a/src/virtualkeyboard/desktopinputpanel_p.h b/src/virtualkeyboard/desktopinputpanel_p.h
new file mode 100644
index 00000000..688a155e
--- /dev/null
+++ b/src/virtualkeyboard/desktopinputpanel_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 DESKTOPINPUTPANEL_P_H
+#define DESKTOPINPUTPANEL_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/appinputpanel_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+
+namespace QtVirtualKeyboard {
+
+class DesktopInputPanelPrivate;
+
+class QVIRTUALKEYBOARD_EXPORT DesktopInputPanel : public AppInputPanel
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(DesktopInputPanel)
+public:
+ explicit DesktopInputPanel(QObject *parent = nullptr);
+ ~DesktopInputPanel();
+
+ void show();
+ void hide();
+ bool isVisible() const;
+
+ void setInputRect(const QRect &inputRect);
+
+public slots:
+ void createView();
+ void destroyView();
+
+protected slots:
+ void repositionView(const QRect &rect);
+ void focusWindowChanged(QWindow *focusWindow);
+ void focusWindowVisibleChanged(bool visible);
+ void previewRectangleChanged();
+ void previewVisibleChanged();
+
+protected:
+ void updateInputRegion();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // DESKTOPINPUTPANEL_P_H
diff --git a/src/virtualkeyboard/desktopinputselectioncontrol.cpp b/src/virtualkeyboard/desktopinputselectioncontrol.cpp
index bb2925b5..196ab512 100644
--- a/src/virtualkeyboard/desktopinputselectioncontrol.cpp
+++ b/src/virtualkeyboard/desktopinputselectioncontrol.cpp
@@ -27,20 +27,22 @@
**
****************************************************************************/
-#include "desktopinputselectioncontrol.h"
-#include "inputcontext.h"
-#include "inputselectionhandle.h"
-#include "settings.h"
-#include "platforminputcontext.h"
+#include <QtVirtualKeyboard/private/desktopinputselectioncontrol_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
+#include <QtVirtualKeyboard/private/inputselectionhandle_p.h>
+#include <QtVirtualKeyboard/private/settings_p.h>
+#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
#include <QtCore/qpropertyanimation.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qstylehints.h>
#include <QtGui/qimagereader.h>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-DesktopInputSelectionControl::DesktopInputSelectionControl(QObject *parent, InputContext *inputContext)
+DesktopInputSelectionControl::DesktopInputSelectionControl(QObject *parent, QVirtualKeyboardInputContext *inputContext)
: QObject(parent),
m_inputContext(inputContext),
m_anchorSelectionHandle(),
@@ -54,7 +56,7 @@ DesktopInputSelectionControl::DesktopInputSelectionControl(QObject *parent, Inpu
{
QWindow *focusWindow = QGuiApplication::focusWindow();
Q_ASSERT(focusWindow);
- connect(m_inputContext, &InputContext::selectionControlVisibleChanged, this, &DesktopInputSelectionControl::updateVisibility);
+ connect(m_inputContext, &QVirtualKeyboardInputContext::selectionControlVisibleChanged, this, &DesktopInputSelectionControl::updateVisibility);
}
/*
@@ -113,7 +115,7 @@ void DesktopInputSelectionControl::updateVisibility()
}
const bool wasAnchorVisible = m_anchorHandleVisible;
const bool wasCursorVisible = m_cursorHandleVisible;
- const bool makeVisible = (m_inputContext->selectionControlVisible() || m_handleState == HandleIsMoving) && m_enabled;
+ const bool makeVisible = (m_inputContext->isSelectionControlVisible() || m_handleState == HandleIsMoving) && m_enabled;
m_anchorHandleVisible = makeVisible;
if (QWindow *focusWindow = QGuiApplication::focusWindow()) {
@@ -122,7 +124,7 @@ void DesktopInputSelectionControl::updateVisibility()
globalAnchorRectangle.moveTopLeft(tl);
m_anchorHandleVisible = m_anchorHandleVisible
&& m_inputContext->anchorRectIntersectsClipRect()
- && !(m_inputContext->keyboardRectangle().intersects(globalAnchorRectangle));
+ && !(m_inputContext->priv()->keyboardRectangle().intersects(globalAnchorRectangle));
}
if (wasAnchorVisible != m_anchorHandleVisible) {
@@ -141,7 +143,7 @@ void DesktopInputSelectionControl::updateVisibility()
globalCursorRectangle.moveTopLeft(tl);
m_cursorHandleVisible = m_cursorHandleVisible
&& m_inputContext->cursorRectIntersectsClipRect()
- && !(m_inputContext->keyboardRectangle().intersects(globalCursorRectangle));
+ && !(m_inputContext->priv()->keyboardRectangle().intersects(globalCursorRectangle));
}
@@ -200,19 +202,19 @@ void DesktopInputSelectionControl::setEnabled(bool enable)
m_enabled = enable;
QWindow *focusWindow = QGuiApplication::focusWindow();
if (enable) {
- connect(m_inputContext, &InputContext::anchorRectangleChanged, this, &DesktopInputSelectionControl::updateAnchorHandlePosition);
- connect(m_inputContext, &InputContext::cursorRectangleChanged, this, &DesktopInputSelectionControl::updateCursorHandlePosition);
- connect(m_inputContext, &InputContext::anchorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
- connect(m_inputContext, &InputContext::cursorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
+ connect(m_inputContext, &QVirtualKeyboardInputContext::anchorRectangleChanged, this, &DesktopInputSelectionControl::updateAnchorHandlePosition);
+ connect(m_inputContext, &QVirtualKeyboardInputContext::cursorRectangleChanged, this, &DesktopInputSelectionControl::updateCursorHandlePosition);
+ connect(m_inputContext, &QVirtualKeyboardInputContext::anchorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
+ connect(m_inputContext, &QVirtualKeyboardInputContext::cursorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
if (focusWindow)
focusWindow->installEventFilter(this);
} else {
if (focusWindow)
focusWindow->removeEventFilter(this);
- disconnect(m_inputContext, &InputContext::cursorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
- disconnect(m_inputContext, &InputContext::anchorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
- disconnect(m_inputContext, &InputContext::anchorRectangleChanged, this, &DesktopInputSelectionControl::updateAnchorHandlePosition);
- disconnect(m_inputContext, &InputContext::cursorRectangleChanged, this, &DesktopInputSelectionControl::updateCursorHandlePosition);
+ disconnect(m_inputContext, &QVirtualKeyboardInputContext::cursorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
+ disconnect(m_inputContext, &QVirtualKeyboardInputContext::anchorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
+ disconnect(m_inputContext, &QVirtualKeyboardInputContext::anchorRectangleChanged, this, &DesktopInputSelectionControl::updateAnchorHandlePosition);
+ disconnect(m_inputContext, &QVirtualKeyboardInputContext::cursorRectangleChanged, this, &DesktopInputSelectionControl::updateCursorHandlePosition);
}
updateVisibility();
}
@@ -323,4 +325,6 @@ bool DesktopInputSelectionControl::eventFilter(QObject *object, QEvent *event)
}
return false;
}
-} // namespace QtVirtualKeyboard
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/desktopinputselectioncontrol.h b/src/virtualkeyboard/desktopinputselectioncontrol.h
deleted file mode 100644
index 9a5ec468..00000000
--- a/src/virtualkeyboard/desktopinputselectioncontrol.h
+++ /dev/null
@@ -1,101 +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 DESKTOPINPUTSELECTIONCONTROL_H
-#define DESKTOPINPUTSELECTIONCONTROL_H
-
-#include <QtCore/qpointer.h>
-#include <QtCore/qobject.h>
-#include <QtGui/qimage.h>
-
-QT_BEGIN_NAMESPACE
-class QMouseEvent;
-QT_END_NAMESPACE
-
-namespace QtVirtualKeyboard {
-class InputContext;
-class InputSelectionHandle;
-
-class DesktopInputSelectionControl : public QObject
-{
- Q_OBJECT
-
-public:
- DesktopInputSelectionControl(QObject *parent, InputContext *inputContext);
- ~DesktopInputSelectionControl() {}
-
- void createHandles();
- void destroyHandles();
- void setEnabled(bool enable);
- QImage *handleImage();
-
-public Q_SLOTS:
- void updateAnchorHandlePosition();
- void updateCursorHandlePosition();
- void updateVisibility();
- void reloadGraphics();
-protected:
- bool eventFilter(QObject *object, QEvent *event);
-
-private:
- QRect anchorHandleRect() const;
- QRect cursorHandleRect() const;
- QRect handleRectForCursorRect(const QRectF &cursorRect) const;
-
-private:
- InputContext *m_inputContext;
- QSharedPointer<InputSelectionHandle> m_anchorSelectionHandle;
- QSharedPointer<InputSelectionHandle> m_cursorSelectionHandle;
- QImage m_handleImage;
-
- enum {
- HandleIsReleased = 0,
- HandleIsHeld = 1,
- HandleIsMoving = 2
- };
- enum HandleType {
- AnchorHandle = 0,
- CursorHandle = 1
- };
-
- unsigned m_handleState : 2;
- unsigned m_currentDragHandle : 1;
- unsigned m_enabled : 1;
- unsigned m_anchorHandleVisible : 1;
- unsigned m_cursorHandleVisible : 1;
- unsigned m_eventFilterEnabled : 1;
- QPoint m_otherSelectionPoint;
- QVector <QMouseEvent*> m_eventQueue;
- QPoint m_distanceBetweenMouseAndCursor;
- QPoint m_handleDragStartedPosition;
- QSize m_handleWindowSize;
-};
-} // namespace QtVirtualKeyboard
-
-#endif // DESKTOPINPUTSELECTIONCONTROL_H
diff --git a/src/virtualkeyboard/desktopinputselectioncontrol_p.h b/src/virtualkeyboard/desktopinputselectioncontrol_p.h
new file mode 100644
index 00000000..c9f81c0e
--- /dev/null
+++ b/src/virtualkeyboard/desktopinputselectioncontrol_p.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** 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 DESKTOPINPUTSELECTIONCONTROL_P_H
+#define DESKTOPINPUTSELECTIONCONTROL_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/qpointer.h>
+#include <QtCore/qobject.h>
+#include <QtGui/qimage.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+class QMouseEvent;
+class QVirtualKeyboardInputContext;
+
+namespace QtVirtualKeyboard {
+
+class InputSelectionHandle;
+
+class QVIRTUALKEYBOARD_EXPORT DesktopInputSelectionControl : public QObject
+{
+ Q_OBJECT
+
+public:
+ DesktopInputSelectionControl(QObject *parent, QVirtualKeyboardInputContext *inputContext);
+ ~DesktopInputSelectionControl() {}
+
+ void createHandles();
+ void destroyHandles();
+ void setEnabled(bool enable);
+ QImage *handleImage();
+
+public Q_SLOTS:
+ void updateAnchorHandlePosition();
+ void updateCursorHandlePosition();
+ void updateVisibility();
+ void reloadGraphics();
+protected:
+ bool eventFilter(QObject *object, QEvent *event);
+
+private:
+ QRect anchorHandleRect() const;
+ QRect cursorHandleRect() const;
+ QRect handleRectForCursorRect(const QRectF &cursorRect) const;
+
+private:
+ QVirtualKeyboardInputContext *m_inputContext;
+ QSharedPointer<InputSelectionHandle> m_anchorSelectionHandle;
+ QSharedPointer<InputSelectionHandle> m_cursorSelectionHandle;
+ QImage m_handleImage;
+
+ enum {
+ HandleIsReleased = 0,
+ HandleIsHeld = 1,
+ HandleIsMoving = 2
+ };
+ enum HandleType {
+ AnchorHandle = 0,
+ CursorHandle = 1
+ };
+
+ unsigned m_handleState : 2;
+ unsigned m_currentDragHandle : 1;
+ unsigned m_enabled : 1;
+ unsigned m_anchorHandleVisible : 1;
+ unsigned m_cursorHandleVisible : 1;
+ unsigned m_eventFilterEnabled : 1;
+ QPoint m_otherSelectionPoint;
+ QVector <QMouseEvent*> m_eventQueue;
+ QPoint m_distanceBetweenMouseAndCursor;
+ QPoint m_handleDragStartedPosition;
+ QSize m_handleWindowSize;
+};
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // DESKTOPINPUTSELECTIONCONTROL_P_H
diff --git a/src/virtualkeyboard/doc/QtVirtualKeyboard_pch.h b/src/virtualkeyboard/doc/QtVirtualKeyboard_pch.h
deleted file mode 100644
index 298f0f60..00000000
--- a/src/virtualkeyboard/doc/QtVirtualKeyboard_pch.h
+++ /dev/null
@@ -1,37 +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$
-**
-****************************************************************************/
-
-#ifdef Q_CLANG_QDOC
-#include "abstractinputmethod.h"
-#include "abstractinputpanel.h"
-#include "inputcontext.h"
-#include "inputengine.h"
-#include "selectionlistmodel.h"
-#include "shifthandler.h"
-#endif // Q_CLANG_QDOC
diff --git a/src/virtualkeyboard/doc/doc.pri b/src/virtualkeyboard/doc/doc.pri
index 9fb8fcf3..4da77d1f 100644
--- a/src/virtualkeyboard/doc/doc.pri
+++ b/src/virtualkeyboard/doc/doc.pri
@@ -3,5 +3,6 @@ OTHER_FILES += \
$$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/images/layouts/qtvirtualkeyboard-layout-en_US.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-en_US.png
new file mode 100644
index 00000000..d3d761a2
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-en_US.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-es_MX.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-es_MX.png
new file mode 100644
index 00000000..62c2734b
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-es_MX.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-fr_CA.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-fr_CA.png
new file mode 100644
index 00000000..03cb10c2
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-fr_CA.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-id_ID.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-id_ID.png
new file mode 100644
index 00000000..535c6c2a
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-id_ID.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-ms_MY.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-ms_MY.png
new file mode 100644
index 00000000..0b31e24c
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-ms_MY.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-pt_BR.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-pt_BR.png
new file mode 100644
index 00000000..a0b97e06
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-pt_BR.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sk_SK.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sk_SK.png
new file mode 100644
index 00000000..6f9ba0f6
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sk_SK.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sl_SI.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sl_SI.png
new file mode 100644
index 00000000..9b2767b2
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sl_SI.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sq_AL.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sq_AL.png
new file mode 100644
index 00000000..c8b6ca62
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-sq_AL.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-th_TH.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-th_TH.png
new file mode 100644
index 00000000..ce5baf0f
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-th_TH.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-tr_TR.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-tr_TR.png
new file mode 100644
index 00000000..4d35661e
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-tr_TR.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-uk_UA.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-uk_UA.png
new file mode 100644
index 00000000..df2f1ec7
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-uk_UA.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-vi_VN.png b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-vi_VN.png
new file mode 100644
index 00000000..658ff346
--- /dev/null
+++ b/src/virtualkeyboard/doc/images/layouts/qtvirtualkeyboard-layout-vi_VN.png
Binary files differ
diff --git a/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf b/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf
index d70883d3..456d400d 100644
--- a/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf
+++ b/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf
@@ -6,26 +6,29 @@ version = $QT_VERSION
buildversion = Qt Virtual Keyboard | Commercial or GPLv3
# Custom module header passed to clang
-moduleheader = QtVirtualKeyboard_pch.h
-
-# Additional include paths passed to clang
-includepaths = -I .
+moduleheader = QtVirtualKeyboard.h
headerdirs += ..
-sourcedirs += ..
-excludedirs += ../content/layouts \
- ../3rdparty
+sourcedirs += .. ../../styles/
+excludedirs += ../content/layouts
+excludefiles += "*_p.h"
# 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"
imagedirs += images
-depends += qtdoc qtcore qtgui qtwidgets qtwayland qtqml qtquick
+depends += qtdoc qtcore qtgui qtwidgets qtwayland qtqml qtquick qtquickcontrols2
qhp.projects = QtVirtualKeyboard
@@ -39,23 +42,23 @@ qhp.QtVirtualKeyboard.filterAttributes = qtvirtualkeyboard $QT_
qhp.QtVirtualKeyboard.customFilters.Qt.name = QtVirtualKeyboard $QT_VERSION
qhp.QtVirtualKeyboard.customFilters.Qt.filterAttributes = qtvirtualkeyboard $QT_VERSION
-qhp.QtVirtualKeyboard.subprojects = qmltypes examples # classes
+qhp.QtVirtualKeyboard.subprojects = classes qmltypes examples
-# qhp.QtVirtualKeyboard.subprojects.classes.title = C++ Classes
-# qhp.QtVirtualKeyboard.subprojects.classes.indexTitle = Qt Virtual Keyboard C++ Classes
-# qhp.QtVirtualKeyboard.subprojects.classes.selectors = class
-# qhp.QtVirtualKeyboard.subprojects.classes.sortPages = true
+qhp.QtVirtualKeyboard.subprojects.classes.title = C++ Classes
+qhp.QtVirtualKeyboard.subprojects.classes.indexTitle = Qt Virtual Keyboard C++ Classes
+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.indexTitle = Qt Virtual Keyboard QML Types
-qhp.QtVirtualKeyboard.subprojects.qmltypes.selectors = fake:qmlclass
+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
-qhp.QtVirtualKeyboard.subprojects.examples.selectors = fake:example
+qhp.QtVirtualKeyboard.subprojects.examples.selectors = doc:example
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"
+navigation.cppclassespage = "Qt Virtual Keyboard C++ Classes"
diff --git a/src/virtualkeyboard/doc/src/build.qdoc b/src/virtualkeyboard/doc/src/build.qdoc
index d72236fa..4968759a 100644
--- a/src/virtualkeyboard/doc/src/build.qdoc
+++ b/src/virtualkeyboard/doc/src/build.qdoc
@@ -42,34 +42,26 @@ The project is split into the following subprojects:
\li \e examples/virtualkeyboard/basic/basic.pro
\li Qt Virtual Keyboard Demo application
\row
- \li \e src/virtualkeyboard/virtualkeyboard.pro
- \li Qt Virtual Keyboard plugin
-\row
- \li \e src/virtualkeyboard/styles/styles.pro
- \li Qt Virtual Keyboard Style plugin that enables style decorations for the
- keyboard
+ \li \e src/virtualkeyboard/import/
+ \li Qt Virtual Keyboard QML plugin (QtQuick.VirtualKeyboard)
\row
- \li \e src/virtualkeyboard/3rdparty/hunspell/hunspell.pro
- \li A project file for compiling the Hunspell library.
- \note This project is used if the Hunspell library is built from
- sources rather than depending on the system library. The project
- will be activated when the source code is extracted to this
- directory.
+ \li \e src/virtualkeyboard/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).
\row
- \li \e src/virtualkeyboard/3rdparty/lipi-toolkit/lipi-toolkit.pro
- \li A project file for compiling the lipi-toolkit library.
+ \li \e src/virtualkeyboard/plugins/
+ \li A directory containing Qt Virtual Keyboard plugins, such as the Hunspell plugin
\row
- \li \e src/virtualkeyboard/3rdparty/openwnn/openwnn.pro
- \li A project file for compiling the OpenWNN library.
+ \li \e src/virtualkeyboard/settings/
+ \li Qt Virtual Keyboard Settings QML plugin (QtQuick.VirtualKeyboard.Settings)
\row
- \li \e src/virtualkeyboard/3rdparty/pinyin/pinyin.pro
- \li A project file for compiling the PinyinIME library.
-\row
- \li \e src/virtualkeyboard/3rdparty/t9write/t9write.pro
- \li A project file for including T9 Write dictionaries as resources.
+ \li \e src/virtualkeyboard/styles/styles.pro
+ \li Qt Virtual Keyboard Styles QML plugin (QtQuick.VirtualKeyboard.Styles)
\row
- \li \e src/virtualkeyboard/3rdparty/tcime/tcime.pro
- \li A project file for compiling the TCIME library.
+ \li \e src/virtualkeyboard/virtualkeyboard.pro
+ \li Qt Virtual Keyboard module, QML components and layouts
\endtable
The input methods are implemented either in C++ or QML.
@@ -128,7 +120,7 @@ keyboard features.
\li \e handwriting
\li Enables handwriting input
\li This flag enables handwriting input using the first engine available at
- build time in the following order: \c t9write, \c lipi-toolkit. To enable handwriting
+ build time in the following order: \c myscript, \c t9write, \c lipi-toolkit. To enable handwriting
input using a specific engine, use the feature-specific configuration instead.
For example, \c CONFIG+=lipi-toolkit.
\row
@@ -188,6 +180,18 @@ the preferred input method to the configuration, e.g., \c CONFIG+="lang-zh_TW zh
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 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 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 static
\li Enables static builds of the virtual keyboard
\li This option enables \l {Static builds}{static builds}.
@@ -199,6 +203,11 @@ the preferred input method to the configuration, e.g., \c CONFIG+="lang-zh_TW zh
included in the package, but this option allows you to change the built-in
default style.
\row
+ \li \e no-builtin-style
+ \li \e n/a
+ \li Disables bunding of styles
+ \li This option excludes styles from the plugin binary.
+\row
\li \e pinyin
\li \e lang-zh_CN
\li Enables the Pinyin input method for Simplified Chinese.
@@ -254,6 +263,11 @@ the preferred input method to the configuration, e.g., \c CONFIG+="lang-zh_TW zh
\li \e handwriting
\li Enables the handwriting input method using T9 Write.
\li Handwriting recognition is based on the commercial T9 Write product from Nuance Communications.
+\row
+ \li \e myscript
+ \li \e handwriting
+ \li Enables the handwriting input method using MyScript Text SDK.
+ \li Handwriting recognition is based on the most recent commercial Text Recognition SDK product from MyScript.
\endtable
\section2 Building Documentation
@@ -270,10 +284,10 @@ 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
-\e src/virtualkeyboard/3rdparty/hunspell directory. If Hunspell sources are used,
-then the dictionary files must also be copied into the
-\e src/virtualkeyboard/3rdparty/hunspell/data directory. Furthermore, if Hunspell
-sources are used, \e hunspell.pro will be used for all targets.
+\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
Hunspell sources and dictionary files is listed below:
@@ -313,7 +327,7 @@ described below, or by using the \e unpack.py script found in the t9write direct
To unpack the SDK using the script:
\badcode
-$ cd src/virtualkeyboard/3rdparty/t9write/
+$ cd src/plugins/t9write/3rdparty/t9write/
$ python unpack.py T9Write_Alpha_v7-8-0_SDK.zip .
\endcode
@@ -426,6 +440,143 @@ Where the contents of each directory are:
Finally, the SDK is included in the build by adding CONFIG+=t9write to the
qmake command line.
+\section2 MyScript Text SDK Integration
+
+MyScript Text is designed for building applications that enable the recognition of
+handwritten text. MyScript Text supports the recognition of isolated characters, cursive,
+print and superimposed writing.
+MyScript superimposed writing is integrated into Qt Virtual Keyboard. It enables
+the recognition of letters, words or parts of words written one over the other,
+without any explicit separation between consecutive fragments. It is capable of running
+on memory and CPU constrained devices.
+
+\section3 Input handwriting styles of MyScript Text SDK
+
+The end-user can write one word fragment over the other, or one character over the other,
+as depicted below. Space between two written words are automatically added, so that there
+is no need for an explicit gesture.
+
+\raw HTML
+<div align="center"><figure><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><figcaption>Writing one character over the other</figcaption></figure></div>
+<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
+
+\section3 Language coverage of MyScript Text SDK
+
+MyScript Superimposed supports 70 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.
+
+The file hierarchy should look like below:
+
+\badcode
+3rdparty
+└── myscript
+ ├─── conf
+ ├─── doc
+ ├─── edk
+ ├─── engine
+ │ └─── bin
+ │ ├─── lin-arm64
+ │ │ └─── *.so
+ │ ├─── lin-armv7
+ │ │ └─── *.so
+ │ ├─── lin-x64
+ │ │ └─── *.so
+ │ ├─── lin-x86
+ │ │ └─── *.so
+ │ ├─── win-x64
+ │ │ └─── *.dll
+ │ ├─── win-x86
+ │ │ └─── *.dll
+ │ (etc.)
+ ├─── rdk
+ ├─── resources
+ │ ├─── ar
+ │ │ └─── *.res
+ │ ├─── en_GB
+ │ │ └─── *.res
+ │ ├─── ja_JP
+ │ │ └─── *.res
+ │ ├─── ko_KR
+ │ │ └─── *.res
+ │ ├─── zh_CN
+ │ │ └─── *.res
+ │ (etc.)
+ ├─── tools
+ └─── voim
+ ├─── api
+ ├─── bin
+ │ ├─── lin-arm64
+ │ │ └─── *.so
+ │ ├─── lin-armv7
+ │ │ └─── *.so
+ │ ├─── lin-x64
+ │ │ └─── *.so
+ │ ├─── lin-x86
+ │ │ └─── *.so
+ │ ├─── win-x64
+ │ │ └─── *.dll
+ │ ├─── win-x86
+ │ │ └─── *.dll
+ │ (etc.)
+ └─── conf
+\endcode
+
+The description for the contents of each directory are:
+
+\table
+\header
+ \li Directory
+ \li Description
+\row
+ \li \e conf
+ \li Contains the language configuration files that the Engine uses to configure language resources.
+\row
+ \li \e doc
+ \li Contains the HTML documentation files. The file \c index.html displays the main page.
+\row
+ \li \e edk
+ \li Contains the Engine Development Kit and handwriting programming elements for each supported programming language API, including code samples.
+\row
+ \li \e engine
+ \li Contains libraries of each engine object, depending on the target platforms it could be SO, A, or DLL.
+\row
+ \li \e rdk
+ \li Contains the Resource Development Kit, i.e. tools and examples for creating custom resources.
+\row
+ \li \e resources
+ \li Contains resource files with the /c .res extension. They are binary assets used at run time by the different MyScript technologies to achieve the various recognition tasks.
+\row
+ \li \e tools
+ \li Contains useful programmer tools including InkTool for ink testing.
+\row
+ \li \e voim
+ \li Contains libraries of MyScript Text Input Method. It is an extension SDK to the MyScript Text recognition system and designed for building input methods using handwriting recognition easily and quickly.
+\endtable
+
+\section3 Setting the Certificate of MyScript Text SDK
+
+\b {A valid certificate is mandatory to use the MyScript Text SDK.} This is a
+security measure that uniquely identifies you as a legitimate customer of MyScript
+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
+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.
+
\section2 Static builds
The virtual keyboard can be built and linked statically against the application.
diff --git a/src/virtualkeyboard/doc/src/deployment-guide.qdoc b/src/virtualkeyboard/doc/src/deployment-guide.qdoc
index 01823e15..6e1a2642 100644
--- a/src/virtualkeyboard/doc/src/deployment-guide.qdoc
+++ b/src/virtualkeyboard/doc/src/deployment-guide.qdoc
@@ -52,6 +52,10 @@ locations:
\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 \c /system/qml/QtQuick/VirtualKeyboard
@@ -200,32 +204,44 @@ There are several environment variables defined by the module that are listed be
\li QT_VIRTUALKEYBOARD_PINYIN_DICTIONARY
\li Overrides the location of the Pinyin dictionary.
- The default location depends on the value of
- \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ 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)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/pinyin/dict_pinyin.dat}.
\row
\li QT_VIRTUALKEYBOARD_CANGJIE_DICTIONARY
\li Overrides the location of the Cangjie dictionary.
- The default location depends on the value of
- \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ 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)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_cangjie.dat}.
\row
\li QT_VIRTUALKEYBOARD_ZHUYIN_DICTIONARY
\li Overrides the location of the Zhuyin dictionary.
- The default location depends on the value of
- \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ 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)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_zhuyin.dat}.
\row
\li QT_VIRTUALKEYBOARD_PHRASE_DICTIONARY
\li Overrides the location of the phrase dictionary.
- The default location depends on the value of
- \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ 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)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_phrases.dat}.
\row
diff --git a/src/virtualkeyboard/doc/src/handwriting.qdoc b/src/virtualkeyboard/doc/src/handwriting.qdoc
index f9408f02..d1376868 100644
--- a/src/virtualkeyboard/doc/src/handwriting.qdoc
+++ b/src/virtualkeyboard/doc/src/handwriting.qdoc
@@ -60,35 +60,146 @@ is a commercial handwriting recognition engine.
T9 Write supports handwriting written in the following languages:
-\list
-\li Arabic
-\li Bulgarian
-\li Croatian
-\li Czech
-\li Danish
-\li Dutch
-\li English
-\li Estonian
-\li Finnish
-\li French
-\li German
-\li Greek
-\li Hebrew
-\li Hungarian
-\li Italian
-\li Japanese
-\li Korean
-\li Norwegian
-\li Persian/Farsi
-\li Polish
-\li Portugese
-\li Romanian
-\li Russian
-\li Serbian
-\li Simplified Chinese
-\li Spanish
-\li Swedish
-\li Traditional Chinese
+\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
+
+\section1 MyScript
+
+\l {https://www.myscript.com}{MyScript}
+SDK is a commercial handwriting recognition engine.
+
+\MyScript SDK supports 71 handwriting recognition languages:
+
+\table
+\row
+\li \list
+ \li Afrikaans
+ \li Albanian
+ \li Arabic
+ \li Armenian
+ \li Azeri, Azerbaijani
+ \li Basque
+ \li Belarusian (Cyrillic)
+ \li Bosnian (Latin)
+ \li Bulgarian
+ \li Catalan
+ \li Cebuano
+ \li Chinese Simplified
+ \li Chinese Traditional - Hong Kong
+ \li Chinese Traditional - Taiwan
+ \li Croatian
+ \li Czech
+ \li Danish
+\endlist
+\li \list
+ \li Dutch, Flemish
+ \li Dutch
+ \li English - Canada
+ \li English - Philippines
+ \li English - United Kingdom
+ \li English - United States
+ \li Estonian
+ \li Farsi, Persian
+ \li Filipino, Pilipino, Tagalog
+ \li Finnish
+ \li French - Canada
+ \li French - France
+ \li Galician
+ \li Georgian
+ \li German - Austria
+ \li German - Germany
+ \li Greek
+ \li Hebrew
+\endlist
+\li \list
+ \li Hindi
+ \li Hungarian
+ \li Icelandic
+ \li Indonesian
+ \li Irish, Ireland Gaelic
+ \li Italian
+ \li Japanese
+ \li Kazakh
+ \li Korean
+ \li Latvian
+ \li Lithuanian
+ \li Macedonian
+ \li Malagasy
+ \li Malay
+ \li Mongolian
+ \li Norwegian, Nordic Bokmal
+ \li Polish
+ \li Portuguese - Brazil
+\endlist
+\li \list
+ \li Portuguese - Portugal
+ \li Romanian
+ \li Russian
+ \li Serbian (Cyrillic)
+ \li Serbian (Latin)
+ \li Slovak
+ \li Slovenian, Slovene
+ \li Spanish - Colombia
+ \li Spanish - Spain
+ \li Spanish - Mexico
+ \li Swahili (Latin)
+ \li Swedish
+ \li Tatar (Cyrillic)
+ \li Thai
+ \li Turkish
+ \li Ukrainian
+ \li Urdu
+ \li Vietnamese
+\endlist
+\endtable
+
+\MyScript is integrated into Qt Virtual Keyboard with identical coverage of supported languages.
+
+ \list
+ \li \l {Qt Virtual Keyboard#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.
+
+To get the \MyScript SDK or additional information, please contact \MyScript at \l {mailto:contactus@myscript.com}{contactus@myscript.com}.
+
+\b {See also}: \l {MyScript Text SDK Integration}
*/
diff --git a/src/virtualkeyboard/doc/src/includes/layouts.qdocinc b/src/virtualkeyboard/doc/src/includes/layouts.qdocinc
index 272f7e9c..47649df5 100644
--- a/src/virtualkeyboard/doc/src/includes/layouts.qdocinc
+++ b/src/virtualkeyboard/doc/src/includes/layouts.qdocinc
@@ -2,7 +2,10 @@
The Virtual Keyboard supports the following languages:
-\list
+\table
+\row
+\li \list
+ \li \l {Albanian Layout}{Albanian}
\li \l {Arabic Layout}{Arabic}
\li \l {Bulgarian Layout}{Bulgarian}
\li \l {Bulgarian Layout (Latin)}{Bulgarian (Latin)}
@@ -10,10 +13,14 @@ The Virtual Keyboard supports the following languages:
\li \l {Czech Layout}{Czech}
\li \l {Danish Layout}{Danish}
\li \l {Dutch Layout}{Dutch}
- \li \l {English Layout}{English}
+ \li \l {English (British) Layout}{English (British)}
+ \li \l {English (American) Layout}{English (American)}
\li \l {Estonian Layout}{Estonian}
+\endlist
+\li \list
\li \l {Finnish Layout}{Finnish}
\li \l {French Layout}{French}
+ \li \l {French Layout (Canadian)}{French (Canadian)}
\li \l {German Layout}{German}
\li \l {Greek Layout}{Greek}
\li \l {Greek Layout (Latin)}{Greek (Latin)}
@@ -21,26 +28,39 @@ The Virtual Keyboard supports the following languages:
\li \l {Hebrew Layout (Latin)}{Hebrew (Latin)}
\li \l {Hindi Layout}{Hindi}
\li \l {Hungarian Layout}{Hungarian}
+ \li \l {Indonesian Layout}{Indonesian}
\li \l {Italian Layout}{Italian}
+\endlist
+\li \list
\li \l {Japanese Layout (Hiragana)}{Japanese (Hiragana)}
\li \l {Japanese Layout (Katakana)}{Japanese (Katakana)}
\li \l {Japanese Layout (Full Width Latin)}{Japanese (Full Width Latin)}
\li \l {Japanese Layout (Latin)}{Japanese (Latin)}
\li \l {Korean Layout}{Korean}
+ \li \l {Malay Layout}{Malay}
\li \l {Norwegian Layout}{Norwegian}
\li \l {Persian/Farsi Layout}{Persian/Farsi}
\li \l {Polish Layout}{Polish}
\li \l {Portugese Layout}{Portugese}
\li \l {Romanian Layout}{Romanian}
\li \l {Russian Layout}{Russian}
+\endlist
+\li \list
\li \l {Serbian Layout}{Serbian}
\li \l {Serbian Layout (Latin)}{Serbian (Latin)}
\li \l {Simplified Chinese Layout}{Simplified Chinese}
\li \l {Traditional Chinese Layout (Zhuyin)}{Traditional Chinese (Zhuyin)}
\li \l {Traditional Chinese Layout (Cangjie)}{Traditional Chinese (Cangjie)}
+ \li \l {Slovak Layout}{Slovak}
+ \li \l {Slovenian Layout}{Slovenian}
\li \l {Spanish Layout}{Spanish}
\li \l {Swedish Layout}{Swedish}
+ \li \l {Thai Layout}{Thai}
+ \li \l {Turkish Layout}{Turkish}
+ \li \l {Ukrainian Layout}{Ukrainian}
+ \li \l {Vietnamese Layout}{Vietnamese}
\endlist
+\endtable
To add support for an additional language, see
\l {Adding New Keyboard Layouts}.
diff --git a/src/virtualkeyboard/doc/src/layouts.qdoc b/src/virtualkeyboard/doc/src/layouts.qdoc
index 044732f1..70ab2f05 100644
--- a/src/virtualkeyboard/doc/src/layouts.qdoc
+++ b/src/virtualkeyboard/doc/src/layouts.qdoc
@@ -36,6 +36,10 @@
The next sections illustrate each layout.
+\section2 Albanian Layout
+
+\image layouts/qtvirtualkeyboard-layout-sq_AL.png
+
\section2 Arabic Layout
\image layouts/qtvirtualkeyboard-layout-ar_AR.png
@@ -64,10 +68,14 @@ The next sections illustrate each layout.
\image layouts/qtvirtualkeyboard-layout-nl_NL.png
-\section2 English Layout
+\section2 English (British) Layout
\image layouts/qtvirtualkeyboard-layout-en_GB.png
+\section2 English (American) Layout
+
+\image layouts/qtvirtualkeyboard-layout-en_US.png
+
\section2 Estonian Layout
\image layouts/qtvirtualkeyboard-layout-et_EE.png
@@ -80,6 +88,10 @@ The next sections illustrate each layout.
\image layouts/qtvirtualkeyboard-layout-fr_FR.png
+\section2 French Layout (Canadian)
+
+\image layouts/qtvirtualkeyboard-layout-fr_CA.png
+
\section2 German Layout
\image layouts/qtvirtualkeyboard-layout-de_DE.png
@@ -108,6 +120,10 @@ The next sections illustrate each layout.
\image layouts/qtvirtualkeyboard-layout-hu_HU.png
+\section2 Indonesian Layout
+
+\image layouts/qtvirtualkeyboard-layout-id_ID.png
+
\section2 Italian Layout
\image layouts/qtvirtualkeyboard-layout-it_IT.png
@@ -132,6 +148,10 @@ The next sections illustrate each layout.
\image layouts/qtvirtualkeyboard-layout-ko_KR.png
+\section2 Malay Layout
+
+\image layouts/qtvirtualkeyboard-layout-ms_MY.png
+
\section2 Norwegian Layout
\image layouts/qtvirtualkeyboard-layout-nb_NO.png
@@ -148,6 +168,10 @@ The next sections illustrate each layout.
\image layouts/qtvirtualkeyboard-layout-pt_PT.png
+\section2 Portugese Layout (Brazil)
+
+\image layouts/qtvirtualkeyboard-layout-pt_BR.png
+
\section2 Romanian Layout
\image layouts/qtvirtualkeyboard-layout-ro_RO.png
@@ -176,12 +200,40 @@ The next sections illustrate each layout.
\image layouts/qtvirtualkeyboard-layout-zh_TW-cangjie.png
+\section2 Slovak Layout
+
+\image layouts/qtvirtualkeyboard-layout-sk_SK.png
+
+\section2 Slovenian Layout
+
+\image layouts/qtvirtualkeyboard-layout-sl_SI.png
+
\section2 Spanish Layout
\image layouts/qtvirtualkeyboard-layout-es_ES.png
+\section2 Spanish Layout (Mexican)
+
+\image layouts/qtvirtualkeyboard-layout-es_MX.png
+
\section2 Swedish Layout
\image layouts/qtvirtualkeyboard-layout-sv_SE.png
+\section2 Thai Layout
+
+\image layouts/qtvirtualkeyboard-layout-th_TH.png
+
+\section2 Turkish Layout
+
+\image layouts/qtvirtualkeyboard-layout-tr_TR.png
+
+\section2 Ukrainian Layout
+
+\image layouts/qtvirtualkeyboard-layout-uk_UA.png
+
+\section2 Vietnamese Layout
+
+\image layouts/qtvirtualkeyboard-layout-vi_VN.png
+
*/
diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc
index 4b42bb7a..353afe6d 100644
--- a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc
+++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc
@@ -63,6 +63,17 @@
\include layouts.qdocinc layout-list
+ \section1 Third-party Plugins
+
+ 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
+
+ \l {Building Qt Virtual Keyboard} describes how to integrate these plugins
+ into the Qt Virtual Keyboard.
+
\section1 Guides
\list
@@ -76,6 +87,7 @@
\list
\li \l{Qt Virtual Keyboard QML Types}{QML Types}
+ \li \l{Qt Virtual Keyboard C++ Classes}{C++ Classes}
\endlist
\section1 Examples
@@ -97,7 +109,7 @@
*/
/*!
-\qmlmodule QtQuick.VirtualKeyboard 2.3
+\qmlmodule QtQuick.VirtualKeyboard 2.4
\title Qt Virtual Keyboard QML Types
\ingroup qmlmodules
\brief Provides QML types for an input framework and a reference keyboard front
@@ -107,7 +119,7 @@ end.
import statements in your .qml file:
\code
- import QtQuick.VirtualKeyboard 2.3
+ import QtQuick.VirtualKeyboard 2.4
import QtQuick.VirtualKeyboard.Styles 2.2
import QtQuick.VirtualKeyboard.Settings 2.2
\endcode
diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc
index a0514fe9..eeb62dac 100644
--- a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc
+++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc
@@ -30,14 +30,13 @@
\title Qt Virtual Keyboard C++ Classes
\brief Provides classes to implement input methods for virtual keyboards.
- \internal
-
+ \ingroup modules
\qtvariable virtualkeyboard
To include the definitions of the module's classes, use the following directive:
\code
- #include <QVirtualKeyboard>
+ #include <QtVirtualKeyboard>
\endcode
To link against the module, add this line to your qmake .pro file:
diff --git a/src/virtualkeyboard/doc/src/technical-guide.qdoc b/src/virtualkeyboard/doc/src/technical-guide.qdoc
index e8ae300a..10e0beea 100644
--- a/src/virtualkeyboard/doc/src/technical-guide.qdoc
+++ b/src/virtualkeyboard/doc/src/technical-guide.qdoc
@@ -44,21 +44,33 @@ These interfaces allow the plugin to be used as a platform input
context plugin in Qt 5 applications.
The plugin itself provides an input framework supporting multiple
-input methods as well as a QML UI for the virtual keyboard.
+input methods as well as a QML UI for the virtual keyboard. The input
+framework is extensible through a plugin interface, which allows third-party
+input methods and keyboard layouts to be loaded at runtime.
The input framework provides the following main interfaces:
\list
- \li InputContext: provides contextual information for the virtual keyboard
- and other input components.
- \li InputEngine: exposes an API to integrate user input events (key
+ \li QVirtualKeyboardInputContext: provides contextual information for the virtual keyboard
+ and other input components. Acts as an interface to the underlying
+ text input component.
+ \li QVirtualKeyboardInputEngine: exposes an API to integrate user input events (key
presses, etc.) and acts as a host for input methods.
- \li InputMethod: a base type for QML based input methods.
+ \li QVirtualKeyboardAbstractInputMethod: a base type for C++-based input methods. The input method
+ usually handles key events, but can also handle mouse and touch input
+ events.
+ \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 The Input Context
+\section1 Input Context
-The input context is used by the keyboard as well as concrete input methods.
+The input context is used by the keyboard as well as concrete input methods. InputContext
+is a singleton instance hosted by QML. An application should not directly interact with
+the input context.
\section2 Contextual Information
@@ -78,7 +90,20 @@ from the application. This information includes, but is not limited to:
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.
+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.
+
+At minimum the layout directory must contain the files:
+
+\list
+ \li \c dialpad.fallback
+ \li \c digits.fallback
+ \li \c main.fallback
+ \li \c numbers.fallback
+ \li \c symbols.fallback
+\endlist
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
@@ -88,8 +113,8 @@ current system locale is used.
The keyboard locale matching is performed in the following sequence:
\list
- \li layouts/language_country
- \li layouts/language_*
+ \li layouts/<language>_<country>
+ \li layouts/<language>_*
\li layouts/en_GB
\endlist
@@ -101,26 +126,21 @@ 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 InputEngine
-and the current InputMethod instances.
-
-\section2 UI Animations
+Internally, the current input locale is also updated to the QVirtualKeyboardInputEngine
+and the current input method instances.
-The keyboard should notify the input context about UI transitions and
-animations. The InputContext::animating property sets the animating property of
-the input context.
-
-\section1 The Input Engine
+\section1 Input Engine
-The input engine object is owned by InputContext. The input engine contains
-API functions which the keyboard can use to map user interactions such as key
-press and key release events.
+The input engine object is owned by InputContext. Like the InputContext, there is
+only one instance of the QVirtualKeyboardInputEngine. The input engine contains API functions which
+the keyboard uses to map user interactions, such as key press and release events,
+to the input method.
-The input events are mapped through the following methods:
+For example, virtual keyboard key events are mapped through the following methods:
\list
- \li InputEngine::virtualKeyPress
- \li InputEngine::virtualKeyRelease
+ \li QVirtualKeyboardInputEngine::virtualKeyPress
+ \li QVirtualKeyboardInputEngine::virtualKeyRelease
\endlist
The above-mentioned methods are intended for the integration of the virtual
@@ -129,21 +149,137 @@ the methods are not suitable for mapping the physical keystrokes. This is a
consequence of the fact that the actual action is performed only when the key
is released.
-If the user releases the key without having to perform the actual action, the
-key can be interrupted by using the InputEngine::virtualKeyCancel method.
+If the key press is interrupted before the key release event, the keyboard invokes
+the QVirtualKeyboardInputEngine::virtualKeyCancel method.
+
+\section2 Input Method
+
+The input method is a concrete implementation of the keypress handler. It's main
+function is to handle keypress events and maintain state information for the
+user input. It interacts with the text editor through \l QVirtualKeyboardInputContext via
+pre-edit text or key events.
+
+The input method instance can be created in various ways, depending on the use
+case:
+
+\list
+ \li \c {KeyboardLayout::inputMethod}: the keyboard layout can create an input method
+ instance solely for this keyboard layout. It should be noted that this
+ instance will be destroyed when the keyboard layout changes. Therefore,
+ this method is usually limited to very narrow use cases.
+ \li \c {KeyboardLayout::createInputMethod()}: the keyboard layout can dynamically
+ create an input method that can be used with this layout and also with the
+ \l {KeyboardLayout::sharedLayouts} {shared layouts} (e.g. symbol layout).
+ This is the preferred way for creating specialized input methods, such as
+ those involving complex languages or handwriting.
+ \li \c {DefaultInputMethod}: the virtual keyboard attempts to create this type of
+ input method at startup. This instance will be used as the default input
+ method across all keyboard layouts, unless the keyboard layout uses a
+ custom input method. This instance outlives keyboard layout changes across
+ languages and is the preferred way of creating and overriding the default
+ input method.
+\endlist
-\section2 Activating an Input Method
+\section1 Virtual Keyboard Extension Plugin
-Activating an input method is straightforward. The required steps are:
+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 Instantiate a concrete implementation of InputMethod
- \li Assign the instance to InputEngine::inputMethod
- \li Set the proper input mode with InputEngine::inputMode
+ \li \b {Link against the virtualkeyboard library}.
+
+ The virtualkeyboard module must be linked against the plugin:
+
+ \badcode
+ QT += virtualkeyboard
+ \endcode
+
+ 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
-When the input method is active, it receives key events from the input engine
-and can produce text.
+\section2 Adding Keyboard Layouts
+
+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
+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
+
+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
\section1 Implementing a Custom Input Method
@@ -170,7 +306,7 @@ InputMethod::update() is called when the input context is updated and
the input state is possibly out of sync. The input method should commit
the current text.
-The keystorke events are handled in InputMethod::keyEvent(). This method handles
+The keystroke events are handled in InputMethod::keyEvent(). This method handles
a single keystroke event and returns \c true if the event was processed.
Otherwise the keystroke is handled by the default input method.
@@ -191,7 +327,7 @@ list types:
\code
function selectionLists() {
- return [SelectionListModel.WordCandidateList];
+ return [SelectionListModel.Type.WordCandidateList];
}
\endcode
@@ -206,8 +342,8 @@ the input method requires the UI to highlight an item in the list, it will emit
the InputMethod::selectionListActiveItemChanged signal.
\code
-selectionListChanged(SelectionListModel.WordCandidateList)
-selectionListActiveItemChanged(SelectionListModel.WordCandidateList, wordIndex)
+selectionListChanged(SelectionListModel.Type.WordCandidateList)
+selectionListActiveItemChanged(SelectionListModel.Type.WordCandidateList, wordIndex)
\endcode
\section3 Populating Items in the Selection Lists
@@ -220,7 +356,7 @@ items in the list identified by the given type.
\code
function selectionListItemCount(type) {
- if (type == SelectionListModel.WordCandidateList) {
+ if (type == SelectionListModel.Type.WordCandidateList) {
return wordList.length
}
return 0
@@ -232,9 +368,9 @@ The InputMethod::selectionListData callback requests the data for items.
\code
function selectionListData(type, index, role) {
var result = null
- if (type == SelectionListModel.WordCandidateList) {
+ if (type == SelectionListModel.Type.WordCandidateList) {
switch (role) {
- case SelectionListModel.DisplayRole:
+ case SelectionListModel.Role.Display:
result = wordList[index]
break
default:
@@ -246,7 +382,7 @@ function selectionListData(type, index, role) {
\endcode
The \a role parameter identifies which data is requested for an item. For
-example, the SelectionListModel.DisplayRole requests the display text data.
+example, the SelectionListModel.Role.Display requests the display text data.
\section3 Responding to User Actions
@@ -255,74 +391,68 @@ event in the InputMethod::selectionListItemSelected method callback.
\code
function selectionListItemSelected(type, index) {
- if (type == SelectionListModel.WordCandidateList) {
+ if (type == SelectionListModel.Type.WordCandidateList) {
inputContext.commit(wordlist[index])
update()
}
}
\endcode
-\section1 Integrating Selection Lists into the UI
-
-The input engine provides a list model for each selection list type.
-The model is null while the list is not allocated, allowing the UI
-to hide the list if necessary.
-
-The list model's word candidate list is provided by the
-InputEngine::wordCandidateListModel property.
-
\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.
-
-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 further processing.
-
-In case of a regular keyboard, the amount of data transferred from the keyboard
-to input method is minimal (namely the keycode and text), but in the case of
-handwriting recognition the data volume is much bigger. Therefore, the touch
-input is stored in a particular data model.
-
-The input method does not participate in the actual collection of touch data.
-However, the input method has full control over touch input since it can
-either accept or reject touch. This allows for precise control over how many
-fingers can be used simultaneously.
-
-The input method can collect as many traces as it deems necessary and begin
-processing them at will. The processing can even be performed in parallel with
-the touch input, although it is not recommended because of the potential side
-effects. A recommended way is to start processing in a background thread
-after a suitable delay, so that it does not negatively affect the performance
-of the user interface.
-
-\section2 Data Model for the Handwriting Input
-
-The data collected from the input source is stored in an object named QtVirtualKeyboard::Trace (C++) or \l Trace (QML).
-
-By definition, \e trace is a set of data collected in one touch. In addition to
-the basic coordinate data, it can also include other types of data, such as
-the time of each data point. The input method can define the desired input channels
-at the beginning of a touch event.
+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).
+
+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.
+
+\section2 Data Model for Handwriting Input
+
+Virtual keyboard collects the handwriting data in a special data model QVirtualKeyboardTrace.
+Each trace represents a collection of data sampled from one touch (e.g.
+a swipe on the screen). There will be as many instances of QVirtualKeyboardTrace as there are
+touches on the handwriting input area.
+
+By definition, \e trace is a set of data sampled from one touch. In addition to
+the basic point data, it can also include other types of data, such as
+the time of each point. The input method can define the desired input channels
+in the beginning of a trace event.
+
+The input method does not participate in the actual collection of trace data.
+However, the input method has full control over the input since it can
+either accept or reject a QVirtualKeyboardTrace (e.g. if there are too many instances to handle).
+This also allows for precise control over how many fingers can be used simultaneously.
+
+The input method can collect as many traces as it sees fit and it can begin
+processing them when necessary. The processing can even be performed in parallel while
+sampling the data, although it is not recommended because of the potential performance
+issues. The recommended way is to start processing in a background thread
+after a suitable delay from the last input, so that the processing does not affect
+negatively to the user interface.
\section2 Trace API for Input Methods
The trace API consists of the following virtual methods, which the input method
-must implement in order to receive and process touch input data.
+must implement in order to receive and process trace input data.
\list
- \li \l { QtVirtualKeyboard::AbstractInputMethod::patternRecognitionModes } { patternRecognitionModes }
- \li \l { QtVirtualKeyboard::AbstractInputMethod::traceBegin } { traceBegin }
- \li \l { QtVirtualKeyboard::AbstractInputMethod::traceEnd } { traceEnd }
+ \li \l { QVirtualKeyboardAbstractInputMethod::patternRecognitionModes } { patternRecognitionModes }
+ \li \l { QVirtualKeyboardAbstractInputMethod::traceBegin } { traceBegin }
+ \li \l { QVirtualKeyboardAbstractInputMethod::traceEnd } { traceEnd }
\endlist
By implementing these methods, the input method can receive and process data
-from a variety of input sources.
+from a variety of input sources (e.g. keyboard layout or full screen).
The patternRecognitionModes method returns a list of pattern recognition modes,
which are supported by the input method. A pattern recognition mode, such as
-\l { QtVirtualKeyboard::InputEngine::HandwritingRecoginition } { HandwritingRecoginition },
+\l { QVirtualKeyboardInputEngine::PatternRecognitionMode::Handwriting } { HandwritingRecognition },
defines the method by which the input method processes the data.
The trace interaction is started when an input source detects a new contact point, and
diff --git a/src/virtualkeyboard/doc/src/user-guide.qdoc b/src/virtualkeyboard/doc/src/user-guide.qdoc
index b784178b..0a5e8235 100644
--- a/src/virtualkeyboard/doc/src/user-guide.qdoc
+++ b/src/virtualkeyboard/doc/src/user-guide.qdoc
@@ -65,30 +65,37 @@ The handwriting mode can be activated by pressing the handwriting key:
\li Gesture
\li Lipi Toolkit
\li T9 Write
+ \li MyScript Text SDK
\row
\li Backspace
\li \image gesture-single-left.png
\li \image gesture-single-left.png
+ \li \image gesture-single-left.png
\row
\li Space
\li \image gesture-single-right.png
\li \image gesture-single-right.png
+ \li \image gesture-single-left.png
\row
\li Enter
\li Gesture not available
\li \image gesture-single-down-left.png
+ \li \image gesture-single-down-left.png
\row
\li Reset word
\li \image gesture-double-left.png
\li Gesture not available
+ \li Gesture not available
\row
\li Toggle input mode
\li \image gesture-single-up.png
\li Gesture not available
+ \li Gesture not available
\row
\li Toggle text case
\li \image gesture-double-up.png
\li Gesture not available
+ \li Gesture not available
\endtable
*/
diff --git a/src/virtualkeyboard/enterkeyaction.cpp b/src/virtualkeyboard/enterkeyaction.cpp
index 13b6246b..6d9361b1 100644
--- a/src/virtualkeyboard/enterkeyaction.cpp
+++ b/src/virtualkeyboard/enterkeyaction.cpp
@@ -27,9 +27,10 @@
**
****************************************************************************/
-#include "enterkeyaction.h"
-#include "enterkeyactionattachedtype.h"
+#include <QtVirtualKeyboard/private/enterkeyaction_p.h>
+#include <QtVirtualKeyboard/private/enterkeyactionattachedtype_p.h>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
/*!
@@ -105,3 +106,4 @@ EnterKeyActionAttachedType *EnterKeyAction::qmlAttachedProperties(QObject *objec
*/
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/enterkeyaction.h b/src/virtualkeyboard/enterkeyaction.h
deleted file mode 100644
index b78e09ec..00000000
--- a/src/virtualkeyboard/enterkeyaction.h
+++ /dev/null
@@ -1,64 +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 ENTERKEYACTION_H
-#define ENTERKEYACTION_H
-
-#include <qqml.h>
-
-namespace QtVirtualKeyboard {
-
-class EnterKeyActionAttachedType;
-
-class EnterKeyAction : public QObject
-{
- Q_OBJECT
-
-public:
- enum Id {
- None,
- Go,
- Search,
- Send,
- Next,
- Done
- };
-
- Q_ENUM(Id)
-
-public:
- static EnterKeyActionAttachedType *qmlAttachedProperties(QObject *object);
-};
-
-} // namespace QtVirtualKeyboard
-
-Q_DECLARE_METATYPE(QtVirtualKeyboard::EnterKeyAction::Id)
-QML_DECLARE_TYPEINFO(QtVirtualKeyboard::EnterKeyAction, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif
diff --git a/src/virtualkeyboard/enterkeyaction_p.h b/src/virtualkeyboard/enterkeyaction_p.h
new file mode 100644
index 00000000..2de309ad
--- /dev/null
+++ b/src/virtualkeyboard/enterkeyaction_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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 ENTERKEYACTION_P_H
+#define ENTERKEYACTION_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 <qqml.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class EnterKeyActionAttachedType;
+
+class QVIRTUALKEYBOARD_EXPORT EnterKeyAction : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum Id {
+ None,
+ Go,
+ Search,
+ Send,
+ Next,
+ Done
+ };
+
+ Q_ENUM(Id)
+
+public:
+ static EnterKeyActionAttachedType *qmlAttachedProperties(QObject *object);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtVirtualKeyboard)::EnterKeyAction::Id)
+QML_DECLARE_TYPEINFO(QT_PREPEND_NAMESPACE(QtVirtualKeyboard)::EnterKeyAction, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
diff --git a/src/virtualkeyboard/enterkeyactionattachedtype.cpp b/src/virtualkeyboard/enterkeyactionattachedtype.cpp
index ce946f95..ca0ee934 100644
--- a/src/virtualkeyboard/enterkeyactionattachedtype.cpp
+++ b/src/virtualkeyboard/enterkeyactionattachedtype.cpp
@@ -27,8 +27,9 @@
**
****************************************************************************/
-#include "enterkeyactionattachedtype.h"
+#include <QtVirtualKeyboard/private/enterkeyactionattachedtype_p.h>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
/*!
@@ -84,3 +85,4 @@ void EnterKeyActionAttachedType::setEnabled(bool enabled)
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/enterkeyactionattachedtype.h b/src/virtualkeyboard/enterkeyactionattachedtype.h
deleted file mode 100644
index 95fd8900..00000000
--- a/src/virtualkeyboard/enterkeyactionattachedtype.h
+++ /dev/null
@@ -1,68 +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 ENTERKEYACTIONATTACHEDTYPE_H
-#define ENTERKEYACTIONATTACHEDTYPE_H
-
-#include <QObject>
-#include "enterkeyaction.h"
-
-namespace QtVirtualKeyboard {
-
-class 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)
-
-public:
- explicit EnterKeyActionAttachedType(QObject *parent);
-
- int actionId() const;
- void setActionId(int actionId);
- QString label() const;
- void setLabel(const QString& label);
- bool enabled() const;
- void setEnabled(bool enabled);
-
-signals:
- void actionIdChanged();
- void labelChanged();
- void enabledChanged();
-
-private:
- int m_actionId;
- QString m_label;
- bool m_enabled;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/enterkeyactionattachedtype_p.h b/src/virtualkeyboard/enterkeyactionattachedtype_p.h
new file mode 100644
index 00000000..a7a7f4f8
--- /dev/null
+++ b/src/virtualkeyboard/enterkeyactionattachedtype_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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 ENTERKEYACTIONATTACHEDTYPE_P_H
+#define ENTERKEYACTIONATTACHEDTYPE_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/enterkeyaction_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class QVIRTUALKEYBOARD_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)
+
+public:
+ explicit EnterKeyActionAttachedType(QObject *parent);
+
+ int actionId() const;
+ void setActionId(int actionId);
+ QString label() const;
+ void setLabel(const QString& label);
+ bool enabled() const;
+ void setEnabled(bool enabled);
+
+signals:
+ void actionIdChanged();
+ void labelChanged();
+ void enabledChanged();
+
+private:
+ int m_actionId;
+ QString m_label;
+ bool m_enabled;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/virtualkeyboard/fallbackinputmethod.cpp b/src/virtualkeyboard/fallbackinputmethod.cpp
new file mode 100644
index 00000000..81703232
--- /dev/null
+++ b/src/virtualkeyboard/fallbackinputmethod.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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/fallbackinputmethod_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::DefaultInputMethod
+ \internal
+*/
+
+FallbackInputMethod::FallbackInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(parent)
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> FallbackInputMethod::inputModes(const QString &locale)
+{
+ Q_UNUSED(locale)
+ return QList<QVirtualKeyboardInputEngine::InputMode>();
+}
+
+bool FallbackInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_UNUSED(locale)
+ Q_UNUSED(inputMode)
+ return true;
+}
+
+bool FallbackInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase)
+ return true;
+}
+
+bool FallbackInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ const Qt::KeyboardModifiers mods = (key == Qt::Key_Return) ? Qt::NoModifier : modifiers;
+ inputContext()->sendKeyClick(key, text, mods);
+ return true;
+}
+
+void FallbackInputMethod::reset()
+{
+}
+
+void FallbackInputMethod::update()
+{
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/fallbackinputmethod_p.h b/src/virtualkeyboard/fallbackinputmethod_p.h
new file mode 100644
index 00000000..f494079d
--- /dev/null
+++ b/src/virtualkeyboard/fallbackinputmethod_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** 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 FALLBACKINPUTMETHOD_P_H
+#define FALLBACKINPUTMETHOD_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 QVIRTUALKEYBOARD_EXPORT FallbackInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+
+public:
+ explicit FallbackInputMethod(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);
+
+ void reset();
+ void update();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // FALLBACKINPUTMETHOD_P_H
diff --git a/src/virtualkeyboard/generateresource.pri b/src/virtualkeyboard/generateresource.pri
deleted file mode 100644
index 967d90c5..00000000
--- a/src/virtualkeyboard/generateresource.pri
+++ /dev/null
@@ -1,28 +0,0 @@
-defineReplace(generate_resource) {
- GENERATED_FILE = $$OUT_PWD/$$1
- INCLUDED_FILES = $$2
- BASE_PREFIX = $$3
- GENERATED_CONTENT = \
- "<RCC>"
-
- RESOURCE_PREFIX = ""
- for (FILE, INCLUDED_FILES) {
- RELATIVE_PATH = $$relative_path($$absolute_path($$FILE), $$_PRO_FILE_PWD_)
- TEST_PREFIX = $$BASE_PREFIX/$$dirname(RELATIVE_PATH)
- !equals(TEST_PREFIX, $$RESOURCE_PREFIX) {
- !isEmpty(RESOURCE_PREFIX): GENERATED_CONTENT += " </qresource>"
- RESOURCE_PREFIX = $$TEST_PREFIX
- GENERATED_CONTENT += " <qresource prefix=\"$$RESOURCE_PREFIX\">"
- }
- ABSOLUTE_PATH = $$absolute_path($$FILE)
- ALIAS_NAME = $$basename(FILE)
- GENERATED_CONTENT += " <file alias=\"$$ALIAS_NAME\">$$ABSOLUTE_PATH</file>"
- }
- !isEmpty(RESOURCE_PREFIX): GENERATED_CONTENT += " </qresource>"
-
- GENERATED_CONTENT += \
- "</RCC>"
- write_file($$GENERATED_FILE, GENERATED_CONTENT)|error("Failed to write resource file!")
-
- return($$GENERATED_FILE)
-}
diff --git a/src/virtualkeyboard/gesturerecognizer.cpp b/src/virtualkeyboard/gesturerecognizer.cpp
index 09db68a5..c50102fe 100644
--- a/src/virtualkeyboard/gesturerecognizer.cpp
+++ b/src/virtualkeyboard/gesturerecognizer.cpp
@@ -27,8 +27,9 @@
**
****************************************************************************/
-#include "gesturerecognizer.h"
+#include <QtVirtualKeyboard/private/gesturerecognizer_p.h>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
GestureRecognizer::GestureRecognizer(QObject *parent) :
@@ -36,4 +37,5 @@ GestureRecognizer::GestureRecognizer(QObject *parent) :
{
}
-}
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/gesturerecognizer.h b/src/virtualkeyboard/gesturerecognizer.h
deleted file mode 100644
index f1636609..00000000
--- a/src/virtualkeyboard/gesturerecognizer.h
+++ /dev/null
@@ -1,50 +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 GESTURERECOGNIZER_H
-#define GESTURERECOGNIZER_H
-
-#include <QObject>
-#include <QVariantMap>
-#include "trace.h"
-
-namespace QtVirtualKeyboard {
-
-class GestureRecognizer : public QObject
-{
- Q_OBJECT
-public:
- explicit GestureRecognizer(QObject *parent = 0);
-
- virtual QVariantMap recognize(const QList<Trace *> traceList) = 0;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // GESTURERECOGNIZER_H
diff --git a/src/virtualkeyboard/gesturerecognizer_p.h b/src/virtualkeyboard/gesturerecognizer_p.h
new file mode 100644
index 00000000..d7b14b20
--- /dev/null
+++ b/src/virtualkeyboard/gesturerecognizer_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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 GESTURERECOGNIZER_P_H
+#define GESTURERECOGNIZER_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 <QVariantMap>
+#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class QVIRTUALKEYBOARD_EXPORT GestureRecognizer : public QObject
+{
+ Q_OBJECT
+public:
+ explicit GestureRecognizer(QObject *parent = nullptr);
+
+ virtual QVariantMap recognize(const QList<QVirtualKeyboardTrace *> traceList) = 0;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // GESTURERECOGNIZER_P_H
diff --git a/src/virtualkeyboard/handwritinggesturerecognizer.cpp b/src/virtualkeyboard/handwritinggesturerecognizer.cpp
index 23ac63e9..36fe8cf8 100644
--- a/src/virtualkeyboard/handwritinggesturerecognizer.cpp
+++ b/src/virtualkeyboard/handwritinggesturerecognizer.cpp
@@ -27,11 +27,12 @@
**
****************************************************************************/
-#include "handwritinggesturerecognizer.h"
+#include <QtVirtualKeyboard/private/handwritinggesturerecognizer_p.h>
#include <QtCore/qmath.h>
#include <QVector2D>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
HandwritingGestureRecognizer::HandwritingGestureRecognizer(QObject *parent) :
@@ -50,7 +51,7 @@ int HandwritingGestureRecognizer::dpi() const
return m_dpi;
}
-QVariantMap HandwritingGestureRecognizer::recognize(const QList<Trace *> traceList)
+QVariantMap HandwritingGestureRecognizer::recognize(const QList<QVirtualKeyboardTrace *> traceList)
{
if (traceList.count() > 0 && traceList.count() < 3) {
@@ -86,7 +87,7 @@ QVariantMap HandwritingGestureRecognizer::recognize(const QList<Trace *> traceLi
const int traceCount = traceList.size();
for (traceIndex = 0; traceIndex < traceCount; ++traceIndex) {
- const Trace *trace = traceList.at(traceIndex);
+ const QVirtualKeyboardTrace *trace = traceList.at(traceIndex);
const QVariantList &points = trace->points();
QVector2D swipeVector;
const int pointCount = points.count();
@@ -201,4 +202,5 @@ QVariantMap HandwritingGestureRecognizer::recognize(const QList<Trace *> traceLi
return QVariantMap();
}
-}
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/handwritinggesturerecognizer.h b/src/virtualkeyboard/handwritinggesturerecognizer.h
deleted file mode 100644
index 5ef2ba14..00000000
--- a/src/virtualkeyboard/handwritinggesturerecognizer.h
+++ /dev/null
@@ -1,54 +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 HANDWRITINGGESTURERECOGNIZER_H
-#define HANDWRITINGGESTURERECOGNIZER_H
-
-#include "gesturerecognizer.h"
-
-namespace QtVirtualKeyboard {
-
-class HandwritingGestureRecognizer : public GestureRecognizer
-{
- Q_OBJECT
-public:
- explicit HandwritingGestureRecognizer(QObject *parent = 0);
-
- void setDpi(int dpi);
- int dpi() const;
-
- QVariantMap recognize(const QList<Trace *> traceList);
-
-private:
- int m_dpi;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // HANDWRITINGGESTURERECOGNIZER_H
diff --git a/src/virtualkeyboard/handwritinggesturerecognizer_p.h b/src/virtualkeyboard/handwritinggesturerecognizer_p.h
new file mode 100644
index 00000000..99a9c89a
--- /dev/null
+++ b/src/virtualkeyboard/handwritinggesturerecognizer_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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 HANDWRITINGGESTURERECOGNIZER_P_H
+#define HANDWRITINGGESTURERECOGNIZER_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/gesturerecognizer_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class QVIRTUALKEYBOARD_EXPORT HandwritingGestureRecognizer : public GestureRecognizer
+{
+ Q_OBJECT
+public:
+ explicit HandwritingGestureRecognizer(QObject *parent = nullptr);
+
+ void setDpi(int dpi);
+ int dpi() const;
+
+ QVariantMap recognize(const QList<QVirtualKeyboardTrace *> traceList);
+
+private:
+ int m_dpi;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // HANDWRITINGGESTURERECOGNIZER_P_H
diff --git a/src/virtualkeyboard/hangul.cpp b/src/virtualkeyboard/hangul.cpp
deleted file mode 100644
index 4410b06f..00000000
--- a/src/virtualkeyboard/hangul.cpp
+++ /dev/null
@@ -1,363 +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 "hangul.h"
-
-namespace QtVirtualKeyboard {
-
-const QList<ushort> Hangul::initials = QList<ushort>()
- << 0x3131 << 0x3132 << 0x3134 << 0x3137 << 0x3138 << 0x3139 << 0x3141
- << 0x3142 << 0x3143 << 0x3145 << 0x3146 << 0x3147 << 0x3148 << 0x3149
- << 0x314A << 0x314B << 0x314C << 0x314D << 0x314E;
-const QList<ushort> Hangul::finals = QList<ushort>()
- << 0x0000 << 0x3131 << 0x3132 << 0x3133 << 0x3134 << 0x3135 << 0x3136
- << 0x3137 << 0x3139 << 0x313A << 0x313B << 0x313C << 0x313D << 0x313E
- << 0x313F << 0x3140 << 0x3141 << 0x3142 << 0x3144 << 0x3145 << 0x3146
- << 0x3147 << 0x3148 << 0x314A << 0x314B << 0x314C << 0x314D << 0x314E;
-const QMap<ushort, Hangul::HangulMedialIndex> Hangul::doubleMedialMap =
- Hangul::initDoubleMedialMap();
-const QMap<ushort, Hangul::HangulFinalIndex> Hangul::doubleFinalMap =
- Hangul::initDoubleFinalMap();
-const int Hangul::SBase = 0xAC00;
-const int Hangul::LBase = 0x1100;
-const int Hangul::VBase = 0x314F;
-const int Hangul::TBase = 0x11A7;
-const int Hangul::LCount = 19;
-const int Hangul::VCount = 21;
-const int Hangul::TCount = 28;
-const int Hangul::NCount = Hangul::VCount * Hangul::TCount; // 588
-const int Hangul::SCount = Hangul::LCount * Hangul::NCount; // 11172
-
-/*!
- \class QtVirtualKeyboard::Hangul
- \internal
-*/
-
-QString Hangul::decompose(const QString &source)
-{
- QString result;
- const int len = source.length();
- for (int i = 0; i < len; i++) {
- QChar ch = source.at(i);
- int SIndex = (int)ch.unicode() - SBase;
- if (SIndex >= 0 && SIndex < SCount) {
-
- // Decompose initial consonant
- result.append(QChar((int)initials[SIndex / NCount]));
-
- // Decompose medial vowel and check if it consists of double Jamo
- int VIndex = (SIndex % NCount) / TCount;
- ushort key = findDoubleMedial((HangulMedialIndex)VIndex);
- if (key) {
- HangulMedialIndex VIndexA, VIndexB;
- unpackDoubleMedial(key, VIndexA, VIndexB);
- result.append(QChar(VBase + (int)VIndexA));
- result.append(QChar(VBase + (int)VIndexB));
- } else {
- result.append(QChar(VBase + VIndex));
- }
-
- // Decompose final consonant and check if it consists of double Jamo
- int TIndex = SIndex % TCount;
- if (TIndex != 0) {
- key = findDoubleFinal((HangulFinalIndex)TIndex);
- if (key) {
- HangulFinalIndex TIndexA, TIndexB;
- unpackDoubleFinal(key, TIndexA, TIndexB);
- result.append(QChar(finals[(int)TIndexA]));
- result.append(QChar(finals[(int)TIndexB]));
- } else {
- result.append(QChar(finals[TIndex]));
- }
- }
- } else {
- result.append(ch);
- }
- }
- return result;
-}
-
-QString Hangul::compose(const QString &source)
-{
- const int len = source.length();
- if (len == 0)
- return QString();
-
- // Always add the initial character into buffer.
- // The last character will serve as the current
- // Hangul Syllable.
- QChar last = source.at(0);
- QString result = QString(last);
-
- // Go through the input buffer starting at next character
- for (int i = 1; i < len; i++) {
- const QChar ch = source.at(i);
-
- // Check to see if the character is Hangul Compatibility Jamo
- const ushort unicode = ch.unicode();
- if (isJamo(unicode)) {
-
- // Check to see if the character is syllable
- const ushort lastUnicode = last.unicode();
- int SIndex = (int)lastUnicode - SBase;
- if (SIndex >= 0 && SIndex < SCount) {
-
- // Check to see if the syllable type is LV or LV+T
- int TIndex = SIndex % TCount;
- if (TIndex == 0) {
-
- // If the current character is final consonant, then
- // make syllable of form LV+T
- TIndex = finals.indexOf(unicode);
- if (TIndex != -1) {
- last = QChar((int)lastUnicode + TIndex);
- result.replace(result.length() - 1, 1, last);
- continue;
- }
-
- // Check to see if the current character is vowel
- HangulMedialIndex VIndexB = (HangulMedialIndex)((int)unicode - VBase);
- if (isMedial(VIndexB)) {
-
- // Some medial Jamos do not exist in the keyboard layout as is.
- // Such Jamos can only be formed by combining the two specific Jamos,
- // aka the double Jamos.
-
- HangulMedialIndex VIndexA = (HangulMedialIndex)((SIndex % NCount) / TCount);
- if (isMedial(VIndexA)) {
-
- // Search the double medial map if such a combination exists
- ushort key = packDoubleMedial(VIndexA, VIndexB);
- const auto it = doubleMedialMap.constFind(key);
- if (it != doubleMedialMap.cend()) {
-
- // Update syllable by adding the difference between
- // the vowels indices
- HangulMedialIndex VIndexD = it.value();
- int VDiff = (int)VIndexD - (int)VIndexA;
- last = QChar((int)lastUnicode + VDiff * TCount);
- result.replace(result.length() - 1, 1, last);
- continue;
- }
- }
- }
-
- } else {
-
- // Check to see if current jamo is vowel
- int VIndex = (int)unicode - VBase;
- if (VIndex >= 0 && VIndex < VCount) {
-
- // Since some initial and final consonants use the same
- // Unicode values, we need to check whether the previous final
- // Jamo is actually an initial Jamo of the next syllable.
- //
- // Consider the following scenario:
- // LVT+V == not possible
- // LV, L+V == possible
- int LIndex = initials.indexOf(finals[TIndex]);
- if (LIndex >= 0 && LIndex < LCount) {
-
- // 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);
-
- // Make new syllable of form LV
- last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
- result.append(last);
- continue;
- }
-
- // Check to see if the current final Jamo is double consonant.
- // In this scenario, the double consonant is split into parts
- // and the second part is removed from the current syllable.
- // Then the second part is joined with the current vowel making
- // the new syllable of form LV.
- ushort key = findDoubleFinal((HangulFinalIndex)TIndex);
- if (key) {
-
- // Split the consonant into two jamos and remove the
- // second jamo B from the current syllable
- HangulFinalIndex TIndexA, TIndexB;
- unpackDoubleFinal(key, TIndexA, TIndexB);
- last = QChar((int)lastUnicode - TIndex + (int)TIndexA);
- result.replace(result.length() - 1, 1, last);
-
- // Add new syllable by combining the initial jamo
- // and the current vowel
- LIndex = initials.indexOf(finals[TIndexB]);
- last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
- result.append(last);
- continue;
- }
- }
-
- // Check whether the current consonant can connect to current
- // consonant forming a double final consonant
- HangulFinalIndex TIndexA = (HangulFinalIndex)TIndex;
- if (isFinal(TIndexA)) {
-
- HangulFinalIndex TIndexB = (HangulFinalIndex)finals.indexOf(unicode);
- if (isFinal(TIndexB)) {
-
- // Search the double final map if such a combination exists
- ushort key = packDoubleFinal(TIndexA, TIndexB);
- const auto it = doubleFinalMap.constFind(key);
- if (it != doubleFinalMap.cend()) {
-
- // Update syllable by adding the difference between
- // the consonant indices
- HangulFinalIndex TIndexD = it.value();
- int TDiff = (int)TIndexD - (int)TIndexA;
- last = QChar((int)lastUnicode + TDiff);
- result.replace(result.length() - 1, 1, last);
- continue;
- }
- }
- }
- }
-
- } else {
-
- // The last character is not syllable.
- // Check to see if the last character is an initial consonant
- int LIndex = initials.indexOf(lastUnicode);
- if (LIndex != -1) {
-
- // If the current character is medial vowel,
- // make syllable of form LV
- int VIndex = (int)unicode - VBase;
- if (VIndex >= 0 && VIndex < VCount) {
- last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
- result.replace(result.length() - 1, 1, last);
- continue;
- }
- }
-
- }
- }
-
- // Otherwise, add the character into buffer
- last = ch;
- result = result.append(ch);
- }
- return result;
-}
-
-bool Hangul::isJamo(const ushort &unicode)
-{
- return unicode >= 0x3131 && unicode <= 0x3163;
-}
-
-bool Hangul::isMedial(HangulMedialIndex vowel)
-{
- return vowel >= HANGUL_MEDIAL_A && vowel <= HANGUL_MEDIAL_I;
-}
-
-bool Hangul::isFinal(HangulFinalIndex consonant)
-{
- return consonant >= HANGUL_FINAL_KIYEOK && consonant <= HANGUL_FINAL_HIEUH;
-}
-
-ushort Hangul::findDoubleMedial(HangulMedialIndex vowel)
-{
- return doubleMedialMap.key(vowel, 0);
-}
-
-ushort Hangul::findDoubleFinal(HangulFinalIndex consonant)
-{
- return doubleFinalMap.key(consonant, 0);
-}
-
-// Packs two Hangul Jamo indices into 16-bit integer.
-// The result can be used as a key to the double jamos lookup table.
-// Note: The returned value is not a Unicode character!
-ushort Hangul::packDoubleMedial(HangulMedialIndex a, HangulMedialIndex b)
-{
- Q_ASSERT(isMedial(a));
- Q_ASSERT(isMedial(b));
- return (ushort)a | ((ushort)b << 8);
-}
-
-ushort Hangul::packDoubleFinal(HangulFinalIndex a, HangulFinalIndex b)
-{
- Q_ASSERT(isFinal(a));
- Q_ASSERT(isFinal(b));
- return (ushort)a | ((ushort)b << 8);
-}
-
-void Hangul::unpackDoubleMedial(ushort key, HangulMedialIndex &a, HangulMedialIndex &b)
-{
- a = (HangulMedialIndex)(key & 0xFF);
- b = (HangulMedialIndex)(key >> 8);
- Q_ASSERT(isMedial(a));
- Q_ASSERT(isMedial(b));
-}
-
-void Hangul::unpackDoubleFinal(ushort key, HangulFinalIndex &a, HangulFinalIndex &b)
-{
- a = (HangulFinalIndex)(key & 0xFF);
- b = (HangulFinalIndex)(key >> 8);
- Q_ASSERT(isFinal(a));
- Q_ASSERT(isFinal(b));
-}
-
-QMap<ushort, Hangul::HangulMedialIndex> Hangul::initDoubleMedialMap()
-{
- QMap<ushort, HangulMedialIndex> map;
- map.insert(packDoubleMedial(HANGUL_MEDIAL_O, HANGUL_MEDIAL_A), HANGUL_MEDIAL_WA);
- map.insert(packDoubleMedial(HANGUL_MEDIAL_O, HANGUL_MEDIAL_AE), HANGUL_MEDIAL_WAE);
- map.insert(packDoubleMedial(HANGUL_MEDIAL_O, HANGUL_MEDIAL_I), HANGUL_MEDIAL_OE);
- map.insert(packDoubleMedial(HANGUL_MEDIAL_U, HANGUL_MEDIAL_EO), HANGUL_MEDIAL_WEO);
- map.insert(packDoubleMedial(HANGUL_MEDIAL_U, HANGUL_MEDIAL_E), HANGUL_MEDIAL_WE);
- map.insert(packDoubleMedial(HANGUL_MEDIAL_U, HANGUL_MEDIAL_I), HANGUL_MEDIAL_WI);
- map.insert(packDoubleMedial(HANGUL_MEDIAL_EU, HANGUL_MEDIAL_I), HANGUL_MEDIAL_YI);
- return map;
-}
-
-QMap<ushort, Hangul::HangulFinalIndex> Hangul::initDoubleFinalMap()
-{
- QMap<ushort, HangulFinalIndex> map;
- map.insert(packDoubleFinal(HANGUL_FINAL_KIYEOK, HANGUL_FINAL_SIOS), HANGUL_FINAL_KIYEOK_SIOS);
- map.insert(packDoubleFinal(HANGUL_FINAL_NIEUN, HANGUL_FINAL_CIEUC), HANGUL_FINAL_NIEUN_CIEUC);
- map.insert(packDoubleFinal(HANGUL_FINAL_NIEUN, HANGUL_FINAL_HIEUH), HANGUL_FINAL_NIEUN_HIEUH);
- map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_KIYEOK), HANGUL_FINAL_RIEUL_KIYEOK);
- map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_MIEUM), HANGUL_FINAL_RIEUL_MIEUM);
- map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_PIEUP), HANGUL_FINAL_RIEUL_PIEUP);
- map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_SIOS), HANGUL_FINAL_RIEUL_SIOS);
- map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_THIEUTH), HANGUL_FINAL_RIEUL_THIEUTH);
- map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_PHIEUPH), HANGUL_FINAL_RIEUL_PHIEUPH);
- map.insert(packDoubleFinal(HANGUL_FINAL_RIEUL, HANGUL_FINAL_HIEUH), HANGUL_FINAL_RIEUL_HIEUH);
- map.insert(packDoubleFinal(HANGUL_FINAL_PIEUP, HANGUL_FINAL_SIOS), HANGUL_FINAL_PIEUP_SIOS);
- map.insert(packDoubleFinal(HANGUL_FINAL_SIOS, HANGUL_FINAL_SIOS), HANGUL_FINAL_SSANGSIOS);
- return map;
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/hangul.h b/src/virtualkeyboard/hangul.h
deleted file mode 100644
index e30a659a..00000000
--- a/src/virtualkeyboard/hangul.h
+++ /dev/null
@@ -1,136 +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 HANGUL_H
-#define HANGUL_H
-
-#include <QString>
-#include <QList>
-#include <QMap>
-
-namespace QtVirtualKeyboard {
-
-class Hangul
-{
- Q_DISABLE_COPY(Hangul)
-
- enum HangulMedialIndex { // VIndex Letter Jungseong Double Jamo
- // ----------------------------------------------------------------------
- HANGUL_MEDIAL_A, // 0 314F 1161
- HANGUL_MEDIAL_AE, // 1 3150 1162
- HANGUL_MEDIAL_YA, // 2 3151 1163
- HANGUL_MEDIAL_YAE, // 3 3152 1164
- HANGUL_MEDIAL_EO, // 4 3153 1165
- HANGUL_MEDIAL_E, // 5 3154 1166
- HANGUL_MEDIAL_YEO, // 6 3155 1167
- HANGUL_MEDIAL_YE, // 7 3156 1168
- HANGUL_MEDIAL_O, // 8 3157 1169
- HANGUL_MEDIAL_WA, // 9 3158 116A 3157+314F
- HANGUL_MEDIAL_WAE, // 10 3159 116B 3157+3150
- HANGUL_MEDIAL_OE, // 11 315A 116C 3157+3163
- HANGUL_MEDIAL_YO, // 12 315B 116D
- HANGUL_MEDIAL_U, // 13 315C 116E
- HANGUL_MEDIAL_WEO, // 14 315D 116F 315C+3153
- HANGUL_MEDIAL_WE, // 15 315E 1170 315C+3154
- HANGUL_MEDIAL_WI, // 16 315F 1171 315C+3163
- HANGUL_MEDIAL_YU, // 17 3160 1172
- HANGUL_MEDIAL_EU, // 18 3161 1173
- HANGUL_MEDIAL_YI, // 19 3162 1174 3161+3163
- HANGUL_MEDIAL_I // 20 3163 1175
- };
-
- enum HangulFinalIndex { // TIndex Letter Jongseong Double Jamo
- // ----------------------------------------------------------------------
- HANGUL_FINAL_NONE, // 0 n/a n/a
- HANGUL_FINAL_KIYEOK, // 1 3131 11A8
- HANGUL_FINAL_SSANGKIYEOK, // 2 3132 11A9
- HANGUL_FINAL_KIYEOK_SIOS, // 3 3133 11AA 3131+3145
- HANGUL_FINAL_NIEUN, // 4 3134 11AB
- HANGUL_FINAL_NIEUN_CIEUC, // 5 3135 11AC 3134+3148
- HANGUL_FINAL_NIEUN_HIEUH, // 6 3136 11AD 3134+314E
- HANGUL_FINAL_TIKEUT, // 7 3137 11AE
- HANGUL_FINAL_RIEUL, // 8 3139 11AF
- HANGUL_FINAL_RIEUL_KIYEOK, // 9 313A 11B0 3139+3131
- HANGUL_FINAL_RIEUL_MIEUM, // 10 313B 11B1 3139+3141
- HANGUL_FINAL_RIEUL_PIEUP, // 11 313C 11B2 3139+3142
- HANGUL_FINAL_RIEUL_SIOS, // 12 313D 11B3 3139+3145
- HANGUL_FINAL_RIEUL_THIEUTH, // 13 313E 11B4 3139+314C
- HANGUL_FINAL_RIEUL_PHIEUPH, // 14 313F 11B5 3139+314D
- HANGUL_FINAL_RIEUL_HIEUH, // 15 3140 11B6 3139+314E
- HANGUL_FINAL_MIEUM, // 16 3141 11B7
- HANGUL_FINAL_PIEUP, // 17 3142 11B8
- HANGUL_FINAL_PIEUP_SIOS, // 18 3144 11B9 3142+3145
- HANGUL_FINAL_SIOS, // 19 3145 11BA
- HANGUL_FINAL_SSANGSIOS, // 20 3146 11BB 3145+3145
- HANGUL_FINAL_IEUNG, // 21 3147 11BC
- HANGUL_FINAL_CIEUC, // 22 3148 11BD
- HANGUL_FINAL_CHIEUCH, // 23 314A 11BE
- HANGUL_FINAL_KHIEUKH, // 24 314B 11BF
- HANGUL_FINAL_THIEUTH, // 25 314C 11C0
- HANGUL_FINAL_PHIEUPH, // 26 314D 11C1
- HANGUL_FINAL_HIEUH // 27 314E 11C2
- };
-
- Hangul();
-
-public:
- static QString decompose(const QString &source);
- static QString compose(const QString &source);
- static bool isJamo(const ushort &unicode);
-
-private:
- static bool isMedial(HangulMedialIndex vowel);
- static bool isFinal(HangulFinalIndex consonant);
- static ushort findDoubleMedial(HangulMedialIndex vowel);
- static ushort findDoubleFinal(HangulFinalIndex consonant);
- static ushort packDoubleMedial(HangulMedialIndex a, HangulMedialIndex b);
- static ushort packDoubleFinal(HangulFinalIndex a, HangulFinalIndex b);
- static void unpackDoubleMedial(ushort key, HangulMedialIndex &a, HangulMedialIndex &b);
- static void unpackDoubleFinal(ushort key, HangulFinalIndex &a, HangulFinalIndex &b);
- static QMap<ushort, HangulMedialIndex> initDoubleMedialMap();
- static QMap<ushort, HangulFinalIndex> initDoubleFinalMap();
-
- static const QList<ushort> initials;
- static const QList<ushort> finals;
- static const QMap<ushort, HangulMedialIndex> doubleMedialMap;
- static const QMap<ushort, HangulFinalIndex> doubleFinalMap;
- static const int SBase;
- static const int LBase;
- static const int VBase;
- static const int TBase;
- static const int LCount;
- static const int VCount;
- static const int TCount;
- static const int NCount;
- static const int SCount;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/hangulinputmethod.cpp b/src/virtualkeyboard/hangulinputmethod.cpp
deleted file mode 100644
index 3baf8305..00000000
--- a/src/virtualkeyboard/hangulinputmethod.cpp
+++ /dev/null
@@ -1,101 +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 "hangulinputmethod.h"
-#include "inputcontext.h"
-#include "hangul.h"
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::HangulInputMethod
- \internal
-*/
-
-HangulInputMethod::HangulInputMethod(QObject *parent) :
- AbstractInputMethod(*new AbstractInputMethodPrivate(), parent)
-{
-}
-
-HangulInputMethod::~HangulInputMethod()
-{
-}
-
-QList<InputEngine::InputMode> HangulInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale)
- return QList<InputEngine::InputMode>() << InputEngine::Hangul;
-}
-
-bool HangulInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale)
- Q_UNUSED(inputMode)
- return true;
-}
-
-bool HangulInputMethod::setTextCase(InputEngine::TextCase textCase)
-{
- Q_UNUSED(textCase)
- return true;
-}
-
-bool HangulInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_UNUSED(modifiers)
- InputContext *ic = inputContext();
- bool accept = false;
- int cursorPosition = ic->cursorPosition();
- if (ic->cursorPosition() > 0) {
- 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) {
- ic->commit(Hangul::compose(hangul.left(length - 1)), -contextLength, contextLength);
- accept = true;
- }
- } else if (!text.isEmpty() && Hangul::isJamo(text.at(0).unicode())) {
- QString hangul = Hangul::compose(ic->surroundingText().mid(cursorPosition - 1, 1) + text);
- ic->commit(hangul, -1, 1);
- accept = true;
- }
- }
- return accept;
-}
-
-void HangulInputMethod::reset()
-{
-}
-
-void HangulInputMethod::update()
-{
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/hangulinputmethod.h b/src/virtualkeyboard/hangulinputmethod.h
deleted file mode 100644
index 2a59528f..00000000
--- a/src/virtualkeyboard/hangulinputmethod.h
+++ /dev/null
@@ -1,59 +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 HANGULINPUTMETHOD_H
-#define HANGULINPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-class HangulInputMethodPrivate;
-
-class HangulInputMethod : public AbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(HangulInputMethod)
-public:
- explicit HangulInputMethod(QObject *parent = 0);
- ~HangulInputMethod();
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- void reset();
- void update();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // HANGULINPUTMETHOD_H
diff --git a/src/virtualkeyboard/hunspellinputmethod.cpp b/src/virtualkeyboard/hunspellinputmethod.cpp
deleted file mode 100644
index 87134162..00000000
--- a/src/virtualkeyboard/hunspellinputmethod.cpp
+++ /dev/null
@@ -1,351 +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 "hunspellinputmethod_p.h"
-#include "inputcontext.h"
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::HunspellInputMethod
- \internal
-*/
-
-HunspellInputMethod::HunspellInputMethod(HunspellInputMethodPrivate &dd, QObject *parent) :
- AbstractInputMethod(dd, parent)
-{
-}
-
-HunspellInputMethod::HunspellInputMethod(QObject *parent) :
- AbstractInputMethod(*new HunspellInputMethodPrivate(this), parent)
-{
-}
-
-HunspellInputMethod::~HunspellInputMethod()
-{
-}
-
-QList<InputEngine::InputMode> HunspellInputMethod::inputModes(const QString &locale)
-{
- QList<InputEngine::InputMode> result;
- switch (QLocale(locale).script()) {
- case QLocale::GreekScript:
- result.append(InputEngine::Greek);
- break;
- case QLocale::CyrillicScript:
- result.append(InputEngine::Cyrillic);
- break;
- case QLocale::ArabicScript:
- result.append(InputEngine::Arabic);
- break;
- case QLocale::HebrewScript:
- result.append(InputEngine::Hebrew);
- break;
- default:
- break;
- }
- result.append(InputEngine::Latin);
- result.append(InputEngine::Numeric);
- return result;
-}
-
-bool HunspellInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
-{
- Q_UNUSED(inputMode)
- Q_D(HunspellInputMethod);
- return d->createHunspell(locale);
-}
-
-bool HunspellInputMethod::setTextCase(InputEngine::TextCase textCase)
-{
- Q_UNUSED(textCase)
- return true;
-}
-
-bool HunspellInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_D(HunspellInputMethod);
- InputContext *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:
- if (!d->word.isEmpty()) {
- d->word.remove(d->word.length() - 1, 1);
- ic->setPreeditText(d->word);
- if (d->updateSuggestions()) {
- emit selectionListChanged(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::WordCandidateList, d->activeWordIndex);
- }
- 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);
- bool addToWord = d->isValidInputChar(c) && (!d->word.isEmpty() || !d->isJoiner(c));
- if (addToWord) {
- /* Automatic space insertion. */
- if (d->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()) {
- ic->commit(" ");
- }
- }
- }
- /* 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 = d->word.isEmpty();
- d->word.append(text);
- ic->setPreeditText(d->word);
- d->ignoreUpdate = false;
- if (d->updateSuggestions()) {
- emit selectionListChanged(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::WordCandidateList, d->activeWordIndex);
- }
- accept = true;
- } else if (text.length() > 1) {
- bool addSpace = !d->word.isEmpty() || d->autoSpaceAllowed;
- update();
- d->autoSpaceAllowed = true;
- if (addSpace && d->isAutoSpaceAllowed())
- ic->commit(" ");
- ic->commit(text);
- d->autoSpaceAllowed = addSpace;
- accept = true;
- } else {
- update();
- inputContext()->sendKeyClick(key, text, modifiers);
- d->autoSpaceAllowed = true;
- accept = true;
- }
- }
- break;
- }
- return accept;
-}
-
-QList<SelectionListModel::Type> HunspellInputMethod::selectionLists()
-{
- Q_D(const HunspellInputMethod);
- Qt::InputMethodHints inputMethodHints = inputContext()->inputMethodHints();
- if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded || inputMethodHints.testFlag(Qt::ImhNoPredictiveText) || inputMethodHints.testFlag(Qt::ImhHiddenText))
- return QList<SelectionListModel::Type>();
- return QList<SelectionListModel::Type>() << SelectionListModel::WordCandidateList;
-}
-
-int HunspellInputMethod::selectionListItemCount(SelectionListModel::Type type)
-{
- Q_UNUSED(type)
- Q_D(HunspellInputMethod);
- return d->wordCandidates.count();
-}
-
-QVariant HunspellInputMethod::selectionListData(SelectionListModel::Type type, int index, int role)
-{
- QVariant result;
- Q_D(HunspellInputMethod);
- switch (role) {
- case SelectionListModel::DisplayRole:
- result = QVariant(d->wordCandidates.at(index));
- break;
- case SelectionListModel::WordCompletionLengthRole:
- {
- const QString wordCandidate(d->wordCandidates.at(index));
- int wordCompletionLength = wordCandidate.length() - d->word.length();
- result.setValue((wordCompletionLength > 0 && wordCandidate.startsWith(d->word)) ? wordCompletionLength : 0);
- break;
- }
- default:
- result = AbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void HunspellInputMethod::selectionListItemSelected(SelectionListModel::Type type, int index)
-{
- Q_UNUSED(type)
- Q_D(HunspellInputMethod);
- QString finalWord = d->wordCandidates.at(index);
- reset();
- inputContext()->commit(finalWord);
- d->autoSpaceAllowed = true;
-}
-
-bool HunspellInputMethod::reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags)
-{
- Q_D(HunspellInputMethod);
- Q_ASSERT(d->word.isEmpty());
-
- if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded)
- return false;
-
- InputContext *ic = inputContext();
- if (!ic)
- return false;
-
- const QString surroundingText = ic->surroundingText();
- int replaceFrom = 0;
-
- if (reselectFlags.testFlag(InputEngine::WordBeforeCursor)) {
- for (int i = cursorPosition - 1; i >= 0; --i) {
- QChar c = surroundingText.at(i);
- if (!d->isValidInputChar(c))
- break;
- d->word.insert(0, c);
- --replaceFrom;
- }
-
- while (replaceFrom < 0 && d->isJoiner(d->word.at(0))) {
- d->word.remove(0, 1);
- ++replaceFrom;
- }
- }
-
- if (reselectFlags.testFlag(InputEngine::WordAtCursor) && replaceFrom == 0) {
- d->word.clear();
- return false;
- }
-
- if (reselectFlags.testFlag(InputEngine::WordAfterCursor)) {
- for (int i = cursorPosition; i < surroundingText.length(); ++i) {
- QChar c = surroundingText.at(i);
- if (!d->isValidInputChar(c))
- break;
- d->word.append(c);
- }
-
- while (replaceFrom > -d->word.length()) {
- int lastPos = d->word.length() - 1;
- if (!d->isJoiner(d->word.at(lastPos)))
- break;
- d->word.remove(lastPos, 1);
- }
- }
-
- if (d->word.isEmpty())
- return false;
-
- if (reselectFlags.testFlag(InputEngine::WordAtCursor) && replaceFrom == -d->word.length()) {
- d->word.clear();
- return false;
- }
-
- if (d->isJoiner(d->word.at(0))) {
- d->word.clear();
- return false;
- }
-
- if (d->isJoiner(d->word.at(d->word.length() - 1))) {
- d->word.clear();
- return false;
- }
-
- ic->setPreeditText(d->word, QList<QInputMethodEvent::Attribute>(), replaceFrom, d->word.length());
-
- d->autoSpaceAllowed = false;
- if (d->updateSuggestions()) {
- emit selectionListChanged(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::WordCandidateList, d->activeWordIndex);
- }
-
- return true;
-}
-
-void HunspellInputMethod::reset()
-{
- Q_D(HunspellInputMethod);
- d->reset();
-}
-
-void HunspellInputMethod::update()
-{
- Q_D(HunspellInputMethod);
- if (d->ignoreUpdate)
- return;
- if (!d->word.isEmpty()) {
- QString finalWord = d->hasSuggestions() ? d->wordCandidates.at(d->activeWordIndex) : d->word;
- d->reset();
- inputContext()->commit(finalWord);
- }
- d->autoSpaceAllowed = false;
-}
-
-void HunspellInputMethod::updateSuggestions(const QStringList &wordList, int activeWordIndex)
-{
- Q_D(HunspellInputMethod);
- if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded) {
- update();
- return;
- }
- d->wordCandidates.clear();
- d->wordCandidates.append(wordList);
- // Make sure the exact match is up-to-date
- if (!d->word.isEmpty() && !d->wordCandidates.isEmpty() && d->wordCandidates.at(0) != d->word)
- d->wordCandidates.replace(0, d->word);
- d->activeWordIndex = activeWordIndex;
- emit selectionListChanged(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::WordCandidateList, d->activeWordIndex);
-}
-
-void HunspellInputMethod::dictionaryLoadCompleted(bool success)
-{
- Q_D(HunspellInputMethod);
- d->dictionaryState = success ? HunspellInputMethodPrivate::DictionaryReady :
- HunspellInputMethodPrivate::DictionaryNotLoaded;
- emit selectionListsChanged();
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/hunspellinputmethod.h b/src/virtualkeyboard/hunspellinputmethod.h
deleted file mode 100644
index 9faeff5c..00000000
--- a/src/virtualkeyboard/hunspellinputmethod.h
+++ /dev/null
@@ -1,72 +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_H
-#define HUNSPELLINPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-class HunspellInputMethodPrivate;
-
-class HunspellInputMethod : public AbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(HunspellInputMethod)
-protected:
- HunspellInputMethod(HunspellInputMethodPrivate &dd, QObject *parent);
-public:
- explicit HunspellInputMethod(QObject *parent = 0);
- ~HunspellInputMethod();
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- QList<SelectionListModel::Type> selectionLists();
- int selectionListItemCount(SelectionListModel::Type type);
- QVariant selectionListData(SelectionListModel::Type type, int index, int role);
- void selectionListItemSelected(SelectionListModel::Type type, int index);
-
- bool reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags);
-
- void reset();
- void update();
-
-protected slots:
- void updateSuggestions(const QStringList &wordList, int activeWordIndex);
- void dictionaryLoadCompleted(bool success);
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // HUNSPELLINPUTMETHOD_H
diff --git a/src/virtualkeyboard/hunspellinputmethod_p.cpp b/src/virtualkeyboard/hunspellinputmethod_p.cpp
deleted file mode 100644
index 3a97e683..00000000
--- a/src/virtualkeyboard/hunspellinputmethod_p.cpp
+++ /dev/null
@@ -1,213 +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 "hunspellinputmethod_p.h"
-#include "inputcontext.h"
-#include <hunspell/hunspell.h>
-#include <QStringList>
-#include <QDir>
-#include "virtualkeyboarddebug.h"
-#include <QTextCodec>
-#include <QtCore/QLibraryInfo>
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::HunspellInputMethodPrivate
- \internal
-*/
-
-HunspellInputMethodPrivate::HunspellInputMethodPrivate(HunspellInputMethod *q_ptr) :
- AbstractInputMethodPrivate(),
- q_ptr(q_ptr),
- hunspellWorker(new HunspellWorker()),
- locale(),
- word(),
- wordCandidates(),
- activeWordIndex(-1),
- wordCompletionPoint(2),
- ignoreUpdate(false),
- autoSpaceAllowed(false),
- dictionaryState(DictionaryNotLoaded)
-{
- if (hunspellWorker)
- hunspellWorker->start();
-}
-
-HunspellInputMethodPrivate::~HunspellInputMethodPrivate()
-{
-}
-
-bool HunspellInputMethodPrivate::createHunspell(const QString &locale)
-{
- Q_Q(HunspellInputMethod);
- if (!hunspellWorker)
- return false;
- if (this->locale != locale) {
- hunspellWorker->removeAllTasks();
- 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, QString::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;
- }
- return true;
-}
-
-void HunspellInputMethodPrivate::reset()
-{
- if (clearSuggestions()) {
- Q_Q(HunspellInputMethod);
- emit q->selectionListChanged(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList, activeWordIndex);
- }
- word.clear();
- autoSpaceAllowed = false;
-}
-
-bool HunspellInputMethodPrivate::updateSuggestions()
-{
- bool wordCandidateListChanged = false;
- if (!word.isEmpty() && dictionaryState != HunspellInputMethodPrivate::DictionaryNotLoaded) {
- if (hunspellWorker)
- hunspellWorker->removeAllTasksExcept<HunspellLoadDictionaryTask>();
- if (wordCandidates.isEmpty()) {
- wordCandidates.append(word);
- activeWordIndex = 0;
- wordCandidateListChanged = true;
- } else if (wordCandidates.at(0) != word) {
- wordCandidates.replace(0, word);
- activeWordIndex = 0;
- wordCandidateListChanged = true;
- }
- if (word.length() >= wordCompletionPoint) {
- if (hunspellWorker) {
- QSharedPointer<HunspellWordList> wordList(new HunspellWordList());
- QSharedPointer<HunspellBuildSuggestionsTask> buildSuggestionsTask(new HunspellBuildSuggestionsTask());
- buildSuggestionsTask->word = word;
- buildSuggestionsTask->wordList = wordList;
- buildSuggestionsTask->autoCorrect = false;
- hunspellWorker->addTask(buildSuggestionsTask);
- QSharedPointer<HunspellUpdateSuggestionsTask> updateSuggestionsTask(new HunspellUpdateSuggestionsTask());
- updateSuggestionsTask->wordList = wordList;
- Q_Q(HunspellInputMethod);
- q->connect(updateSuggestionsTask.data(), SIGNAL(updateSuggestions(QStringList, int)), SLOT(updateSuggestions(QStringList, int)));
- hunspellWorker->addTask(updateSuggestionsTask);
- }
- } else if (wordCandidates.length() > 1) {
- wordCandidates.clear();
- wordCandidates.append(word);
- activeWordIndex = 0;
- wordCandidateListChanged = true;
- }
- } else {
- wordCandidateListChanged = clearSuggestions();
- }
- return wordCandidateListChanged;
-}
-
-bool HunspellInputMethodPrivate::clearSuggestions()
-{
- if (hunspellWorker)
- hunspellWorker->removeAllTasksExcept<HunspellLoadDictionaryTask>();
- if (wordCandidates.isEmpty())
- return false;
- wordCandidates.clear();
- activeWordIndex = -1;
- return true;
-}
-
-bool HunspellInputMethodPrivate::hasSuggestions() const
-{
- return !wordCandidates.isEmpty();
-}
-
-bool HunspellInputMethodPrivate::isAutoSpaceAllowed() const
-{
- Q_Q(const HunspellInputMethod);
- if (!autoSpaceAllowed)
- return false;
- if (q->inputEngine()->inputMode() == InputEngine::Numeric)
- return false;
- InputContext *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;
- return false;
-}
-
-bool HunspellInputMethodPrivate::isJoiner(const QChar &c) const
-{
- if (c.isPunct() || c.isSymbol()) {
- Q_Q(const HunspellInputMethod);
- InputContext *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;
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/hunspellinputmethod_p.h b/src/virtualkeyboard/hunspellinputmethod_p.h
deleted file mode 100644
index a73273b2..00000000
--- a/src/virtualkeyboard/hunspellinputmethod_p.h
+++ /dev/null
@@ -1,75 +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
-
-#include "hunspellinputmethod.h"
-#include "hunspellworker.h"
-
-namespace QtVirtualKeyboard {
-
-class HunspellInputMethodPrivate : public AbstractInputMethodPrivate
-{
- 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 hasSuggestions() const;
- bool isAutoSpaceAllowed() const;
- bool isValidInputChar(const QChar &c) const;
- bool isJoiner(const QChar &c) const;
-
- HunspellInputMethod *q_ptr;
- QScopedPointer<HunspellWorker> hunspellWorker;
- QString locale;
- QString word;
- QStringList wordCandidates;
- int activeWordIndex;
- int wordCompletionPoint;
- bool ignoreUpdate;
- bool autoSpaceAllowed;
- DictionaryState dictionaryState;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // HUNSPELLINPUTMETHOD_P_H
diff --git a/src/virtualkeyboard/hunspellworker.cpp b/src/virtualkeyboard/hunspellworker.cpp
deleted file mode 100644
index fee4b939..00000000
--- a/src/virtualkeyboard/hunspellworker.cpp
+++ /dev/null
@@ -1,321 +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 "hunspellworker.h"
-#include "virtualkeyboarddebug.h"
-#include <QVector>
-#include <QTextCodec>
-#include <QFileInfo>
-#include <QRegularExpression>
-#include <QTime>
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::HunspellTask
- \internal
-*/
-
-/*!
- \class QtVirtualKeyboard::HunspellWordList
- \internal
-*/
-
-/*!
- \class QtVirtualKeyboard::HunspellLoadDictionaryTask
- \internal
-*/
-
-HunspellLoadDictionaryTask::HunspellLoadDictionaryTask(const QString &locale, const QStringList &searchPaths) :
- HunspellTask(),
- hunspellPtr(0),
- locale(locale),
- searchPaths(searchPaths)
-{
-}
-
-void HunspellLoadDictionaryTask::run()
-{
- Q_ASSERT(hunspellPtr != 0);
-
- VIRTUALKEYBOARD_DEBUG() << "HunspellLoadDictionaryTask::run(): locale:" << locale;
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
-
- if (*hunspellPtr) {
- Hunspell_destroy(*hunspellPtr);
- *hunspellPtr = 0;
- }
-
- 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 QTextCodec.
- */
- if (!QTextCodec::codecForName(Hunspell_get_dic_encoding(*hunspellPtr))) {
- qWarning() << "The Hunspell dictionary" << dicPath << "cannot be used because it uses an unknown text codec" << QString(Hunspell_get_dic_encoding(*hunspellPtr));
- Hunspell_destroy(*hunspellPtr);
- *hunspellPtr = 0;
- }
- }
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- VIRTUALKEYBOARD_DEBUG() << "HunspellLoadDictionaryTask::run(): time:" << perf.elapsed() << "ms";
-#endif
- } else {
- VIRTUALKEYBOARD_DEBUG() << "Hunspell dictionary is missing for" << locale << ". Search paths" << searchPaths;
- }
-
- emit completed(*hunspellPtr != 0);
-}
-
-/*!
- \class QtVirtualKeyboard::HunspellBuildSuggestionsTask
- \internal
-*/
-
-void HunspellBuildSuggestionsTask::run()
-{
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
-
- wordList->list.append(word);
- wordList->index = 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.
- */
- textCodec = QTextCodec::codecForName(Hunspell_get_dic_encoding(hunspell));
- if (!textCodec)
- return;
-
- char **slst = 0;
- int n = Hunspell_suggest(hunspell, &slst, textCodec->fromUnicode(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->list.length();
- int lastWordCompletionIndex = firstWordCompletionIndex;
- bool suggestCapitalization = false;
- for (int i = 0; i < n; i++) {
- QString wordCandidate(textCodec->toUnicode(slst[i]));
- wordCandidate.replace(QChar(0x2019), '\'');
- if (wordCandidate.compare(word) != 0) {
- QString normalizedWordCandidate = removeAccentsAndDiacritics(wordCandidate);
- /* Prioritize word Capitalization */
- if (!suggestCapitalization && !wordCandidate.compare(word, Qt::CaseInsensitive)) {
- wordList->list.insert(1, wordCandidate);
- lastWordCompletionIndex++;
- suggestCapitalization = true;
- /* Prioritize word completions, missing punctuation or missing accents */
- } else if (normalizedWordCandidate.startsWith(word) ||
- wordCandidate.contains(QChar('\''))) {
- wordList->list.insert(lastWordCompletionIndex++, wordCandidate);
- } else {
- wordList->list.append(wordCandidate);
- }
- }
- }
- /* Prioritize words with missing spaces next to word completions.
- */
- for (int i = lastWordCompletionIndex; i < wordList->list.length(); i++) {
- if (QString(wordList->list.at(i)).replace(" ", "").compare(word) == 0) {
- if (i != lastWordCompletionIndex) {
- wordList->list.move(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->list.length() > 1 && (!spellCheck(word) || suggestCapitalization)) {
- if (lastWordCompletionIndex > firstWordCompletionIndex || levenshteinDistance(word, wordList->list.at(firstWordCompletionIndex)) < 3)
- wordList->index = firstWordCompletionIndex;
- }
- }
- Hunspell_free_list(hunspell, &slst, n);
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- VIRTUALKEYBOARD_DEBUG() << "HunspellBuildSuggestionsTask::run(): time:" << perf.elapsed() << "ms";
-#endif
-}
-
-bool HunspellBuildSuggestionsTask::spellCheck(const QString &word)
-{
- if (!hunspell)
- return false;
- if (word.contains(QRegularExpression("[0-9]")))
- return true;
- return Hunspell_spell(hunspell, textCodec->fromUnicode(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();
- QVector<int> v0(t.length() + 1);
- QVector<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->list, wordList->index);
-}
-
-/*!
- \class QtVirtualKeyboard::HunspellWorker
- \internal
-*/
-
-HunspellWorker::HunspellWorker(QObject *parent) :
- QThread(parent),
- taskSema(),
- taskLock(),
- hunspell(0)
-{
- abort = false;
-}
-
-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::run()
-{
- while (!abort) {
- taskSema.acquire();
- if (abort)
- break;
- 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;
- currentTask->run();
- }
- }
- if (hunspell) {
- Hunspell_destroy(hunspell);
- hunspell = 0;
- }
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/hunspellworker.h b/src/virtualkeyboard/hunspellworker.h
deleted file mode 100644
index ff423595..00000000
--- a/src/virtualkeyboard/hunspellworker.h
+++ /dev/null
@@ -1,155 +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_H
-#define HUNSPELLWORKER_H
-
-#include <QThread>
-#include <QSemaphore>
-#include <QMutex>
-#include <QStringList>
-#include <QSharedPointer>
-#include <hunspell/hunspell.h>
-
-QT_BEGIN_NAMESPACE
-class QTextCodec;
-QT_END_NAMESPACE
-
-namespace QtVirtualKeyboard {
-
-class HunspellTask : public QObject
-{
- Q_OBJECT
-public:
- explicit HunspellTask(QObject *parent = 0) :
- QObject(parent),
- hunspell(0)
- {}
-
- virtual void run() = 0;
-
- Hunhandle *hunspell;
-};
-
-class HunspellLoadDictionaryTask : public HunspellTask
-{
- Q_OBJECT
-public:
- explicit HunspellLoadDictionaryTask(const QString &locale, const QStringList &searchPaths);
-
- void run();
-
-signals:
- void completed(bool success);
-
-public:
- Hunhandle **hunspellPtr;
- const QString locale;
- const QStringList searchPaths;
-};
-
-class HunspellWordList
-{
-public:
- HunspellWordList() :
- list(),
- index(-1)
- {}
-
- QStringList list;
- int index;
-};
-
-class HunspellBuildSuggestionsTask : public HunspellTask
-{
- Q_OBJECT
- const QTextCodec *textCodec;
-public:
- QString word;
- QSharedPointer<HunspellWordList> wordList;
- bool autoCorrect;
-
- void run();
- bool spellCheck(const QString &word);
- int levenshteinDistance(const QString &s, const QString &t);
- QString removeAccentsAndDiacritics(const QString& s);
-};
-
-class HunspellUpdateSuggestionsTask : public HunspellTask
-{
- Q_OBJECT
-public:
- QSharedPointer<HunspellWordList> wordList;
-
- void run();
-
-signals:
- void updateSuggestions(const QStringList &wordList, int activeWordIndex);
-};
-
-class HunspellWorker : public QThread
-{
- Q_OBJECT
-public:
- explicit HunspellWorker(QObject *parent = 0);
- ~HunspellWorker();
-
- void addTask(QSharedPointer<HunspellTask> task);
- void removeAllTasks();
-
- template <class X>
- void removeAllTasksExcept() {
- QMutexLocker guard(&taskLock);
- for (int i = 0; i < taskList.size();) {
- QSharedPointer<X> task(taskList[i].objectCast<X>());
- if (!task)
- taskList.removeAt(i);
- else
- i++;
- }
- }
-
-protected:
- void run();
-
-private:
- void createHunspell();
-
-private:
- friend class HunspellLoadDictionaryTask;
- QList<QSharedPointer<HunspellTask> > taskList;
- QSemaphore taskSema;
- QMutex taskLock;
- Hunhandle *hunspell;
- QBasicAtomicInt abort;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // HUNSPELLWORKER_H
diff --git a/src/virtualkeyboard/import/import.pro b/src/virtualkeyboard/import/import.pro
deleted file mode 100644
index d76bb91e..00000000
--- a/src/virtualkeyboard/import/import.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGETPATH = QtQuick/VirtualKeyboard
-QML_FILES += plugins.qmltypes
-
-load(qml_module)
-
-# qmltypes target
-!cross_compile:if(build_pass|!debug_and_release) {
- qtPrepareTool(QMLPLUGINDUMP, qmlplugindump)
-
- qmltypes.commands = QT_IM_MODULE=qtvirtualkeyboard $$QMLPLUGINDUMP -defaultplatform -nonrelocatable QtQuick.VirtualKeyboard 2.3 > $$PWD/plugins.qmltypes
- QMAKE_EXTRA_TARGETS += qmltypes
-}
diff --git a/src/virtualkeyboard/import/plugins.qmltypes b/src/virtualkeyboard/import/plugins.qmltypes
deleted file mode 100644
index f2977658..00000000
--- a/src/virtualkeyboard/import/plugins.qmltypes
+++ /dev/null
@@ -1,1999 +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 QtQuick.VirtualKeyboard 2.1'
-
-Module {
- dependencies: [
- "Qt.labs.folderlistmodel 2.1",
- "QtQuick.Layouts 1.1",
- "QtQuick.VirtualKeyboard.Styles 1.1"
- ]
- 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: "uppercased"; type: "bool" }
- 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 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: "uppercased"; type: "bool" }
- 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: "enabled"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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 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: "enabled"; 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 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: "enabled"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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.2"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.2"]
- exportMetaObjectRevisions: [2]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_10"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 1.3"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.3"]
- exportMetaObjectRevisions: [3]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_10"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.1"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_10"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.0"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_10"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 1.0"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_10"; isReadonly: true; isPointer: true }
- }
- 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: "enabled"; 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 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: "enabled"; 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.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: "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" }
- Property { name: "preferNumbers"; type: "bool" }
- Property { name: "layout"; type: "string" }
- Property { name: "layoutType"; type: "string" }
- Property { name: "active"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "handwritingMode"; type: "bool" }
- Property { name: "fullScreenHandwritingMode"; type: "bool" }
- Property { name: "symbolMode"; 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: "style"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "soundEffect"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Method { name: "initDefaultInputMethod"; type: "QVariant" }
- Method { name: "updateInputMethod"; type: "QVariant" }
- Method { name: "updateLayout"; type: "QVariant" }
- Method { name: "updateDefaultLocale"; type: "QVariant" }
- Method { name: "updateAvailableLocaleIndices"; 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: "isValidLocale"
- type: "QVariant"
- Parameter { name: "localeNameOrIndex"; type: "QVariant" }
- }
- Method {
- name: "getLayoutFile"
- 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" }
- }
- 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" }
- Property { name: "preferNumbers"; type: "bool" }
- Property { name: "layout"; type: "string" }
- Property { name: "layoutType"; type: "string" }
- Property { name: "active"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "handwritingMode"; type: "bool" }
- Property { name: "fullScreenHandwritingMode"; type: "bool" }
- Property { name: "symbolMode"; 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: "style"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "soundEffect"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Method { name: "initDefaultInputMethod"; type: "QVariant" }
- Method { name: "updateInputMethod"; type: "QVariant" }
- Method { name: "updateLayout"; type: "QVariant" }
- Method { name: "updateDefaultLocale"; type: "QVariant" }
- Method { name: "updateAvailableLocaleIndices"; 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: "isValidLocale"
- type: "QVariant"
- Parameter { name: "localeNameOrIndex"; type: "QVariant" }
- }
- Method {
- name: "getLayoutFile"
- 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" }
- }
- 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/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/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: "QQuickItem"
- 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" }
- Property { name: "active"; type: "bool" }
- Property { name: "source"; type: "QUrl" }
- Property { name: "sourceComponent"; type: "QQmlComponent"; isPointer: true }
- Property { name: "item"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "progress"; type: "double"; isReadonly: true }
- Property { name: "asynchronous"; type: "bool" }
- Signal { name: "loaded" }
- Method {
- name: "setSource"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Property { name: "implicitWidth"; type: "double"; isReadonly: true }
- Property { name: "implicitHeight"; type: "double"; isReadonly: true }
- Signal { name: "implicitWidthChanged2"; revision: 1 }
- Signal { name: "implicitHeightChanged2"; revision: 1 }
- }
- Component {
- prototype: "QQuickItem"
- 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" }
- Property { name: "active"; type: "bool" }
- Property { name: "source"; type: "QUrl" }
- Property { name: "sourceComponent"; type: "QQmlComponent"; isPointer: true }
- Property { name: "item"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "progress"; type: "double"; isReadonly: true }
- Property { name: "asynchronous"; type: "bool" }
- Signal { name: "loaded" }
- Method {
- name: "setSource"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Property { name: "implicitWidth"; type: "double"; isReadonly: true }
- Property { name: "implicitHeight"; type: "double"; isReadonly: true }
- Signal { name: "implicitWidthChanged2"; revision: 1 }
- Signal { name: "implicitHeightChanged2"; revision: 1 }
- }
- 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: "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: "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: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- }
- 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: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- }
- 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: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- }
- 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: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- }
- 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: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- }
- 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: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- }
- 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: "enabled"; 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: "QtVirtualKeyboard::InputMethod"
- 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" }
- }
- }
- Component {
- prototype: "QtVirtualKeyboard::InputMethod"
- 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" }
- }
- }
- 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: "enabled"; 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: "enabled"; 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/SelectionControl 2.1"
- exports: ["QtQuick.VirtualKeyboard/SelectionControl 2.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- defaultProperty: "data"
- Property { name: "handleIsMoving"; type: "bool" }
- }
- 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: "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/ShiftKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/ShiftKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "capsLock"; type: "bool" }
- Property { name: "shift"; 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: "enabled"; 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 1.0"
- exports: ["QtQuick.VirtualKeyboard/ShiftKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "capsLock"; type: "bool" }
- Property { name: "shift"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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: "enabled"; 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.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" }
- Property { name: "available"; type: "bool"; isReadonly: true }
- Property { name: "contextType"; type: "string" }
- Property { name: "context"; type: "QQmlV4Handle"; isReadonly: true }
- Property { name: "canvasSize"; type: "QSizeF" }
- Property { name: "tileSize"; type: "QSize" }
- Property { name: "canvasWindow"; type: "QRectF" }
- Property { name: "renderTarget"; type: "RenderTarget" }
- Property { name: "renderStrategy"; type: "RenderStrategy" }
- Signal {
- name: "paint"
- Parameter { name: "region"; type: "QRect" }
- }
- Signal { name: "painted" }
- Signal { name: "imageLoaded" }
- Method {
- name: "loadImage"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "unloadImage"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "isImageLoaded"
- type: "bool"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "isImageLoading"
- type: "bool"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "isImageError"
- type: "bool"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "getContext"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "requestAnimationFrame"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "cancelRequestAnimationFrame"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method { name: "requestPaint" }
- Method {
- name: "markDirty"
- Parameter { name: "dirtyRect"; type: "QRectF" }
- }
- Method { name: "markDirty" }
- Method {
- name: "save"
- type: "bool"
- Parameter { name: "filename"; type: "string" }
- }
- Method {
- name: "toDataURL"
- type: "string"
- Parameter { name: "type"; type: "string" }
- }
- Method { name: "toDataURL"; type: "string" }
- }
- Component {
- prototype: "QQuickItem"
- 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" }
- }
- Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true }
- Property { name: "minimumTouchPoints"; type: "int" }
- Property { name: "maximumTouchPoints"; type: "int" }
- Property { name: "mouseEnabled"; type: "bool" }
- Signal {
- name: "pressed"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- Signal {
- name: "updated"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- Signal {
- name: "released"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- Signal {
- name: "canceled"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- Signal {
- name: "gestureStarted"
- Parameter { name: "gesture"; type: "QQuickGrabGestureEvent"; isPointer: true }
- }
- Signal {
- name: "touchUpdated"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- }
- 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: "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" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/WordCandidatePopupList 2.0"
- exports: ["QtQuick.VirtualKeyboard/WordCandidatePopupList 2.0"]
- exportMetaObjectRevisions: [0]
- 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: "flipVertical"; type: "bool"; isReadonly: true }
- Property { name: "highlightMoveVelocity"; type: "double" }
- Property { name: "highlightResizeVelocity"; type: "double" }
- Property { name: "highlightResizeDuration"; type: "int" }
- Property { name: "spacing"; type: "double" }
- Property { name: "orientation"; type: "Orientation" }
- Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true }
- Property { name: "currentSection"; type: "string"; isReadonly: true }
- Property { name: "snapMode"; type: "SnapMode" }
- Property { name: "headerPositioning"; revision: 2; type: "HeaderPositioning" }
- Property { name: "footerPositioning"; revision: 2; type: "FooterPositioning" }
- Method { name: "incrementCurrentIndex" }
- Method { name: "decrementCurrentIndex" }
- Property { name: "model"; type: "QVariant" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "currentIndex"; type: "int" }
- Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "keyNavigationWraps"; type: "bool" }
- Property { name: "keyNavigationEnabled"; revision: 7; type: "bool" }
- Property { name: "cacheBuffer"; type: "int" }
- Property { name: "displayMarginBeginning"; revision: 2; type: "int" }
- Property { name: "displayMarginEnd"; revision: 2; type: "int" }
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
- Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
- Property { name: "verticalLayoutDirection"; type: "VerticalLayoutDirection" }
- Property { name: "header"; type: "QQmlComponent"; isPointer: true }
- Property { name: "headerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "footer"; type: "QQmlComponent"; isPointer: true }
- Property { name: "footerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "populate"; type: "QQuickTransition"; isPointer: true }
- Property { name: "add"; type: "QQuickTransition"; isPointer: true }
- Property { name: "addDisplaced"; type: "QQuickTransition"; isPointer: true }
- Property { name: "move"; type: "QQuickTransition"; isPointer: true }
- Property { name: "moveDisplaced"; type: "QQuickTransition"; isPointer: true }
- Property { name: "remove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "removeDisplaced"; type: "QQuickTransition"; isPointer: true }
- Property { name: "displaced"; type: "QQuickTransition"; isPointer: true }
- Property { name: "highlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "highlightFollowsCurrentItem"; type: "bool" }
- Property { name: "highlightRangeMode"; type: "HighlightRangeMode" }
- Property { name: "preferredHighlightBegin"; type: "double" }
- Property { name: "preferredHighlightEnd"; type: "double" }
- Property { name: "highlightMoveDuration"; type: "int" }
- Signal { name: "populateTransitionChanged" }
- Signal { name: "addTransitionChanged" }
- Signal { name: "addDisplacedTransitionChanged" }
- Signal { name: "moveTransitionChanged" }
- Signal { name: "moveDisplacedTransitionChanged" }
- Signal { name: "removeTransitionChanged" }
- Signal { name: "removeDisplacedTransitionChanged" }
- Signal { name: "displacedTransitionChanged" }
- Method {
- name: "positionViewAtIndex"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "mode"; type: "int" }
- }
- Method {
- name: "indexAt"
- type: "int"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "itemAt"
- type: "QQuickItem*"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method { name: "positionViewAtBeginning" }
- Method { name: "positionViewAtEnd" }
- Method { name: "forceLayout"; revision: 1 }
- Property { name: "contentHeight"; type: "double" }
- Property { name: "contentX"; type: "double" }
- Property { name: "contentY"; type: "double" }
- Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "topMargin"; type: "double" }
- Property { name: "bottomMargin"; type: "double" }
- Property { name: "originY"; type: "double"; isReadonly: true }
- Property { name: "leftMargin"; type: "double" }
- Property { name: "rightMargin"; type: "double" }
- Property { name: "originX"; type: "double"; isReadonly: true }
- Property { name: "horizontalVelocity"; type: "double"; isReadonly: true }
- Property { name: "verticalVelocity"; type: "double"; isReadonly: true }
- Property { name: "boundsBehavior"; type: "BoundsBehavior" }
- Property { name: "rebound"; type: "QQuickTransition"; isPointer: true }
- Property { name: "maximumFlickVelocity"; type: "double" }
- Property { name: "flickDeceleration"; type: "double" }
- Property { name: "moving"; type: "bool"; isReadonly: true }
- Property { name: "movingHorizontally"; type: "bool"; isReadonly: true }
- Property { name: "movingVertically"; type: "bool"; isReadonly: true }
- Property { name: "flicking"; type: "bool"; isReadonly: true }
- Property { name: "flickingHorizontally"; type: "bool"; isReadonly: true }
- Property { name: "flickingVertically"; type: "bool"; isReadonly: true }
- Property { name: "dragging"; type: "bool"; isReadonly: true }
- Property { name: "draggingHorizontally"; type: "bool"; isReadonly: true }
- Property { name: "draggingVertically"; type: "bool"; isReadonly: true }
- Property { name: "flickableDirection"; type: "FlickableDirection" }
- Property { name: "interactive"; type: "bool" }
- Property { name: "pressDelay"; type: "int" }
- Property { name: "atXEnd"; type: "bool"; isReadonly: true }
- Property { name: "atYEnd"; type: "bool"; isReadonly: true }
- Property { name: "atXBeginning"; type: "bool"; isReadonly: true }
- Property { name: "atYBeginning"; type: "bool"; isReadonly: true }
- Property {
- name: "visibleArea"
- type: "QQuickFlickableVisibleArea"
- isReadonly: true
- isPointer: true
- }
- Property { name: "pixelAligned"; type: "bool" }
- Property { name: "flickableData"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "flickableChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
- Signal { name: "isAtBoundaryChanged" }
- Signal { name: "movementStarted" }
- Signal { name: "movementEnded" }
- Signal { name: "flickStarted" }
- Signal { name: "flickEnded" }
- Signal { name: "dragStarted" }
- Signal { name: "dragEnded" }
- Method {
- name: "resizeContent"
- Parameter { name: "w"; type: "double" }
- Parameter { name: "h"; type: "double" }
- Parameter { name: "center"; type: "QPointF" }
- }
- Method { name: "returnToBounds" }
- Method {
- name: "flick"
- Parameter { name: "xVelocity"; type: "double" }
- Parameter { name: "yVelocity"; type: "double" }
- }
- Method { name: "cancelFlick" }
- }
-}
diff --git a/src/virtualkeyboard/import/qmldir b/src/virtualkeyboard/import/qmldir
deleted file mode 100644
index b13824c5..00000000
--- a/src/virtualkeyboard/import/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-module QtQuick.VirtualKeyboard
-typeinfo plugins.qmltypes
-depends QtQuick.Layouts 1.1
-depends QtQuick.VirtualKeyboard.Styles 1.1
-depends Qt.labs.folderlistmodel 2.1
diff --git a/src/virtualkeyboard/inputcontext.cpp b/src/virtualkeyboard/inputcontext.cpp
deleted file mode 100644
index 80739819..00000000
--- a/src/virtualkeyboard/inputcontext.cpp
+++ /dev/null
@@ -1,1205 +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 "inputcontext.h"
-#include "inputengine.h"
-#include "shifthandler.h"
-#include "platforminputcontext.h"
-#include "shadowinputcontext.h"
-#include "virtualkeyboarddebug.h"
-#include "enterkeyaction.h"
-#include "settings.h"
-
-#include <QTextFormat>
-#include <QGuiApplication>
-#include <QtCore/private/qobject_p.h>
-
-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;
-}
-QT_END_NAMESPACE
-
-/*!
- \namespace QtVirtualKeyboard
- \inmodule QtVirtualKeyboard
-
- \brief Namespace for the Qt Virtual Keyboard C++ API.
- \internal
-*/
-
-namespace QtVirtualKeyboard {
-
-class InputContextPrivate : public QObjectPrivate
-{
-public:
- enum StateFlag {
- ReselectEventState = 0x1,
- InputMethodEventState = 0x2,
- KeyEventState = 0x4,
- InputMethodClickState = 0x8,
- SyncShadowInputState = 0x10
- };
- Q_DECLARE_FLAGS(StateFlags, StateFlag)
-
- InputContextPrivate() :
- QObjectPrivate(),
- inputContext(0),
- inputEngine(0),
- shiftHandler(0),
- keyboardRect(),
- previewRect(),
- previewVisible(false),
- animating(false),
- focus(false),
- shift(false),
- capsLock(false),
- cursorPosition(0),
- anchorPosition(0),
- forceAnchorPosition(-1),
- forceCursorPosition(-1),
- inputMethodHints(Qt::ImhNone),
- preeditText(),
- preeditTextAttributes(),
- surroundingText(),
- selectedText(),
- anchorRectangle(),
- cursorRectangle(),
- selectionControlVisible(false),
- anchorRectIntersectsClipRect(false),
- cursorRectIntersectsClipRect(false)
-#ifdef QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
- , activeNavigationKeys()
-#endif
- {
- }
-
- PlatformInputContext *inputContext;
- InputEngine *inputEngine;
- ShiftHandler *shiftHandler;
- QRectF keyboardRect;
- QRectF previewRect;
- bool previewVisible;
- bool animating;
- bool focus;
- bool shift;
- bool capsLock;
- StateFlags stateFlags;
- int cursorPosition;
- int anchorPosition;
- int forceAnchorPosition;
- int forceCursorPosition;
- Qt::InputMethodHints inputMethodHints;
- QString preeditText;
- QList<QInputMethodEvent::Attribute> preeditTextAttributes;
- QString surroundingText;
- QString selectedText;
- QRectF anchorRectangle;
- QRectF cursorRectangle;
- bool selectionControlVisible;
- bool anchorRectIntersectsClipRect;
- bool cursorRectIntersectsClipRect;
-#ifdef QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
- QSet<int> activeNavigationKeys;
-#endif
- QSet<quint32> activeKeys;
- ShadowInputContext shadow;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(InputContextPrivate::StateFlags)
-
-/*!
- \qmltype InputContext
- \instantiates QtVirtualKeyboard::InputContext
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \brief Provides access to an input context.
-
- The InputContext can be accessed as singleton instance.
-*/
-
-/*!
- \class QtVirtualKeyboard::InputContext
- \inmodule QtVirtualKeyboard
- \brief Provides access to an input context.
- \internal
-*/
-
-/*!
- \internal
- Constructs an input context with \a parent as the platform input
- context.
-*/
-InputContext::InputContext(PlatformInputContext *parent) :
- QObject(*new InputContextPrivate(), parent)
-{
- Q_D(InputContext);
- d->inputContext = parent;
- d->shadow.setInputContext(this);
- if (d->inputContext) {
- d->inputContext->setInputContext(this);
- connect(d->inputContext, SIGNAL(focusObjectChanged()), SLOT(onInputItemChanged()));
- }
- d->inputEngine = new InputEngine(this);
- d->shiftHandler = new ShiftHandler(this);
-}
-
-/*!
- \internal
- Destroys the input context and frees all allocated resources.
-*/
-InputContext::~InputContext()
-{
-}
-
-bool InputContext::focus() const
-{
- Q_D(const InputContext);
- return d->focus;
-}
-
-bool InputContext::shift() const
-{
- Q_D(const InputContext);
- return d->shift;
-}
-
-void InputContext::setShift(bool enable)
-{
- Q_D(InputContext);
- if (d->shift != enable) {
- d->shift = enable;
- emit shiftChanged();
- if (!d->capsLock)
- emit uppercaseChanged();
- }
-}
-
-bool InputContext::capsLock() const
-{
- Q_D(const InputContext);
- return d->capsLock;
-}
-
-void InputContext::setCapsLock(bool enable)
-{
- Q_D(InputContext);
- if (d->capsLock != enable) {
- d->capsLock = enable;
- emit capsLockChanged();
- if (!d->shift)
- emit uppercaseChanged();
- }
-}
-
-bool InputContext::uppercase() const
-{
- Q_D(const InputContext);
- return d->shift || d->capsLock;
-}
-
-int InputContext::anchorPosition() const
-{
- Q_D(const InputContext);
- return d->anchorPosition;
-}
-
-int InputContext::cursorPosition() const
-{
- Q_D(const InputContext);
- return d->cursorPosition;
-}
-
-Qt::InputMethodHints InputContext::inputMethodHints() const
-{
- Q_D(const InputContext);
- return d->inputMethodHints;
-}
-
-QString InputContext::preeditText() const
-{
- Q_D(const InputContext);
- return d->preeditText;
-}
-
-void InputContext::setPreeditText(const QString &text, QList<QInputMethodEvent::Attribute> attributes, int replaceFrom, int replaceLength)
-{
- // Add default attributes
- if (!text.isEmpty()) {
- if (!testAttribute(attributes, QInputMethodEvent::TextFormat)) {
- QTextCharFormat textFormat;
- textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, text.length(), textFormat));
- }
- } else {
- addSelectionAttribute(attributes);
- }
-
- sendPreedit(text, attributes, replaceFrom, replaceLength);
-}
-
-QList<QInputMethodEvent::Attribute> InputContext::preeditTextAttributes() const
-{
- Q_D(const InputContext);
- return d->preeditTextAttributes;
-}
-
-QString InputContext::surroundingText() const
-{
- Q_D(const InputContext);
- return d->surroundingText;
-}
-
-QString InputContext::selectedText() const
-{
- Q_D(const InputContext);
- return d->selectedText;
-}
-
-QRectF InputContext::anchorRectangle() const
-{
- Q_D(const InputContext);
- return d->anchorRectangle;
-}
-
-QRectF InputContext::cursorRectangle() const
-{
- Q_D(const InputContext);
- return d->cursorRectangle;
-}
-
-QRectF InputContext::keyboardRectangle() const
-{
- Q_D(const InputContext);
- return d->keyboardRect;
-}
-
-void InputContext::setKeyboardRectangle(QRectF rectangle)
-{
- Q_D(InputContext);
- if (d->keyboardRect != rectangle) {
- d->keyboardRect = rectangle;
- emit keyboardRectangleChanged();
- d->inputContext->emitKeyboardRectChanged();
- }
-}
-
-QRectF InputContext::previewRectangle() const
-{
- Q_D(const InputContext);
- return d->previewRect;
-}
-
-void InputContext::setPreviewRectangle(QRectF rectangle)
-{
- Q_D(InputContext);
- if (d->previewRect != rectangle) {
- d->previewRect = rectangle;
- emit previewRectangleChanged();
- }
-}
-
-bool InputContext::previewVisible() const
-{
- Q_D(const InputContext);
- return d->previewVisible;
-}
-
-void InputContext::setPreviewVisible(bool visible)
-{
- Q_D(InputContext);
- if (d->previewVisible != visible) {
- d->previewVisible = visible;
- emit previewVisibleChanged();
- }
-}
-
-bool InputContext::animating() const
-{
- Q_D(const InputContext);
- return d->animating;
-}
-
-void InputContext::setAnimating(bool animating)
-{
- Q_D(InputContext);
- if (d->animating != animating) {
- VIRTUALKEYBOARD_DEBUG() << "InputContext::setAnimating():" << animating;
- d->animating = animating;
- emit animatingChanged();
- d->inputContext->emitAnimatingChanged();
- }
-}
-
-
-QString InputContext::locale() const
-{
- Q_D(const InputContext);
- return d->inputContext->locale().name();
-}
-
-void InputContext::setLocale(const QString &locale)
-{
- Q_D(InputContext);
- VIRTUALKEYBOARD_DEBUG() << "InputContext::setLocale():" << locale;
- QLocale newLocale(locale);
- if (newLocale != d->inputContext->locale()) {
- d->inputContext->setLocale(newLocale);
- d->inputContext->setInputDirection(newLocale.textDirection());
- emit localeChanged();
- }
-}
-
-/*!
- \internal
-*/
-void InputContext::updateAvailableLocales(const QStringList &availableLocales)
-{
- Settings *settings = Settings::instance();
- if (settings)
- settings->setAvailableLocales(availableLocales);
-}
-
-QObject *InputContext::inputItem() const
-{
- Q_D(const InputContext);
- return d->inputContext ? d->inputContext->focusObject() : 0;
-}
-
-ShiftHandler *InputContext::shiftHandler() const
-{
- Q_D(const InputContext);
- return d->shiftHandler;
-}
-
-InputEngine *InputContext::inputEngine() const
-{
- Q_D(const InputContext);
- return d->inputEngine;
-}
-
-/*!
- \qmlmethod void InputContext::hideInputPanel()
-
- This method hides the input panel. This method should only be called
- when the user initiates the hide, e.g. by pressing a dedicated button
- on the keyboard.
-*/
-/*!
- \fn void QtVirtualKeyboard::InputContext::hideInputPanel()
-
- This method hides the input panel. This method should only be called
- when the user initiates the hide, e.g. by pressing a dedicated button
- on the keyboard.
-*/
-void InputContext::hideInputPanel()
-{
- Q_D(InputContext);
- d->inputContext->hideInputPanel();
-}
-
-/*!
- \qmlmethod void InputContext::sendKeyClick(int key, string text, int modifiers = 0)
-
- Sends a key click event with the given \a key, \a text and \a modifiers to
- the input item that currently has focus.
-*/
-/*!
- Sends a key click event with the given \a key, \a text and \a modifiers to
- the input item that currently has focus.
-*/
-void InputContext::sendKeyClick(int key, const QString &text, int modifiers)
-{
- Q_D(InputContext);
- if (d->focus && d->inputContext) {
- QKeyEvent pressEvent(QEvent::KeyPress, key, Qt::KeyboardModifiers(modifiers), text);
- QKeyEvent releaseEvent(QEvent::KeyRelease, key, Qt::KeyboardModifiers(modifiers), text);
- VIRTUALKEYBOARD_DEBUG() << "InputContext::sendKeyClick():" << key;
-
- d->stateFlags |= InputContextPrivate::KeyEventState;
- d->inputContext->sendKeyEvent(&pressEvent);
- d->inputContext->sendKeyEvent(&releaseEvent);
- if (d->activeKeys.isEmpty())
- d->stateFlags &= ~InputContextPrivate::KeyEventState;
- } else {
- qWarning() << "InputContext::sendKeyClick(): no focus to send key click" << key << text
- << "- QGuiApplication::focusWindow() is:" << QGuiApplication::focusWindow();
- }
-}
-
-/*!
- \qmlmethod void InputContext::commit()
-
- Commits the current pre-edit text.
-*/
-/*!
- \fn void QtVirtualKeyboard::InputContext::commit()
-
- Commits the current pre-edit text.
-*/
-void InputContext::commit()
-{
- Q_D(InputContext);
- QString text = d->preeditText;
- commit(text);
-}
-
-/*!
- \qmlmethod void InputContext::commit(string text, int replaceFrom = 0, int replaceLength = 0)
-
- Commits the final \a text to the input item and optionally
- modifies the text relative to the start of the pre-edit text.
- If \a replaceFrom is non-zero, the \a text replaces the
- contents relative to \a replaceFrom with a length of
- \a replaceLength.
-*/
-/*!
- Commits the final \a text to the input item and optionally
- modifies the text relative to the start of the pre-edit text.
- If \a replaceFrom is non-zero, the \a text replaces the
- contents relative to \a replaceFrom with a length of
- \a replaceLength.
-*/
-void InputContext::commit(const QString &text, int replaceFrom, int replaceLength)
-{
- Q_D(InputContext);
- VIRTUALKEYBOARD_DEBUG() << "InputContext::commit():" << text << replaceFrom << replaceLength;
- bool preeditChanged = !d->preeditText.isEmpty();
- d->preeditText.clear();
- d->preeditTextAttributes.clear();
-
- if (d->inputContext) {
- QList<QInputMethodEvent::Attribute> attributes;
- addSelectionAttribute(attributes);
- QInputMethodEvent inputEvent(QString(), attributes);
- inputEvent.setCommitString(text, replaceFrom, replaceLength);
- d->stateFlags |= InputContextPrivate::InputMethodEventState;
- d->inputContext->sendEvent(&inputEvent);
- d->stateFlags &= ~InputContextPrivate::InputMethodEventState;
- }
-
- if (preeditChanged)
- emit preeditTextChanged();
-}
-
-/*!
- \qmlmethod void InputContext::clear()
-
- Clears the pre-edit text.
-*/
-/*!
- \fn void QtVirtualKeyboard::InputContext::clear()
-
- Clears the pre-edit text.
-*/
-void InputContext::clear()
-{
- Q_D(InputContext);
- bool preeditChanged = !d->preeditText.isEmpty();
- d->preeditText.clear();
- d->preeditTextAttributes.clear();
-
- if (d->inputContext) {
- QList<QInputMethodEvent::Attribute> attributes;
- addSelectionAttribute(attributes);
- QInputMethodEvent event(QString(), attributes);
- d->stateFlags |= InputContextPrivate::InputMethodEventState;
- d->inputContext->sendEvent(&event);
- d->stateFlags &= ~InputContextPrivate::InputMethodEventState;
- }
-
- if (preeditChanged)
- emit preeditTextChanged();
-}
-
-/*!
- \internal
-*/
-bool InputContext::fileExists(const QUrl &fileUrl)
-{
- QString fileName;
- if (fileUrl.scheme() == QLatin1String("qrc")) {
- fileName = QLatin1Char(':') + fileUrl.path();
- } else {
- fileName = fileUrl.toLocalFile();
- }
- return !fileName.isEmpty() && QFile::exists(fileName);
-}
-
-/*!
- \internal
-*/
-bool InputContext::hasEnterKeyAction(QObject *item) const
-{
- return item != 0 && qmlAttachedPropertiesObject<EnterKeyAction>(item, false);
-}
-
-/*!
- \internal
-*/
-void InputContext::setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos)
-{
- QPlatformInputContext::setSelectionOnFocusObject(anchorPos, cursorPos);
-}
-
-/*!
- \internal
-*/
-void InputContext::forceCursorPosition(int anchorPosition, int cursorPosition)
-{
- Q_D(InputContext);
- if (!d->shadow.inputItem())
- return;
- if (!d->inputContext->m_visible)
- return;
- if (d->stateFlags.testFlag(InputContextPrivate::ReselectEventState))
- return;
- if (d->stateFlags.testFlag(InputContextPrivate::SyncShadowInputState))
- return;
-
- VIRTUALKEYBOARD_DEBUG() << "InputContext::forceCursorPosition():" << cursorPosition << "anchorPosition:" << anchorPosition;
- if (!d->preeditText.isEmpty()) {
- d->forceAnchorPosition = -1;
- d->forceCursorPosition = cursorPosition;
- if (cursorPosition > d->cursorPosition)
- d->forceCursorPosition += d->preeditText.length();
- d->inputEngine->update();
- } else {
- d->forceAnchorPosition = anchorPosition;
- d->forceCursorPosition = cursorPosition;
- setPreeditText("");
- if (!d->inputMethodHints.testFlag(Qt::ImhNoPredictiveText) &&
- cursorPosition > 0 && d->selectedText.isEmpty()) {
- d->stateFlags |= InputContextPrivate::ReselectEventState;
- if (d->inputEngine->reselect(cursorPosition, InputEngine::WordAtCursor))
- d->stateFlags |= InputContextPrivate::InputMethodClickState;
- d->stateFlags &= ~InputContextPrivate::ReselectEventState;
- }
- }
-}
-
-bool InputContext::anchorRectIntersectsClipRect() const
-{
- Q_D(const InputContext);
- return d->anchorRectIntersectsClipRect;
-}
-
-bool InputContext::cursorRectIntersectsClipRect() const
-{
- Q_D(const InputContext);
- return d->cursorRectIntersectsClipRect;
-}
-
-bool InputContext::selectionControlVisible() const
-{
- Q_D(const InputContext);
- return d->selectionControlVisible;
-}
-
-ShadowInputContext *InputContext::shadow() const
-{
- Q_D(const InputContext);
- return const_cast<ShadowInputContext *>(&d->shadow);
-}
-
-void InputContext::onInputItemChanged()
-{
- Q_D(InputContext);
- if (!inputItem() && !d->activeKeys.isEmpty()) {
- // After losing keyboard focus it is impossible to track pressed keys
- d->activeKeys.clear();
- d->stateFlags &= ~InputContextPrivate::KeyEventState;
- }
- d->stateFlags &= ~InputContextPrivate::InputMethodClickState;
-
- emit inputItemChanged();
-}
-
-void InputContext::setFocus(bool enable)
-{
- Q_D(InputContext);
- if (d->focus != enable) {
- VIRTUALKEYBOARD_DEBUG() << "InputContext::setFocus():" << enable;
- d->focus = enable;
- emit focusChanged();
- }
- emit focusEditorChanged();
-}
-
-void InputContext::sendPreedit(const QString &text, const QList<QInputMethodEvent::Attribute> &attributes, int replaceFrom, int replaceLength)
-{
- Q_D(InputContext);
- VIRTUALKEYBOARD_DEBUG() << "InputContext::sendPreedit():" << text << replaceFrom << replaceLength;
-
- bool textChanged = d->preeditText != text;
- bool attributesChanged = d->preeditTextAttributes != attributes;
-
- if (textChanged || attributesChanged) {
- d->preeditText = text;
- d->preeditTextAttributes = attributes;
-
- if (d->inputContext) {
- QInputMethodEvent event(text, attributes);
- const bool replace = replaceFrom != 0 || replaceLength > 0;
- if (replace)
- event.setCommitString(QString(), replaceFrom, replaceLength);
- d->stateFlags |= InputContextPrivate::InputMethodEventState;
- d->inputContext->sendEvent(&event);
- d->stateFlags &= ~InputContextPrivate::InputMethodEventState;
-
- // Send also to shadow input if only attributes changed.
- // In this case the update() may not be called, so the shadow
- // input may be out of sync.
- if (d->shadow.inputItem() && !replace && !text.isEmpty() &&
- !textChanged && attributesChanged) {
- VIRTUALKEYBOARD_DEBUG() << "InputContext::sendPreedit(shadow):" << text << replaceFrom << replaceLength;
- event.setAccepted(true);
- QGuiApplication::sendEvent(d->shadow.inputItem(), &event);
- }
- }
-
- if (textChanged)
- emit preeditTextChanged();
- }
-
- if (d->preeditText.isEmpty())
- d->preeditTextAttributes.clear();
-}
-
-void InputContext::reset()
-{
- Q_D(InputContext);
- d->inputEngine->reset();
-}
-
-void InputContext::externalCommit()
-{
- Q_D(InputContext);
- d->inputEngine->update();
-}
-
-void InputContext::update(Qt::InputMethodQueries queries)
-{
- Q_D(InputContext);
-
- // No need to fetch input clip rectangle during animation
- if (!(queries & ~Qt::ImInputItemClipRectangle) && d->animating)
- return;
-
- // fetch
- QInputMethodQueryEvent imQueryEvent(Qt::InputMethodQueries(Qt::ImHints |
- Qt::ImQueryInput | Qt::ImInputItemClipRectangle));
- d->inputContext->sendEvent(&imQueryEvent);
- Qt::InputMethodHints inputMethodHints = Qt::InputMethodHints(imQueryEvent.value(Qt::ImHints).toInt());
- const int cursorPosition = imQueryEvent.value(Qt::ImCursorPosition).toInt();
- const int anchorPosition = imQueryEvent.value(Qt::ImAnchorPosition).toInt();
- QRectF anchorRectangle;
- QRectF cursorRectangle;
- if (const QGuiApplication *app = qApp) {
- anchorRectangle = app->inputMethod()->anchorRectangle();
- cursorRectangle = app->inputMethod()->cursorRectangle();
- } else {
- anchorRectangle = d->anchorRectangle;
- cursorRectangle = d->cursorRectangle;
- }
- QString surroundingText = imQueryEvent.value(Qt::ImSurroundingText).toString();
- QString selectedText = imQueryEvent.value(Qt::ImCurrentSelection).toString();
-
- // check against changes
- bool newInputMethodHints = inputMethodHints != d->inputMethodHints;
- bool newSurroundingText = surroundingText != d->surroundingText;
- bool newSelectedText = selectedText != d->selectedText;
- bool newAnchorPosition = anchorPosition != d->anchorPosition;
- bool newCursorPosition = cursorPosition != d->cursorPosition;
- bool newAnchorRectangle = anchorRectangle != d->anchorRectangle;
- bool newCursorRectangle = cursorRectangle != d->cursorRectangle;
- bool selectionControlVisible = d->inputContext->isInputPanelVisible() && (cursorPosition != anchorPosition) && !inputMethodHints.testFlag(Qt::ImhNoTextHandles);
- bool newSelectionControlVisible = selectionControlVisible != d->selectionControlVisible;
-
- QRectF inputItemClipRect = imQueryEvent.value(Qt::ImInputItemClipRectangle).toRectF();
- QRectF anchorRect = imQueryEvent.value(Qt::ImAnchorRectangle).toRectF();
- QRectF cursorRect = imQueryEvent.value(Qt::ImCursorRectangle).toRectF();
-
- bool anchorRectIntersectsClipRect = inputItemClipRect.intersects(anchorRect);
- bool newAnchorRectIntersectsClipRect = anchorRectIntersectsClipRect != d->anchorRectIntersectsClipRect;
-
- bool cursorRectIntersectsClipRect = inputItemClipRect.intersects(cursorRect);
- bool newCursorRectIntersectsClipRect = cursorRectIntersectsClipRect != d->cursorRectIntersectsClipRect;
-
- // update
- d->inputMethodHints = inputMethodHints;
- d->surroundingText = surroundingText;
- d->selectedText = selectedText;
- d->anchorPosition = anchorPosition;
- d->cursorPosition = cursorPosition;
- d->anchorRectangle = anchorRectangle;
- d->cursorRectangle = cursorRectangle;
- d->selectionControlVisible = selectionControlVisible;
- d->anchorRectIntersectsClipRect = anchorRectIntersectsClipRect;
- d->cursorRectIntersectsClipRect = cursorRectIntersectsClipRect;
-
- // update input engine
- if ((newSurroundingText || newCursorPosition) &&
- !d->stateFlags.testFlag(InputContextPrivate::InputMethodEventState)) {
- d->inputEngine->update();
- }
- if (newInputMethodHints) {
- d->inputEngine->reset();
- }
-
- // notify
- if (newInputMethodHints) {
- emit inputMethodHintsChanged();
- }
- if (newSurroundingText) {
- emit surroundingTextChanged();
- }
- if (newSelectedText) {
- emit selectedTextChanged();
- }
- if (newAnchorPosition) {
- emit anchorPositionChanged();
- }
- if (newCursorPosition) {
- emit cursorPositionChanged();
- }
- if (newAnchorRectangle) {
- emit anchorRectangleChanged();
- }
- if (newCursorRectangle) {
- emit cursorRectangleChanged();
- }
- if (newSelectionControlVisible) {
- emit selectionControlVisibleChanged();
- }
- if (newAnchorRectIntersectsClipRect) {
- emit anchorRectIntersectsClipRectChanged();
- }
- if (newCursorRectIntersectsClipRect) {
- emit cursorRectIntersectsClipRectChanged();
- }
-
- // word reselection
- if (newInputMethodHints || newSurroundingText || newSelectedText)
- d->stateFlags &= ~InputContextPrivate::InputMethodClickState;
- if ((newSurroundingText || newCursorPosition) && !newSelectedText && (int)d->stateFlags == 0 &&
- !d->inputMethodHints.testFlag(Qt::ImhNoPredictiveText) &&
- d->cursorPosition > 0 && d->selectedText.isEmpty()) {
- d->stateFlags |= InputContextPrivate::ReselectEventState;
- if (d->inputEngine->reselect(d->cursorPosition, InputEngine::WordAtCursor))
- d->stateFlags |= InputContextPrivate::InputMethodClickState;
- d->stateFlags &= ~InputContextPrivate::ReselectEventState;
- }
-
- if (!d->stateFlags.testFlag(InputContextPrivate::SyncShadowInputState)) {
- d->stateFlags |= InputContextPrivate::SyncShadowInputState;
- d->shadow.update(queries);
- d->stateFlags &= ~InputContextPrivate::SyncShadowInputState;
- }
-}
-
-void InputContext::invokeAction(QInputMethod::Action action, int cursorPosition)
-{
- Q_D(InputContext);
- switch (action) {
- case QInputMethod::Click:
- if ((int)d->stateFlags == 0) {
- bool reselect = !d->inputMethodHints.testFlag(Qt::ImhNoPredictiveText) && d->selectedText.isEmpty() && cursorPosition < d->preeditText.length();
- if (reselect) {
- d->stateFlags |= InputContextPrivate::ReselectEventState;
- d->forceCursorPosition = d->cursorPosition + cursorPosition;
- d->inputEngine->update();
- d->inputEngine->reselect(d->cursorPosition, InputEngine::WordBeforeCursor);
- d->stateFlags &= ~InputContextPrivate::ReselectEventState;
- } else if (!d->preeditText.isEmpty() && cursorPosition == d->preeditText.length()) {
- d->inputEngine->update();
- }
- }
- d->stateFlags &= ~InputContextPrivate::InputMethodClickState;
- break;
-
- case QInputMethod::ContextMenu:
- break;
- }
-}
-
-bool InputContext::filterEvent(const QEvent *event)
-{
- QEvent::Type type = event->type();
- if (type == QEvent::KeyPress || type == QEvent::KeyRelease) {
- Q_D(InputContext);
- const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
-
- // Keep track of pressed keys update key event state
- if (type == QEvent::KeyPress)
- d->activeKeys += keyEvent->nativeScanCode();
- else if (type == QEvent::KeyRelease)
- d->activeKeys -= keyEvent->nativeScanCode();
-
- if (d->activeKeys.isEmpty())
- d->stateFlags &= ~InputContextPrivate::KeyEventState;
- else
- d->stateFlags |= InputContextPrivate::KeyEventState;
-
-#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 && d->inputContext->isInputPanelVisible()) {
- d->activeNavigationKeys += key;
- emit navigationKeyPressed(key, keyEvent->isAutoRepeat());
- return true;
- } else if (type == QEvent::KeyRelease && d->activeNavigationKeys.contains(key)) {
- d->activeNavigationKeys -= key;
- emit navigationKeyReleased(key, keyEvent->isAutoRepeat());
- return true;
- }
- }
-#endif
-
- // Break composing text since the virtual keyboard does not support hard keyboard events
- if (!d->preeditText.isEmpty())
- d->inputEngine->update();
- }
- return false;
-}
-
-void InputContext::addSelectionAttribute(QList<QInputMethodEvent::Attribute> &attributes)
-{
- Q_D(InputContext);
- if (!testAttribute(attributes, QInputMethodEvent::Selection) && d->forceCursorPosition != -1) {
- if (d->forceAnchorPosition != -1)
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, d->forceAnchorPosition, d->forceCursorPosition - d->forceAnchorPosition, QVariant()));
- else
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, d->forceCursorPosition, 0, QVariant()));
- }
- d->forceAnchorPosition = -1;
- d->forceCursorPosition = -1;
-}
-
-bool InputContext::testAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const
-{
- for (const QInputMethodEvent::Attribute &attribute : qAsConst(attributes)) {
- if (attribute.type == attributeType)
- return true;
- }
- return false;
-}
-
-/*!
- \qmlproperty bool InputContext::focus
-
- This property is changed when the input method receives or loses focus.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::focus
- \brief the focus status.
-
- This property is changed when the input method receives or loses focus.
-*/
-
-/*!
- \qmlproperty bool InputContext::shift
-
- This property is changed when the shift status changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::shift
- \brief the shift status.
-
- This property is changed when the shift status changes.
-*/
-
-/*!
- \qmlproperty bool InputContext::capsLock
-
- This property is changed when the caps lock status changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::capsLock
- \brief the caps lock status.
-
- This property is changed when the caps lock status changes.
-*/
-
-/*!
- \qmlproperty bool InputContext::uppercase
- \since QtQuick.VirtualKeyboard 2.2
-
- This property is \c true when either \l shift or \l capsLock is \c true.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::uppercase
- \brief the uppercase status.
-
- This property is \c true when either \l shift or \l capsLock is \c true.
-*/
-
-/*!
- \qmlproperty int InputContext::anchorPosition
- \since QtQuick.VirtualKeyboard 2.2
-
- This property is changed when the anchor position changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::anchorPosition
- \brief the anchor position.
-
- This property is changed when the anchor position changes.
-*/
-
-/*!
- \qmlproperty int InputContext::cursorPosition
-
- This property is changed when the cursor position changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::cursorPosition
- \brief the cursor position.
-
- This property is changed when the cursor position changes.
-*/
-
-/*!
- \qmlproperty int InputContext::inputMethodHints
-
- This property is changed when the input method hints changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::inputMethodHints
- \brief the input method hints.
-
- This property is changed when the input method hints changes.
-*/
-
-/*!
- \qmlproperty string InputContext::preeditText
-
- This property sets the pre-edit text.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::preeditText
- \brief the pre-edit text.
-
- This property sets the pre-edit text.
-*/
-
-/*!
- \qmlproperty string InputContext::surroundingText
-
- This property is changed when the surrounding text around the cursor changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::surroundingText
- \brief the surrounding text around cursor.
-
- This property is changed when the surrounding text around the cursor changes.
-*/
-
-/*!
- \qmlproperty string InputContext::selectedText
-
- This property is changed when the selected text changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::selectedText
- \brief the selected text.
-
- This property is changed when the selected text changes.
-*/
-
-/*!
- \qmlproperty rect InputContext::anchorRectangle
- \since QtQuick.VirtualKeyboard 2.1
-
- This property is changed when the anchor rectangle changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::anchorRectangle
- \brief the anchor rectangle.
-
- This property is changed when the anchor rectangle changes.
-*/
-
-/*!
- \qmlproperty rect InputContext::cursorRectangle
-
- This property is changed when the cursor rectangle changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::cursorRectangle
- \brief the cursor rectangle.
-
- This property is changed when the cursor rectangle changes.
-*/
-
-/*!
- \qmlproperty rect InputContext::keyboardRectangle
-
- Use this property to set the keyboard rectangle.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::keyboardRectangle
- \brief the keyboard rectangle.
-
- Use this property to set the keyboard rectangle.
-*/
-
-/*!
- \qmlproperty rect InputContext::previewRectangle
-
- Use this property to set the preview rectangle.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::previewRectangle
- \brief the preview rectangle.
-
- Use this property to set the preview rectangle.
-*/
-
-/*!
- \qmlproperty bool InputContext::previewVisible
-
- Use this property to set the visibility status of the preview.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::previewVisible
- \brief the animating status.
-
- Use this property to set the visibility status of the preview.
-*/
-
-/*!
- \qmlproperty bool InputContext::animating
-
- Use this property to set the animating status, for example
- during UI transitioning states.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::animating
- \brief the animating status.
-
- Use this property to set the animating status, for example
- during UI transitioning states.
-*/
-
-/*!
- \qmlproperty string InputContext::locale
-
- Sets the locale for this input context.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::locale
- \brief the locale.
-
- Sets the locale for this input context.
-*/
-
-/*!
- \qmlproperty QtObject InputContext::inputItem
-
- This property is changed when the focused input item changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::inputItem
- \brief the focused input item.
-
- This property is changed when the focused input item changes.
-*/
-
-/*!
- \qmlproperty ShiftHandler InputContext::shiftHandler
-
- This property stores the shift handler.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::shiftHandler
- \brief the shift handler instance.
-
- This property stores the shift handler.
-*/
-
-/*!
- \qmlproperty InputEngine InputContext::inputEngine
-
- This property stores the input engine.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputContext::inputEngine
- \brief the input engine.
-
- This property stores the input engine.
-*/
-
-/*!
- \qmlsignal InputContext::focusEditorChanged()
-
- This signal is emitted when the focus editor changes.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputContext::focusEditorChanged()
-
- This signal is emitted when the focus editor changes.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputContext::navigationKeyPressed(int key, bool isAutoRepeat)
- \internal
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputContext::navigationKeyReleased(int key, bool isAutoRepeat)
- \internal
-*/
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/inputcontext.h b/src/virtualkeyboard/inputcontext.h
deleted file mode 100644
index 3b0727e2..00000000
--- a/src/virtualkeyboard/inputcontext.h
+++ /dev/null
@@ -1,178 +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 INPUTCONTEXT_H
-#define INPUTCONTEXT_H
-
-#include <QObject>
-#include <QRectF>
-#include <QLocale>
-#include <QInputMethodEvent>
-#include <QInputMethod>
-
-namespace QtVirtualKeyboard {
-
-class PlatformInputContext;
-class ShadowInputContext;
-class InputEngine;
-class ShiftHandler;
-class InputContextPrivate;
-
-class InputContext : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(InputContext)
- Q_DECLARE_PRIVATE(InputContext)
- Q_PROPERTY(bool focus READ focus NOTIFY focusChanged)
- Q_PROPERTY(bool shift READ shift WRITE setShift NOTIFY shiftChanged)
- Q_PROPERTY(bool capsLock READ capsLock WRITE setCapsLock NOTIFY capsLockChanged)
- Q_PROPERTY(bool uppercase READ uppercase NOTIFY uppercaseChanged)
- Q_PROPERTY(int anchorPosition READ anchorPosition NOTIFY anchorPositionChanged)
- Q_PROPERTY(int cursorPosition READ cursorPosition NOTIFY cursorPositionChanged)
- Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints NOTIFY inputMethodHintsChanged)
- Q_PROPERTY(QString preeditText READ preeditText WRITE setPreeditText NOTIFY preeditTextChanged)
- Q_PROPERTY(QString surroundingText READ surroundingText NOTIFY surroundingTextChanged)
- Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged)
- Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged)
- Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
- Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle WRITE setKeyboardRectangle NOTIFY keyboardRectangleChanged)
- Q_PROPERTY(QRectF previewRectangle READ previewRectangle WRITE setPreviewRectangle NOTIFY previewRectangleChanged)
- Q_PROPERTY(bool previewVisible READ previewVisible WRITE setPreviewVisible NOTIFY previewVisibleChanged)
- Q_PROPERTY(bool animating READ animating WRITE setAnimating NOTIFY animatingChanged)
- Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged)
- Q_PROPERTY(QObject *inputItem READ inputItem NOTIFY inputItemChanged)
- Q_PROPERTY(QtVirtualKeyboard::ShiftHandler *shiftHandler READ shiftHandler CONSTANT)
- Q_PROPERTY(QtVirtualKeyboard::InputEngine *inputEngine READ inputEngine CONSTANT)
- Q_PROPERTY(bool selectionControlVisible READ selectionControlVisible NOTIFY selectionControlVisibleChanged)
- Q_PROPERTY(bool anchorRectIntersectsClipRect READ anchorRectIntersectsClipRect NOTIFY anchorRectIntersectsClipRectChanged)
- Q_PROPERTY(bool cursorRectIntersectsClipRect READ cursorRectIntersectsClipRect NOTIFY cursorRectIntersectsClipRectChanged)
- Q_PROPERTY(ShadowInputContext *shadow READ shadow CONSTANT)
-
-public:
- explicit InputContext(PlatformInputContext *parent = 0);
- ~InputContext();
-
- bool focus() const;
- bool shift() const;
- void setShift(bool enable);
- bool capsLock() const;
- void setCapsLock(bool enable);
- bool uppercase() const;
- int anchorPosition() const;
- int cursorPosition() const;
- Qt::InputMethodHints inputMethodHints() const;
- QString preeditText() const;
- void setPreeditText(const QString &text, QList<QInputMethodEvent::Attribute> attributes = QList<QInputMethodEvent::Attribute>(), int replaceFrom = 0, int replaceLength = 0);
- QList<QInputMethodEvent::Attribute> preeditTextAttributes() const;
- QString surroundingText() const;
- QString selectedText() const;
- QRectF anchorRectangle() const;
- QRectF cursorRectangle() const;
- QRectF keyboardRectangle() const;
- void setKeyboardRectangle(QRectF rectangle);
- QRectF previewRectangle() const;
- void setPreviewRectangle(QRectF rectangle);
- bool previewVisible() const;
- void setPreviewVisible(bool visible);
- bool animating() const;
- void setAnimating(bool animating);
- QString locale() const;
- void setLocale(const QString &locale);
- Q_INVOKABLE void updateAvailableLocales(const QStringList &availableLocales);
- QObject *inputItem() const;
- ShiftHandler *shiftHandler() const;
- InputEngine *inputEngine() const;
- bool selectionControlVisible() const;
- bool anchorRectIntersectsClipRect() const;
- bool cursorRectIntersectsClipRect() const;
- ShadowInputContext *shadow() const;
-
- Q_INVOKABLE void hideInputPanel();
- Q_INVOKABLE void sendKeyClick(int key, const QString &text, int modifiers = 0);
- Q_INVOKABLE void commit();
- Q_INVOKABLE void commit(const QString &text, int replaceFrom = 0, int replaceLength = 0);
- Q_INVOKABLE void clear();
-
- // Helper functions
- Q_INVOKABLE bool fileExists(const QUrl &fileUrl);
- Q_INVOKABLE bool hasEnterKeyAction(QObject *item) const;
-
- // For selection handles
- Q_INVOKABLE void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos);
-
- // For shadow input
- Q_INVOKABLE void forceCursorPosition(int anchorPosition, int cursorPosition);
-
-signals:
- void focusChanged();
- void focusEditorChanged();
- void preeditTextChanged();
- void inputMethodHintsChanged();
- void surroundingTextChanged();
- void selectedTextChanged();
- void anchorPositionChanged();
- void cursorPositionChanged();
- void anchorRectangleChanged();
- void cursorRectangleChanged();
- void shiftChanged();
- void capsLockChanged();
- void uppercaseChanged();
- void keyboardRectangleChanged();
- void previewRectangleChanged();
- void previewVisibleChanged();
- void animatingChanged();
- void localeChanged();
- void inputItemChanged();
- void selectionControlVisibleChanged();
- void navigationKeyPressed(int key, bool isAutoRepeat);
- void navigationKeyReleased(int key, bool isAutoRepeat);
- void anchorRectIntersectsClipRectChanged();
- void cursorRectIntersectsClipRectChanged();
-
-private slots:
- void onInputItemChanged();
-
-private:
- void setFocus(bool enable);
- void sendPreedit(const QString &text, const QList<QInputMethodEvent::Attribute> &attributes, int replaceFrom, int replaceLength);
- void reset();
- void externalCommit();
- void update(Qt::InputMethodQueries queries);
- void invokeAction(QInputMethod::Action action, int cursorPosition);
- bool filterEvent(const QEvent *event);
- void addSelectionAttribute(QList<QInputMethodEvent::Attribute> &attributes);
- bool testAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const;
-
-private:
- friend class PlatformInputContext;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/inputengine.cpp b/src/virtualkeyboard/inputengine.cpp
deleted file mode 100644
index e825f05b..00000000
--- a/src/virtualkeyboard/inputengine.cpp
+++ /dev/null
@@ -1,1030 +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 "inputengine.h"
-#include "inputcontext.h"
-#include "defaultinputmethod.h"
-#include "trace.h"
-#include "virtualkeyboarddebug.h"
-
-#include <QTimerEvent>
-#include <QtCore/private/qobject_p.h>
-
-namespace QtVirtualKeyboard {
-
-class InputEnginePrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(InputEngine)
-
-public:
- InputEnginePrivate(InputEngine *q_ptr) :
- QObjectPrivate(),
- q_ptr(q_ptr),
- inputContext(0),
- defaultInputMethod(0),
- textCase(InputEngine::Lower),
- inputMode(InputEngine::Latin),
- activeKey(Qt::Key_unknown),
- activeKeyModifiers(Qt::NoModifier),
- previousKey(Qt::Key_unknown),
- repeatTimer(0),
- repeatCount(0),
- recursiveMethodLock(0)
- {
- }
-
- virtual ~InputEnginePrivate()
- {
- }
-
- bool virtualKeyClick(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat)
- {
- Q_Q(InputEngine);
- bool accept = false;
- if (inputMethod) {
- accept = inputMethod->keyEvent(key, text, modifiers);
- if (!accept) {
- accept = defaultInputMethod->keyEvent(key, text, modifiers);
- }
- emit q->virtualKeyClicked(key, text, modifiers, isAutoRepeat);
- } else {
- qWarning() << "input method is not set";
- }
- return accept;
- }
-
- InputEngine* q_ptr;
- InputContext *inputContext;
- QPointer<AbstractInputMethod> inputMethod;
- AbstractInputMethod *defaultInputMethod;
- InputEngine::TextCase textCase;
- InputEngine::InputMode inputMode;
- QList<int> inputModes;
- QMap<SelectionListModel::Type, SelectionListModel *> selectionListModels;
- Qt::Key activeKey;
- QString activeKeyText;
- Qt::KeyboardModifiers activeKeyModifiers;
- Qt::Key previousKey;
- int repeatTimer;
- int repeatCount;
- int recursiveMethodLock;
-};
-
-class RecursiveMethodGuard
-{
-public:
- explicit RecursiveMethodGuard(int &ref) : m_ref(ref)
- {
- m_ref++;
- }
- ~RecursiveMethodGuard()
- {
- m_ref--;
- }
- bool locked() const
- {
- return m_ref > 1;
- }
-private:
- int &m_ref;
-};
-
-/*!
- \qmltype InputEngine
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \instantiates QtVirtualKeyboard::InputEngine
- \brief Maps the user input to the input methods.
-
- The input engine is responsible for routing input events to input
- methods. The actual input logic is implemented by the input methods.
-
- The input engine also includes the default input method, which takes
- care of default processing if the active input method does not handle
- the event.
-*/
-
-/*!
- \class QtVirtualKeyboard::InputEngine
- \inmodule QtVirtualKeyboard
- \brief The InputEngine class provides an input engine
- that supports C++ and QML integration.
-
- \internal
-
- The input engine is responsible for routing input events to input
- methods. The actual input logic is implemented by the input methods.
-
- The input engine also includes the default input method, which takes
- care of default processing if the active input method does not handle
- the event.
-*/
-
-/*!
- \internal
- Constructs an input engine with input context as \a parent.
-*/
-InputEngine::InputEngine(InputContext *parent) :
- QObject(*new InputEnginePrivate(this), parent)
-{
- Q_D(InputEngine);
- d->inputContext = parent;
- if (d->inputContext) {
- connect(d->inputContext, SIGNAL(shiftChanged()), SLOT(shiftChanged()));
- connect(d->inputContext, SIGNAL(localeChanged()), SLOT(update()));
- QObject::connect(d->inputContext, &InputContext::inputMethodHintsChanged, this, &InputEngine::updateSelectionListModels);
- QObject::connect(d->inputContext, &InputContext::localeChanged, this, &InputEngine::updateInputModes);
- QObject::connect(this, &InputEngine::inputMethodChanged, this, &InputEngine::updateInputModes);
- }
- d->defaultInputMethod = new DefaultInputMethod(this);
- if (d->defaultInputMethod)
- d->defaultInputMethod->setInputEngine(this);
- d->selectionListModels[SelectionListModel::WordCandidateList] = new SelectionListModel(this);
-}
-
-/*!
- \internal
- Destroys the input engine and frees all allocated resources.
-*/
-InputEngine::~InputEngine()
-{
-}
-
-/*!
- \qmlmethod bool InputEngine::virtualKeyPress(int key, string text, int modifiers, bool repeat)
-
- Called by the keyboard layer to indicate that \a key was pressed, with
- the given \a text and \a modifiers.
-
- The \a key is set as an active key (down key). The actual key event is
- triggered when the key is released by the virtualKeyRelease() method. The
- key press event can be discarded by calling virtualKeyCancel().
-
- The key press also initiates the key repeat timer if \a repeat is \c true.
-
- Returns \c true if the key was accepted by this input engine.
-
- \sa virtualKeyCancel(), virtualKeyRelease()
-*/
-/*!
- Called by the keyboard layer to indicate that \a key was pressed, with
- the given \a text and \a modifiers.
-
- The \a key is set as an active key (down key). The actual key event is
- triggered when the key is released by the virtualKeyRelease() method. The
- key press event can be discarded by calling virtualKeyCancel().
-
- The key press also initiates the key repeat timer if \a repeat is \c true.
-
- Returns \c true if the key was accepted by this input engine.
-
- \sa virtualKeyCancel(), virtualKeyRelease()
-*/
-bool InputEngine::virtualKeyPress(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool repeat)
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::virtualKeyPress():" << key << text << modifiers << repeat;
- bool accept = false;
- if (d->activeKey == Qt::Key_unknown || d->activeKey == key) {
- d->activeKey = key;
- d->activeKeyText = text;
- d->activeKeyModifiers = modifiers;
- if (repeat) {
- d->repeatTimer = startTimer(600);
- }
- accept = true;
- emit activeKeyChanged(d->activeKey);
- } else {
- qWarning("key press ignored; key is already active");
- }
- return accept;
-}
-
-/*!
- \qmlmethod void InputEngine::virtualKeyCancel()
-
- Reverts the active key state without emitting the key event.
- This method is useful when the user discards the current key and
- the key state needs to be restored.
-*/
-/*!
- \fn void QtVirtualKeyboard::InputEngine::virtualKeyCancel()
-
- Reverts the active key state without emitting the key event.
- This method is useful when the user discards the current key and
- the key state needs to be restored.
-*/
-void InputEngine::virtualKeyCancel()
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::virtualKeyCancel()";
- if (d->activeKey != Qt::Key_unknown) {
- d->activeKey = Qt::Key_unknown;
- d->activeKeyText = QString();
- d->activeKeyModifiers = Qt::KeyboardModifiers();
- if (d->repeatTimer) {
- killTimer(d->repeatTimer);
- d->repeatTimer = 0;
- d->repeatCount = 0;
- }
- emit activeKeyChanged(d->activeKey);
- }
-}
-
-/*!
- \qmlmethod bool InputEngine::virtualKeyRelease(int key, string text, int modifiers)
-
- Releases the key at \a key. The method emits a key event for the input
- method if the event has not been generated by a repeating timer.
- The \a text and \a modifiers are passed to the input method.
-
- Returns \c true if the key was accepted by the input engine.
-*/
-/*!
- Releases the key at \a key. The method emits a key event for the input
- method if the event has not been generated by a repeating timer.
- The \a text and \a modifiers are passed to the input method.
-
- Returns \c true if the key was accepted by the input engine.
-*/
-bool InputEngine::virtualKeyRelease(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::virtualKeyRelease():" << key << text << modifiers;
- bool accept = false;
- if (d->activeKey == key) {
- if (!d->repeatCount) {
- accept = d->virtualKeyClick(key, text, modifiers, false);
- } else {
- accept = true;
- }
- } else {
- qWarning("key release ignored; key is not pressed");
- }
- if (d->activeKey != Qt::Key_unknown) {
- d->previousKey = d->activeKey;
- emit previousKeyChanged(d->previousKey);
- d->activeKey = Qt::Key_unknown;
- d->activeKeyText = QString();
- d->activeKeyModifiers = Qt::KeyboardModifiers();
- if (d->repeatTimer) {
- killTimer(d->repeatTimer);
- d->repeatTimer = 0;
- d->repeatCount = 0;
- }
- emit activeKeyChanged(d->activeKey);
- }
- return accept;
-}
-
-/*!
- \qmlmethod bool InputEngine::virtualKeyClick(int key, string text, int modifiers)
-
- Emits a key click event for the given \a key, \a text and \a modifiers.
- Returns \c true if the key event was accepted by the input engine.
-*/
-/*!
- Emits a key click event for the given \a key, \a text and \a modifiers.
- Returns \c true if the key event was accepted by the input engine.
-*/
-bool InputEngine::virtualKeyClick(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::virtualKeyClick():" << key << text << modifiers;
- return d->virtualKeyClick(key, text, modifiers, false);
-}
-
-/*!
- Returns the \c InputContext instance associated with the input
- engine.
-*/
-InputContext *InputEngine::inputContext() const
-{
- Q_D(const InputEngine);
- return d->inputContext;
-}
-
-/*!
- Returns the currently active key, or Qt::Key_unknown if no key is active.
-*/
-Qt::Key InputEngine::activeKey() const
-{
- Q_D(const InputEngine);
- return d->activeKey;
-}
-
-/*!
- Returns the previously active key, or Qt::Key_unknown if no key has been
- active.
-*/
-Qt::Key InputEngine::previousKey() const
-{
- Q_D(const InputEngine);
- return d->previousKey;
-}
-
-/*!
- Returns the active input method.
-*/
-AbstractInputMethod *InputEngine::inputMethod() const
-{
- Q_D(const InputEngine);
- return d->inputMethod;
-}
-
-/*!
- Sets \a inputMethod as the active input method.
-*/
-void InputEngine::setInputMethod(AbstractInputMethod *inputMethod)
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::setInputMethod():" << inputMethod;
- if (d->inputMethod != inputMethod) {
- update();
- if (d->inputMethod) {
- QObject::disconnect(d->inputMethod.data(), &AbstractInputMethod::selectionListsChanged, this, &InputEngine::updateSelectionListModels);
- d->inputMethod->setInputEngine(0);
- }
- d->inputMethod = inputMethod;
- if (d->inputMethod) {
- d->inputMethod->setInputEngine(this);
- QObject::connect(d->inputMethod.data(), &AbstractInputMethod::selectionListsChanged, this, &InputEngine::updateSelectionListModels);
-
- // Set current text case
- d->inputMethod->setTextCase(d->textCase);
- }
- updateSelectionListModels();
- emit inputMethodChanged();
- emit patternRecognitionModesChanged();
- }
-}
-
-/*!
- Returns the list of available input modes.
-*/
-QList<int> InputEngine::inputModes() const
-{
- Q_D(const InputEngine);
- return d->inputModes;
-}
-
-InputEngine::InputMode InputEngine::inputMode() const
-{
- Q_D(const InputEngine);
- return d->inputMode;
-}
-
-void InputEngine::setInputMode(InputEngine::InputMode inputMode)
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::setInputMode():" << inputMode;
- if (d->inputMethod) {
-#ifdef QT_DEBUG
- // Cached input modes should be in sync with the input method
- // If the assert below fails, we have missed an update somewhere
- QList<int> cachedInputModes(d->inputModes);
- updateInputModes();
- Q_ASSERT(cachedInputModes == d->inputModes);
-#endif
- if (d->inputModes.contains(inputMode)) {
- d->inputMethod->setInputMode(d->inputContext->locale(), inputMode);
- if (d->inputMode != inputMode) {
- d->inputMode = inputMode;
- emit inputModeChanged();
- }
- } else {
- qWarning() << "Input mode" << inputMode <<
- "is not in the list of available input modes" << d->inputModes;
- }
- }
-}
-
-SelectionListModel *InputEngine::wordCandidateListModel() const
-{
- Q_D(const InputEngine);
- return d->selectionListModels[SelectionListModel::WordCandidateList];
-}
-
-bool InputEngine::wordCandidateListVisibleHint() const
-{
- Q_D(const InputEngine);
- const auto it = d->selectionListModels.constFind(SelectionListModel::WordCandidateList);
- if (it == d->selectionListModels.cend())
- return false;
- return it.value()->dataSource() != 0;
-}
-
-/*!
- Returns list of supported pattern recognition modes.
-*/
-QList<int> InputEngine::patternRecognitionModes() const
-{
- Q_D(const InputEngine);
- QList<PatternRecognitionMode> patterRecognitionModeList;
- if (d->inputMethod)
- patterRecognitionModeList = d->inputMethod->patternRecognitionModes();
- QList<int> resultList;
- if (patterRecognitionModeList.isEmpty())
- return resultList;
- resultList.reserve(patterRecognitionModeList.size());
- for (const PatternRecognitionMode &patternRecognitionMode : qAsConst(patterRecognitionModeList))
- resultList.append(patternRecognitionMode);
- return resultList;
-}
-
-/*!
- \qmlmethod Trace InputEngine::traceBegin(int traceId, int patternRecognitionMode, var traceCaptureDeviceInfo, var traceScreenInfo)
- \since QtQuick.VirtualKeyboard 2.0
-
- Starts a trace interaction with the input engine.
-
- The trace is uniquely identified by the \a traceId. The input engine will assign
- the id to the Trace object if the input method accepts the event.
-
- The \a patternRecognitionMode specifies the recognition mode used for the pattern.
-
- If the current input method accepts the event it returns a Trace object associated with this interaction.
- If the input method discards the event, it returns a null value.
-
- The \a traceCaptureDeviceInfo provides information about the source device and the \a traceScreenInfo
- provides information about the screen context.
-
- By definition, the Trace object remains valid until the traceEnd() method is called.
-
- The trace interaction is ended by calling the \l {InputEngine::traceEnd()} {InputEngine.traceEnd()} method.
-*/
-/*!
- \since QtQuick.VirtualKeyboard 2.0
-
- Starts a trace interaction with the input engine.
-
- The trace is uniquely identified by the \a traceId. The input engine will assign
- the id to the Trace object if the input method accepts the event.
-
- The \a patternRecognitionMode specifies the recognition mode used for the pattern.
-
- If the current input method accepts the event it returns a Trace object associated with this interaction.
- If the input method discards the event, it returns a NULL value.
-
- The \a traceCaptureDeviceInfo provides information about the source device and the \a traceScreenInfo
- provides information about the screen context.
-
- By definition, the Trace object remains valid until the traceEnd() method is called.
-
- The trace interaction is ended by calling the traceEnd() method.
-*/
-QtVirtualKeyboard::Trace *InputEngine::traceBegin(int traceId, QtVirtualKeyboard::InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::traceBegin():"
- << "traceId:" << traceId
- << "patternRecognitionMode:" << patternRecognitionMode
- << "traceCaptureDeviceInfo:" << traceCaptureDeviceInfo
- << "traceScreenInfo:" << traceScreenInfo;
- if (!d->inputMethod)
- return 0;
- if (patternRecognitionMode == PatternRecognitionDisabled)
- return 0;
- if (!d->inputMethod->patternRecognitionModes().contains(patternRecognitionMode))
- return 0;
- Trace *trace = d->inputMethod->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
- if (trace)
- trace->setTraceId(traceId);
- return trace;
-}
-
-/*!
- \qmlmethod bool InputEngine::traceEnd(Trace trace)
-
- Ends the trace interaction with the input engine.
-
- The \a trace object may be discarded at any point after calling this function.
-
- The function returns true if the trace interaction was accepted (i.e. the touch
- events should not be used for anything else).
-*/
-/*!
- Ends the trace interaction with the input engine.
-
- The \a trace object may be discarded at any point after calling this function.
-
- The function returns true if the trace interaction was accepted (i.e. the touch
- events should not be used for anything else).
-*/
-bool InputEngine::traceEnd(QtVirtualKeyboard::Trace *trace)
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::traceEnd():" << trace;
- Q_ASSERT(trace);
- if (!d->inputMethod)
- return false;
- return d->inputMethod->traceEnd(trace);
-}
-
-/*!
- \since QtQuick.VirtualKeyboard 2.0
-
- This function attempts to reselect a word located at the \a cursorPosition.
- The \a reselectFlags define the rules for how the word should be selected in
- relation to the cursor position.
-
- The function returns \c true if the word was successfully reselected.
-*/
-bool InputEngine::reselect(int cursorPosition, const ReselectFlags &reselectFlags)
-{
- Q_D(InputEngine);
- VIRTUALKEYBOARD_DEBUG() << "InputEngine::reselect():" << cursorPosition << reselectFlags;
- if (!d->inputMethod || !wordCandidateListVisibleHint())
- return false;
- return d->inputMethod->reselect(cursorPosition, reselectFlags);
-}
-
-/*!
- \internal
- Resets the input method.
-*/
-void InputEngine::reset()
-{
- Q_D(InputEngine);
- if (d->inputMethod) {
- RecursiveMethodGuard guard(d->recursiveMethodLock);
- if (!guard.locked()) {
- emit inputMethodReset();
- updateInputModes();
- }
- } else {
- updateInputModes();
- }
-}
-
-/*!
- \internal
- Updates the input method's state. This method is called whenever the input
- context is changed.
-*/
-void InputEngine::update()
-{
- Q_D(InputEngine);
- if (d->inputMethod) {
- RecursiveMethodGuard guard(d->recursiveMethodLock);
- if (!guard.locked()) {
- emit inputMethodUpdate();
- }
- }
-}
-
-/*!
- \internal
- Updates the text case for the input method.
-*/
-void InputEngine::shiftChanged()
-{
- Q_D(InputEngine);
- TextCase newCase = d->inputContext->shift() ? Upper : Lower;
- if (d->textCase != newCase) {
- d->textCase = newCase;
- if (d->inputMethod) {
- d->inputMethod->setTextCase(d->textCase);
- }
- }
-}
-
-/*!
- \internal
-*/
-void InputEngine::updateSelectionListModels()
-{
- Q_D(InputEngine);
- QList<SelectionListModel::Type> inactiveSelectionLists = d->selectionListModels.keys();
- if (d->inputMethod) {
- // Allocate selection lists for the input method
- const QList<SelectionListModel::Type> activeSelectionLists = d->inputMethod->selectionLists();
- for (const SelectionListModel::Type &selectionListType : activeSelectionLists) {
- auto it = d->selectionListModels.find(selectionListType);
- if (it == d->selectionListModels.end()) {
- it = d->selectionListModels.insert(selectionListType, new SelectionListModel(this));
- if (selectionListType == SelectionListModel::WordCandidateList)
- emit wordCandidateListModelChanged();
- }
- it.value()->setDataSource(d->inputMethod, selectionListType);
- if (selectionListType == SelectionListModel::WordCandidateList)
- emit wordCandidateListVisibleHintChanged();
- inactiveSelectionLists.removeAll(selectionListType);
- }
- }
-
- // Deallocate inactive selection lists
- for (const SelectionListModel::Type &selectionListType : qAsConst(inactiveSelectionLists)) {
- const auto it = d->selectionListModels.constFind(selectionListType);
- if (it != d->selectionListModels.cend()) {
- it.value()->setDataSource(0, selectionListType);
- if (selectionListType == SelectionListModel::WordCandidateList)
- emit wordCandidateListVisibleHintChanged();
- }
- }
-}
-
-/*!
- \internal
-*/
-void InputEngine::updateInputModes()
-{
- Q_D(InputEngine);
- QList<int> newInputModes;
- if (d->inputMethod) {
- QList<InputMode> tmpList(d->inputMethod->inputModes(d->inputContext->locale()));
- if (!tmpList.isEmpty()) {
- std::transform(tmpList.constBegin(), tmpList.constEnd(),
- std::back_inserter(newInputModes),
- [tmpList] (InputMode inputMode) {
- return static_cast<int>(inputMode);
- });
- }
- }
- if (d->inputModes != newInputModes) {
- d->inputModes = newInputModes;
- emit inputModesChanged();
- }
-}
-
-/*!
- \internal
-*/
-void InputEngine::timerEvent(QTimerEvent *timerEvent)
-{
- Q_D(InputEngine);
- if (timerEvent->timerId() == d->repeatTimer) {
- d->repeatTimer = 0;
- d->virtualKeyClick(d->activeKey, d->activeKeyText, d->activeKeyModifiers, true);
- d->repeatTimer = startTimer(50);
- d->repeatCount++;
- }
-}
-
-/*!
- \qmlproperty int InputEngine::activeKey
-
- Currently pressed key.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputEngine::activeKey
- \brief the active key.
-
- Currently pressed key.
-*/
-
-/*!
- \qmlproperty int InputEngine::previousKey
-
- Previously pressed key.
-*/
-/*!
- \property QtVirtualKeyboard::InputEngine::previousKey
- \brief the previous active key.
-
- Previously pressed key.
-*/
-
-/*!
- \qmlproperty InputMethod InputEngine::inputMethod
-
- Use this property to set the active input method, or to monitor when the
- active input method changes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputEngine::inputMethod
- \brief the active input method.
-
- Use this property to set active the input method, or to monitor when the
- active input method changes.
-*/
-
-/*!
- \qmlproperty list<int> InputEngine::inputModes
-
- The list of available input modes is dependent on the input method and
- locale. This property is updated when either of the dependencies change.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputEngine::inputModes
- \brief the available input modes for active input method.
-
- The list of available input modes is dependent on the input method and
- locale. This property is updated when either of the dependencies changes.
-*/
-
-/*!
- \qmlproperty int InputEngine::inputMode
-
- Use this property to get or set the current input mode. The
- InputEngine::inputModes property provides the list of valid input modes
- for the current input method and locale.
-
- The predefined input modes are:
-
- \list
- \li \c InputEngine.Latin The default input mode for latin text.
- \li \c InputEngine.Numeric Only numeric input is allowed.
- \li \c InputEngine.Dialable Only dialable input is allowed.
- \li \c InputEngine.Pinyin Pinyin input mode for Chinese.
- \li \c InputEngine.Cangjie Cangjie input mode for Chinese.
- \li \c InputEngine.Zhuyin Zhuyin input mode for Chinese.
- \li \c InputEngine.Hangul Hangul input mode for Korean.
- \li \c InputEngine.Hiragana Hiragana input mode for Japanese.
- \li \c InputEngine.Katakana Katakana input mode for Japanese.
- \li \c InputEngine.FullwidthLatin Fullwidth latin input mode for East Asian languages.
- \li \c InputEngine.Greek Greek input mode.
- \li \c InputEngine.Cyrillic Cyrillic input mode.
- \li \c InputEngine.Arabic Arabic input mode.
- \li \c InputEngine.Hebrew Hebrew input mode.
- \li \c InputEngine.ChineseHandwriting Chinese handwriting.
- \li \c InputEngine.JapaneseHandwriting Japanese handwriting.
- \li \c InputEngine.KoreanHandwriting Korean handwriting.
- \endlist
-*/
-
-/*!
- \property QtVirtualKeyboard::InputEngine::inputMode
- \brief the current input mode.
-
- Use this property to get or set the current input mode. The
- InputEngine::inputModes provides list of valid input modes
- for current input method and locale.
-*/
-
-/*!
- \qmlproperty SelectionListModel InputEngine::wordCandidateListModel
-
- Use this property to access the list model for the word candidate
- list.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputEngine::wordCandidateListModel
- \brief list model for the word candidate list.
-
- Use this property to access the list model for the word candidate
- list.
-*/
-
-/*!
- \qmlproperty bool InputEngine::wordCandidateListVisibleHint
-
- Use this property to check if the word candidate list should be visible
- in the UI.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputEngine::wordCandidateListVisibleHint
- \brief visible hint for the word candidate list.
-
- Use this property to check if the word candidate list should be visible
- in the UI.
-*/
-
-/*!
- \enum QtVirtualKeyboard::InputEngine::InputMode
-
- This enum specifies the input mode for the input method.
-
- \value Latin
- The default input mode for latin text.
- \value Numeric
- Only numeric input is allowed.
- \value Dialable
- Only dialable input is allowed.
- \value Pinyin
- Pinyin input mode for Chinese.
- \value Cangjie
- Cangjie input mode for Chinese.
- \value Zhuyin
- Zhuyin input mode for Chinese.
- \value Hangul
- Hangul input mode for Korean.
- \value Hiragana
- Hiragana input mode for Japanese.
- \value Katakana
- Katakana input mode for Japanese.
- \value FullwidthLatin
- Fullwidth latin input mode for East Asian languages.
- \value Greek
- Greek input mode.
- \value Cyrillic
- Cyrillic input mode.
- \value Arabic
- Arabic input mode.
- \value Hebrew
- Hebrew input mode.
-*/
-
-/*!
- \enum QtVirtualKeyboard::InputEngine::TextCase
-
- This enum specifies the text case for the input method.
-
- \value Lower
- Lower case text.
- \value Upper
- Upper case text.
-*/
-
-/*!
- \enum QtVirtualKeyboard::InputEngine::PatternRecognitionMode
-
- This enum specifies the input mode for the input method.
-
- \value PatternRecognitionDisabled
- Pattern recognition is not available.
- \value HandwritingRecoginition
- Pattern recognition mode for handwriting recognition.
-*/
-
-/*!
- \enum QtVirtualKeyboard::InputEngine::ReselectFlag
-
- This enum specifies the rules for word reselection.
-
- \value WordBeforeCursor
- Activate the word before the cursor. When this flag is used exclusively, the word must end exactly at the cursor.
- \value WordAfterCursor
- Activate the word after the cursor. When this flag is used exclusively, the word must start exactly at the cursor.
- \value WordAtCursor
- Activate the word at the cursor. This flag is a combination of the above flags with the exception that the word cannot start or stop at the cursor.
-*/
-
-/*!
- \qmlsignal void InputEngine::virtualKeyClicked(int key, string text, int modifiers)
-
- Indicates that the virtual \a key was clicked with the given \a text and
- \a modifiers.
- This signal is emitted after the input method has processed the key event.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::virtualKeyClicked(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat)
-
- Indicates that the virtual \a key was clicked with the given \a text and
- \a modifiers. The \a isAutoRepeat indicates if the event is automatically
- repeated while the key is being pressed.
- This signal is emitted after the input method has processed the key event.
-*/
-
-/*!
- \qmlproperty list<int> InputEngine::patternRecognitionModes
- \since QtQuick.VirtualKeyboard 2.0
-
- The list of available pattern recognition modes.
-*/
-
-/*!
- \property QtVirtualKeyboard::InputEngine::patternRecognitionModes
- \since QtQuick.VirtualKeyboard 2.0
- \brief the list of available pattern recognition modes.
-
- The list of available pattern recognition modes.
-*/
-
-/*!
- \qmlsignal void InputEngine::activeKeyChanged(int key)
-
- Indicates that the active \a key has changed.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::activeKeyChanged(Qt::Key key)
-
- Indicates that the active \a key has changed.
-*/
-
-/*!
- \qmlsignal void InputEngine::previousKeyChanged(int key)
-
- Indicates that the previous \a key has changed.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::previousKeyChanged(Qt::Key key)
-
- Indicates that the previous \a key has changed.
-*/
-
-/*!
- \qmlsignal void InputEngine::inputMethodChanged()
-
- Indicates that the input method has changed.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::inputMethodChanged()
-
- Indicates that the input method has changed.
-*/
-
-/*!
- \qmlsignal void InputEngine::inputMethodReset()
-
- Emitted when the input method needs to be reset.
-
- \note This signal is automatically connected to AbstractInputMethod::reset()
- and InputMethod::reset() when the input method is activated.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::inputMethodReset()
-
- Emitted when the input method needs to be reset.
-
- \note This signal is automatically connected to AbstractInputMethod::reset()
- and InputMethod::reset() when the input method is activated.
-*/
-
-/*!
- \qmlsignal void InputEngine::inputMethodUpdate()
-
- \note This signal is automatically connected to AbstractInputMethod::update()
- and InputMethod::update() when the input method is activated.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::inputMethodUpdate()
-
- \note This signal is automatically connected to AbstractInputMethod::update()
- and InputMethod::update() when the input method is activated.
-*/
-
-/*!
- \qmlsignal void InputEngine::inputModesChanged()
-
- Indicates that the available input modes have changed.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::inputModesChanged()
-
- Indicates that the available input modes have changed.
-*/
-
-/*!
- \qmlsignal void InputEngine::inputModeChanged()
-
- Indicates that the input mode has changed.
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::inputModeChanged()
-
- Indicates that the input mode has changed.
-*/
-
-/*!
- \qmlsignal void InputEngine::patternRecognitionModesChanged()
- \since QtQuick.VirtualKeyboard 2.0
-
- Indicates that the available pattern recognition modes have changed.
-
- The predefined pattern recognition modes are:
-
- \list
- \li \c InputEngine.PatternRecognitionDisabled Pattern recognition is not available.
- \li \c InputEngine.HandwritingRecoginition Pattern recognition mode for handwriting recognition.
- \endlist
-*/
-
-/*!
- \fn void QtVirtualKeyboard::InputEngine::patternRecognitionModesChanged()
- \since QtQuick.VirtualKeyboard 2.0
-
- Indicates that the available pattern recognition modes have changed.
-*/
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/inputengine.h b/src/virtualkeyboard/inputengine.h
deleted file mode 100644
index 66eb2c3d..00000000
--- a/src/virtualkeyboard/inputengine.h
+++ /dev/null
@@ -1,163 +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 INPUTENGINE_H
-#define INPUTENGINE_H
-
-#include <QObject>
-#include <QPointer>
-
-namespace QtVirtualKeyboard {
-
-class InputContext;
-class SelectionListModel;
-class AbstractInputMethod;
-class InputEnginePrivate;
-class Trace;
-
-class InputEngine : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(InputEngine)
- Q_DECLARE_PRIVATE(InputEngine)
- Q_FLAGS(ReselectFlags)
- Q_PROPERTY(Qt::Key activeKey READ activeKey NOTIFY activeKeyChanged)
- Q_PROPERTY(Qt::Key previousKey READ previousKey NOTIFY previousKeyChanged)
- Q_PROPERTY(QtVirtualKeyboard::AbstractInputMethod *inputMethod READ inputMethod WRITE setInputMethod NOTIFY inputMethodChanged)
- Q_PROPERTY(QList<int> inputModes READ inputModes NOTIFY inputModesChanged)
- Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode NOTIFY inputModeChanged)
- Q_PROPERTY(QList<int> patternRecognitionModes READ patternRecognitionModes NOTIFY patternRecognitionModesChanged)
- Q_PROPERTY(QtVirtualKeyboard::SelectionListModel *wordCandidateListModel READ wordCandidateListModel NOTIFY wordCandidateListModelChanged)
- Q_PROPERTY(bool wordCandidateListVisibleHint READ wordCandidateListVisibleHint NOTIFY wordCandidateListVisibleHintChanged)
-
- explicit InputEngine(InputContext *parent = 0);
-
-public:
- enum TextCase {
- Lower,
- Upper
- };
- enum InputMode {
- Latin,
- Numeric,
- Dialable,
- Pinyin,
- Cangjie,
- Zhuyin,
- Hangul,
- Hiragana,
- Katakana,
- FullwidthLatin,
- Greek,
- Cyrillic,
- Arabic,
- Hebrew,
- ChineseHandwriting,
- JapaneseHandwriting,
- KoreanHandwriting
- };
- enum PatternRecognitionMode {
- PatternRecognitionDisabled,
- HandwritingRecoginition
- };
- enum ReselectFlag {
- WordBeforeCursor = 0x1,
- WordAfterCursor = 0x2,
- WordAtCursor = WordBeforeCursor | WordAfterCursor
- };
-
- Q_ENUM(TextCase)
- Q_ENUM(InputMode)
- Q_ENUM(PatternRecognitionMode)
- Q_DECLARE_FLAGS(ReselectFlags, ReselectFlag)
-
-public:
- ~InputEngine();
-
- Q_INVOKABLE bool virtualKeyPress(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool repeat);
- Q_INVOKABLE void virtualKeyCancel();
- Q_INVOKABLE bool virtualKeyRelease(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
- Q_INVOKABLE bool virtualKeyClick(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- InputContext *inputContext() const;
- Qt::Key activeKey() const;
- Qt::Key previousKey() const;
-
- AbstractInputMethod *inputMethod() const;
- void setInputMethod(AbstractInputMethod *inputMethod);
-
- QList<int> inputModes() const;
-
- InputMode inputMode() const;
- void setInputMode(InputMode inputMode);
-
- SelectionListModel *wordCandidateListModel() const;
- bool wordCandidateListVisibleHint() const;
-
- QList<int> patternRecognitionModes() const;
- Q_INVOKABLE QtVirtualKeyboard::Trace *traceBegin(int traceId, QtVirtualKeyboard::InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
- Q_INVOKABLE bool traceEnd(QtVirtualKeyboard::Trace *trace);
-
- Q_INVOKABLE bool reselect(int cursorPosition, const ReselectFlags &reselectFlags);
-
-signals:
- void virtualKeyClicked(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat);
- void activeKeyChanged(Qt::Key key);
- void previousKeyChanged(Qt::Key key);
- void inputMethodChanged();
- void inputMethodReset();
- void inputMethodUpdate();
- void inputModesChanged();
- void inputModeChanged();
- void patternRecognitionModesChanged();
- void wordCandidateListModelChanged();
- void wordCandidateListVisibleHintChanged();
-
-private slots:
- void reset();
- void update();
- void shiftChanged();
- void updateSelectionListModels();
- void updateInputModes();
-
-protected:
- void timerEvent(QTimerEvent *timerEvent);
-
-private:
- friend class InputContext;
-};
-
-} // namespace QtVirtualKeyboard
-
-Q_DECLARE_METATYPE(QtVirtualKeyboard::InputEngine::TextCase)
-Q_DECLARE_METATYPE(QtVirtualKeyboard::InputEngine::InputMode)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QtVirtualKeyboard::InputEngine::ReselectFlags)
-
-#endif
diff --git a/src/virtualkeyboard/inputmethod.cpp b/src/virtualkeyboard/inputmethod.cpp
index 91e9152b..45c0da97 100644
--- a/src/virtualkeyboard/inputmethod.cpp
+++ b/src/virtualkeyboard/inputmethod.cpp
@@ -27,10 +27,11 @@
**
****************************************************************************/
-#include "inputmethod.h"
-#include "trace.h"
+#include <QtVirtualKeyboard/private/inputmethod_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
#include <QVariant>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
/*!
@@ -206,7 +207,7 @@ namespace QtVirtualKeyboard {
\since QtQuick.VirtualKeyboard 2.0
This method is called when the trace interaction ends. The input method should destroy the \a trace object
- at some point after this function is called. See the \l Trace API how to access the gathered
+ at some point after this function is called. See the \l {Trace API for Input Methods} how to access the gathered
data.
*/
@@ -228,12 +229,22 @@ namespace QtVirtualKeyboard {
*/
/*!
+ \qmlmethod bool InputMethod::clickPreeditText(int cursorPosition)
+ \since QtQuick.VirtualKeyboard 2.4
+
+ Called when the user clicks on pre-edit text at \a cursorPosition.
+
+ The function should return \c true if it handles the event. Otherwise the input
+ falls back to \l reselect() for further processing.
+*/
+
+/*!
\class QtVirtualKeyboard::InputMethod
\internal
*/
InputMethod::InputMethod(QObject *parent) :
- AbstractInputMethod(parent)
+ QVirtualKeyboardAbstractInputMethod(parent)
{
}
@@ -241,21 +252,21 @@ InputMethod::~InputMethod()
{
}
-QList<InputEngine::InputMode> InputMethod::inputModes(const QString &locale)
+QList<QVirtualKeyboardInputEngine::InputMode> InputMethod::inputModes(const QString &locale)
{
QVariant result;
QMetaObject::invokeMethod(this, "inputModes",
Q_RETURN_ARG(QVariant, result),
Q_ARG(QVariant, locale));
- QList<InputEngine::InputMode> inputModeList;
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModeList;
const auto resultList = result.toList();
inputModeList.reserve(resultList.size());
for (const QVariant &inputMode : resultList)
- inputModeList.append(static_cast<InputEngine::InputMode>(inputMode.toInt()));
+ inputModeList.append(static_cast<QVirtualKeyboardInputEngine::InputMode>(inputMode.toInt()));
return inputModeList;
}
-bool InputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
+bool InputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
{
QVariant result;
QMetaObject::invokeMethod(this, "setInputMode",
@@ -265,7 +276,7 @@ bool InputMethod::setInputMode(const QString &locale, InputEngine::InputMode inp
return result.toBool();
}
-bool InputMethod::setTextCase(InputEngine::TextCase textCase)
+bool InputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
{
QVariant result;
QMetaObject::invokeMethod(this, "setTextCase",
@@ -285,21 +296,21 @@ bool InputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifie
return result.toBool();
}
-QList<SelectionListModel::Type> InputMethod::selectionLists()
+QList<QVirtualKeyboardSelectionListModel::Type> InputMethod::selectionLists()
{
QVariant result;
QMetaObject::invokeMethod(this, "selectionLists",
Q_RETURN_ARG(QVariant, result));
- QList<SelectionListModel::Type> selectionListsList;
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionListsList;
const auto resultList = result.toList();
selectionListsList.reserve(resultList.size());
for (const QVariant &selectionListType : resultList)
- selectionListsList.append(static_cast<SelectionListModel::Type>(selectionListType.toInt()));
+ selectionListsList.append(static_cast<QVirtualKeyboardSelectionListModel::Type>(selectionListType.toInt()));
return selectionListsList;
}
-int InputMethod::selectionListItemCount(SelectionListModel::Type type)
+int InputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
{
QVariant result;
QMetaObject::invokeMethod(this, "selectionListItemCount",
@@ -308,43 +319,44 @@ int InputMethod::selectionListItemCount(SelectionListModel::Type type)
return result.toInt();
}
-QVariant InputMethod::selectionListData(SelectionListModel::Type type, int index, int role)
+QVariant InputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
{
QVariant result;
QMetaObject::invokeMethod(this, "selectionListData",
Q_RETURN_ARG(QVariant, result),
Q_ARG(QVariant, static_cast<int>(type)),
Q_ARG(QVariant, index),
- Q_ARG(QVariant, role));
+ Q_ARG(QVariant, static_cast<int>(role)));
if (result.isNull()) {
- result = AbstractInputMethod::selectionListData(type, index, role);
+ result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
}
return result;
}
-void InputMethod::selectionListItemSelected(SelectionListModel::Type type, int index)
+void InputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
{
QMetaObject::invokeMethod(this, "selectionListItemSelected",
Q_ARG(QVariant, static_cast<int>(type)),
Q_ARG(QVariant, index));
}
-QList<InputEngine::PatternRecognitionMode> InputMethod::patternRecognitionModes() const
+QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> InputMethod::patternRecognitionModes() const
{
QVariant result;
QMetaObject::invokeMethod(const_cast<InputMethod *>(this), "patternRecognitionModes",
Q_RETURN_ARG(QVariant, result));
- QList<InputEngine::PatternRecognitionMode> patterRecognitionModeList;
+ QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> patterRecognitionModeList;
const auto resultList = result.toList();
patterRecognitionModeList.reserve(resultList.size());
for (const QVariant &patterRecognitionMode : resultList)
- patterRecognitionModeList.append(static_cast<InputEngine::PatternRecognitionMode>(patterRecognitionMode.toInt()));
+ patterRecognitionModeList.append(static_cast<QVirtualKeyboardInputEngine::PatternRecognitionMode>(patterRecognitionMode.toInt()));
return patterRecognitionModeList;
}
-Trace *InputMethod::traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+QVirtualKeyboardTrace *InputMethod::traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
{
QVariant result;
QMetaObject::invokeMethod(this, "traceBegin",
@@ -353,10 +365,10 @@ Trace *InputMethod::traceBegin(int traceId, InputEngine::PatternRecognitionMode
Q_ARG(int, (int)patternRecognitionMode),
Q_ARG(QVariant, traceCaptureDeviceInfo),
Q_ARG(QVariant, traceScreenInfo));
- return result.value<Trace *>();
+ return result.value<QVirtualKeyboardTrace *>();
}
-bool InputMethod::traceEnd(Trace *trace)
+bool InputMethod::traceEnd(QVirtualKeyboardTrace *trace)
{
QVariant result;
QMetaObject::invokeMethod(this, "traceEnd",
@@ -365,7 +377,7 @@ bool InputMethod::traceEnd(Trace *trace)
return result.toBool();
}
-bool InputMethod::reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags)
+bool InputMethod::reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags)
{
QVariant result;
QMetaObject::invokeMethod(this, "reselect",
@@ -375,6 +387,15 @@ bool InputMethod::reselect(int cursorPosition, const InputEngine::ReselectFlags
return result.toBool();
}
+bool InputMethod::clickPreeditText(int cursorPosition)
+{
+ QVariant result;
+ QMetaObject::invokeMethod(this, "clickPreeditText",
+ Q_RETURN_ARG(QVariant, result),
+ Q_ARG(int, cursorPosition));
+ return result.toBool();
+}
+
void InputMethod::reset()
{
QMetaObject::invokeMethod(this, "reset");
@@ -386,3 +407,4 @@ void InputMethod::update()
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/inputmethod.h b/src/virtualkeyboard/inputmethod.h
deleted file mode 100644
index 05159b88..00000000
--- a/src/virtualkeyboard/inputmethod.h
+++ /dev/null
@@ -1,71 +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 INPUTMETHOD_H
-#define INPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-class InputMethod : public AbstractInputMethod
-{
- Q_OBJECT
- Q_PROPERTY(QtVirtualKeyboard::InputContext *inputContext READ inputContext CONSTANT)
- Q_PROPERTY(QtVirtualKeyboard::InputEngine *inputEngine READ inputEngine CONSTANT)
-
-public:
- explicit InputMethod(QObject *parent = 0);
- ~InputMethod();
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- QList<SelectionListModel::Type> selectionLists();
- int selectionListItemCount(SelectionListModel::Type type);
- QVariant selectionListData(SelectionListModel::Type type, int index, int role);
- void selectionListItemSelected(SelectionListModel::Type type, int index);
-
- QList<InputEngine::PatternRecognitionMode> patternRecognitionModes() const;
- Trace *traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
- bool traceEnd(Trace *trace);
-
- bool reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags);
-
- void reset();
- void update();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // INPUTMETHOD_H
diff --git a/src/virtualkeyboard/inputmethod_p.h b/src/virtualkeyboard/inputmethod_p.h
new file mode 100644
index 00000000..0489bcae
--- /dev/null
+++ b/src/virtualkeyboard/inputmethod_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 INPUTMETHOD_P_H
+#define INPUTMETHOD_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 QVIRTUALKEYBOARD_EXPORT InputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_PROPERTY(QVirtualKeyboardInputContext *inputContext READ inputContext CONSTANT)
+ Q_PROPERTY(QVirtualKeyboardInputEngine *inputEngine READ inputEngine CONSTANT)
+
+public:
+ explicit InputMethod(QObject *parent = nullptr);
+ ~InputMethod();
+
+ 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);
+
+ 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);
+ bool clickPreeditText(int cursorPosition);
+
+ void reset();
+ void update();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // INPUTMETHOD_P_H
diff --git a/src/virtualkeyboard/inputselectionhandle.cpp b/src/virtualkeyboard/inputselectionhandle.cpp
index 58131a0f..3f4817a2 100644
--- a/src/virtualkeyboard/inputselectionhandle.cpp
+++ b/src/virtualkeyboard/inputselectionhandle.cpp
@@ -27,12 +27,13 @@
**
****************************************************************************/
-#include "inputselectionhandle.h"
-#include "desktopinputselectioncontrol.h"
+#include <QtVirtualKeyboard/private/inputselectionhandle_p.h>
+#include <QtVirtualKeyboard/private/desktopinputselectioncontrol_p.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/QPainter>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
InputSelectionHandle::InputSelectionHandle(DesktopInputSelectionControl *control, QWindow *eventWindow)
: QRasterWindow()
@@ -82,3 +83,4 @@ bool InputSelectionHandle::event(QEvent *e)
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/inputselectionhandle.h b/src/virtualkeyboard/inputselectionhandle.h
deleted file mode 100644
index 5d70df2b..00000000
--- a/src/virtualkeyboard/inputselectionhandle.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef INPUTSELECTIONHANDLE_H
-#define INPUTSELECTIONHANDLE_H
-
-
-#include <QtGui/QRasterWindow>
-
-QT_BEGIN_NAMESPACE
-class QWindow;
-QT_END_NAMESPACE
-
-namespace QtVirtualKeyboard {
-class DesktopInputSelectionControl;
-
-class InputSelectionHandle : public QRasterWindow
-{
- Q_OBJECT
-
-public:
- InputSelectionHandle(DesktopInputSelectionControl *control, QWindow *eventWindow);
- void applyImage(const QSize &windowSize);
-
-protected:
- void paintEvent(QPaintEvent *pe) override;
- bool event(QEvent *event) override;
-
-private:
- DesktopInputSelectionControl *m_control;
- QWindow *m_eventWindow;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // INPUTSELECTIONHANDLE_H
diff --git a/src/virtualkeyboard/inputselectionhandle_p.h b/src/virtualkeyboard/inputselectionhandle_p.h
new file mode 100644
index 00000000..d62e4147
--- /dev/null
+++ b/src/virtualkeyboard/inputselectionhandle_p.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** 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 INPUTSELECTIONHANDLE_P_H
+#define INPUTSELECTIONHANDLE_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 <QtGui/QRasterWindow>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+
+namespace QtVirtualKeyboard {
+
+class DesktopInputSelectionControl;
+
+class QVIRTUALKEYBOARD_EXPORT InputSelectionHandle : public QRasterWindow
+{
+ Q_OBJECT
+
+public:
+ InputSelectionHandle(DesktopInputSelectionControl *control, QWindow *eventWindow);
+ void applyImage(const QSize &windowSize);
+
+protected:
+ void paintEvent(QPaintEvent *pe) override;
+ bool event(QEvent *event) override;
+
+private:
+ DesktopInputSelectionControl *m_control;
+ QWindow *m_eventWindow;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // INPUTSELECTIONHANDLE_P_H
diff --git a/src/virtualkeyboard/inputview.cpp b/src/virtualkeyboard/inputview.cpp
index 07f0f4ec..304a3419 100644
--- a/src/virtualkeyboard/inputview.cpp
+++ b/src/virtualkeyboard/inputview.cpp
@@ -27,8 +27,9 @@
**
****************************************************************************/
-#include "inputview.h"
+#include <QtVirtualKeyboard/private/inputview_p.h>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
/*!
@@ -48,3 +49,4 @@ void InputView::resizeEvent(QResizeEvent *event)
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/inputview.h b/src/virtualkeyboard/inputview.h
deleted file mode 100644
index b1e93fd8..00000000
--- a/src/virtualkeyboard/inputview.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef INPUTVIEW_H
-#define INPUTVIEW_H
-
-#include <QQuickView>
-
-namespace QtVirtualKeyboard {
-
-class InputView : public QQuickView
-{
- Q_OBJECT
-public:
- explicit InputView(QWindow *parent = 0);
-
-signals:
- void sizeChanged();
-
-protected:
- void resizeEvent(QResizeEvent *event);
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // INPUTVIEW_H
diff --git a/src/virtualkeyboard/inputview_p.h b/src/virtualkeyboard/inputview_p.h
new file mode 100644
index 00000000..cdbd6a2f
--- /dev/null
+++ b/src/virtualkeyboard/inputview_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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 INPUTVIEW_P_H
+#define INPUTVIEW_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 <QQuickView>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class QVIRTUALKEYBOARD_EXPORT InputView : public QQuickView
+{
+ Q_OBJECT
+public:
+ explicit InputView(QWindow *parent = nullptr);
+
+signals:
+ void sizeChanged();
+
+protected:
+ void resizeEvent(QResizeEvent *event);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // INPUTVIEW_P_H
diff --git a/src/virtualkeyboard/lipiinputmethod.cpp b/src/virtualkeyboard/lipiinputmethod.cpp
deleted file mode 100644
index 5bb1d46c..00000000
--- a/src/virtualkeyboard/lipiinputmethod.cpp
+++ /dev/null
@@ -1,624 +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.h"
-#include "lipisharedrecognizer.h"
-#include "inputengine.h"
-#include "inputcontext.h"
-#include "shifthandler.h"
-#include "virtualkeyboarddebug.h"
-#include "trace.h"
-#include "handwritinggesturerecognizer.h"
-
-#ifdef HAVE_HUNSPELL
-#include "hunspellinputmethod_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 "unipentrace.h"
-#include <QStandardPaths>
-#endif
-
-#ifdef HAVE_HUNSPELL
-#define LipiInputMethodPrivateBase HunspellInputMethodPrivate
-#else
-#define LipiInputMethodPrivateBase AbstractInputMethodPrivate
-#endif
-
-namespace QtVirtualKeyboard {
-
-class LipiInputMethodPrivate : public LipiInputMethodPrivateBase
-{
- Q_DECLARE_PUBLIC(LipiInputMethod)
-public:
- LipiInputMethodPrivate(LipiInputMethod *q_ptr) :
-#ifdef HAVE_HUNSPELL
- LipiInputMethodPrivateBase(static_cast<HunspellInputMethod *>(q_ptr)),
-#else
- LipiInputMethodPrivateBase(),
-#endif
- q_ptr(q_ptr),
- recognizeTimer(0),
- textCase(InputEngine::Lower)
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- , unipenTrace(0)
-#endif
- {
- }
-
- ~LipiInputMethodPrivate()
- {
- cancelRecognition();
- }
-
- QByteArray getContext(InputEngine::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(InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo,
- const QVariantMap &traceScreenInfo)
- {
- QByteArray context = getContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
- if (context == currentContext)
- return;
-
- VIRTUALKEYBOARD_DEBUG() << "LipiInputMethodPrivate::setContext():" << QString(context.toHex());
-
- clearTraces();
-
- deviceInfo.reset(new LTKCaptureDevice());
- deviceInfo->setSamplingRate(traceCaptureDeviceInfo.value("sampleRate", 60).toInt());
- deviceInfo->setXDPI(traceCaptureDeviceInfo.value("dpi", 96).toInt());
- deviceInfo->setYDPI(deviceInfo->getXDPI());
- deviceInfo->setLatency(traceCaptureDeviceInfo.value("latency", 0.0).toFloat());
- deviceInfo->setUniformSampling(traceCaptureDeviceInfo.value("uniform", false).toBool());
-
- screenContext.reset(new LTKScreenContext());
- QRectF boundingBox(traceScreenInfo.value("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("horizontalRulers", QVariantList()).toList());
- if (!horizontalRulers.isEmpty()) {
- for (QVariantList::ConstIterator i = horizontalRulers.constBegin();
- i != horizontalRulers.constEnd(); i++) {
- screenContext->addHLine(i->toFloat());
- }
- }
-
- QVariantList verticalRulers(traceScreenInfo.value("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;
- }
-
- Trace *traceBegin(int traceId, InputEngine::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
-
- Trace *trace = new Trace();
- trace->setChannels(QStringList("t"));
- traceList.append(trace);
-
- return trace;
- }
-
- void traceEnd(Trace *trace)
- {
- if (trace->isCanceled()) {
- VIRTUALKEYBOARD_DEBUG() << "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 (Trace *trace : qAsConst(traceList)) {
- if (!trace->isFinal())
- count++;
- }
- return count;
- }
-
- void handleGesture()
- {
- if (countActiveTraces() > 0)
- return;
-
- QVariantMap gesture = gestureRecognizer.recognize(traceList);
- if (gesture.isEmpty())
- return;
-
- VIRTUALKEYBOARD_DEBUG() << "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);
- InputContext *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, QString(" "), Qt::NoModifier);
- } else if (swipeTouchCount == 2) {
- // Double swipe: commit word, or insert space
- cancelRecognition();
-#ifdef HAVE_HUNSPELL
- if (activeWordIndex != -1) {
- q->selectionListItemSelected(SelectionListModel::WordCandidateList, activeWordIndex);
- return;
- }
-#endif
- ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QString(" "), 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))) {
- InputEngine::InputMode inputMode = ic->inputEngine()->inputMode();
- inputMode = inputMode == InputEngine::Latin ?
- InputEngine::Numeric : InputEngine::Latin;
- ic->inputEngine()->setInputMode(inputMode);
- }
- } else if (swipeTouchCount == 2) {
- // Double swipe: toggle text case
- cancelRecognition();
- ic->shiftHandler()->toggleShift();
- }
- return;
- }
- }
- }
- }
-
- void clearTraces()
- {
- qDeleteAll(traceList);
- traceList.clear();
- traceGroup.emptyAllTraces();
- }
-
- void addPointsToTraceGroup(Trace *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("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("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["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["resultId"].toInt())
- delayedResult = result;
- else
- processResult(result);
- }
- }
-
- void processResult(const QVariantMap &result)
- {
- const QChar ch = result["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 == InputEngine::Upper)))
- saveTraces(ch.unicode(), qRound(result["confidence"].toDouble() * 100));
- delete unipenTrace;
- unipenTrace = 0;
- }
-#endif
- Q_Q(LipiInputMethod);
- q->inputContext()->inputEngine()->virtualKeyClick((Qt::Key)chUpper.unicode(),
- textCase == InputEngine::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("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<Trace *> traceList;
- int recognizeTimer;
- InputEngine::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) :
- LipiInputMethodBase(*new LipiInputMethodPrivate(this), parent)
-{
-}
-
-LipiInputMethod::~LipiInputMethod()
-{
-}
-
-QList<InputEngine::InputMode> LipiInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale)
- QList<InputEngine::InputMode> availableInputModes;
- const Qt::InputMethodHints inputMethodHints(inputContext()->inputMethodHints());
-
- if (inputMethodHints.testFlag(Qt::ImhDialableCharactersOnly) || inputMethodHints.testFlag(Qt::ImhDigitsOnly)) {
- availableInputModes.append(InputEngine::Dialable);
- } else if (inputMethodHints.testFlag(Qt::ImhFormattedNumbersOnly)) {
- availableInputModes.append(InputEngine::Numeric);
- } else {
- availableInputModes.append(InputEngine::Latin);
- availableInputModes.append(InputEngine::Numeric);
- }
-
- return availableInputModes;
-}
-
-bool LipiInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
-{
- Q_D(LipiInputMethod);
-#ifdef HAVE_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 InputEngine::Latin:
- d->recognizer.subsetOfClasses(QStringLiteral("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz?,.@"), d->subsetOfClasses);
- break;
- case InputEngine::Numeric:
- case InputEngine::Dialable:
- d->recognizer.subsetOfClasses(QStringLiteral("1234567890,.+"), d->subsetOfClasses);
- break;
- default:
- break;
- }
- return true;
-}
-
-bool LipiInputMethod::setTextCase(InputEngine::TextCase textCase)
-{
- Q_D(LipiInputMethod);
- d->textCase = textCase;
-#ifdef HAVE_HUNSPELL
- HunspellInputMethod::setTextCase(textCase);
-#endif
- return true;
-}
-
-bool LipiInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
-#ifdef HAVE_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(SelectionListModel::Type type, int index)
-{
- LipiInputMethodBase::selectionListItemSelected(type, index);
- Q_D(LipiInputMethod);
- d->cancelRecognition();
-}
-
-QList<InputEngine::PatternRecognitionMode> LipiInputMethod::patternRecognitionModes() const
-{
- return QList<InputEngine::PatternRecognitionMode>()
- << InputEngine::HandwritingRecoginition;
-}
-
-Trace *LipiInputMethod::traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
-{
- Q_D(LipiInputMethod);
- return d->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
-}
-
-bool LipiInputMethod::traceEnd(Trace *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 QT_VIRTUALKEYBOARD_DEBUG
- {
- VIRTUALKEYBOARD_DEBUG() << "LipiInputMethod::resultsAvailable():";
- for (int i = 0; i < resultList.size(); i++) {
- QVariantMap result = resultList.at(i).toMap();
- VIRTUALKEYBOARD_DEBUG() << QString("%1: %2 (%3)").arg(i + 1).arg(result["unicode"].toChar()).arg(result["confidence"].toFloat()).toUtf8().constData();
- }
- }
-#endif
- Q_D(LipiInputMethod);
- d->resultsAvailable(resultList);
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/lipiinputmethod.h b/src/virtualkeyboard/lipiinputmethod.h
deleted file mode 100644
index cbb211ba..00000000
--- a/src/virtualkeyboard/lipiinputmethod.h
+++ /dev/null
@@ -1,78 +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_H
-#define LIPIINPUTMETHOD_H
-
-#ifdef HAVE_HUNSPELL
-#include "hunspellinputmethod.h"
-#define LipiInputMethodBase HunspellInputMethod
-#else
-#include "abstractinputmethod.h"
-#define LipiInputMethodBase AbstractInputMethod
-#endif
-
-namespace QtVirtualKeyboard {
-
-class LipiInputMethodPrivate;
-
-class LipiInputMethod : public LipiInputMethodBase
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(LipiInputMethod)
-public:
- explicit LipiInputMethod(QObject *parent = 0);
- ~LipiInputMethod();
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- void reset();
- void update();
-
- void selectionListItemSelected(SelectionListModel::Type type, int index);
-
- QList<InputEngine::PatternRecognitionMode> patternRecognitionModes() const;
- Trace *traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
- bool traceEnd(Trace *trace);
-
-protected:
- void timerEvent(QTimerEvent *timerEvent);
-
-protected slots:
- void resultsAvailable(const QVariantList &resultList);
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/lipisharedrecognizer.cpp b/src/virtualkeyboard/lipisharedrecognizer.cpp
deleted file mode 100644
index fc5a1ba7..00000000
--- a/src/virtualkeyboard/lipisharedrecognizer.cpp
+++ /dev/null
@@ -1,418 +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.h"
-#include "virtualkeyboarddebug.h"
-#include "lipiworker.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>
-
-namespace QtVirtualKeyboard {
-
-int LipiSharedRecognizer::s_lipiEngineRefCount = 0;
-QString LipiSharedRecognizer::s_lipiRoot;
-QString LipiSharedRecognizer::s_lipiLib;
-void *LipiSharedRecognizer::s_lipiEngineHandle = 0;
-LipiSharedRecognizer::FN_PTR_CREATELTKLIPIENGINE LipiSharedRecognizer::s_createLTKLipiEngine = 0;
-LipiSharedRecognizer::FN_PTR_DELETELTKLIPIENGINE LipiSharedRecognizer::s_deleteLTKLipiEngine = 0;
-LTKLipiEngineInterface *LipiSharedRecognizer::s_lipiEngine = 0;
-LTKShapeRecognizer *LipiSharedRecognizer::s_shapeRecognizer = 0;
-LipiWorker *LipiSharedRecognizer::s_lipiWorker = 0;
-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)
-{
- VIRTUALKEYBOARD_DEBUG() << "LipiSharedRecognizer::setModel():" << modelName;
-
- if (!s_lipiEngine) {
- qWarning() << "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());
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QString notFound;
-#endif
- for (int i = 0; i < charset.length(); i++) {
- int classId = s_unicodeMap.key(charset.at(i), -1);
- if (classId != -1)
- outSubsetOfClasses.push_back(classId);
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- else
- notFound.append(charset.at(i));
-#endif
- }
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- if (!notFound.isEmpty())
- VIRTUALKEYBOARD_DEBUG() << "LipiSharedRecognizer::subsetOfClasses(): unrecognized characters" << notFound;
-#endif
-}
-
-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()
-{
- VIRTUALKEYBOARD_DEBUG() << "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) + "/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 + "/lib";
- else
- s_lipiLib = QDir(QLibraryInfo::location(QLibraryInfo::PluginsPath) + "/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) {
- qWarning() << QString("Error %1: Could not open shared library for module '%2'").arg(result).arg(LIPIENGINE_MODULE_STR);
- return result;
- }
-
- result = loadLipiEngineConfig();
- if (result != SUCCESS)
- return result;
-
- result = osUtil->getFunctionAddress(s_lipiEngineHandle, "createLTKLipiEngine", (void **)&s_createLTKLipiEngine);
- if (result != SUCCESS) {
- qWarning() << QString("Error %1: %2").arg(result).arg(getErrorMessage(result).c_str());
- return result;
- }
-
- result = osUtil->getFunctionAddress(s_lipiEngineHandle, "deleteLTKLipiEngine", (void **)&s_deleteLTKLipiEngine);
- if (result != SUCCESS) {
- qWarning() << QString("Error %1: %2").arg(result).arg(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) {
- qWarning() << QString("Error %1: %2").arg(result).arg(getErrorMessage(result).c_str());
- return result;
- }
- }
-
- return SUCCESS;
-}
-
-void LipiSharedRecognizer::unloadLipiInterface()
-{
- VIRTUALKEYBOARD_DEBUG() << "LipiSharedRecognizer::unloadLipiInterface():" << s_lipiEngineRefCount;
-
- Q_ASSERT(s_lipiEngineRefCount > 0);
- if (--s_lipiEngineRefCount == 0) {
- unloadModelData();
- if (s_lipiEngine) {
- s_deleteLTKLipiEngine();
- s_lipiEngine = 0;
- }
- s_createLTKLipiEngine = 0;
- s_deleteLTKLipiEngine = 0;
- QScopedPointer<LTKOSUtil> osUtil(LTKOSUtilFactory::getInstance());
- osUtil->unloadSharedLib(s_lipiEngineHandle);
- s_lipiEngineHandle = 0;
- }
-}
-
-int LipiSharedRecognizer::loadLipiEngineConfig()
-{
- s_lipiEngineConfigEntries.clear();
-
- const QString &lipiEngineConfigFile(QDir::toNativeSeparators(QString("%1/projects/lipiengine.cfg").arg(s_lipiRoot)));
- if (!QFileInfo::exists(lipiEngineConfigFile)) {
- qWarning() << "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(configEntry->second.c_str()).split('(', QString::SkipEmptyParts);
- if (parts.length() != 2)
- return FAILURE;
-
- parts[1].replace(')', "");
-
- outProjectName = parts[0].trimmed();
- outProfileName = parts[1].trimmed();
-
- return SUCCESS;
-}
-
-int LipiSharedRecognizer::loadModelData(const QString &logicalName)
-{
- VIRTUALKEYBOARD_DEBUG() << "LipiSharedRecognizer::loadModelData():" << logicalName;
-
- Q_ASSERT(s_shapeRecognizer == 0);
- Q_ASSERT(s_lipiWorker == 0);
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
-
- 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(QString("%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();
- }
- }
- }
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- if (result == SUCCESS)
- VIRTUALKEYBOARD_DEBUG() << "LipiSharedRecognizer::loadModelData(): time:" << perf.elapsed() << "ms";
-#endif
-
- if (result != SUCCESS) {
- qWarning() << QString("Error %1: %2").arg(result).arg(getErrorMessage(result).c_str());
- unloadModelData();
- }
-
- return result;
-}
-
-void LipiSharedRecognizer::unloadModelData()
-{
- if (!s_shapeRecognizer)
- return;
-
- VIRTUALKEYBOARD_DEBUG() << "LipiSharedRecognizer::unloadModelData():" << s_activeModel;
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
-
- if (s_lipiWorker) {
- delete s_lipiWorker;
- s_lipiWorker = 0;
- }
-
- s_lipiEngine->deleteShapeRecognizer(s_shapeRecognizer);
- s_shapeRecognizer = 0;
- s_unicodeMap.clear();
- s_activeModel.clear();
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- VIRTUALKEYBOARD_DEBUG() << "LipiSharedRecognizer::unloadModelData(): time:" << perf.elapsed() << "ms";
-#endif
-}
-
-int LipiSharedRecognizer::loadMapping(const QString &mapFile)
-{
- if (!QFileInfo(mapFile).exists()) {
- qWarning() << "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(i->first.at(0)).isDigit())
- continue;
-
- bool ok;
- int id = QString(i->first.c_str()).toInt(&ok, 10);
- if (!ok)
- continue;
-
- QChar ch = QChar(QString(i->second.c_str()).toInt(&ok, 16));
- if (!ok)
- continue;
-
- s_unicodeMap[id] = ch;
- }
- } catch (LTKException) {
- return FAILURE;
- }
-
- VIRTUALKEYBOARD_DEBUG() << s_unicodeMap;
-
- return SUCCESS;
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/lipisharedrecognizer.h b/src/virtualkeyboard/lipisharedrecognizer.h
deleted file mode 100644
index 5bfb6ec6..00000000
--- a/src/virtualkeyboard/lipisharedrecognizer.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 LIPISHAREDRECOGNIZER_H
-#define LIPISHAREDRECOGNIZER_H
-
-#include <QString>
-#include <QMap>
-
-#include "lipiworker.h"
-
-class LTKLipiEngineInterface;
-
-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
-
-#endif // LIPISHAREDRECOGNIZER_H
diff --git a/src/virtualkeyboard/lipiworker.cpp b/src/virtualkeyboard/lipiworker.cpp
deleted file mode 100644
index 45983621..00000000
--- a/src/virtualkeyboard/lipiworker.cpp
+++ /dev/null
@@ -1,256 +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.h"
-#include "virtualkeyboarddebug.h"
-
-#include <QTime>
-
-#include "LTKShapeRecognizer.h"
-#include "LTKErrors.h"
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::LipiTask
- \internal
-*/
-
-/*!
- \class QtVirtualKeyboard::LipiLoadModelDataTask
- \internal
-*/
-
-void LipiLoadModelDataTask::run()
-{
- VIRTUALKEYBOARD_DEBUG() << "LipiLoadModelDataTask::run()";
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
- int result = shapeRecognizer->loadModelData();
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- VIRTUALKEYBOARD_DEBUG() << "LipiLoadModelDataTask::run(): time:" << perf.elapsed() << "ms";
-#endif
- if (result != SUCCESS)
- qWarning() << QString("Error %1: %2").arg(result).arg(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()
-{
- VIRTUALKEYBOARD_DEBUG() << "LipiRecognitionTask::run()";
-
- if (!shapeRecognizer || !resultVector)
- return;
-
- {
- QMutexLocker stateGuard(&stateLock);
- stateRunning = true;
- }
-
- resultVector->clear();
- resultVector->reserve(numChoices);
-
- shapeRecognizer->setDeviceContext(deviceInfo);
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
- shapeRecognizer->recognize(traceGroup, screenContext,
- inSubsetOfClasses, confThreshold,
- numChoices, *resultVector);
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- int perfElapsed = perf.elapsed();
-#endif
-
- {
- QMutexLocker stateGuard(&stateLock);
- stateRunning = false;
- if (stateCancelled)
- resultVector->clear();
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- VIRTUALKEYBOARD_DEBUG() << "LipiRecognitionTask::run(): time:" << perfElapsed << "ms" << (stateCancelled ? "(cancelled)" : "");
-#endif
- }
-}
-
-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["resultId"] = _resultId;
- result["shapeId"] = shapeId;
- result["unicode"] = unicodeMap.value(shapeId);
- result["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
diff --git a/src/virtualkeyboard/lipiworker.h b/src/virtualkeyboard/lipiworker.h
deleted file mode 100644
index 1117c3f4..00000000
--- a/src/virtualkeyboard/lipiworker.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef LIPIWORKER_H
-#define LIPIWORKER_H
-
-#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"
-
-namespace QtVirtualKeyboard {
-
-class LipiTask : public QObject
-{
- Q_OBJECT
-public:
- explicit LipiTask(QObject *parent = 0) :
- QObject(parent),
- shapeRecognizer(0)
- {}
-
- 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 = 0);
- ~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
-
-#endif // LIPIWORKER_H
diff --git a/src/virtualkeyboard/openwnninputmethod.cpp b/src/virtualkeyboard/openwnninputmethod.cpp
deleted file mode 100644
index 2c265d00..00000000
--- a/src/virtualkeyboard/openwnninputmethod.cpp
+++ /dev/null
@@ -1,823 +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.h"
-#include "inputcontext.h"
-#include "virtualkeyboarddebug.h"
-#include <openwnnenginejajp.h>
-#include <composingtext.h>
-#include <romkan.h>
-#include <romkanfullkatakana.h>
-#include <romkanhalfkatakana.h>
-#include <QTextFormat>
-
-namespace QtVirtualKeyboard {
-
-class OpenWnnInputMethodPrivate : public AbstractInputMethodPrivate
-{
- 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) :
- AbstractInputMethodPrivate(),
- q_ptr(q_ptr),
- inputMode(InputEngine::Latin),
- exactMatchMode(false),
- converter(0),
- converterJAJP(),
- activeConvertType(CONVERT_TYPE_NONE),
- preConverter(0),
- 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 = NULL;
- preConverter.reset();
- break;
-
- case ENGINE_MODE_NO_LV2_CONV:
- converter = NULL;
- preConverter.reset(new Romkan());
- break;
-
- case ENGINE_MODE_FULL_KATAKANA:
- converter = NULL;
- preConverter.reset(new RomkanFullKatakana());
- break;
-
- case ENGINE_MODE_HALF_KATAKANA:
- converter = NULL;
- 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 != NULL && 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);
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- composingText.debugout();
-#endif
- updateViewStatus(ComposingText::LAYER2, false, false);
- }
-
- void initializeScreen()
- {
- if (composingText.size(ComposingText::LAYER0) != 0)
- inputEngine->inputContext()->commit("");
- 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()));
-
- inputEngine->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(SelectionListModel::WordCandidateList);
- if (previousActiveWordIndex != activeWordIndex)
- emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList, activeWordIndex);
- }
-
- void clearCandidates(bool deferUpdate = false)
- {
- if (!candidateList.isEmpty()) {
- candidateList.clear();
- if (!deferUpdate) {
- Q_Q(OpenWnnInputMethod);
- emit q->selectionListChanged(SelectionListModel::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(SelectionListModel::WordCandidateList, activeWordIndex);
- return candidateList.at(activeWordIndex);
- }
-
- void clearFocusCandidate(bool deferUpdate = false)
- {
- Q_Q(OpenWnnInputMethod);
- if (activeWordIndex != -1) {
- activeWordIndex = -1;
- if (!deferUpdate)
- emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList, activeWordIndex);
- }
- }
-
- void fitInputType()
- {
- Q_Q(OpenWnnInputMethod);
- enableConverter = true;
-
- Qt::InputMethodHints inputMethodHints = inputEngine->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 != InputEngine::Hiragana ||
- inputMethodHints.testFlag(Qt::ImhHiddenText) ||
- inputMethodHints.testFlag(Qt::ImhSensitiveData) ||
- inputMethodHints.testFlag(Qt::ImhNoPredictiveText)) {
- if (enablePrediction) {
- enablePrediction = false;
- emit q->selectionListsChanged();
- }
- } else if (inputMode == InputEngine::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) {
- int size = composingText.size(ComposingText::LAYER2);
- for (int i = 0; i < size; i++) {
- learnWord(i);
- }
-
- QString text = composingText.toString(ComposingText::LAYER2);
- disableUpdate = true;
- inputEngine->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 != NULL) {
- 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)
- {
- ComposingText::TextLayer layer = targetLayer;
-
- disableUpdate = true;
- inputEngine->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;
- }
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- composingText.debugout();
-#endif
-
- 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);
- }
- }
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- composingText.debugout();
-#endif
-
- commitCount = 0; /* retry consecutive clause conversion if necessary. */
-
- updateViewStatus(layer, true, true);
-
- if (activeConvertType != CONVERT_TYPE_NONE)
- focusNextCandidate();
-
- return true;
- }
-
- OpenWnnInputMethod *q_ptr;
- InputEngine::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) :
- AbstractInputMethod(*new OpenWnnInputMethodPrivate(this), parent)
-{
-}
-
-OpenWnnInputMethod::~OpenWnnInputMethod()
-{
-}
-
-QList<InputEngine::InputMode> OpenWnnInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale)
- return QList<InputEngine::InputMode>()
- << InputEngine::Hiragana
- << InputEngine::Katakana
- << InputEngine::FullwidthLatin
- << InputEngine::Latin;
-}
-
-bool OpenWnnInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale)
- Q_D(OpenWnnInputMethod);
- if (d->inputMode == inputMode)
- return true;
- update();
- switch (inputMode) {
- case InputEngine::Hiragana:
- d->changeEngineMode(OpenWnnInputMethodPrivate::ENGINE_MODE_DEFAULT);
- break;
-
- case InputEngine::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(InputEngine::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 == NULL && !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);
- }
- }
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- d->composingText.debugout();
-#endif
- 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 != NULL)
- 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);
- }
- }
- }
- }
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- d->composingText.debugout();
-#endif
- return true;
- }
- break;
- }
-
- return false;
-}
-
-QList<SelectionListModel::Type> OpenWnnInputMethod::selectionLists()
-{
- Q_D(OpenWnnInputMethod);
- if (!d->enablePrediction)
- return QList<SelectionListModel::Type>();
- return QList<SelectionListModel::Type>() << SelectionListModel::WordCandidateList;
-}
-
-int OpenWnnInputMethod::selectionListItemCount(SelectionListModel::Type type)
-{
- Q_UNUSED(type)
- Q_D(OpenWnnInputMethod);
- return d->candidateList.size();
-}
-
-QVariant OpenWnnInputMethod::selectionListData(SelectionListModel::Type type, int index, int role)
-{
- QVariant result;
- Q_D(OpenWnnInputMethod);
- switch (role) {
- case SelectionListModel::DisplayRole:
- result = QVariant(d->candidateList.at(index)->candidate);
- break;
- case SelectionListModel::WordCompletionLengthRole:
- result.setValue(0);
- break;
- default:
- result = AbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void OpenWnnInputMethod::selectionListItemSelected(SelectionListModel::Type type, int index)
-{
- Q_UNUSED(type)
- Q_D(OpenWnnInputMethod);
- 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
diff --git a/src/virtualkeyboard/openwnninputmethod.h b/src/virtualkeyboard/openwnninputmethod.h
deleted file mode 100644
index 30d7d0f7..00000000
--- a/src/virtualkeyboard/openwnninputmethod.h
+++ /dev/null
@@ -1,65 +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_H
-#define OPENWNNINPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-class OpenWnnInputMethodPrivate;
-
-class OpenWnnInputMethod : public AbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(OpenWnnInputMethod)
-
-public:
- explicit OpenWnnInputMethod(QObject *parent = 0);
- ~OpenWnnInputMethod();
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- QList<SelectionListModel::Type> selectionLists();
- int selectionListItemCount(SelectionListModel::Type type);
- QVariant selectionListData(SelectionListModel::Type type, int index, int role);
- void selectionListItemSelected(SelectionListModel::Type type, int index);
-
- void reset();
- void update();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/pinyindecoderservice.cpp b/src/virtualkeyboard/pinyindecoderservice.cpp
deleted file mode 100644
index ea0dc705..00000000
--- a/src/virtualkeyboard/pinyindecoderservice.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include "pinyindecoderservice.h"
-#include "pinyinime.h"
-#include "dictdef.h"
-#include <QStandardPaths>
-#include <QFileInfo>
-#include <QDir>
-#include <QtCore/QLibraryInfo>
-#include "virtualkeyboarddebug.h"
-
-namespace QtVirtualKeyboard {
-
-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 0;
- return _instance.data();
-}
-
-bool PinyinDecoderService::init()
-{
- if (initDone)
- return true;
-
- QString sysDict(qEnvironmentVariable("QT_VIRTUALKEYBOARD_PINYIN_DICTIONARY"));
- if (sysDict.isEmpty())
- sysDict = QLibraryInfo::location(QLibraryInfo::DataPath) + "/qtvirtualkeyboard/pinyin/dict_pinyin.dat";
-
- QString usrDictPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
- QFileInfo usrDictInfo(usrDictPath + "/qtvirtualkeyboard/pinyin/usr_dict.dat");
- if (!usrDictInfo.exists()) {
- VIRTUALKEYBOARD_DEBUG() << "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)
- VIRTUALKEYBOARD_DEBUG() << "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 + "/qtvirtualkeyboard/pinyin/usr_dict.dat");
- im_init_user_dictionary(usrDictInfo.absoluteFilePath().toUtf8().constData());
- } else {
- im_init_user_dictionary(NULL);
- }
-}
-
-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;
-}
-
-QVector<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);
-
- QVector<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);
- QVector<QChar> candidateBuf;
- candidateBuf.resize(kMaxSearchSteps + 1);
- if (!im_get_candidate(size_t(index), (char16 *)candidateBuf.data(), candidateBuf.length() - 1))
- return QString();
- candidateBuf.last() = 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] = 0;
- 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
diff --git a/src/virtualkeyboard/pinyindecoderservice.h b/src/virtualkeyboard/pinyindecoderservice.h
deleted file mode 100644
index 1db1d503..00000000
--- a/src/virtualkeyboard/pinyindecoderservice.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef PINYINDECODERSERVICE_H
-#define PINYINDECODERSERVICE_H
-
-#include <QObject>
-
-namespace QtVirtualKeyboard {
-
-class PinyinDecoderService : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(PinyinDecoderService)
- explicit PinyinDecoderService(QObject *parent = 0);
-
-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);
- QVector<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
-
-#endif // PINYINDECODERSERVICE_H
diff --git a/src/virtualkeyboard/pinyininputmethod.cpp b/src/virtualkeyboard/pinyininputmethod.cpp
deleted file mode 100644
index 3181b438..00000000
--- a/src/virtualkeyboard/pinyininputmethod.cpp
+++ /dev/null
@@ -1,496 +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.h"
-#include "pinyindecoderservice.h"
-#include "inputcontext.h"
-#include "virtualkeyboarddebug.h"
-
-namespace QtVirtualKeyboard {
-
-class PinyinInputMethodPrivate : public AbstractInputMethodPrivate
-{
- Q_DECLARE_PUBLIC(PinyinInputMethod)
-
-public:
- enum State
- {
- Idle,
- Input,
- Predict
- };
-
- PinyinInputMethodPrivate(PinyinInputMethod *q_ptr) :
- q_ptr(q_ptr),
- inputMode(InputEngine::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);
-
- InputContext *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("");
- activeCmpsLen = 0;
- posDelSpl = -1;
- isPosInSpl = false;
-
- resetCandidates();
- }
-
- bool addSpellingChar(QChar ch, bool reset)
- {
- if (reset) {
- surface.clear();
- pinyinDecoderService->resetSearch();
- }
- if (ch == Qt::Key_Apostrophe) {
- if (surface.isEmpty())
- return false;
- if (surface.endsWith(ch))
- return true;
- }
- surface.append(ch);
- return true;
- }
-
- bool removeSpellingChar()
- {
- if (surface.isEmpty())
- return false;
- QVector<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);
- QVector<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 += " ";
- }
- 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(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList,
- totalChoicesNum > 0 && state == PinyinInputMethodPrivate::Input ? 0 : -1);
- }
-
- bool canDoPrediction()
- {
- Q_Q(PinyinInputMethod);
- InputContext *inputContext = q->inputContext();
- return inputMode == InputEngine::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();
- InputContext *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;
- InputEngine::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) :
- AbstractInputMethod(*new PinyinInputMethodPrivate(this), parent)
-{
-}
-
-PinyinInputMethod::~PinyinInputMethod()
-{
-}
-
-QList<InputEngine::InputMode> PinyinInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale)
- Q_D(PinyinInputMethod);
- QList<InputEngine::InputMode> result;
- if (d->pinyinDecoderService)
- result << InputEngine::Pinyin;
- result << InputEngine::Latin;
- return result;
-}
-
-bool PinyinInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale)
- Q_D(PinyinInputMethod);
- reset();
- if (inputMode == InputEngine::Pinyin && !d->pinyinDecoderService)
- return false;
- d->inputMode = inputMode;
- return true;
-}
-
-bool PinyinInputMethod::setTextCase(InputEngine::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 == InputEngine::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<SelectionListModel::Type> PinyinInputMethod::selectionLists()
-{
- return QList<SelectionListModel::Type>() << SelectionListModel::WordCandidateList;
-}
-
-int PinyinInputMethod::selectionListItemCount(SelectionListModel::Type type)
-{
- Q_UNUSED(type)
- Q_D(PinyinInputMethod);
- return d->candidatesCount();
-}
-
-QVariant PinyinInputMethod::selectionListData(SelectionListModel::Type type, int index, int role)
-{
- QVariant result;
- Q_UNUSED(type)
- Q_D(PinyinInputMethod);
- switch (role) {
- case SelectionListModel::DisplayRole:
- result = QVariant(d->candidateAt(index));
- break;
- case SelectionListModel::WordCompletionLengthRole:
- result.setValue(0);
- break;
- default:
- result = AbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void PinyinInputMethod::selectionListItemSelected(SelectionListModel::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
diff --git a/src/virtualkeyboard/pinyininputmethod.h b/src/virtualkeyboard/pinyininputmethod.h
deleted file mode 100644
index 08837f2f..00000000
--- a/src/virtualkeyboard/pinyininputmethod.h
+++ /dev/null
@@ -1,65 +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_H
-#define PINYININPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-class PinyinInputMethodPrivate;
-
-class PinyinInputMethod : public AbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(PinyinInputMethod)
-
-public:
- explicit PinyinInputMethod(QObject *parent = 0);
- ~PinyinInputMethod();
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- QList<SelectionListModel::Type> selectionLists();
- int selectionListItemCount(SelectionListModel::Type type);
- QVariant selectionListData(SelectionListModel::Type type, int index, int role);
- void selectionListItemSelected(SelectionListModel::Type type, int index);
-
- void reset();
- void update();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // PINYININPUTMETHOD_H
diff --git a/src/virtualkeyboard/plaininputmethod.cpp b/src/virtualkeyboard/plaininputmethod.cpp
index 2ca10cb4..8ee7088c 100644
--- a/src/virtualkeyboard/plaininputmethod.cpp
+++ b/src/virtualkeyboard/plaininputmethod.cpp
@@ -27,10 +27,11 @@
**
****************************************************************************/
-#include "plaininputmethod.h"
-#include "inputengine.h"
-#include "inputcontext.h"
+#include <QtVirtualKeyboard/private/plaininputmethod_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
/*!
@@ -39,7 +40,7 @@ namespace QtVirtualKeyboard {
*/
PlainInputMethod::PlainInputMethod(QObject *parent) :
- AbstractInputMethod(parent)
+ QVirtualKeyboardAbstractInputMethod(parent)
{
}
@@ -47,38 +48,38 @@ PlainInputMethod::~PlainInputMethod()
{
}
-QList<InputEngine::InputMode> PlainInputMethod::inputModes(const QString &locale)
+QList<QVirtualKeyboardInputEngine::InputMode> PlainInputMethod::inputModes(const QString &locale)
{
- QList<InputEngine::InputMode> result;
+ QList<QVirtualKeyboardInputEngine::InputMode> result;
switch (QLocale(locale).script()) {
case QLocale::GreekScript:
- result.append(InputEngine::Greek);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Greek);
break;
case QLocale::CyrillicScript:
- result.append(InputEngine::Cyrillic);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Cyrillic);
break;
case QLocale::ArabicScript:
- result.append(InputEngine::Arabic);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Arabic);
break;
case QLocale::HebrewScript:
- result.append(InputEngine::Hebrew);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Hebrew);
break;
default:
break;
}
- result.append(InputEngine::Latin);
- result.append(InputEngine::Numeric);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Latin);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
return result;
}
-bool PlainInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
+bool PlainInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
{
Q_UNUSED(locale)
Q_UNUSED(inputMode)
return true;
}
-bool PlainInputMethod::setTextCase(InputEngine::TextCase textCase)
+bool PlainInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
{
Q_UNUSED(textCase)
return true;
@@ -102,3 +103,4 @@ void PlainInputMethod::update()
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/plaininputmethod.h b/src/virtualkeyboard/plaininputmethod.h
deleted file mode 100644
index cc1f9a50..00000000
--- a/src/virtualkeyboard/plaininputmethod.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef PLAININPUTMETHOD_H
-#define PLAININPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-class PlainInputMethod : public AbstractInputMethod
-{
- Q_OBJECT
-
-public:
- explicit PlainInputMethod(QObject *parent = 0);
- ~PlainInputMethod();
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- void reset();
- void update();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/plaininputmethod_p.h b/src/virtualkeyboard/plaininputmethod_p.h
new file mode 100644
index 00000000..c1bf54d6
--- /dev/null
+++ b/src/virtualkeyboard/plaininputmethod_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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 PLAININPUTMETHOD_P_H
+#define PLAININPUTMETHOD_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 QVIRTUALKEYBOARD_EXPORT PlainInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+
+public:
+ explicit PlainInputMethod(QObject *parent = nullptr);
+ ~PlainInputMethod();
+
+ 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();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/virtualkeyboard/platforminputcontext.cpp b/src/virtualkeyboard/platforminputcontext.cpp
index 9980ff17..736af37c 100644
--- a/src/virtualkeyboard/platforminputcontext.cpp
+++ b/src/virtualkeyboard/platforminputcontext.cpp
@@ -27,33 +27,37 @@
**
****************************************************************************/
-#include "platforminputcontext.h"
-#include "inputcontext.h"
-#include "shadowinputcontext.h"
-#include "abstractinputpanel.h"
+#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
+#include <QtVirtualKeyboard/private/shadowinputcontext_p.h>
+#include <QtVirtualKeyboard/private/abstractinputpanel_p.h>
#ifdef QT_VIRTUALKEYBOARD_DESKTOP
-#include "desktopinputpanel.h"
+#include <QtVirtualKeyboard/private/desktopinputpanel_p.h>
#endif
-#include "appinputpanel.h"
-#include "virtualkeyboarddebug.h"
+#include <QtVirtualKeyboard/private/appinputpanel_p.h>
+#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
#include <QWindow>
#include <QGuiApplication>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
+Q_LOGGING_CATEGORY(qlcVirtualKeyboard, "qt.virtualkeyboard")
+
/*!
\class QtVirtualKeyboard::PlatformInputContext
\internal
*/
PlatformInputContext::PlatformInputContext() :
- m_inputContext(0),
- m_inputPanel(0),
- m_focusObject(0),
+ m_inputContext(nullptr),
+ m_inputPanel(nullptr),
+ m_focusObject(nullptr),
m_locale(),
m_inputDirection(m_locale.textDirection()),
- m_filterEvent(0),
+ m_filterEvent(nullptr),
m_visible(false)
{
}
@@ -71,14 +75,14 @@ void PlatformInputContext::reset()
{
VIRTUALKEYBOARD_DEBUG() << "PlatformInputContext::reset()";
if (m_inputContext)
- m_inputContext->reset();
+ m_inputContext->priv()->reset();
}
void PlatformInputContext::commit()
{
VIRTUALKEYBOARD_DEBUG() << "PlatformInputContext::commit()";
if (m_inputContext)
- m_inputContext->externalCommit();
+ m_inputContext->priv()->commit();
}
void PlatformInputContext::update(Qt::InputMethodQueries queries)
@@ -97,13 +101,13 @@ void PlatformInputContext::update(Qt::InputMethodQueries queries)
#endif
if (m_inputContext) {
if (enabled) {
- m_inputContext->update(queries);
+ m_inputContext->priv()->update(queries);
if (m_visible)
updateInputPanelVisible();
} else {
hideInputPanel();
}
- m_inputContext->setFocus(enabled);
+ m_inputContext->priv()->setFocus(enabled);
}
}
@@ -111,17 +115,17 @@ void PlatformInputContext::invokeAction(QInputMethod::Action action, int cursorP
{
VIRTUALKEYBOARD_DEBUG() << "PlatformInputContext::invokeAction():" << action << cursorPosition;
if (m_inputContext)
- m_inputContext->invokeAction(action, cursorPosition);
+ m_inputContext->priv()->invokeAction(action, cursorPosition);
}
QRectF PlatformInputContext::keyboardRect() const
{
- return m_inputContext ? m_inputContext->keyboardRectangle() : QRectF();
+ return m_inputContext ? m_inputContext->priv()->keyboardRectangle() : QRectF();
}
bool PlatformInputContext::isAnimating() const
{
- return m_inputContext ? m_inputContext->animating() : false;
+ return m_inputContext ? m_inputContext->isAnimating() : false;
}
void PlatformInputContext::showInputPanel()
@@ -183,9 +187,9 @@ QObject *PlatformInputContext::focusObject()
void PlatformInputContext::setFocusObject(QObject *object)
{
VIRTUALKEYBOARD_DEBUG() << "PlatformInputContext::setFocusObject():" << object;
- Q_ASSERT(m_inputContext == 0 ||
- m_inputContext->shadow()->inputItem() == 0 ||
- m_inputContext->shadow()->inputItem() != object);
+ Q_ASSERT(m_inputContext == nullptr ||
+ m_inputContext->priv()->shadow()->inputItem() == nullptr ||
+ m_inputContext->priv()->shadow()->inputItem() != object);
if (m_focusObject != object) {
if (m_focusObject)
m_focusObject->removeEventFilter(this);
@@ -197,7 +201,7 @@ void PlatformInputContext::setFocusObject(QObject *object)
update(Qt::ImQueryAll);
}
-InputContext *PlatformInputContext::inputContext() const
+QVirtualKeyboardInputContext *PlatformInputContext::inputContext() const
{
return m_inputContext;
}
@@ -205,27 +209,37 @@ InputContext *PlatformInputContext::inputContext() const
bool PlatformInputContext::eventFilter(QObject *object, QEvent *event)
{
if (event != m_filterEvent && object == m_focusObject && m_inputContext)
- return m_inputContext->filterEvent(event);
+ return m_inputContext->priv()->filterEvent(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) {
m_filterEvent = event;
QGuiApplication::sendEvent(m_focusObject, event);
- m_filterEvent = 0;
+ m_filterEvent = nullptr;
}
}
void PlatformInputContext::sendKeyEvent(QKeyEvent *event)
{
const QGuiApplication *app = qApp;
- QWindow *focusWindow = app ? app->focusWindow() : 0;
+ QWindow *focusWindow = app ? app->focusWindow() : nullptr;
if (focusWindow) {
m_filterEvent = event;
QGuiApplication::sendEvent(focusWindow, event);
- m_filterEvent = 0;
+ m_filterEvent = nullptr;
}
}
@@ -236,7 +250,7 @@ QVariant PlatformInputContext::inputMethodQuery(Qt::InputMethodQuery query)
return event.value(query);
}
-void PlatformInputContext::setInputContext(InputContext *context)
+void PlatformInputContext::setInputContext(QVirtualKeyboardInputContext *context)
{
if (m_inputContext) {
disconnect(this, SLOT(keyboardRectangleChanged()));
@@ -245,15 +259,15 @@ void PlatformInputContext::setInputContext(InputContext *context)
if (m_inputContext) {
if (!m_inputPanel)
m_inputPanel = new AppInputPanel(this);
- connect(m_inputContext, SIGNAL(keyboardRectangleChanged()), SLOT(keyboardRectangleChanged()));
+ QObject::connect(m_inputContext->priv(), &QVirtualKeyboardInputContextPrivate::keyboardRectangleChanged, this, &PlatformInputContext::keyboardRectangleChanged);
} else if (m_inputPanel) {
- m_inputPanel = 0;
+ m_inputPanel = nullptr;
}
}
void PlatformInputContext::keyboardRectangleChanged()
{
- m_inputPanel->setInputRect(m_inputContext->keyboardRectangle().toRect());
+ m_inputPanel->setInputRect(m_inputContext->priv()->keyboardRectangle().toRect());
}
void PlatformInputContext::updateInputPanelVisible()
@@ -273,3 +287,4 @@ void PlatformInputContext::updateInputPanelVisible()
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/platforminputcontext.h b/src/virtualkeyboard/platforminputcontext.h
deleted file mode 100644
index 5c5c2909..00000000
--- a/src/virtualkeyboard/platforminputcontext.h
+++ /dev/null
@@ -1,104 +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 PLATFORMINPUTCONTEXT_H
-#define PLATFORMINPUTCONTEXT_H
-
-#include <qevent.h>
-#include <qpa/qplatforminputcontext.h>
-#include <QPointer>
-#include <QLocale>
-#include "inputselectionhandle.h"
-#include "desktopinputselectioncontrol.h"
-
-namespace QtVirtualKeyboard {
-
-class InputContext;
-class AbstractInputPanel;
-class PlatformInputContext : public QPlatformInputContext
-{
- Q_OBJECT
-public:
- explicit PlatformInputContext();
- ~PlatformInputContext();
-
- virtual bool isValid() const;
-
- virtual void reset();
- virtual void commit();
- virtual void update(Qt::InputMethodQueries queries);
- virtual void invokeAction(QInputMethod::Action action, int cursorPosition);
- virtual QRectF keyboardRect() const;
-
- virtual bool isAnimating() const;
-
- virtual void showInputPanel();
- virtual void hideInputPanel();
- virtual bool isInputPanelVisible() const;
-
- virtual QLocale locale() const;
- void setLocale(QLocale locale);
- virtual Qt::LayoutDirection inputDirection() const;
- void setInputDirection(Qt::LayoutDirection direction);
-
- QObject *focusObject();
- virtual void setFocusObject(QObject *object);
-
- InputContext *inputContext() const;
-
- virtual bool eventFilter(QObject *object, QEvent *event);
-
-signals:
- void focusObjectChanged();
-
-protected:
- void sendEvent(QEvent *event);
- void sendKeyEvent(QKeyEvent *event);
- QVariant inputMethodQuery(Qt::InputMethodQuery query);
- void setInputContext(InputContext *context);
-
-private slots:
- void keyboardRectangleChanged();
- void updateInputPanelVisible();
-
-private:
- friend class InputContext;
- QPointer<InputContext> m_inputContext;
- QPointer<AbstractInputPanel> m_inputPanel;
- QPointer<DesktopInputSelectionControl> m_selectionControl;
- QPointer<QObject> m_focusObject;
- QLocale m_locale;
- Qt::LayoutDirection m_inputDirection;
- QEvent *m_filterEvent;
- bool m_visible;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/platforminputcontext_p.h b/src/virtualkeyboard/platforminputcontext_p.h
new file mode 100644
index 00000000..50ccf561
--- /dev/null
+++ b/src/virtualkeyboard/platforminputcontext_p.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** 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 PLATFORMINPUTCONTEXT_P_H
+#define PLATFORMINPUTCONTEXT_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 <qevent.h>
+#include <qpa/qplatforminputcontext.h>
+#include <QPointer>
+#include <QLocale>
+#include <QtVirtualKeyboard/private/inputselectionhandle_p.h>
+#include <QtVirtualKeyboard/private/desktopinputselectioncontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardInputContext;
+class QVirtualKeyboardInputContextPrivate;
+
+namespace QtVirtualKeyboard {
+
+class AbstractInputPanel;
+
+class QVIRTUALKEYBOARD_EXPORT PlatformInputContext : public QPlatformInputContext
+{
+ Q_OBJECT
+public:
+ explicit PlatformInputContext();
+ ~PlatformInputContext();
+
+ virtual bool isValid() const;
+
+ virtual void reset();
+ virtual void commit();
+ virtual void update(Qt::InputMethodQueries queries);
+ virtual void invokeAction(QInputMethod::Action action, int cursorPosition);
+ virtual QRectF keyboardRect() const;
+
+ virtual bool isAnimating() const;
+
+ virtual void showInputPanel();
+ virtual void hideInputPanel();
+ virtual bool isInputPanelVisible() const;
+
+ virtual QLocale locale() const;
+ void setLocale(QLocale locale);
+ virtual Qt::LayoutDirection inputDirection() const;
+ void setInputDirection(Qt::LayoutDirection direction);
+
+ QObject *focusObject();
+ virtual void setFocusObject(QObject *object);
+
+ QVirtualKeyboardInputContext *inputContext() const;
+
+ virtual bool eventFilter(QObject *object, QEvent *event);
+
+ void setInputMethods(const QStringList &inputMethods);
+ QStringList inputMethods() const;
+
+signals:
+ void focusObjectChanged();
+
+protected:
+ void sendEvent(QEvent *event);
+ void sendKeyEvent(QKeyEvent *event);
+ QVariant inputMethodQuery(Qt::InputMethodQuery query);
+ void setInputContext(QVirtualKeyboardInputContext *context);
+
+private slots:
+ void keyboardRectangleChanged();
+ void updateInputPanelVisible();
+
+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;
+ QLocale m_locale;
+ Qt::LayoutDirection m_inputDirection;
+ QEvent *m_filterEvent;
+ bool m_visible;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/virtualkeyboard/plugin.cpp b/src/virtualkeyboard/plugin.cpp
deleted file mode 100644
index b0571116..00000000
--- a/src/virtualkeyboard/plugin.cpp
+++ /dev/null
@@ -1,257 +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 "plugin.h"
-#include "inputcontext.h"
-#include "inputengine.h"
-#include "shifthandler.h"
-#include "plaininputmethod.h"
-#ifdef HAVE_HUNSPELL
-#include "hunspellinputmethod.h"
-#endif
-#ifdef HAVE_PINYIN
-#include "pinyininputmethod.h"
-#endif
-#ifdef HAVE_TCIME
-#include "tcinputmethod.h"
-#endif
-#ifdef HAVE_HANGUL
-#include "hangulinputmethod.h"
-#endif
-#ifdef HAVE_OPENWNN
-#include "openwnninputmethod.h"
-#endif
-#ifdef HAVE_LIPI_TOOLKIT
-#include "lipiinputmethod.h"
-#endif
-#ifdef HAVE_T9WRITE
-#include "t9writeinputmethod.h"
-#endif
-#include "inputmethod.h"
-#include "selectionlistmodel.h"
-#include "enterkeyaction.h"
-#include "enterkeyactionattachedtype.h"
-#include "virtualkeyboardsettings.h"
-#include "trace.h"
-#include "shadowinputcontext.h"
-#if defined(QT_STATICPLUGIN)
-#include <QtPlugin>
-// 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(); \
- if (!QPluginLoader::staticInstances().contains(qt_static_plugin_##PLUGIN().instance())) \
- qRegisterStaticPluginFunction(qt_static_plugin_##PLUGIN());
-#endif
-
-using namespace QtVirtualKeyboard;
-
-Q_LOGGING_CATEGORY(qlcVirtualKeyboard, "qt.virtualkeyboard")
-
-static const char pluginName[] = "qtvirtualkeyboard";
-static const char inputMethodEnvVarName[] = "QT_IM_MODULE";
-static const char pluginUri[] = "QtQuick.VirtualKeyboard";
-static const char pluginSettingsUri[] = "QtQuick.VirtualKeyboard.Settings";
-
-static QPointer<PlatformInputContext> platformInputContext;
-
-static QObject *createInputContextModule(QQmlEngine *engine, QJSEngine *scriptEngine)
-{
- Q_UNUSED(scriptEngine);
- QQmlContext *rootContext = engine->rootContext();
- QStringList inputMethodList = QStringList()
- << QLatin1String("PlainInputMethod")
- << QLatin1String("HunspellInputMethod")
-#ifdef HAVE_PINYIN
- << QLatin1String("PinyinInputMethod")
-#endif
-#ifdef HAVE_TCIME
- << QLatin1String("TCInputMethod")
-#endif
-#ifdef HAVE_HANGUL
- << QLatin1String("HangulInputMethod")
-#endif
-#ifdef HAVE_OPENWNN
- << QLatin1String("JapaneseInputMethod")
-#endif
-#if defined(HAVE_LIPI_TOOLKIT) || defined(HAVE_T9WRITE)
- << QLatin1String("HandwritingInputMethod")
-#endif
- ;
- rootContext->setContextProperty(QStringLiteral("VirtualKeyboardInputMethods"), inputMethodList);
- return new InputContext(platformInputContext);
-}
-
-QStringList QVirtualKeyboardPlugin::keys() const
-{
- return QStringList(QLatin1String(pluginName));
-}
-
-QPlatformInputContext *QVirtualKeyboardPlugin::create(const QString &system, const QStringList &paramList)
-{
- Q_UNUSED(paramList);
- Q_INIT_RESOURCE(content);
- Q_INIT_RESOURCE(default_style);
- Q_INIT_RESOURCE(retro_style);
-#ifdef HAVE_T9WRITE
- Q_INIT_RESOURCE(t9write_db);
-#endif
-#ifdef HAVE_LAYOUTS
- Q_INIT_RESOURCE(layouts);
-#endif
-
- if (!qEnvironmentVariableIsSet(inputMethodEnvVarName) || qgetenv(inputMethodEnvVarName) != pluginName)
- return Q_NULLPTR;
-
-#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(QtVirtualKeyboardStylesPlugin)
-#endif
-
- qmlRegisterSingletonType<InputContext>(pluginUri, 1, 0, "InputContext", createInputContextModule);
- qmlRegisterSingletonType<InputContext>(pluginUri, 2, 0, "InputContext", createInputContextModule);
- qmlRegisterUncreatableType<InputEngine>(pluginUri, 1, 0, "InputEngine", QLatin1String("Cannot create input method engine"));
- qmlRegisterUncreatableType<InputEngine>(pluginUri, 2, 0, "InputEngine", QLatin1String("Cannot create input method engine"));
- qmlRegisterUncreatableType<ShiftHandler>(pluginUri, 1, 0, "ShiftHandler", QLatin1String("Cannot create shift handler"));
- qmlRegisterUncreatableType<ShiftHandler>(pluginUri, 2, 0, "ShiftHandler", QLatin1String("Cannot create shift handler"));
- qmlRegisterUncreatableType<SelectionListModel>(pluginUri, 1, 0, "SelectionListModel", QLatin1String("Cannot create selection list model"));
- qmlRegisterUncreatableType<SelectionListModel>(pluginUri, 2, 0, "SelectionListModel", QLatin1String("Cannot create selection list model"));
- qmlRegisterUncreatableType<AbstractInputMethod>(pluginUri, 1, 0, "AbstractInputMethod", QLatin1String("Cannot create abstract input method"));
- qmlRegisterUncreatableType<AbstractInputMethod>(pluginUri, 2, 0, "AbstractInputMethod", QLatin1String("Cannot create abstract input method"));
- qmlRegisterType<PlainInputMethod>(pluginUri, 1, 0, "PlainInputMethod");
- qmlRegisterType<PlainInputMethod>(pluginUri, 2, 0, "PlainInputMethod");
- qmlRegisterType<InputMethod>(pluginUri, 1, 0, "InputMethod");
- qmlRegisterType<InputMethod>(pluginUri, 2, 0, "InputMethod");
-#ifdef HAVE_HUNSPELL
- qmlRegisterType<HunspellInputMethod>(pluginUri, 1, 0, "HunspellInputMethod");
- qmlRegisterType<HunspellInputMethod>(pluginUri, 2, 0, "HunspellInputMethod");
-#endif
-#ifdef HAVE_PINYIN
- qmlRegisterType<PinyinInputMethod>(pluginUri, 1, 1, "PinyinInputMethod");
- qmlRegisterType<PinyinInputMethod>(pluginUri, 2, 0, "PinyinInputMethod");
-#endif
-#ifdef HAVE_TCIME
- qmlRegisterType<TCInputMethod>(pluginUri, 2, 0, "TCInputMethod");
-#endif
-#ifdef HAVE_HANGUL
- qmlRegisterType<HangulInputMethod>(pluginUri, 1, 3, "HangulInputMethod");
- qmlRegisterType<HangulInputMethod>(pluginUri, 2, 0, "HangulInputMethod");
-#endif
-#ifdef HAVE_OPENWNN
- qmlRegisterType<OpenWnnInputMethod>(pluginUri, 1, 3, "JapaneseInputMethod");
- qmlRegisterType<OpenWnnInputMethod>(pluginUri, 2, 0, "JapaneseInputMethod");
-#endif
-#ifdef HAVE_LIPI_TOOLKIT
- qmlRegisterType<LipiInputMethod>(pluginUri, 2, 0, "HandwritingInputMethod");
-#endif
-#ifdef HAVE_T9WRITE
- qmlRegisterType<T9WriteInputMethod>(pluginUri, 2, 0, "HandwritingInputMethod");
-#endif
- qmlRegisterType<EnterKeyActionAttachedType>();
- qmlRegisterType<EnterKeyAction>(pluginUri, 1, 0, "EnterKeyAction");
- qmlRegisterType<EnterKeyAction>(pluginUri, 2, 0, "EnterKeyAction");
- qmlRegisterType<Trace>(pluginUri, 2, 0, "Trace");
- qRegisterMetaType<QtVirtualKeyboard::ShadowInputContext *>("ShadowInputContext*");
- qmlRegisterUncreatableType<ShadowInputContext>(pluginUri, 2, 2, "ShadowInputContext", QLatin1String("Cannot create shadow input context"));
- qmlRegisterSingletonType<VirtualKeyboardSettings>(pluginSettingsUri, 1, 0, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterSingletonType<VirtualKeyboardSettings>(pluginSettingsUri, 1, 1, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterSingletonType<VirtualKeyboardSettings>(pluginSettingsUri, 1, 2, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterSingletonType<VirtualKeyboardSettings>(pluginSettingsUri, 2, 0, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterSingletonType<VirtualKeyboardSettings>(pluginSettingsUri, 2, 1, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterUncreatableType<WordCandidateListSettings>(pluginSettingsUri, 2, 2, "WordCandidateListSettings", QLatin1String("Cannot create word candidate list settings"));
-
- const QString path(QStringLiteral("qrc:///QtQuick/VirtualKeyboard/content/"));
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), pluginUri, 1, 0, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), pluginUri, 1, 2, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), pluginUri, 1, 3, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), pluginUri, 2, 0, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), pluginUri, 2, 1, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), pluginUri, 2, 2, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), pluginUri, 2, 3, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("HandwritingInputPanel.qml")), pluginUri, 2, 0, "HandwritingInputPanel");
- const QString componentsPath = path + QStringLiteral("components/");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("AlternativeKeys.qml")), pluginUri, 1, 0, "AlternativeKeys");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("AlternativeKeys.qml")), pluginUri, 2, 0, "AlternativeKeys");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("BackspaceKey.qml")), pluginUri, 1, 0, "BackspaceKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("BackspaceKey.qml")), pluginUri, 2, 0, "BackspaceKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("BaseKey.qml")), pluginUri, 1, 0, "BaseKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("BaseKey.qml")), pluginUri, 2, 0, "BaseKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ChangeLanguageKey.qml")), pluginUri, 1, 0, "ChangeLanguageKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ChangeLanguageKey.qml")), pluginUri, 2, 0, "ChangeLanguageKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("CharacterPreviewBubble.qml")), pluginUri, 1, 0, "CharacterPreviewBubble");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("CharacterPreviewBubble.qml")), pluginUri, 2, 0, "CharacterPreviewBubble");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("EnterKey.qml")), pluginUri, 1, 0, "EnterKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("EnterKey.qml")), pluginUri, 2, 0, "EnterKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("FillerKey.qml")), pluginUri, 1, 0, "FillerKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("FillerKey.qml")), pluginUri, 2, 0, "FillerKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("HideKeyboardKey.qml")), pluginUri, 1, 0, "HideKeyboardKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("HideKeyboardKey.qml")), pluginUri, 2, 0, "HideKeyboardKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardColumn.qml")), pluginUri, 1, 0, "KeyboardColumn");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardColumn.qml")), pluginUri, 2, 0, "KeyboardColumn");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardLayout.qml")), pluginUri, 1, 0, "KeyboardLayout");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardLayout.qml")), pluginUri, 2, 0, "KeyboardLayout");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardLayoutLoader.qml")), pluginUri, 1, 1, "KeyboardLayoutLoader");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardLayoutLoader.qml")), pluginUri, 2, 0, "KeyboardLayoutLoader");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("Keyboard.qml")), pluginUri, 1, 0, "Keyboard");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("Keyboard.qml")), pluginUri, 2, 0, "Keyboard");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardRow.qml")), pluginUri, 1, 0, "KeyboardRow");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardRow.qml")), pluginUri, 2, 0, "KeyboardRow");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("Key.qml")), pluginUri, 1, 0, "Key");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("Key.qml")), pluginUri, 2, 0, "Key");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ModeKey.qml")), pluginUri, 2, 0, "ModeKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("MultiSoundEffect.qml")), pluginUri, 1, 1, "MultiSoundEffect");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("MultiSoundEffect.qml")), pluginUri, 2, 0, "MultiSoundEffect");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("MultitapInputMethod.qml")), pluginUri, 1, 0, "MultitapInputMethod");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("MultitapInputMethod.qml")), pluginUri, 2, 0, "MultitapInputMethod");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("NumberKey.qml")), pluginUri, 1, 0, "NumberKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("NumberKey.qml")), pluginUri, 2, 0, "NumberKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ShiftKey.qml")), pluginUri, 1, 0, "ShiftKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ShiftKey.qml")), pluginUri, 2, 0, "ShiftKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SpaceKey.qml")), pluginUri, 1, 0, "SpaceKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SpaceKey.qml")), pluginUri, 2, 0, "SpaceKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SymbolModeKey.qml")), pluginUri, 1, 0, "SymbolModeKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SymbolModeKey.qml")), pluginUri, 2, 0, "SymbolModeKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("HandwritingModeKey.qml")), pluginUri, 2, 0, "HandwritingModeKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("TraceInputArea.qml")), pluginUri, 2, 0, "TraceInputArea");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("TraceInputKey.qml")), pluginUri, 2, 0, "TraceInputKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("WordCandidatePopupList.qml")), pluginUri, 2, 0, "WordCandidatePopupList");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("LanguagePopupList.qml")), pluginUri, 2, 1, "LanguagePopupList");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SelectionControl.qml")), pluginUri, 2, 1, "SelectionControl");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("InputModeKey.qml")), pluginUri, 2, 3, "InputModeKey");
-
- if (system.compare(system, QLatin1String(pluginName), Qt::CaseInsensitive) == 0) {
- platformInputContext = new PlatformInputContext();
- }
- return platformInputContext;
-}
diff --git a/src/virtualkeyboard/plugin.h b/src/virtualkeyboard/plugin.h
deleted file mode 100644
index 08074d19..00000000
--- a/src/virtualkeyboard/plugin.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef PLUGIN_H
-#define PLUGIN_H
-
-#include <QtQml>
-#include <qpa/qplatforminputcontextplugin_p.h>
-#include "platforminputcontext.h"
-#include <QStringList>
-
-class QVirtualKeyboardPlugin : public QPlatformInputContextPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE "qtvirtualkeyboard.json")
-
-public:
- QStringList keys() const;
- QPlatformInputContext *create(const QString&, const QStringList&);
-};
-
-#endif // PLUGIN_H
diff --git a/src/virtualkeyboard/qvirtualkeyboard_global.h b/src/virtualkeyboard/qvirtualkeyboard_global.h
new file mode 100644
index 00000000..f14375e5
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboard_global.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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_GLOBAL_H
+#define QVIRTUALKEYBOARD_GLOBAL_H
+
+#include <QtCore/qglobal.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
+
+#endif
diff --git a/src/virtualkeyboard/qvirtualkeyboard_staticplugin_p.h b/src/virtualkeyboard/qvirtualkeyboard_staticplugin_p.h
new file mode 100644
index 00000000..00ac394c
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboard_staticplugin_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..8ca0cdba
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.cpp
@@ -0,0 +1,363 @@
+/****************************************************************************
+**
+** 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/qvirtualkeyboardabstractinputmethod.h>
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardAbstractInputMethodPrivate : public QObjectPrivate
+{
+public:
+ QVirtualKeyboardAbstractInputMethodPrivate();
+
+ QVirtualKeyboardInputEngine *inputEngine;
+};
+
+/*!
+ \class AbstractInputMethodPrivate
+ \internal
+*/
+
+QVirtualKeyboardAbstractInputMethodPrivate::QVirtualKeyboardAbstractInputMethodPrivate() :
+ inputEngine(nullptr)
+{
+}
+
+/*!
+ \class QVirtualKeyboardAbstractInputMethod
+
+ \inmodule QtVirtualKeyboard
+
+ \brief The base class for input methods.
+
+ Use this class if you want to implement a custom input
+ method using C/C++ language.
+*/
+
+/*!
+ Constructs an input method with \a parent.
+*/
+QVirtualKeyboardAbstractInputMethod::QVirtualKeyboardAbstractInputMethod(QObject *parent) :
+ QObject(*new QVirtualKeyboardAbstractInputMethodPrivate(), parent)
+{
+}
+
+/*!
+ Destroys the input method and frees all allocated resources.
+*/
+QVirtualKeyboardAbstractInputMethod::~QVirtualKeyboardAbstractInputMethod()
+{
+}
+
+/*!
+ Returns the input context associated with the input method.
+ This method returns \c NULL if the input method is not active.
+*/
+QVirtualKeyboardInputContext *QVirtualKeyboardAbstractInputMethod::inputContext() const
+{
+ Q_D(const QVirtualKeyboardAbstractInputMethod);
+ return d->inputEngine ? d->inputEngine->inputContext() : nullptr;
+}
+
+/*!
+ Returns the input engine associated with the input method.
+ This method returns \c NULL if the input method is not active.
+*/
+QVirtualKeyboardInputEngine *QVirtualKeyboardAbstractInputMethod::inputEngine() const
+{
+ Q_D(const QVirtualKeyboardAbstractInputMethod);
+ return d->inputEngine;
+}
+
+/*!
+ This method is called by the input engine when the input method needs
+ to be reset. The input method must reset its internal state only. The main
+ difference to the update() method is that reset() modifies only
+ the input method state, i.e. it must not modify the input context.
+*/
+void QVirtualKeyboardAbstractInputMethod::reset()
+{
+}
+
+/*!
+ This method is called by the input engine when the input method needs to be
+ updated. The input method must close the current pre-edit text and
+ restore its internal state to the default.
+*/
+void QVirtualKeyboardAbstractInputMethod::update()
+{
+}
+
+/*!
+ \internal
+ Called by the input engine when the input method is activated and
+ deactivated.
+*/
+void QVirtualKeyboardAbstractInputMethod::setInputEngine(QVirtualKeyboardInputEngine *inputEngine)
+{
+ Q_D(QVirtualKeyboardAbstractInputMethod);
+ if (d->inputEngine) {
+ d->inputEngine->disconnect(this, SLOT(reset()));
+ d->inputEngine->disconnect(this, SLOT(update()));
+ }
+ d->inputEngine = inputEngine;
+ if (d->inputEngine) {
+ connect(d->inputEngine, SIGNAL(inputMethodReset()), SLOT(reset()));
+ connect(d->inputEngine, SIGNAL(inputMethodUpdate()), SLOT(update()));
+ }
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> QVirtualKeyboardAbstractInputMethod::selectionLists()
+{
+ return QList<QVirtualKeyboardSelectionListModel::Type>();
+}
+
+int QVirtualKeyboardAbstractInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type)
+ return 0;
+}
+
+QVariant QVirtualKeyboardAbstractInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ Q_UNUSED(type)
+ Q_UNUSED(index)
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ return QVariant(QString());
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ return QVariant(0);
+ case QVirtualKeyboardSelectionListModel::Role::Dictionary:
+ return QVariant(static_cast<int>(QVirtualKeyboardSelectionListModel::DictionaryType::Default));
+ case QVirtualKeyboardSelectionListModel::Role::CanRemoveSuggestion:
+ return QVariant(false);
+ }
+ return QVariant();
+}
+
+void QVirtualKeyboardAbstractInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type)
+ Q_UNUSED(index)
+}
+
+bool QVirtualKeyboardAbstractInputMethod::selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type)
+ Q_UNUSED(index)
+ return false;
+}
+
+/*!
+ \since QtQuick.VirtualKeyboard 2.0
+
+ Returns list of supported pattern recognition modes.
+
+ This method is called by the input engine to query the list of
+ supported pattern recognition modes.
+*/
+QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> QVirtualKeyboardAbstractInputMethod::patternRecognitionModes() const
+{
+ return QList<QVirtualKeyboardInputEngine::PatternRecognitionMode>();
+}
+
+/*!
+ \since QtQuick.VirtualKeyboard 2.0
+
+ This method is called when a trace interaction starts with the specified \a patternRecognitionMode.
+ The trace is uniquely identified by the \a traceId.
+ The \a traceCaptureDeviceInfo provides information about the source device and the
+ \a traceScreenInfo provides information about the screen context.
+
+ If the input method accepts the event and wants to capture the trace input, it must return
+ a new QVirtualKeyboardTrace object. This object must remain valid until the traceEnd() method is called. If the
+ QVirtualKeyboardTrace is rendered on screen, it remains there until the QVirtualKeyboardTrace object is destroyed.
+*/
+QVirtualKeyboardTrace *QVirtualKeyboardAbstractInputMethod::traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+{
+ Q_UNUSED(traceId)
+ Q_UNUSED(patternRecognitionMode)
+ Q_UNUSED(traceCaptureDeviceInfo)
+ Q_UNUSED(traceScreenInfo)
+ return nullptr;
+}
+
+/*!
+ \since QtQuick.VirtualKeyboard 2.0
+
+ This method is called when the trace interaction ends. The input method should destroy the \a trace object
+ at some point after this function is called. See the \l {Trace API for Input Methods} how to access the gathered
+ data.
+
+ The method returns \c true if the trace interaction is accepted.
+*/
+bool QVirtualKeyboardAbstractInputMethod::traceEnd(QVirtualKeyboardTrace *trace)
+{
+ Q_UNUSED(trace)
+ return false;
+}
+
+/*!
+ \since QtQuick.VirtualKeyboard 2.0
+
+ This function attempts to reselect a word located at the \a cursorPosition.
+ The \a reselectFlags define the rules for how the word should be selected in
+ relation to the cursor position.
+
+ The function returns \c true if the word was successfully reselected.
+*/
+bool QVirtualKeyboardAbstractInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags)
+{
+ Q_UNUSED(cursorPosition)
+ Q_UNUSED(reselectFlags)
+ return false;
+}
+
+/*!
+ \since QtQuick.VirtualKeyboard 2.4
+
+ Called when the user clicks on pre-edit text at \a cursorPosition.
+
+ The function should return \c true if it handles the event. Otherwise the input
+ falls back to \l reselect() for further processing.
+*/
+bool QVirtualKeyboardAbstractInputMethod::clickPreeditText(int cursorPosition)
+{
+ Q_UNUSED(cursorPosition)
+ return false;
+}
+
+/*!
+ \fn QList<QVirtualKeyboardInputEngine::InputMode> QVirtualKeyboardAbstractInputMethod::inputModes(const QString& locale)
+
+ Returns the list of input modes for \a locale.
+*/
+
+/*!
+ \fn bool QVirtualKeyboardAbstractInputMethod::setInputMode(const QString& locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+
+ Sets the \a inputMode and \a locale for this input method. Returns \c true
+ if successful.
+*/
+
+/*!
+ \fn bool QVirtualKeyboardAbstractInputMethod::setTextCase(QVirtualKeyboardInputEngine::::TextCase textCase)
+
+ Updates the \a textCase for this input method. The method returns \c true
+ if successful.
+*/
+
+/*!
+ \fn bool QVirtualKeyboardAbstractInputMethod::keyEvent(Qt::Key key, const QString& text, Qt::KeyboardModifiers modifiers)
+
+ The purpose of this method is to handle the key events generated by the the
+ input engine.
+
+ The \a key parameter specifies the code of the key to handle. The key code
+ does not distinguish between capital and non-capital letters. The \a
+ text parameter contains the Unicode text for the key. The \a modifiers
+ parameter contains the key modifiers that apply to key.
+
+ This method returns \c true if the key event was successfully handled.
+ If the return value is \c false, the key event is redirected to the default
+ input method for further processing.
+*/
+
+/*!
+ \fn QList<QVirtualKeyboardSelectionListModel::Type> QVirtualKeyboardAbstractInputMethod::selectionLists()
+
+ Returns the list of selection lists used by this input method.
+
+ This method is called by input engine when the input method is being
+ activated and every time the input method hints are updated. The input method
+ can reserve selection lists by returning the desired selection list types.
+
+ The input method may request the input engine to update the selection lists
+ at any time by emitting selectionListsChanged() signal. This signal will
+ trigger a call to this method, allowing the input method to update the selection
+ list types.
+*/
+
+/*!
+ \fn int QVirtualKeyboardAbstractInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+
+ Returns the number of items in the selection list identified by \a type.
+*/
+
+/*!
+ \fn QVariant QVirtualKeyboardAbstractInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+
+ Returns item data for the selection list identified by \a type. The \a \l {QVirtualKeyboardSelectionListModel::Role}{role}
+ parameter specifies which data is requested. The \a index parameter is a
+ zero based index into the list.
+*/
+
+/*!
+ \fn void QVirtualKeyboardAbstractInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+
+ This method is called when an item at \a index has been selected by the
+ user. The selection list is identified by the \a type parameter.
+*/
+
+/*!
+ \fn bool QVirtualKeyboardAbstractInputMethod::selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index)
+
+ This method is called when an item at \a index must be removed from dictionary.
+ The selection list is identified by the \a type parameter.
+ The function returns \c true if the word was successfully removed.
+*/
+
+/*!
+ \fn void QVirtualKeyboardAbstractInputMethod::selectionListChanged(QVirtualKeyboardSelectionListModel::Type type)
+
+ The input method emits this signal when the contents of the selection list
+ has changed. The \a type parameter specifies which selection list has
+ changed.
+*/
+
+/*!
+ \fn void QVirtualKeyboardAbstractInputMethod::selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type type, int index)
+
+ The input method emits this signal when the current \a index has changed
+ in the selection list identified by \a type.
+*/
+
+/*!
+ \fn void QVirtualKeyboardAbstractInputMethod::selectionListsChanged()
+ \since QtQuick.VirtualKeyboard 2.2
+
+ The input method emits this signal when the selection list types have
+ changed. This signal will trigger a call to selectionLists() method,
+ allowing the input method to update the selection list types.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h
new file mode 100644
index 00000000..b3fc0f04
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** 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 QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_H
+#define QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_H
+
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardselectionlistmodel.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardAbstractInputMethodPrivate;
+
+class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardAbstractInputMethod : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QVirtualKeyboardAbstractInputMethod)
+
+public:
+ explicit QVirtualKeyboardAbstractInputMethod(QObject *parent = nullptr);
+ ~QVirtualKeyboardAbstractInputMethod();
+
+ QVirtualKeyboardInputContext *inputContext() const;
+ QVirtualKeyboardInputEngine *inputEngine() const;
+
+ virtual QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) = 0;
+ virtual bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) = 0;
+ virtual bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) = 0;
+
+ virtual bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) = 0;
+
+ virtual QList<QVirtualKeyboardSelectionListModel::Type> selectionLists();
+ virtual int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type);
+ virtual QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role);
+ virtual void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index);
+ virtual bool selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index);
+
+ virtual QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> patternRecognitionModes() const;
+ virtual QVirtualKeyboardTrace *traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
+ virtual bool traceEnd(QVirtualKeyboardTrace *trace);
+
+ virtual bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags);
+ virtual bool clickPreeditText(int cursorPosition);
+
+Q_SIGNALS:
+ void selectionListChanged(QVirtualKeyboardSelectionListModel::Type type);
+ void selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type type, int index);
+ void selectionListsChanged();
+
+public Q_SLOTS:
+ virtual void reset();
+ virtual void update();
+
+private:
+ void setInputEngine(QVirtualKeyboardInputEngine *inputEngine);
+
+ friend class QVirtualKeyboardInputEngine;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/virtualkeyboard/qvirtualkeyboardextensionplugin.cpp b/src/virtualkeyboard/qvirtualkeyboardextensionplugin.cpp
new file mode 100644
index 00000000..8eef200f
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardextensionplugin.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 00000000..40e2192f
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardextensionplugin.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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/qvirtualkeyboardinputcontext.cpp b/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp
new file mode 100644
index 00000000..6fc6c1c3
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp
@@ -0,0 +1,572 @@
+/****************************************************************************
+**
+** 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/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 <QTextFormat>
+#include <QGuiApplication>
+
+/*!
+ \namespace QtVirtualKeyboard
+ \inmodule QtVirtualKeyboard
+
+ \brief Namespace for the Qt Virtual Keyboard C++ API.
+*/
+
+QT_BEGIN_NAMESPACE
+using namespace QtVirtualKeyboard;
+
+/*!
+ \qmltype InputContext
+ \instantiates QVirtualKeyboardInputContext
+ \inqmlmodule QtQuick.VirtualKeyboard
+ \ingroup qtvirtualkeyboard-qml
+ \brief Provides access to an input context.
+
+ The InputContext can be accessed as singleton instance.
+*/
+
+/*!
+ \class QVirtualKeyboardInputContext
+ \inmodule QtVirtualKeyboard
+ \brief Provides access to an input context.
+*/
+
+/*!
+ \internal
+ Constructs an input context with \a parent as the platform input
+ context.
+*/
+QVirtualKeyboardInputContext::QVirtualKeyboardInputContext(QObject *parent) :
+ QObject(parent),
+ d_ptr(new QVirtualKeyboardInputContextPrivate(this))
+{
+ Q_D(QVirtualKeyboardInputContext);
+ d->init();
+ QObject::connect(d->_shiftHandler, &ShiftHandler::shiftActiveChanged, this, &QVirtualKeyboardInputContext::shiftActiveChanged);
+ QObject::connect(d->_shiftHandler, &ShiftHandler::capsLockActiveChanged, this, &QVirtualKeyboardInputContext::capsLockActiveChanged);
+ QObject::connect(d->_shiftHandler, &ShiftHandler::uppercaseChanged, this, &QVirtualKeyboardInputContext::uppercaseChanged);
+ QObject::connect(d, &QVirtualKeyboardInputContextPrivate::localeChanged, this, &QVirtualKeyboardInputContext::localeChanged);
+}
+
+/*!
+ \internal
+ Destroys the input context and frees all allocated resources.
+*/
+QVirtualKeyboardInputContext::~QVirtualKeyboardInputContext()
+{
+}
+
+bool QVirtualKeyboardInputContext::isShiftActive() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->_shiftHandler->isShiftActive();
+}
+
+bool QVirtualKeyboardInputContext::isCapsLockActive() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->_shiftHandler->isCapsLockActive();
+}
+
+bool QVirtualKeyboardInputContext::isUppercase() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->_shiftHandler->isUppercase();
+}
+
+int QVirtualKeyboardInputContext::anchorPosition() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->anchorPosition;
+}
+
+int QVirtualKeyboardInputContext::cursorPosition() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->cursorPosition;
+}
+
+Qt::InputMethodHints QVirtualKeyboardInputContext::inputMethodHints() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->inputMethodHints;
+}
+
+QString QVirtualKeyboardInputContext::preeditText() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->preeditText;
+}
+
+void QVirtualKeyboardInputContext::setPreeditText(const QString &text, QList<QInputMethodEvent::Attribute> attributes, int replaceFrom, int replaceLength)
+{
+ Q_D(QVirtualKeyboardInputContext);
+ // Add default attributes
+ if (!text.isEmpty()) {
+ if (!d->testAttribute(attributes, QInputMethodEvent::TextFormat)) {
+ QTextCharFormat textFormat;
+ textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, text.length(), textFormat));
+ }
+ } else if (d->_forceCursorPosition != -1) {
+ d->addSelectionAttribute(attributes);
+ }
+
+ d->sendPreedit(text, attributes, replaceFrom, replaceLength);
+}
+
+QList<QInputMethodEvent::Attribute> QVirtualKeyboardInputContext::preeditTextAttributes() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->preeditTextAttributes;
+}
+
+QString QVirtualKeyboardInputContext::surroundingText() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->surroundingText;
+}
+
+QString QVirtualKeyboardInputContext::selectedText() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->selectedText;
+}
+
+QRectF QVirtualKeyboardInputContext::anchorRectangle() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->anchorRectangle;
+}
+
+QRectF QVirtualKeyboardInputContext::cursorRectangle() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->cursorRectangle;
+}
+
+bool QVirtualKeyboardInputContext::isAnimating() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->animating;
+}
+
+void QVirtualKeyboardInputContext::setAnimating(bool animating)
+{
+ Q_D(QVirtualKeyboardInputContext);
+ if (d->animating != animating) {
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContext::setAnimating():" << animating;
+ d->animating = animating;
+ emit animatingChanged();
+ d->platformInputContext->emitAnimatingChanged();
+ }
+}
+
+QString QVirtualKeyboardInputContext::locale() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->locale();
+}
+
+QVirtualKeyboardInputEngine *QVirtualKeyboardInputContext::inputEngine() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->inputEngine;
+}
+
+/*!
+ \qmlmethod void InputContext::sendKeyClick(int key, string text, int modifiers = 0)
+
+ Sends a key click event with the given \a key, \a text and \a modifiers to
+ the input item that currently has focus.
+*/
+/*!
+ Sends a key click event with the given \a key, \a text and \a modifiers to
+ the input item that currently has focus.
+*/
+void QVirtualKeyboardInputContext::sendKeyClick(int key, const QString &text, int modifiers)
+{
+ Q_D(QVirtualKeyboardInputContext);
+ if (d->_focus && d->platformInputContext) {
+ QKeyEvent pressEvent(QEvent::KeyPress, key, Qt::KeyboardModifiers(modifiers), text);
+ QKeyEvent releaseEvent(QEvent::KeyRelease, key, Qt::KeyboardModifiers(modifiers), text);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContext::sendKeyClick():" << key;
+
+ d->setState(QVirtualKeyboardInputContextPrivate::State::KeyEvent);
+ d->platformInputContext->sendKeyEvent(&pressEvent);
+ d->platformInputContext->sendKeyEvent(&releaseEvent);
+ if (d->activeKeys.isEmpty())
+ d->clearState(QVirtualKeyboardInputContextPrivate::State::KeyEvent);
+ } else {
+ qWarning() << "QVirtualKeyboardInputContext::sendKeyClick(): no focus to send key click" << key << text
+ << "- QGuiApplication::focusWindow() is:" << QGuiApplication::focusWindow();
+ }
+}
+
+/*!
+ \qmlmethod void InputContext::commit()
+
+ Commits the current pre-edit text.
+*/
+/*!
+ \fn void QVirtualKeyboardInputContext::commit()
+
+ Commits the current pre-edit text.
+*/
+void QVirtualKeyboardInputContext::commit()
+{
+ Q_D(QVirtualKeyboardInputContext);
+ QString text = d->preeditText;
+ commit(text);
+}
+
+/*!
+ \qmlmethod void InputContext::commit(string text, int replaceFrom = 0, int replaceLength = 0)
+
+ Commits the final \a text to the input item and optionally
+ modifies the text relative to the start of the pre-edit text.
+ If \a replaceFrom is non-zero, the \a text replaces the
+ contents relative to \a replaceFrom with a length of
+ \a replaceLength.
+*/
+/*!
+ Commits the final \a text to the input item and optionally
+ modifies the text relative to the start of the pre-edit text.
+ If \a replaceFrom is non-zero, the \a text replaces the
+ contents relative to \a replaceFrom with a length of
+ \a replaceLength.
+*/
+void QVirtualKeyboardInputContext::commit(const QString &text, int replaceFrom, int replaceLength)
+{
+ Q_D(QVirtualKeyboardInputContext);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContext::commit():" << text << replaceFrom << replaceLength;
+ bool preeditChanged = !d->preeditText.isEmpty();
+
+ if (d->platformInputContext) {
+ QList<QInputMethodEvent::Attribute> attributes;
+ d->addSelectionAttribute(attributes);
+ d->preeditText.clear();
+ d->preeditTextAttributes.clear();
+ QInputMethodEvent inputEvent(QString(), attributes);
+ inputEvent.setCommitString(text, replaceFrom, replaceLength);
+ d->sendInputMethodEvent(&inputEvent);
+ } else {
+ d->preeditText.clear();
+ d->preeditTextAttributes.clear();
+ }
+
+ if (preeditChanged)
+ emit preeditTextChanged();
+}
+
+/*!
+ \qmlmethod void InputContext::clear()
+
+ Clears the pre-edit text.
+*/
+/*!
+ \fn void QVirtualKeyboardInputContext::clear()
+
+ Clears the pre-edit text.
+*/
+void QVirtualKeyboardInputContext::clear()
+{
+ Q_D(QVirtualKeyboardInputContext);
+ bool preeditChanged = !d->preeditText.isEmpty();
+ d->preeditText.clear();
+ d->preeditTextAttributes.clear();
+
+ if (d->platformInputContext) {
+ QList<QInputMethodEvent::Attribute> attributes;
+ d->addSelectionAttribute(attributes);
+ QInputMethodEvent event(QString(), attributes);
+ d->sendInputMethodEvent(&event);
+ }
+
+ if (preeditChanged)
+ emit preeditTextChanged();
+}
+
+/*!
+ \internal
+*/
+void QVirtualKeyboardInputContext::setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos)
+{
+ QPlatformInputContext::setSelectionOnFocusObject(anchorPos, cursorPos);
+}
+
+bool QVirtualKeyboardInputContext::anchorRectIntersectsClipRect() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->anchorRectIntersectsClipRect;
+}
+
+bool QVirtualKeyboardInputContext::cursorRectIntersectsClipRect() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->cursorRectIntersectsClipRect;
+}
+
+bool QVirtualKeyboardInputContext::isSelectionControlVisible() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->selectionControlVisible;
+}
+
+QVirtualKeyboardInputContextPrivate *QVirtualKeyboardInputContext::priv() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return const_cast<QVirtualKeyboardInputContextPrivate *>(d);
+}
+
+/*!
+ \qmlproperty bool InputContext::shift
+ \deprecated Use \l shiftActive instead.
+
+ This property is changed when the shift status changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::shift
+ \brief the shift status.
+ \deprecated Use \l shiftActive instead.
+
+ This property is changed when the shift status changes.
+*/
+
+/*!
+ \qmlproperty bool InputContext::shiftActive
+ \since QtQuick.VirtualKeyboard 2.4
+
+ This property is changed when the shift status changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::shiftActive
+ \brief the shift status.
+
+ This property is changed when the shift status changes.
+*/
+
+/*!
+ \qmlproperty bool InputContext::capsLock
+ \deprecated Use \l capsLockActive instead.
+
+ This property is changed when the caps lock status changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::capsLock
+ \brief the caps lock status.
+ \deprecated Use \l capsLockActive instead.
+
+ This property is changed when the caps lock status changes.
+*/
+
+/*!
+ \qmlproperty bool InputContext::capsLockActive
+ \since QtQuick.VirtualKeyboard 2.4
+
+ This property is changed when the caps lock status changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::capsLockActive
+ \brief the caps lock status.
+
+ This property is changed when the caps lock status changes.
+*/
+
+/*!
+ \qmlproperty bool InputContext::uppercase
+ \since QtQuick.VirtualKeyboard 2.2
+
+ This property is \c true when either \l shiftActive or \l capsLockActive is \c true.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::uppercase
+ \brief the uppercase status.
+
+ This property is \c true when either \l shiftActive or \l capsLockActive is \c true.
+*/
+
+/*!
+ \qmlproperty int InputContext::anchorPosition
+ \since QtQuick.VirtualKeyboard 2.2
+
+ This property is changed when the anchor position changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::anchorPosition
+ \brief the anchor position.
+
+ This property is changed when the anchor position changes.
+*/
+
+/*!
+ \qmlproperty int InputContext::cursorPosition
+
+ This property is changed when the cursor position changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::cursorPosition
+ \brief the cursor position.
+
+ This property is changed when the cursor position changes.
+*/
+
+/*!
+ \qmlproperty int InputContext::inputMethodHints
+
+ This property is changed when the input method hints changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::inputMethodHints
+ \brief the input method hints.
+
+ This property is changed when the input method hints changes.
+*/
+
+/*!
+ \qmlproperty string InputContext::preeditText
+
+ This property sets the pre-edit text.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::preeditText
+ \brief the pre-edit text.
+
+ This property sets the pre-edit text.
+*/
+
+/*!
+ \qmlproperty string InputContext::surroundingText
+
+ This property is changed when the surrounding text around the cursor changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::surroundingText
+ \brief the surrounding text around cursor.
+
+ This property is changed when the surrounding text around the cursor changes.
+*/
+
+/*!
+ \qmlproperty string InputContext::selectedText
+
+ This property is changed when the selected text changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::selectedText
+ \brief the selected text.
+
+ This property is changed when the selected text changes.
+*/
+
+/*!
+ \qmlproperty rect InputContext::anchorRectangle
+ \since QtQuick.VirtualKeyboard 2.1
+
+ This property is changed when the anchor rectangle changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::anchorRectangle
+ \brief the anchor rectangle.
+
+ This property is changed when the anchor rectangle changes.
+*/
+
+/*!
+ \qmlproperty rect InputContext::cursorRectangle
+
+ This property is changed when the cursor rectangle changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::cursorRectangle
+ \brief the cursor rectangle.
+
+ This property is changed when the cursor rectangle changes.
+*/
+
+/*!
+ \qmlproperty bool InputContext::animating
+
+ Use this property to set the animating status, for example
+ during UI transitioning states.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::animating
+ \brief the animating status.
+
+ Use this property to set the animating status, for example
+ during UI transitioning states.
+*/
+
+/*!
+ \qmlproperty string InputContext::locale
+
+ This property is changed when the input locale changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::locale
+ \brief the locale.
+
+ This property is changed when the input locale changes.
+*/
+
+/*!
+ \qmlproperty InputEngine InputContext::inputEngine
+
+ This property stores the input engine.
+*/
+
+/*!
+ \property QVirtualKeyboardInputContext::inputEngine
+ \brief the input engine.
+
+ This property stores the input engine.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext.h b/src/virtualkeyboard/qvirtualkeyboardinputcontext.h
new file mode 100644
index 00000000..f55d8cae
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext.h
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** 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 QVIRTUALKEYBOARDINPUTCONTEXT_H
+#define QVIRTUALKEYBOARDINPUTCONTEXT_H
+
+#include <QObject>
+#include <QRectF>
+#include <QLocale>
+#include <QInputMethodEvent>
+#include <QInputMethod>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtVirtualKeyboard {
+class PlatformInputContext;
+}
+class QVirtualKeyboardInputEngine;
+class QVirtualKeyboardInputContextPrivate;
+
+class QVIRTUALKEYBOARD_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 capsLock READ isCapsLockActive NOTIFY capsLockActiveChanged)
+ Q_PROPERTY(bool capsLockActive READ isCapsLockActive NOTIFY capsLockActiveChanged REVISION 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)
+ Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints NOTIFY inputMethodHintsChanged)
+ Q_PROPERTY(QString preeditText READ preeditText WRITE setPreeditText NOTIFY preeditTextChanged)
+ Q_PROPERTY(QString surroundingText READ surroundingText NOTIFY surroundingTextChanged)
+ Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged)
+ Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged)
+ Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
+ Q_PROPERTY(bool animating READ isAnimating WRITE setAnimating NOTIFY animatingChanged)
+ Q_PROPERTY(QString locale READ locale NOTIFY localeChanged)
+ Q_PROPERTY(QVirtualKeyboardInputEngine *inputEngine READ inputEngine CONSTANT)
+ 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)
+
+public:
+ explicit QVirtualKeyboardInputContext(QObject *parent = nullptr);
+ ~QVirtualKeyboardInputContext();
+
+ bool isShiftActive() const;
+ bool isCapsLockActive() const;
+ bool isUppercase() const;
+ int anchorPosition() const;
+ int cursorPosition() const;
+ Qt::InputMethodHints inputMethodHints() const;
+ QString preeditText() const;
+ void setPreeditText(const QString &text, QList<QInputMethodEvent::Attribute> attributes = QList<QInputMethodEvent::Attribute>(), int replaceFrom = 0, int replaceLength = 0);
+ QList<QInputMethodEvent::Attribute> preeditTextAttributes() const;
+ QString surroundingText() const;
+ QString selectedText() const;
+ QRectF anchorRectangle() const;
+ QRectF cursorRectangle() const;
+ bool isAnimating() const;
+ void setAnimating(bool isAnimating);
+ QString locale() const;
+ QVirtualKeyboardInputEngine *inputEngine() const;
+ bool isSelectionControlVisible() const;
+ bool anchorRectIntersectsClipRect() const;
+ bool cursorRectIntersectsClipRect() const;
+ QVirtualKeyboardInputContextPrivate *priv() const;
+
+ Q_INVOKABLE void sendKeyClick(int key, const QString &text, int modifiers = 0);
+ Q_INVOKABLE void commit();
+ Q_INVOKABLE void commit(const QString &text, int replaceFrom = 0, int replaceLength = 0);
+ Q_INVOKABLE void clear();
+
+ // For selection handles
+ Q_INVOKABLE void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos);
+
+Q_SIGNALS:
+ void preeditTextChanged();
+ void inputMethodHintsChanged();
+ void surroundingTextChanged();
+ void selectedTextChanged();
+ void anchorPositionChanged();
+ void cursorPositionChanged();
+ void anchorRectangleChanged();
+ void cursorRectangleChanged();
+ void shiftActiveChanged();
+ void capsLockActiveChanged();
+ void uppercaseChanged();
+ void animatingChanged();
+ void localeChanged();
+ void selectionControlVisibleChanged();
+ void anchorRectIntersectsClipRectChanged();
+ void cursorRectIntersectsClipRectChanged();
+
+private:
+ friend class QVirtualKeyboardInputContextPrivate;
+
+ QScopedPointer<QVirtualKeyboardInputContextPrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
new file mode 100644
index 00000000..d2308b04
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
@@ -0,0 +1,550 @@
+/****************************************************************************
+**
+** 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 <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
+#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
+#include <QtVirtualKeyboard/private/settings_p.h>
+#include <QtVirtualKeyboard/private/shifthandler_p.h>
+#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
+#include <QtVirtualKeyboard/private/enterkeyaction_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+
+#include <QGuiApplication>
+#include <QtGui/qpa/qplatformintegration.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+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;
+
+QVirtualKeyboardInputContextPrivate::QVirtualKeyboardInputContextPrivate(QVirtualKeyboardInputContext *q_ptr) :
+ QObject(nullptr),
+ q_ptr(q_ptr),
+ platformInputContext(nullptr),
+ inputEngine(nullptr),
+ _shiftHandler(nullptr),
+ keyboardRect(),
+ previewRect(),
+ _previewVisible(false),
+ animating(false),
+ _focus(false),
+ cursorPosition(0),
+ anchorPosition(0),
+ forceAnchorPosition(-1),
+ _forceCursorPosition(-1),
+ inputMethodHints(Qt::ImhNone),
+ preeditText(),
+ preeditTextAttributes(),
+ surroundingText(),
+ selectedText(),
+ anchorRectangle(),
+ cursorRectangle(),
+ selectionControlVisible(false),
+ anchorRectIntersectsClipRect(false),
+ cursorRectIntersectsClipRect(false)
+#ifdef QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
+ , activeNavigationKeys()
+#endif
+{
+}
+
+void QVirtualKeyboardInputContextPrivate::init()
+{
+ Q_Q(QVirtualKeyboardInputContext);
+ QGuiApplicationPrivate *guiApplicationPrivate = QGuiApplicationPrivate::instance();
+ QPlatformIntegration *platformIntegration = guiApplicationPrivate->platformIntegration();
+ QPlatformInputContext *unknownPlatformInputContext = platformIntegration->inputContext();
+ platformInputContext = qobject_cast<PlatformInputContext *>(unknownPlatformInputContext);
+ inputEngine = new QVirtualKeyboardInputEngine(q);
+ _shiftHandler = new ShiftHandler(q);
+ inputEngine->init();
+ _shiftHandler->init();
+ _shadow.setInputContext(q);
+ if (platformInputContext) {
+ platformInputContext->setInputContext(q);
+ QObject::connect(platformInputContext, &PlatformInputContext::focusObjectChanged, this, &QVirtualKeyboardInputContextPrivate::onInputItemChanged);
+ QObject::connect(platformInputContext, &PlatformInputContext::focusObjectChanged, this, &QVirtualKeyboardInputContextPrivate::inputItemChanged);
+ }
+}
+
+QVirtualKeyboardInputContextPrivate::~QVirtualKeyboardInputContextPrivate()
+{
+}
+
+bool QVirtualKeyboardInputContextPrivate::focus() const
+{
+ return _focus;
+}
+
+void QVirtualKeyboardInputContextPrivate::setFocus(bool focus)
+{
+ if (_focus != focus) {
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContextPrivate::setFocus():" << focus;
+ _focus = focus;
+ emit focusChanged();
+ }
+}
+
+QRectF QVirtualKeyboardInputContextPrivate::keyboardRectangle() const
+{
+ return keyboardRect;
+}
+
+void QVirtualKeyboardInputContextPrivate::setKeyboardRectangle(QRectF rectangle)
+{
+ if (keyboardRect != rectangle) {
+ keyboardRect = rectangle;
+ emit keyboardRectangleChanged();
+ platformInputContext->emitKeyboardRectChanged();
+ }
+}
+
+QRectF QVirtualKeyboardInputContextPrivate::previewRectangle() const
+{
+ return previewRect;
+}
+
+void QVirtualKeyboardInputContextPrivate::setPreviewRectangle(QRectF rectangle)
+{
+ if (previewRect != rectangle) {
+ previewRect = rectangle;
+ emit previewRectangleChanged();
+ }
+}
+
+bool QVirtualKeyboardInputContextPrivate::previewVisible() const
+{
+ return _previewVisible;
+}
+
+void QVirtualKeyboardInputContextPrivate::setPreviewVisible(bool visible)
+{
+ if (_previewVisible != visible) {
+ _previewVisible = visible;
+ emit previewVisibleChanged();
+ }
+}
+
+QString QVirtualKeyboardInputContextPrivate::locale() const
+{
+ return platformInputContext ? platformInputContext->locale().name() : QString();
+}
+
+void QVirtualKeyboardInputContextPrivate::setLocale(const QString &locale)
+{
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContextPrivate::setLocale():" << locale;
+ QLocale newLocale(locale);
+ if (newLocale != platformInputContext->locale()) {
+ platformInputContext->setLocale(newLocale);
+ platformInputContext->setInputDirection(newLocale.textDirection());
+ emit localeChanged();
+ }
+}
+
+QObject *QVirtualKeyboardInputContextPrivate::inputItem() const
+{
+ return platformInputContext ? platformInputContext->focusObject() : nullptr;
+}
+
+ShiftHandler *QVirtualKeyboardInputContextPrivate::shiftHandler() const
+{
+ return _shiftHandler;
+}
+
+ShadowInputContext *QVirtualKeyboardInputContextPrivate::shadow() const
+{
+ return const_cast<ShadowInputContext *>(&_shadow);
+}
+
+QStringList QVirtualKeyboardInputContextPrivate::inputMethods() const
+{
+ return platformInputContext ? platformInputContext->inputMethods() : QStringList();
+}
+
+bool QVirtualKeyboardInputContextPrivate::fileExists(const QUrl &fileUrl)
+{
+ QString fileName;
+ if (fileUrl.scheme() == QLatin1String("qrc")) {
+ fileName = QLatin1Char(':') + fileUrl.path();
+ } else {
+ fileName = fileUrl.toLocalFile();
+ }
+ return !fileName.isEmpty() && QFile::exists(fileName);
+}
+
+bool QVirtualKeyboardInputContextPrivate::hasEnterKeyAction(QObject *item) const
+{
+ return item != nullptr && qmlAttachedPropertiesObject<EnterKeyAction>(item, false);
+}
+
+void QVirtualKeyboardInputContextPrivate::hideInputPanel()
+{
+ platformInputContext->hideInputPanel();
+}
+
+void QVirtualKeyboardInputContextPrivate::updateAvailableLocales(const QStringList &availableLocales)
+{
+ Settings *settings = Settings::instance();
+ if (settings)
+ settings->setAvailableLocales(availableLocales);
+}
+
+void QVirtualKeyboardInputContextPrivate::forceCursorPosition(int anchorPosition, int cursorPosition)
+{
+ if (!_shadow.inputItem())
+ return;
+ if (!platformInputContext->m_visible)
+ return;
+ if (testState(State::Reselect))
+ return;
+ if (testState(State::SyncShadowInput))
+ return;
+
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContextPrivate::forceCursorPosition():" << cursorPosition << "anchorPosition:" << anchorPosition;
+ if (!preeditText.isEmpty()) {
+ forceAnchorPosition = -1;
+ _forceCursorPosition = cursorPosition;
+ if (cursorPosition > this->cursorPosition)
+ _forceCursorPosition += preeditText.length();
+ commit();
+ } else {
+ forceAnchorPosition = anchorPosition;
+ _forceCursorPosition = cursorPosition;
+ Q_Q(QVirtualKeyboardInputContext);
+ q->setPreeditText(QString());
+ if (!inputMethodHints.testFlag(Qt::ImhNoPredictiveText) &&
+ cursorPosition > 0 && selectedText.isEmpty()) {
+ QVirtualKeyboardScopedState reselectState(this, State::Reselect);
+ if (inputEngine->reselect(cursorPosition, QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor))
+ setState(State::InputMethodClick);
+ }
+ }
+}
+
+void QVirtualKeyboardInputContextPrivate::onInputItemChanged()
+{
+ if (!inputItem() && !activeKeys.isEmpty()) {
+ // After losing keyboard focus it is impossible to track pressed keys
+ activeKeys.clear();
+ clearState(State::KeyEvent);
+ }
+ clearState(State::InputMethodClick);
+}
+
+void QVirtualKeyboardInputContextPrivate::sendPreedit(const QString &text, const QList<QInputMethodEvent::Attribute> &attributes, int replaceFrom, int replaceLength)
+{
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContextPrivate::sendPreedit():" << text << replaceFrom << replaceLength;
+
+ bool textChanged = preeditText != text;
+ bool attributesChanged = preeditTextAttributes != attributes;
+
+ if (textChanged || attributesChanged) {
+ preeditText = text;
+ preeditTextAttributes = attributes;
+
+ if (platformInputContext) {
+ QInputMethodEvent event(text, attributes);
+ const bool replace = replaceFrom != 0 || replaceLength > 0;
+ if (replace)
+ event.setCommitString(QString(), replaceFrom, replaceLength);
+
+ sendInputMethodEvent(&event);
+
+ // Send also to shadow input if only attributes changed.
+ // In this case the update() may not be called, so the shadow
+ // input may be out of sync.
+ if (_shadow.inputItem() && !replace && !text.isEmpty() &&
+ !textChanged && attributesChanged) {
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContextPrivate::sendPreedit(shadow):" << text << replaceFrom << replaceLength;
+ event.setAccepted(true);
+ QGuiApplication::sendEvent(_shadow.inputItem(), &event);
+ }
+ }
+
+ if (textChanged) {
+ Q_Q(QVirtualKeyboardInputContext);
+ emit q->preeditTextChanged();
+ }
+ }
+
+ if (preeditText.isEmpty())
+ preeditTextAttributes.clear();
+}
+
+void QVirtualKeyboardInputContextPrivate::sendInputMethodEvent(QInputMethodEvent *event)
+{
+ QVirtualKeyboardScopedState inputMethodEventState(this, State::InputMethodEvent);
+ platformInputContext->sendEvent(event);
+}
+
+void QVirtualKeyboardInputContextPrivate::reset()
+{
+ inputEngine->reset();
+}
+
+void QVirtualKeyboardInputContextPrivate::commit()
+{
+ inputEngine->update();
+}
+
+void QVirtualKeyboardInputContextPrivate::update(Qt::InputMethodQueries queries)
+{
+ Q_Q(QVirtualKeyboardInputContext);
+
+ // No need to fetch input clip rectangle during animation
+ if (!(queries & ~Qt::ImInputItemClipRectangle) && animating)
+ return;
+
+ // fetch
+ QInputMethodQueryEvent imQueryEvent(Qt::InputMethodQueries(Qt::ImHints |
+ Qt::ImQueryInput | Qt::ImInputItemClipRectangle));
+ platformInputContext->sendEvent(&imQueryEvent);
+ Qt::InputMethodHints inputMethodHints = Qt::InputMethodHints(imQueryEvent.value(Qt::ImHints).toInt());
+ const int cursorPosition = imQueryEvent.value(Qt::ImCursorPosition).toInt();
+ const int anchorPosition = imQueryEvent.value(Qt::ImAnchorPosition).toInt();
+ QRectF anchorRectangle;
+ QRectF cursorRectangle;
+ if (const QGuiApplication *app = qApp) {
+ anchorRectangle = app->inputMethod()->anchorRectangle();
+ cursorRectangle = app->inputMethod()->cursorRectangle();
+ } else {
+ anchorRectangle = this->anchorRectangle;
+ cursorRectangle = this->cursorRectangle;
+ }
+ QString surroundingText = imQueryEvent.value(Qt::ImSurroundingText).toString();
+ QString selectedText = imQueryEvent.value(Qt::ImCurrentSelection).toString();
+
+ // check against changes
+ bool newInputMethodHints = inputMethodHints != this->inputMethodHints;
+ bool newSurroundingText = surroundingText != this->surroundingText;
+ bool newSelectedText = selectedText != this->selectedText;
+ bool newAnchorPosition = anchorPosition != this->anchorPosition;
+ 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 newSelectionControlVisible = selectionControlVisible != this->selectionControlVisible;
+
+ QRectF inputItemClipRect = imQueryEvent.value(Qt::ImInputItemClipRectangle).toRectF();
+ QRectF anchorRect = imQueryEvent.value(Qt::ImAnchorRectangle).toRectF();
+ QRectF cursorRect = imQueryEvent.value(Qt::ImCursorRectangle).toRectF();
+
+ bool anchorRectIntersectsClipRect = inputItemClipRect.intersects(anchorRect);
+ bool newAnchorRectIntersectsClipRect = anchorRectIntersectsClipRect != this->anchorRectIntersectsClipRect;
+
+ bool cursorRectIntersectsClipRect = inputItemClipRect.intersects(cursorRect);
+ bool newCursorRectIntersectsClipRect = cursorRectIntersectsClipRect != this->cursorRectIntersectsClipRect;
+
+ // update
+ this->inputMethodHints = inputMethodHints;
+ this->surroundingText = surroundingText;
+ this->selectedText = selectedText;
+ this->anchorPosition = anchorPosition;
+ this->cursorPosition = cursorPosition;
+ this->anchorRectangle = anchorRectangle;
+ this->cursorRectangle = cursorRectangle;
+ this->selectionControlVisible = selectionControlVisible;
+ this->anchorRectIntersectsClipRect = anchorRectIntersectsClipRect;
+ this->cursorRectIntersectsClipRect = cursorRectIntersectsClipRect;
+
+ // update input engine
+ if ((newSurroundingText || newCursorPosition) &&
+ !testState(State::InputMethodEvent)) {
+ commit();
+ }
+ if (newInputMethodHints) {
+ reset();
+ }
+
+ // notify
+ if (newInputMethodHints) {
+ emit q->inputMethodHintsChanged();
+ }
+ if (newSurroundingText) {
+ emit q->surroundingTextChanged();
+ }
+ if (newSelectedText) {
+ emit q->selectedTextChanged();
+ }
+ if (newAnchorPosition) {
+ emit q->anchorPositionChanged();
+ }
+ if (newCursorPosition) {
+ emit q->cursorPositionChanged();
+ }
+ if (newAnchorRectangle) {
+ emit q->anchorRectangleChanged();
+ }
+ if (newCursorRectangle) {
+ emit q->cursorRectangleChanged();
+ }
+ if (newSelectionControlVisible) {
+ emit q->selectionControlVisibleChanged();
+ }
+ if (newAnchorRectIntersectsClipRect) {
+ emit q->anchorRectIntersectsClipRectChanged();
+ }
+ if (newCursorRectIntersectsClipRect) {
+ emit q->cursorRectIntersectsClipRectChanged();
+ }
+
+ // word reselection
+ if (newInputMethodHints || newSurroundingText || newSelectedText)
+ clearState(State::InputMethodClick);
+ if ((newSurroundingText || newCursorPosition) && !newSelectedText && isEmptyState() &&
+ !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) &&
+ cursorPosition > 0 && this->selectedText.isEmpty()) {
+ QVirtualKeyboardScopedState reselectState(this, State::Reselect);
+ if (inputEngine->reselect(cursorPosition, QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor))
+ setState(State::InputMethodClick);
+ }
+
+ if (!testState(State::SyncShadowInput)) {
+ QVirtualKeyboardScopedState syncShadowInputState(this, State::SyncShadowInput);
+ _shadow.update(queries);
+ }
+}
+
+void QVirtualKeyboardInputContextPrivate::invokeAction(QInputMethod::Action action, int cursorPosition)
+{
+ switch (action) {
+ case QInputMethod::Click:
+ if (isEmptyState()) {
+ if (inputEngine->clickPreeditText(cursorPosition))
+ break;
+
+ bool reselect = !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) && selectedText.isEmpty() && cursorPosition < preeditText.length();
+ 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()) {
+ commit();
+ }
+ }
+ clearState(State::InputMethodClick);
+ break;
+
+ case QInputMethod::ContextMenu:
+ break;
+ }
+}
+
+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);
+
+ // Keep track of pressed keys update key event state
+ if (type == QEvent::KeyPress)
+ activeKeys += keyEvent->nativeScanCode();
+ else if (type == QEvent::KeyRelease)
+ activeKeys -= keyEvent->nativeScanCode();
+
+ if (activeKeys.isEmpty())
+ clearState(State::KeyEvent);
+ else
+ 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;
+ emit navigationKeyPressed(key, keyEvent->isAutoRepeat());
+ return true;
+ } else if (type == QEvent::KeyRelease && activeNavigationKeys.contains(key)) {
+ activeNavigationKeys -= key;
+ emit navigationKeyReleased(key, keyEvent->isAutoRepeat());
+ return true;
+ }
+ }
+#endif
+
+ // Break composing text since the virtual keyboard does not support hard keyboard events
+ if (!preeditText.isEmpty())
+ commit();
+ }
+ return false;
+}
+
+void QVirtualKeyboardInputContextPrivate::addSelectionAttribute(QList<QInputMethodEvent::Attribute> &attributes)
+{
+ if (!testAttribute(attributes, QInputMethodEvent::Selection)) {
+ // Convert Cursor attribute to Selection attribute.
+ // In this case the cursor is set in pre-edit text, but
+ // the cursor is not being forced to specific location.
+ if (_forceCursorPosition == -1) {
+ int cursorAttributeIndex = findAttribute(preeditTextAttributes, QInputMethodEvent::Cursor);
+ if (cursorAttributeIndex != -1 && preeditTextAttributes[cursorAttributeIndex].length > 0)
+ _forceCursorPosition = cursorPosition + preeditTextAttributes[cursorAttributeIndex].start;
+ forceAnchorPosition = -1;
+ }
+
+ if (_forceCursorPosition != -1) {
+ if (forceAnchorPosition != -1)
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, forceAnchorPosition, _forceCursorPosition - forceAnchorPosition, QVariant()));
+ else
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, _forceCursorPosition, 0, QVariant()));
+ }
+ }
+ forceAnchorPosition = -1;
+ _forceCursorPosition = -1;
+}
+
+bool QVirtualKeyboardInputContextPrivate::testAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const
+{
+ for (const QInputMethodEvent::Attribute &attribute : qAsConst(attributes)) {
+ if (attribute.type == attributeType)
+ return true;
+ }
+ return false;
+}
+
+int QVirtualKeyboardInputContextPrivate::findAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const
+{
+ const int count = attributes.count();
+ for (int i = 0; i < count; ++i) {
+ if (attributes.at(i).type == attributeType)
+ return i;
+ }
+ return -1;
+}
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h
new file mode 100644
index 00000000..05349d38
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** 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 QVIRTUALKEYBOARDINPUTCONTEXT_P_H
+#define QVIRTUALKEYBOARDINPUTCONTEXT_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 <QRectF>
+#include <QInputMethodEvent>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/private/shadowinputcontext_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtVirtualKeyboard {
+class PlatformInputContext;
+class ShiftHandler;
+}
+class QVirtualKeyboardInputEngine;
+class QVirtualKeyboardInputContextPrivate;
+
+class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputContextPrivate : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC(QVirtualKeyboardInputContext)
+ Q_PROPERTY(bool focus READ focus WRITE setFocus NOTIFY focusChanged)
+ Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle WRITE setKeyboardRectangle NOTIFY keyboardRectangleChanged)
+ Q_PROPERTY(QRectF previewRectangle READ previewRectangle WRITE setPreviewRectangle NOTIFY previewRectangleChanged)
+ Q_PROPERTY(bool previewVisible READ previewVisible WRITE setPreviewVisible NOTIFY previewVisibleChanged)
+ Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged)
+ 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)
+
+ explicit QVirtualKeyboardInputContextPrivate(QVirtualKeyboardInputContext *q_ptr);
+ void init();
+
+public:
+ enum class State {
+ Reselect = 0x1,
+ InputMethodEvent = 0x2,
+ KeyEvent = 0x4,
+ InputMethodClick = 0x8,
+ SyncShadowInput = 0x10
+ };
+ Q_FLAG(State)
+ Q_DECLARE_FLAGS(StateFlags, QVirtualKeyboardInputContextPrivate::State)
+
+ ~QVirtualKeyboardInputContextPrivate();
+
+ bool focus() const;
+ void setFocus(bool focus);
+ QRectF keyboardRectangle() const;
+ void setKeyboardRectangle(QRectF rectangle);
+ QRectF previewRectangle() const;
+ void setPreviewRectangle(QRectF rectangle);
+ bool previewVisible() const;
+ void setPreviewVisible(bool visible);
+ QString locale() const;
+ void setLocale(const QString &locale);
+ QObject *inputItem() const;
+ QtVirtualKeyboard::ShiftHandler *shiftHandler() const;
+ QtVirtualKeyboard::ShadowInputContext *shadow() const;
+ QStringList inputMethods() const;
+
+ // Helper functions
+ Q_INVOKABLE bool fileExists(const QUrl &fileUrl);
+ Q_INVOKABLE bool hasEnterKeyAction(QObject *item) const;
+
+Q_SIGNALS:
+ void focusChanged();
+ void keyboardRectangleChanged();
+ void previewRectangleChanged();
+ void previewVisibleChanged();
+ void localeChanged();
+ void inputItemChanged();
+ void navigationKeyPressed(int key, bool isAutoRepeat);
+ void navigationKeyReleased(int key, bool isAutoRepeat);
+
+public Q_SLOTS:
+ void hideInputPanel();
+ void updateAvailableLocales(const QStringList &availableLocales);
+ void forceCursorPosition(int anchorPosition, int cursorPosition);
+
+private Q_SLOTS:
+ void onInputItemChanged();
+
+private:
+ void sendPreedit(const QString &text, const QList<QInputMethodEvent::Attribute> &attributes, int replaceFrom, int replaceLength);
+ void sendInputMethodEvent(QInputMethodEvent *event);
+ void reset();
+ void commit();
+ void update(Qt::InputMethodQueries queries);
+ void invokeAction(QInputMethod::Action action, int cursorPosition);
+ bool filterEvent(const QEvent *event);
+ void addSelectionAttribute(QList<QInputMethodEvent::Attribute> &attributes);
+ bool testAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const;
+ int findAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const;
+ inline void setState(const State &state) { stateFlags.setFlag(state); }
+ 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; }
+
+private:
+ QVirtualKeyboardInputContext *q_ptr;
+ QtVirtualKeyboard::PlatformInputContext *platformInputContext;
+ QVirtualKeyboardInputEngine *inputEngine;
+ QtVirtualKeyboard::ShiftHandler *_shiftHandler;
+ QRectF keyboardRect;
+ QRectF previewRect;
+ bool _previewVisible;
+ bool animating;
+ bool _focus;
+ StateFlags stateFlags;
+ int cursorPosition;
+ int anchorPosition;
+ int forceAnchorPosition;
+ int _forceCursorPosition;
+ Qt::InputMethodHints inputMethodHints;
+ QString preeditText;
+ QList<QInputMethodEvent::Attribute> preeditTextAttributes;
+ QString surroundingText;
+ QString selectedText;
+ QRectF anchorRectangle;
+ QRectF cursorRectangle;
+ bool selectionControlVisible;
+ bool anchorRectIntersectsClipRect;
+ bool cursorRectIntersectsClipRect;
+#ifdef QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
+ QSet<int> activeNavigationKeys;
+#endif
+ QSet<quint32> activeKeys;
+ QtVirtualKeyboard::ShadowInputContext _shadow;
+
+ friend class QtVirtualKeyboard::PlatformInputContext;
+ friend class QVirtualKeyboardScopedState;
+};
+
+class QVirtualKeyboardScopedState
+{
+ Q_DISABLE_COPY(QVirtualKeyboardScopedState)
+public:
+ QVirtualKeyboardScopedState(QVirtualKeyboardInputContextPrivate *d, QVirtualKeyboardInputContextPrivate::State state) :
+ d(d),
+ state(state)
+ {
+ d->setState(state);
+ }
+
+ ~QVirtualKeyboardScopedState()
+ {
+ d->clearState(state);
+ }
+
+private:
+ QVirtualKeyboardInputContextPrivate *d;
+ QVirtualKeyboardInputContextPrivate::State state;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QVirtualKeyboardInputContextPrivate::StateFlags)
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QVirtualKeyboardInputContextPrivate::State)
+
+#endif // QVIRTUALKEYBOARDINPUTCONTEXT_P_H
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputengine.cpp b/src/virtualkeyboard/qvirtualkeyboardinputengine.cpp
new file mode 100644
index 00000000..ddc793bf
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardinputengine.cpp
@@ -0,0 +1,1054 @@
+/****************************************************************************
+**
+** 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/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
+#include <QtVirtualKeyboard/private/shifthandler_p.h>
+#include <QtVirtualKeyboard/private/fallbackinputmethod_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
+#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
+
+#include <QTimerEvent>
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+using namespace QtVirtualKeyboard;
+
+class QVirtualKeyboardInputEnginePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QVirtualKeyboardInputEngine)
+
+public:
+ QVirtualKeyboardInputEnginePrivate(QVirtualKeyboardInputEngine *q_ptr) :
+ QObjectPrivate(),
+ q_ptr(q_ptr),
+ inputContext(nullptr),
+ fallbackInputMethod(nullptr),
+ textCase(QVirtualKeyboardInputEngine::TextCase::Lower),
+ inputMode(QVirtualKeyboardInputEngine::InputMode::Latin),
+ activeKey(Qt::Key_unknown),
+ activeKeyModifiers(Qt::NoModifier),
+ previousKey(Qt::Key_unknown),
+ repeatTimer(0),
+ repeatCount(0),
+ recursiveMethodLock(0)
+ {
+ }
+
+ virtual ~QVirtualKeyboardInputEnginePrivate()
+ {
+ }
+
+ bool virtualKeyClick(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat)
+ {
+ Q_Q(QVirtualKeyboardInputEngine);
+ bool accept = false;
+ if (inputMethod) {
+ accept = inputMethod->keyEvent(key, text, modifiers);
+ if (!accept) {
+ accept = fallbackInputMethod->keyEvent(key, text, modifiers);
+ }
+ emit q->virtualKeyClicked(key, text, modifiers, isAutoRepeat);
+ } else {
+ qWarning() << "input method is not set";
+ }
+ return accept;
+ }
+
+ QVirtualKeyboardInputEngine* q_ptr;
+ QVirtualKeyboardInputContext *inputContext;
+ QPointer<QVirtualKeyboardAbstractInputMethod> inputMethod;
+ QVirtualKeyboardAbstractInputMethod *fallbackInputMethod;
+ QVirtualKeyboardInputEngine::TextCase textCase;
+ QVirtualKeyboardInputEngine::InputMode inputMode;
+ QList<int> inputModes;
+ QMap<QVirtualKeyboardSelectionListModel::Type, QVirtualKeyboardSelectionListModel *> selectionListModels;
+ Qt::Key activeKey;
+ QString activeKeyText;
+ Qt::KeyboardModifiers activeKeyModifiers;
+ Qt::Key previousKey;
+ int repeatTimer;
+ int repeatCount;
+ int recursiveMethodLock;
+};
+
+class RecursiveMethodGuard
+{
+public:
+ explicit RecursiveMethodGuard(int &ref) : m_ref(ref)
+ {
+ m_ref++;
+ }
+ ~RecursiveMethodGuard()
+ {
+ m_ref--;
+ }
+ bool locked() const
+ {
+ return m_ref > 1;
+ }
+private:
+ int &m_ref;
+};
+
+/*!
+ \qmltype InputEngine
+ \inqmlmodule QtQuick.VirtualKeyboard
+ \ingroup qtvirtualkeyboard-qml
+ \instantiates QVirtualKeyboardInputEngine
+ \brief Maps the user input to the input methods.
+
+ The input engine is responsible for routing input events to input
+ methods. The actual input logic is implemented by the input methods.
+
+ The input engine also includes the default input method, which takes
+ care of default processing if the active input method does not handle
+ the event.
+*/
+
+/*!
+ \class QVirtualKeyboardInputEngine
+ \inmodule QtVirtualKeyboard
+ \brief The InputEngine class provides an input engine
+ that supports C++ and QML integration.
+
+ The input engine is responsible for routing input events to input
+ methods. The actual input logic is implemented by the input methods.
+
+ The input engine also includes the default input method, which takes
+ care of default processing if the active input method does not handle
+ the event.
+*/
+
+/*!
+ \internal
+ Constructs an input engine with input context as \a parent.
+*/
+QVirtualKeyboardInputEngine::QVirtualKeyboardInputEngine(QVirtualKeyboardInputContext *parent) :
+ QObject(*new QVirtualKeyboardInputEnginePrivate(this), parent)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ d->inputContext = parent;
+}
+
+void QVirtualKeyboardInputEngine::init()
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ ShiftHandler *shiftHandler = d->inputContext->priv()->shiftHandler();
+ QObject::connect(shiftHandler, &ShiftHandler::shiftActiveChanged, this, &QVirtualKeyboardInputEngine::shiftChanged);
+ QObject::connect(d->inputContext, &QVirtualKeyboardInputContext::localeChanged, this, &QVirtualKeyboardInputEngine::update);
+ QObject::connect(d->inputContext, &QVirtualKeyboardInputContext::inputMethodHintsChanged, this, &QVirtualKeyboardInputEngine::updateSelectionListModels);
+ QObject::connect(d->inputContext, &QVirtualKeyboardInputContext::localeChanged, this, &QVirtualKeyboardInputEngine::updateInputModes);
+ QObject::connect(this, &QVirtualKeyboardInputEngine::inputMethodChanged, this, &QVirtualKeyboardInputEngine::updateInputModes);
+ d->fallbackInputMethod = new FallbackInputMethod(this);
+ if (d->fallbackInputMethod)
+ d->fallbackInputMethod->setInputEngine(this);
+ d->selectionListModels[QVirtualKeyboardSelectionListModel::Type::WordCandidateList] = new QVirtualKeyboardSelectionListModel(this);
+}
+
+/*!
+ \internal
+ Destroys the input engine and frees all allocated resources.
+*/
+QVirtualKeyboardInputEngine::~QVirtualKeyboardInputEngine()
+{
+}
+
+/*!
+ \qmlmethod bool InputEngine::virtualKeyPress(int key, string text, int modifiers, bool repeat)
+
+ Called by the keyboard layer to indicate that \a key was pressed, with
+ the given \a text and \a modifiers.
+
+ The \a key is set as an active key (down key). The actual key event is
+ triggered when the key is released by the virtualKeyRelease() method. The
+ key press event can be discarded by calling virtualKeyCancel().
+
+ The key press also initiates the key repeat timer if \a repeat is \c true.
+
+ Returns \c true if the key was accepted by this input engine.
+
+ \sa virtualKeyCancel(), virtualKeyRelease()
+*/
+/*!
+ Called by the keyboard layer to indicate that \a key was pressed, with
+ the given \a text and \a modifiers.
+
+ The \a key is set as an active key (down key). The actual key event is
+ triggered when the key is released by the virtualKeyRelease() method. The
+ key press event can be discarded by calling virtualKeyCancel().
+
+ The key press also initiates the key repeat timer if \a repeat is \c true.
+
+ Returns \c true if the key was accepted by this input engine.
+
+ \sa virtualKeyCancel(), virtualKeyRelease()
+*/
+bool QVirtualKeyboardInputEngine::virtualKeyPress(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool repeat)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::virtualKeyPress():" << key << text << modifiers << repeat;
+ bool accept = false;
+ if (d->activeKey == Qt::Key_unknown || d->activeKey == key) {
+ d->activeKey = key;
+ d->activeKeyText = text;
+ d->activeKeyModifiers = modifiers;
+ if (repeat) {
+ d->repeatTimer = startTimer(600);
+ }
+ accept = true;
+ emit activeKeyChanged(d->activeKey);
+ } else {
+ qWarning("key press ignored; key is already active");
+ }
+ return accept;
+}
+
+/*!
+ \qmlmethod void InputEngine::virtualKeyCancel()
+
+ Reverts the active key state without emitting the key event.
+ This method is useful when the user discards the current key and
+ the key state needs to be restored.
+*/
+/*!
+ \fn void QVirtualKeyboardInputEngine::virtualKeyCancel()
+
+ Reverts the active key state without emitting the key event.
+ This method is useful when the user discards the current key and
+ the key state needs to be restored.
+*/
+void QVirtualKeyboardInputEngine::virtualKeyCancel()
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::virtualKeyCancel()";
+ if (d->activeKey != Qt::Key_unknown) {
+ d->activeKey = Qt::Key_unknown;
+ d->activeKeyText = QString();
+ d->activeKeyModifiers = Qt::KeyboardModifiers();
+ if (d->repeatTimer) {
+ killTimer(d->repeatTimer);
+ d->repeatTimer = 0;
+ d->repeatCount = 0;
+ }
+ emit activeKeyChanged(d->activeKey);
+ }
+}
+
+/*!
+ \qmlmethod bool InputEngine::virtualKeyRelease(int key, string text, int modifiers)
+
+ Releases the key at \a key. The method emits a key event for the input
+ method if the event has not been generated by a repeating timer.
+ The \a text and \a modifiers are passed to the input method.
+
+ Returns \c true if the key was accepted by the input engine.
+*/
+/*!
+ Releases the key at \a key. The method emits a key event for the input
+ method if the event has not been generated by a repeating timer.
+ The \a text and \a modifiers are passed to the input method.
+
+ Returns \c true if the key was accepted by the input engine.
+*/
+bool QVirtualKeyboardInputEngine::virtualKeyRelease(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::virtualKeyRelease():" << key << text << modifiers;
+ bool accept = false;
+ if (d->activeKey == key) {
+ if (!d->repeatCount) {
+ accept = d->virtualKeyClick(key, text, modifiers, false);
+ } else {
+ accept = true;
+ }
+ } else {
+ qWarning("key release ignored; key is not pressed");
+ }
+ if (d->activeKey != Qt::Key_unknown) {
+ d->previousKey = d->activeKey;
+ emit previousKeyChanged(d->previousKey);
+ d->activeKey = Qt::Key_unknown;
+ d->activeKeyText = QString();
+ d->activeKeyModifiers = Qt::KeyboardModifiers();
+ if (d->repeatTimer) {
+ killTimer(d->repeatTimer);
+ d->repeatTimer = 0;
+ d->repeatCount = 0;
+ }
+ emit activeKeyChanged(d->activeKey);
+ }
+ return accept;
+}
+
+/*!
+ \qmlmethod bool InputEngine::virtualKeyClick(int key, string text, int modifiers)
+
+ Emits a key click event for the given \a key, \a text and \a modifiers.
+ Returns \c true if the key event was accepted by the input engine.
+*/
+/*!
+ Emits a key click event for the given \a key, \a text and \a modifiers.
+ Returns \c true if the key event was accepted by the input engine.
+*/
+bool QVirtualKeyboardInputEngine::virtualKeyClick(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::virtualKeyClick():" << key << text << modifiers;
+ return d->virtualKeyClick(key, text, modifiers, false);
+}
+
+/*!
+ Returns the \c InputContext instance associated with the input
+ engine.
+*/
+QVirtualKeyboardInputContext *QVirtualKeyboardInputEngine::inputContext() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ return d->inputContext;
+}
+
+/*!
+ Returns the currently active key, or Qt::Key_unknown if no key is active.
+*/
+Qt::Key QVirtualKeyboardInputEngine::activeKey() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ return d->activeKey;
+}
+
+/*!
+ Returns the previously active key, or Qt::Key_unknown if no key has been
+ active.
+*/
+Qt::Key QVirtualKeyboardInputEngine::previousKey() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ return d->previousKey;
+}
+
+/*!
+ Returns the active input method.
+*/
+QVirtualKeyboardAbstractInputMethod *QVirtualKeyboardInputEngine::inputMethod() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ return d->inputMethod;
+}
+
+/*!
+ Sets \a inputMethod as the active input method.
+*/
+void QVirtualKeyboardInputEngine::setInputMethod(QVirtualKeyboardAbstractInputMethod *inputMethod)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::setInputMethod():" << inputMethod;
+ if (d->inputMethod != inputMethod) {
+ update();
+ if (d->inputMethod) {
+ QObject::disconnect(d->inputMethod.data(), &QVirtualKeyboardAbstractInputMethod::selectionListsChanged, this, &QVirtualKeyboardInputEngine::updateSelectionListModels);
+ d->inputMethod->setInputEngine(nullptr);
+ }
+ d->inputMethod = inputMethod;
+ if (d->inputMethod) {
+ d->inputMethod->setInputEngine(this);
+ QObject::connect(d->inputMethod.data(), &QVirtualKeyboardAbstractInputMethod::selectionListsChanged, this, &QVirtualKeyboardInputEngine::updateSelectionListModels);
+
+ // Set current text case
+ d->inputMethod->setTextCase(d->textCase);
+ }
+ updateSelectionListModels();
+ emit inputMethodChanged();
+ emit patternRecognitionModesChanged();
+ }
+}
+
+/*!
+ Returns the list of available input modes.
+*/
+QList<int> QVirtualKeyboardInputEngine::inputModes() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ return d->inputModes;
+}
+
+QVirtualKeyboardInputEngine::InputMode QVirtualKeyboardInputEngine::inputMode() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ return d->inputMode;
+}
+
+void QVirtualKeyboardInputEngine::setInputMode(QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::setInputMode():" << inputMode;
+ if (d->inputMethod) {
+#ifdef QT_DEBUG
+ // Cached input modes should be in sync with the input method
+ // If the assert below fails, we have missed an update somewhere
+ QList<int> cachedInputModes(d->inputModes);
+ updateInputModes();
+ Q_ASSERT(cachedInputModes == d->inputModes);
+#endif
+ if (d->inputModes.contains(static_cast<const int>(inputMode))) {
+ d->inputMethod->setInputMode(d->inputContext->locale(), inputMode);
+ if (d->inputMode != inputMode) {
+ d->inputMode = inputMode;
+ emit inputModeChanged();
+ }
+ } else {
+ qWarning() << "Input mode" << inputMode <<
+ "is not in the list of available input modes" << d->inputModes;
+ }
+ }
+}
+
+QVirtualKeyboardSelectionListModel *QVirtualKeyboardInputEngine::wordCandidateListModel() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ return d->selectionListModels[QVirtualKeyboardSelectionListModel::Type::WordCandidateList];
+}
+
+bool QVirtualKeyboardInputEngine::wordCandidateListVisibleHint() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ const auto it = d->selectionListModels.constFind(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ if (it == d->selectionListModels.cend())
+ return false;
+ return it.value()->dataSource() != nullptr;
+}
+
+/*!
+ Returns list of supported pattern recognition modes.
+*/
+QList<int> QVirtualKeyboardInputEngine::patternRecognitionModes() const
+{
+ Q_D(const QVirtualKeyboardInputEngine);
+ QList<PatternRecognitionMode> patterRecognitionModeList;
+ if (d->inputMethod)
+ patterRecognitionModeList = d->inputMethod->patternRecognitionModes();
+ QList<int> resultList;
+ if (patterRecognitionModeList.isEmpty())
+ return resultList;
+ resultList.reserve(patterRecognitionModeList.size());
+ for (const PatternRecognitionMode &patternRecognitionMode : qAsConst(patterRecognitionModeList))
+ resultList.append(static_cast<int>(patternRecognitionMode));
+ return resultList;
+}
+
+/*!
+ \qmlmethod QVirtualKeyboardTrace InputEngine::traceBegin(int traceId, int patternRecognitionMode, var traceCaptureDeviceInfo, var traceScreenInfo)
+ \since QtQuick.VirtualKeyboard 2.0
+
+ Starts a trace interaction with the input engine.
+
+ The trace is uniquely identified by the \a traceId. The input engine will assign
+ the id to the Trace object if the input method accepts the event.
+
+ The \a patternRecognitionMode specifies the recognition mode used for the pattern.
+
+ If the current input method accepts the event it returns a Trace object associated with this interaction.
+ If the input method discards the event, it returns a null value.
+
+ The \a traceCaptureDeviceInfo provides information about the source device and the \a traceScreenInfo
+ provides information about the screen context.
+
+ By definition, the Trace object remains valid until the traceEnd() method is called.
+
+ The trace interaction is ended by calling the \l {InputEngine::traceEnd()} {InputEngine.traceEnd()} method.
+*/
+/*!
+ \since QtQuick.VirtualKeyboard 2.0
+
+ Starts a trace interaction with the input engine.
+
+ The trace is uniquely identified by the \a traceId. The input engine will assign
+ the id to the QVirtualKeyboardTrace object if the input method accepts the event.
+
+ The \a patternRecognitionMode specifies the recognition mode used for the pattern.
+
+ If the current input method accepts the event it returns a QVirtualKeyboardTrace object associated with this interaction.
+ If the input method discards the event, it returns a NULL value.
+
+ The \a traceCaptureDeviceInfo provides information about the source device and the \a traceScreenInfo
+ provides information about the screen context.
+
+ By definition, the QVirtualKeyboardTrace object remains valid until the traceEnd() method is called.
+
+ The trace interaction is ended by calling the traceEnd() method.
+*/
+QVirtualKeyboardTrace *QVirtualKeyboardInputEngine::traceBegin(
+ int traceId, PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::traceBegin():"
+ << "traceId:" << traceId
+ << "patternRecognitionMode:" << patternRecognitionMode
+ << "traceCaptureDeviceInfo:" << traceCaptureDeviceInfo
+ << "traceScreenInfo:" << traceScreenInfo;
+ if (!d->inputMethod)
+ return nullptr;
+ if (patternRecognitionMode == PatternRecognitionMode::None)
+ return nullptr;
+ if (!d->inputMethod->patternRecognitionModes().contains(patternRecognitionMode))
+ return nullptr;
+ QVirtualKeyboardTrace *trace = d->inputMethod->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
+ if (trace)
+ trace->setTraceId(traceId);
+ return trace;
+}
+
+/*!
+ \qmlmethod bool InputEngine::traceEnd(Trace trace)
+
+ Ends the trace interaction with the input engine.
+
+ The \a trace object may be discarded at any point after calling this function.
+
+ The function returns true if the trace interaction was accepted (i.e. the touch
+ events should not be used for anything else).
+*/
+/*!
+ Ends the trace interaction with the input engine.
+
+ The \a trace object may be discarded at any point after calling this function.
+
+ The function returns true if the trace interaction was accepted (i.e. the touch
+ events should not be used for anything else).
+*/
+bool QVirtualKeyboardInputEngine::traceEnd(QVirtualKeyboardTrace *trace)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::traceEnd():" << trace;
+ Q_ASSERT(trace);
+ if (!d->inputMethod)
+ return false;
+ return d->inputMethod->traceEnd(trace);
+}
+
+/*!
+ \since QtQuick.VirtualKeyboard 2.0
+
+ This function attempts to reselect a word located at the \a cursorPosition.
+ The \a reselectFlags define the rules for how the word should be selected in
+ relation to the cursor position.
+
+ The function returns \c true if the word was successfully reselected.
+*/
+bool QVirtualKeyboardInputEngine::reselect(int cursorPosition, const ReselectFlags &reselectFlags)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::reselect():" << cursorPosition << reselectFlags;
+ if (!d->inputMethod || !wordCandidateListVisibleHint())
+ return false;
+ return d->inputMethod->reselect(cursorPosition, reselectFlags);
+}
+
+/*!
+ \internal
+ This method is called when the current preedit text is clicked.
+*/
+bool QVirtualKeyboardInputEngine::clickPreeditText(int cursorPosition)
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ if (!d->inputMethod)
+ return false;
+ return d->inputMethod->clickPreeditText(cursorPosition);
+}
+
+/*!
+ \internal
+ Resets the input method.
+*/
+void QVirtualKeyboardInputEngine::reset()
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ if (d->inputMethod) {
+ RecursiveMethodGuard guard(d->recursiveMethodLock);
+ if (!guard.locked()) {
+ emit inputMethodReset();
+ updateInputModes();
+ }
+ } else {
+ updateInputModes();
+ }
+}
+
+/*!
+ \internal
+ Updates the input method's state. This method is called whenever the input
+ context is changed.
+*/
+void QVirtualKeyboardInputEngine::update()
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ if (d->inputMethod) {
+ RecursiveMethodGuard guard(d->recursiveMethodLock);
+ if (!guard.locked()) {
+ emit inputMethodUpdate();
+ }
+ }
+}
+
+/*!
+ \internal
+ Updates the text case for the input method.
+*/
+void QVirtualKeyboardInputEngine::shiftChanged()
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ TextCase newCase = d->inputContext->priv()->shiftHandler()->isShiftActive() ? TextCase::Upper : TextCase::Lower;
+ if (d->textCase != newCase) {
+ d->textCase = newCase;
+ if (d->inputMethod) {
+ d->inputMethod->setTextCase(d->textCase);
+ }
+ }
+}
+
+/*!
+ \internal
+*/
+void QVirtualKeyboardInputEngine::updateSelectionListModels()
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ QList<QVirtualKeyboardSelectionListModel::Type> inactiveSelectionLists = d->selectionListModels.keys();
+ if (d->inputMethod) {
+ // Allocate selection lists for the input method
+ const QList<QVirtualKeyboardSelectionListModel::Type> activeSelectionLists = d->inputMethod->selectionLists();
+ for (const QVirtualKeyboardSelectionListModel::Type &selectionListType : activeSelectionLists) {
+ auto it = d->selectionListModels.find(selectionListType);
+ if (it == d->selectionListModels.end()) {
+ it = d->selectionListModels.insert(selectionListType, new QVirtualKeyboardSelectionListModel(this));
+ if (selectionListType == QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
+ emit wordCandidateListModelChanged();
+ }
+ it.value()->setDataSource(d->inputMethod, selectionListType);
+ if (selectionListType == QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
+ emit wordCandidateListVisibleHintChanged();
+ inactiveSelectionLists.removeAll(selectionListType);
+ }
+ }
+
+ // Deallocate inactive selection lists
+ for (const QVirtualKeyboardSelectionListModel::Type &selectionListType : qAsConst(inactiveSelectionLists)) {
+ const auto it = d->selectionListModels.constFind(selectionListType);
+ if (it != d->selectionListModels.cend()) {
+ it.value()->setDataSource(nullptr, selectionListType);
+ if (selectionListType == QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
+ emit wordCandidateListVisibleHintChanged();
+ }
+ }
+}
+
+/*!
+ \internal
+*/
+void QVirtualKeyboardInputEngine::updateInputModes()
+{
+ Q_D(QVirtualKeyboardInputEngine);
+ QList<int> newInputModes;
+ if (d->inputMethod) {
+ QList<InputMode> tmpList(d->inputMethod->inputModes(d->inputContext->locale()));
+ if (!tmpList.isEmpty()) {
+ std::transform(tmpList.constBegin(), tmpList.constEnd(),
+ std::back_inserter(newInputModes),
+ [tmpList] (InputMode inputMode) {
+ return static_cast<int>(inputMode);
+ });
+ }
+ }
+ if (d->inputModes != newInputModes) {
+ d->inputModes = newInputModes;
+ emit inputModesChanged();
+ }
+}
+
+/*!
+ \internal
+*/
+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);
+ d->repeatCount++;
+ }
+}
+
+/*!
+ \qmlproperty int InputEngine::activeKey
+
+ Currently pressed key.
+*/
+
+/*!
+ \property QVirtualKeyboardInputEngine::activeKey
+ \brief the active key.
+
+ Currently pressed key.
+*/
+
+/*!
+ \qmlproperty int InputEngine::previousKey
+
+ Previously pressed key.
+*/
+/*!
+ \property QVirtualKeyboardInputEngine::previousKey
+ \brief the previous active key.
+
+ Previously pressed key.
+*/
+
+/*!
+ \qmlproperty InputMethod InputEngine::inputMethod
+
+ Use this property to set the active input method, or to monitor when the
+ active input method changes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputEngine::inputMethod
+ \brief the active input method.
+
+ Use this property to set active the input method, or to monitor when the
+ active input method changes.
+*/
+
+/*!
+ \qmlproperty list<int> InputEngine::inputModes
+
+ The list of available input modes is dependent on the input method and
+ locale. This property is updated when either of the dependencies change.
+*/
+
+/*!
+ \property QVirtualKeyboardInputEngine::inputModes
+ \brief the available input modes for active input method.
+
+ The list of available input modes is dependent on the input method and
+ locale. This property is updated when either of the dependencies changes.
+*/
+
+/*!
+ \qmlproperty int InputEngine::inputMode
+
+ Use this property to get or set the current input mode. The
+ InputEngine::inputModes property provides the list of valid input modes
+ for the current input method and locale.
+
+ The predefined input modes are:
+
+ \list
+ \li \c InputEngine.InputMode.Latin The default input mode for latin text.
+ \li \c InputEngine.InputMode.Numeric Only numeric input is allowed.
+ \li \c InputEngine.InputMode.Dialable Only dialable input is allowed.
+ \li \c InputEngine.InputMode.Pinyin Pinyin input mode for Chinese.
+ \li \c InputEngine.InputMode.Cangjie Cangjie input mode for Chinese.
+ \li \c InputEngine.InputMode.Zhuyin Zhuyin input mode for Chinese.
+ \li \c InputEngine.InputMode.Hangul Hangul input mode for Korean.
+ \li \c InputEngine.InputMode.Hiragana Hiragana input mode for Japanese.
+ \li \c InputEngine.InputMode.Katakana Katakana input mode for Japanese.
+ \li \c InputEngine.InputMode.FullwidthLatin Fullwidth latin input mode for East Asian languages.
+ \li \c InputEngine.InputMode.Greek Greek input mode.
+ \li \c InputEngine.InputMode.Cyrillic Cyrillic input mode.
+ \li \c InputEngine.InputMode.Arabic Arabic input mode.
+ \li \c InputEngine.InputMode.Hebrew Hebrew input mode.
+ \li \c InputEngine.InputMode.ChineseHandwriting Chinese handwriting.
+ \li \c InputEngine.InputMode.JapaneseHandwriting Japanese handwriting.
+ \li \c InputEngine.InputMode.KoreanHandwriting Korean handwriting.
+ \endlist
+*/
+
+/*!
+ \property QVirtualKeyboardInputEngine::inputMode
+ \brief the current input mode.
+
+ Use this property to get or set the current input mode. The
+ InputEngine::inputModes provides list of valid input modes
+ for current input method and locale.
+*/
+
+/*!
+ \qmlproperty QVirtualKeyboardSelectionListModel InputEngine::wordCandidateListModel
+
+ Use this property to access the list model for the word candidate
+ list.
+*/
+
+/*!
+ \property QVirtualKeyboardInputEngine::wordCandidateListModel
+ \brief list model for the word candidate list.
+
+ Use this property to access the list model for the word candidate
+ list.
+*/
+
+/*!
+ \qmlproperty bool InputEngine::wordCandidateListVisibleHint
+
+ Use this property to check if the word candidate list should be visible
+ in the UI.
+*/
+
+/*!
+ \property QVirtualKeyboardInputEngine::wordCandidateListVisibleHint
+ \brief visible hint for the word candidate list.
+
+ Use this property to check if the word candidate list should be visible
+ in the UI.
+*/
+
+/*!
+ \enum QVirtualKeyboardInputEngine::InputMode
+
+ This enum specifies the input mode for the input method.
+
+ \value InputMode::Latin
+ The default input mode for latin text.
+ \value InputMode::Numeric
+ Only numeric input is allowed.
+ \value InputMode::Dialable
+ Only dialable input is allowed.
+ \value InputMode::Pinyin
+ Pinyin input mode for Chinese.
+ \value InputMode::Cangjie
+ Cangjie input mode for Chinese.
+ \value InputMode::Zhuyin
+ Zhuyin input mode for Chinese.
+ \value InputMode::Hangul
+ Hangul input mode for Korean.
+ \value InputMode::Hiragana
+ Hiragana input mode for Japanese.
+ \value InputMode::Katakana
+ Katakana input mode for Japanese.
+ \value InputMode::FullwidthLatin
+ Fullwidth latin input mode for East Asian languages.
+ \value InputMode::Greek
+ Greek input mode.
+ \value InputMode::Cyrillic
+ Cyrillic input mode.
+ \value InputMode::Arabic
+ Arabic input mode.
+ \value InputMode::Hebrew
+ Hebrew input mode.
+*/
+
+/*!
+ \enum QVirtualKeyboardInputEngine::TextCase
+
+ This enum specifies the text case for the input method.
+
+ \value TextCase::Lower
+ Lower case text.
+ \value TextCase::Upper
+ Upper case text.
+*/
+
+/*!
+ \enum QVirtualKeyboardInputEngine::PatternRecognitionMode
+
+ This enum specifies the input mode for the input method.
+
+ \value PatternRecognitionMode::None
+ Pattern recognition is not available.
+ \value PatternRecognitionMode::PatternRecognitionDisabled
+ \c obsolete Use PatternRecognitionMode::None
+ \value PatternRecognitionMode::Handwriting
+ Pattern recognition mode for handwriting recognition.
+ \value PatternRecognitionMode::HandwritingRecoginition
+ \c obsolete Use PatternRecognitionMode::Handwriting
+*/
+
+/*!
+ \enum QVirtualKeyboardInputEngine::ReselectFlag
+
+ This enum specifies the rules for word reselection.
+
+ \value ReselectFlag::WordBeforeCursor
+ Activate the word before the cursor. When this flag is used exclusively, the word must end exactly at the cursor.
+ \value ReselectFlag::WordAfterCursor
+ Activate the word after the cursor. When this flag is used exclusively, the word must start exactly at the cursor.
+ \value ReselectFlag::WordAtCursor
+ Activate the word at the cursor. This flag is a combination of the above flags with the exception that the word cannot start or stop at the cursor.
+*/
+
+/*!
+ \qmlsignal void InputEngine::virtualKeyClicked(int key, string text, int modifiers)
+
+ Indicates that the virtual \a key was clicked with the given \a text and
+ \a modifiers.
+ This signal is emitted after the input method has processed the key event.
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::virtualKeyClicked(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat)
+
+ Indicates that the virtual \a key was clicked with the given \a text and
+ \a modifiers. The \a isAutoRepeat indicates if the event is automatically
+ repeated while the key is being pressed.
+ This signal is emitted after the input method has processed the key event.
+*/
+
+/*!
+ \qmlproperty list<int> InputEngine::patternRecognitionModes
+ \since QtQuick.VirtualKeyboard 2.0
+
+ The list of available pattern recognition modes.
+*/
+
+/*!
+ \property QVirtualKeyboardInputEngine::patternRecognitionModes
+ \since QtQuick.VirtualKeyboard 2.0
+ \brief the list of available pattern recognition modes.
+
+ The list of available pattern recognition modes.
+*/
+
+/*!
+ \qmlsignal void InputEngine::activeKeyChanged(int key)
+
+ Indicates that the active \a key has changed.
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::activeKeyChanged(Qt::Key key)
+
+ Indicates that the active \a key has changed.
+*/
+
+/*!
+ \qmlsignal void InputEngine::previousKeyChanged(int key)
+
+ Indicates that the previous \a key has changed.
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::previousKeyChanged(Qt::Key key)
+
+ Indicates that the previous \a key has changed.
+*/
+
+/*!
+ \qmlsignal void InputEngine::inputMethodChanged()
+
+ Indicates that the input method has changed.
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::inputMethodChanged()
+
+ Indicates that the input method has changed.
+*/
+
+/*!
+ \qmlsignal void InputEngine::inputMethodReset()
+
+ Emitted when the input method needs to be reset.
+
+ \note This signal is automatically connected to QVirtualKeyboardAbstractInputMethod::reset()
+ and InputMethod::reset() when the input method is activated.
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::inputMethodReset()
+
+ Emitted when the input method needs to be reset.
+
+ \note This signal is automatically connected to QVirtualKeyboardAbstractInputMethod::reset()
+ and InputMethod::reset() when the input method is activated.
+*/
+
+/*!
+ \qmlsignal void InputEngine::inputMethodUpdate()
+
+ \note This signal is automatically connected to QVirtualKeyboardAbstractInputMethod::update()
+ and InputMethod::update() when the input method is activated.
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::inputMethodUpdate()
+
+ \note This signal is automatically connected to QVirtualKeyboardAbstractInputMethod::update()
+ and InputMethod::update() when the input method is activated.
+*/
+
+/*!
+ \qmlsignal void InputEngine::inputModesChanged()
+
+ Indicates that the available input modes have changed.
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::inputModesChanged()
+
+ Indicates that the available input modes have changed.
+*/
+
+/*!
+ \qmlsignal void InputEngine::inputModeChanged()
+
+ Indicates that the input mode has changed.
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::inputModeChanged()
+
+ Indicates that the input mode has changed.
+*/
+
+/*!
+ \qmlsignal void InputEngine::patternRecognitionModesChanged()
+ \since QtQuick.VirtualKeyboard 2.0
+
+ Indicates that the available pattern recognition modes have changed.
+
+ The predefined pattern recognition modes are:
+
+ \list
+ \li \c InputEngine.PatternRecognitionMode.None Pattern recognition is not available.
+ \li \c InputEngine.PatternRecognitionMode.PatternRecognitionDisabled \c obsolete Use InputEngine.PatternRecognitionMode.None
+ \li \c InputEngine.PatternRecognitionMode.Handwriting Pattern recognition mode for handwriting recognition.
+ \li \c InputEngine.PatternRecognitionMode.HandwritingRecoginition \c obsolete Use InputEngine.PatternRecognitionMode.Handwriting
+ \endlist
+*/
+
+/*!
+ \fn void QVirtualKeyboardInputEngine::patternRecognitionModesChanged()
+ \since QtQuick.VirtualKeyboard 2.0
+
+ Indicates that the available pattern recognition modes have changed.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputengine.h b/src/virtualkeyboard/qvirtualkeyboardinputengine.h
new file mode 100644
index 00000000..29c0eedd
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardinputengine.h
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** 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 QVIRTUALKEYBOARDINPUTENGINE_H
+#define QVIRTUALKEYBOARDINPUTENGINE_H
+
+#include <QObject>
+#include <QPointer>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardInputContext;
+class QVirtualKeyboardSelectionListModel;
+class QVirtualKeyboardAbstractInputMethod;
+class QVirtualKeyboardInputEnginePrivate;
+class QVirtualKeyboardTrace;
+
+class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputEngine : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QVirtualKeyboardInputEngine)
+ Q_DECLARE_PRIVATE(QVirtualKeyboardInputEngine)
+ Q_PROPERTY(Qt::Key activeKey READ activeKey NOTIFY activeKeyChanged)
+ Q_PROPERTY(Qt::Key previousKey READ previousKey NOTIFY previousKeyChanged)
+ Q_PROPERTY(QVirtualKeyboardAbstractInputMethod *inputMethod READ inputMethod WRITE setInputMethod NOTIFY inputMethodChanged)
+ Q_PROPERTY(QList<int> inputModes READ inputModes NOTIFY inputModesChanged)
+ Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode NOTIFY inputModeChanged)
+ Q_PROPERTY(QList<int> patternRecognitionModes READ patternRecognitionModes NOTIFY patternRecognitionModesChanged)
+ Q_PROPERTY(QVirtualKeyboardSelectionListModel *wordCandidateListModel READ wordCandidateListModel NOTIFY wordCandidateListModelChanged)
+ Q_PROPERTY(bool wordCandidateListVisibleHint READ wordCandidateListVisibleHint NOTIFY wordCandidateListVisibleHintChanged)
+
+ explicit QVirtualKeyboardInputEngine(QVirtualKeyboardInputContext *parent = nullptr);
+ void init();
+
+public:
+ enum class TextCase {
+ Lower,
+ Upper
+ };
+ Q_ENUM(TextCase)
+
+ enum class InputMode {
+ Latin,
+ Numeric,
+ Dialable,
+ Pinyin,
+ Cangjie,
+ Zhuyin,
+ Hangul,
+ Hiragana,
+ Katakana,
+ FullwidthLatin,
+ Greek,
+ Cyrillic,
+ Arabic,
+ Hebrew,
+ ChineseHandwriting,
+ JapaneseHandwriting,
+ KoreanHandwriting
+ };
+ Q_ENUM(InputMode)
+
+ enum class PatternRecognitionMode {
+ None,
+ PatternRecognitionDisabled = None,
+ Handwriting,
+ HandwritingRecoginition = Handwriting
+ };
+ Q_ENUM(PatternRecognitionMode)
+
+ enum class ReselectFlag {
+ WordBeforeCursor = 0x1,
+ WordAfterCursor = 0x2,
+ WordAtCursor = WordBeforeCursor | WordAfterCursor
+ };
+ Q_FLAG(ReselectFlag)
+ Q_DECLARE_FLAGS(ReselectFlags, QVirtualKeyboardInputEngine::ReselectFlag)
+
+public:
+ ~QVirtualKeyboardInputEngine();
+
+ Q_INVOKABLE bool virtualKeyPress(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool repeat);
+ Q_INVOKABLE void virtualKeyCancel();
+ Q_INVOKABLE bool virtualKeyRelease(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
+ Q_INVOKABLE bool virtualKeyClick(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
+
+ QVirtualKeyboardInputContext *inputContext() const;
+ Qt::Key activeKey() const;
+ Qt::Key previousKey() const;
+
+ QVirtualKeyboardAbstractInputMethod *inputMethod() const;
+ void setInputMethod(QVirtualKeyboardAbstractInputMethod *inputMethod);
+
+ QList<int> inputModes() const;
+
+ InputMode inputMode() const;
+ void setInputMode(InputMode inputMode);
+
+ QVirtualKeyboardSelectionListModel *wordCandidateListModel() const;
+ bool wordCandidateListVisibleHint() const;
+
+ QList<int> patternRecognitionModes() const;
+ Q_INVOKABLE QVirtualKeyboardTrace *traceBegin(
+ int traceId, PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
+ Q_INVOKABLE bool traceEnd(QVirtualKeyboardTrace *trace);
+
+ Q_INVOKABLE bool reselect(int cursorPosition, const ReselectFlags &reselectFlags);
+ bool clickPreeditText(int cursorPosition);
+
+Q_SIGNALS:
+ void virtualKeyClicked(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat);
+ void activeKeyChanged(Qt::Key key);
+ void previousKeyChanged(Qt::Key key);
+ void inputMethodChanged();
+ void inputMethodReset();
+ void inputMethodUpdate();
+ void inputModesChanged();
+ void inputModeChanged();
+ void patternRecognitionModesChanged();
+ void wordCandidateListModelChanged();
+ void wordCandidateListVisibleHintChanged();
+
+private Q_SLOTS:
+ void reset();
+ void update();
+ void shiftChanged();
+ void updateSelectionListModels();
+ void updateInputModes();
+
+protected:
+ void timerEvent(QTimerEvent *timerEvent);
+
+private:
+ friend class QVirtualKeyboardInputContext;
+ friend class QVirtualKeyboardInputContextPrivate;
+};
+
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(QVirtualKeyboardInputEngine::InputMode key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; }
+Q_DECLARE_OPERATORS_FOR_FLAGS(QVirtualKeyboardInputEngine::ReselectFlags)
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QVirtualKeyboardInputEngine::TextCase)
+Q_DECLARE_METATYPE(QVirtualKeyboardInputEngine::InputMode)
+Q_DECLARE_METATYPE(QVirtualKeyboardInputEngine::PatternRecognitionMode)
+Q_DECLARE_METATYPE(QVirtualKeyboardInputEngine::ReselectFlag)
+
+#endif
diff --git a/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp
new file mode 100644
index 00000000..99ea6ae0
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp
@@ -0,0 +1,345 @@
+/****************************************************************************
+**
+** 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/qvirtualkeyboardselectionlistmodel.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+#include <QtVirtualKeyboard/private/settings_p.h>
+#include <QtCore/private/qabstractitemmodel_p.h>
+#include <QtCore/qpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QtVirtualKeyboard;
+
+class QVirtualKeyboardSelectionListModelPrivate : public QAbstractItemModelPrivate
+{
+public:
+ QVirtualKeyboardSelectionListModelPrivate() :
+ QAbstractItemModelPrivate(),
+ dataSource(nullptr),
+ type(QVirtualKeyboardSelectionListModel::Type::WordCandidateList),
+ rowCount(0),
+ wclAutoCommitWord(false)
+ {
+ }
+
+ QHash<int, QByteArray> roles;
+ QPointer<QVirtualKeyboardAbstractInputMethod> dataSource;
+ QVirtualKeyboardSelectionListModel::Type type;
+ int rowCount;
+ bool wclAutoCommitWord;
+};
+
+/*!
+ \qmltype QVirtualKeyboardSelectionListModel
+ \instantiates QVirtualKeyboardSelectionListModel
+ \inqmlmodule QtQuick.VirtualKeyboard
+ \ingroup qtvirtualkeyboard-qml
+ \brief Provides a data model for the selection lists.
+
+ The QVirtualKeyboardSelectionListModel is a data model for word candidates
+ provided by the input method.
+
+ An instance of QVirtualKeyboardSelectionListModel cannot be created directly.
+ Instead, the QVirtualKeyboardInputEngine manages the instances and provides
+ access to the model by QVirtualKeyboardInputEngine::wordCandidateListModel
+ property.
+
+ The model exposes the following data roles for the list delegate:
+ \list
+ \li \c display Display text for item.
+ \li \c wordCompletionLength Word completion length for item.
+ \li \c dictionaryType Dictionary type of the word, see QVirtualKeyboardSelectionListModel::DictionaryType.
+ \li \c canRemoveSuggestion A boolean indicating if the word can be removed from the dictionary.
+ \endlist
+
+ The activeItemChanged signal indicates which item is currently
+ highlighted by the input method. The view should respond to this
+ signal by highlighting the corresponding item in the list.
+
+ The user selection is handled by the selectItem() method. The view
+ should be invoke this method when the user selects an item from the
+ list.
+*/
+
+/*!
+ \class QVirtualKeyboardSelectionListModel
+
+ \inmodule QtVirtualKeyboard
+
+ \brief List model for selection lists.
+
+ This class acts as a bridge between the UI and the
+ input method that provides the data for selection
+ lists.
+*/
+
+/*!
+ \enum QVirtualKeyboardSelectionListModel::Type
+
+ This enum specifies the type of selection list.
+
+ \value Type::WordCandidateList
+ Shows list of word candidates
+*/
+
+/*!
+ \enum QVirtualKeyboardSelectionListModel::Role
+
+ This enum specifies a role of the data requested.
+
+ \value Role::Display
+ The data to be rendered in form of text.
+ \value Role::DisplayRole
+ \c obsolete Use Role::Display.
+ \value Role::WordCompletionLength
+ An integer specifying the length of the word
+ the completion part expressed as the
+ number of characters counted from the
+ end of the string.
+ \value Role::WordCompletionLengthRole
+ \c obsolete Use Role::WordCompletionLength.
+ \value Role::Dictionary
+ An integer specifying \ l {QVirtualKeyboardSelectionListModel::DictionaryType}{dictionary type}.
+ \value Role::CanRemoveSuggestion
+ A boolean value indicating if the word candidate
+ can be removed from the dictionary.
+*/
+
+/*!
+ \enum QVirtualKeyboardSelectionListModel::DictionaryType
+
+ This enum specifies the dictionary type of a word.
+
+ \value DictionaryType::Default
+ The word candidate is from the default dictionary.
+ \value DictionaryType::User
+ The word candidate is from the user dictionary.
+*/
+
+QVirtualKeyboardSelectionListModel::QVirtualKeyboardSelectionListModel(QObject *parent) :
+ QAbstractListModel(*new QVirtualKeyboardSelectionListModelPrivate(), parent)
+{
+ Q_D(QVirtualKeyboardSelectionListModel);
+ d->roles[static_cast<const int>(Role::Display)] = "display";
+ d->roles[static_cast<const int>(Role::WordCompletionLength)] = "wordCompletionLength";
+ d->roles[static_cast<const int>(Role::Dictionary)] = "dictionary";
+ d->roles[static_cast<const int>(Role::CanRemoveSuggestion)] = "canRemoveSuggestion";
+}
+
+/*!
+ \internal
+*/
+QVirtualKeyboardSelectionListModel::~QVirtualKeyboardSelectionListModel()
+{
+}
+
+/*!
+ \internal
+*/
+void QVirtualKeyboardSelectionListModel::setDataSource(QVirtualKeyboardAbstractInputMethod *dataSource, Type type)
+{
+ Q_D(QVirtualKeyboardSelectionListModel);
+ if (d->dataSource) {
+ disconnect(this, SLOT(selectionListChanged(Type)));
+ disconnect(this, SLOT(selectionListActiveItemChanged(Type, int)));
+ }
+ d->type = type;
+ if (d->dataSource) {
+ d->dataSource = nullptr;
+ selectionListChanged(type);
+ selectionListActiveItemChanged(type, -1);
+ }
+ d->dataSource = dataSource;
+ if (d->dataSource) {
+ QObject::connect(d->dataSource, &QVirtualKeyboardAbstractInputMethod::selectionListChanged, this, &QVirtualKeyboardSelectionListModel::selectionListChanged);
+ QObject::connect(d->dataSource, &QVirtualKeyboardAbstractInputMethod::selectionListActiveItemChanged, this, &QVirtualKeyboardSelectionListModel::selectionListActiveItemChanged);
+ }
+}
+
+/*!
+ \internal
+*/
+QVirtualKeyboardAbstractInputMethod *QVirtualKeyboardSelectionListModel::dataSource() const
+{
+ Q_D(const QVirtualKeyboardSelectionListModel);
+ return d->dataSource;
+}
+
+/*!
+ \internal
+*/
+int QVirtualKeyboardSelectionListModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QVirtualKeyboardSelectionListModel);
+ Q_UNUSED(parent)
+ return d->rowCount;
+}
+
+/*!
+ \internal
+*/
+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();
+}
+
+/*!
+ \internal
+*/
+QHash<int,QByteArray> QVirtualKeyboardSelectionListModel::roleNames() const
+{
+ Q_D(const QVirtualKeyboardSelectionListModel);
+ return d->roles;
+}
+
+/*!
+ \internal
+*/
+int QVirtualKeyboardSelectionListModel::count() const
+{
+ Q_D(const QVirtualKeyboardSelectionListModel);
+ return d->rowCount;
+}
+
+/*! \qmlmethod void QVirtualKeyboardSelectionListModel::selectItem(int index)
+
+ This method should be called when the user selects an item at position
+ \a index from the list.
+ The selection is forwarded to the input method for further processing.
+*/
+/*!
+ \fn void QVirtualKeyboardSelectionListModel::selectItem(int index)
+
+ This method should be called when the user selects an item at position
+ \a index from the list.
+ The selection is forwarded to the input method for further processing.
+*/
+void QVirtualKeyboardSelectionListModel::selectItem(int index)
+{
+ Q_D(QVirtualKeyboardSelectionListModel);
+ if (index >= 0 && index < d->rowCount && d->dataSource) {
+ emit itemSelected(index);
+ d->dataSource->selectionListItemSelected(d->type, index);
+ }
+}
+
+void QVirtualKeyboardSelectionListModel::removeItem(int index)
+{
+ Q_D(QVirtualKeyboardSelectionListModel);
+ if (index >= 0 && index < d->rowCount && d->dataSource) {
+ d->dataSource->selectionListRemoveItem(d->type, index);
+ }
+}
+
+/*!
+ * \internal
+ */
+QVariant QVirtualKeyboardSelectionListModel::dataAt(int index, QVirtualKeyboardSelectionListModel::Role role) const
+{
+ return data(this->index(index, 0), static_cast<int>(role));
+}
+
+/*!
+ \internal
+*/
+void QVirtualKeyboardSelectionListModel::selectionListChanged(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_D(QVirtualKeyboardSelectionListModel);
+ if (static_cast<Type>(type) == d->type) {
+ int oldCount = d->rowCount;
+ int newCount = d->dataSource ? d->dataSource->selectionListItemCount(d->type) : 0;
+ if (newCount) {
+ int changedCount = qMin(oldCount, newCount);
+ if (changedCount)
+ emit dataChanged(index(0), index(changedCount - 1));
+ if (oldCount > newCount) {
+ beginRemoveRows(QModelIndex(), newCount, oldCount - 1);
+ d->rowCount = newCount;
+ endRemoveRows();
+ } else if (oldCount < newCount) {
+ beginInsertRows(QModelIndex(), oldCount, newCount - 1);
+ d->rowCount = newCount;
+ endInsertRows();
+ }
+ } else {
+ beginResetModel();
+ d->rowCount = 0;
+ endResetModel();
+ }
+ 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);
+ if (d->rowCount != oldCount)
+ emit countChanged();
+ }
+}
+
+/*!
+ \internal
+*/
+void QVirtualKeyboardSelectionListModel::selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_D(QVirtualKeyboardSelectionListModel);
+ if (static_cast<Type>(type) == d->type && index < d->rowCount) {
+ emit activeItemChanged(index);
+ if (index == 0 && d->wclAutoCommitWord)
+ selectItem(0);
+ }
+}
+
+/*!
+ \qmlsignal void QVirtualKeyboardSelectionListModel::activeItemChanged(int index)
+
+ This signal is emitted when the active item in the list changes. The
+ UI should react to this signal by highlighting the item at \a index in
+ the list.
+*/
+/*!
+ \fn void QVirtualKeyboardSelectionListModel::activeItemChanged(int index)
+
+ This signal is emitted when the active item in the list changes. The
+ UI should react to this signal by highlighting the item at \a index in
+ the list.
+*/
+
+/*!
+ \qmlsignal void QVirtualKeyboardSelectionListModel::itemSelected(int index)
+
+ This signal is emitted when an item at \a index is selected by the user.
+*/
+/*!
+ \fn void QVirtualKeyboardSelectionListModel::itemSelected(int index)
+
+ This signal is emitted when an item at \a index is selected by the user.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h
new file mode 100644
index 00000000..59a3e3a6
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** 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 QVIRTUALKEYBOARDSELECTIONLISTMODEL_H
+#define QVIRTUALKEYBOARDSELECTIONLISTMODEL_H
+
+#include <QAbstractListModel>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardAbstractInputMethod;
+class QVirtualKeyboardInputEngine;
+class QVirtualKeyboardSelectionListModelPrivate;
+
+class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardSelectionListModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QVirtualKeyboardSelectionListModel)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+
+ explicit QVirtualKeyboardSelectionListModel(QObject *parent = nullptr);
+
+public:
+ enum class Type
+ {
+ WordCandidateList = 0
+ };
+ Q_ENUM(Type)
+
+ enum class Role
+ {
+ Display = Qt::DisplayRole,
+ DisplayRole = Display,
+ WordCompletionLength = Qt::UserRole + 1,
+ WordCompletionLengthRole = WordCompletionLength,
+ Dictionary,
+ CanRemoveSuggestion
+ };
+ Q_ENUM(Role)
+
+ enum class DictionaryType
+ {
+ Default = 0,
+ User
+ };
+ Q_ENUM(DictionaryType)
+
+ ~QVirtualKeyboardSelectionListModel();
+ void setDataSource(QVirtualKeyboardAbstractInputMethod *dataSource, Type type);
+ QVirtualKeyboardAbstractInputMethod *dataSource() const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QHash<int,QByteArray> roleNames() const;
+
+ int count() const;
+
+ Q_INVOKABLE void selectItem(int index);
+ Q_INVOKABLE void removeItem(int index);
+ Q_INVOKABLE QVariant dataAt(int index, Role role = Role::Display) const;
+
+Q_SIGNALS:
+ void countChanged();
+ void activeItemChanged(int index);
+ void itemSelected(int index);
+
+protected Q_SLOTS:
+ void selectionListChanged(Type type);
+ void selectionListActiveItemChanged(Type type, int index);
+
+private:
+ friend class QVirtualKeyboardInputEngine;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QVirtualKeyboardSelectionListModel::Type)
+Q_DECLARE_METATYPE(QVirtualKeyboardSelectionListModel::Role)
+Q_DECLARE_METATYPE(QVirtualKeyboardSelectionListModel::DictionaryType)
+
+#endif // QVIRTUALKEYBOARDSELECTIONLISTMODEL_H
diff --git a/src/virtualkeyboard/qvirtualkeyboardtrace.cpp b/src/virtualkeyboard/qvirtualkeyboardtrace.cpp
new file mode 100644
index 00000000..4f29d0ea
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardtrace.cpp
@@ -0,0 +1,467 @@
+/****************************************************************************
+**
+** 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/qvirtualkeyboardtrace.h>
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardTracePrivate : public QObjectPrivate
+{
+public:
+ QVirtualKeyboardTracePrivate() :
+ QObjectPrivate(),
+ traceId(0),
+ final(false),
+ canceled(false),
+ opacity(1.0)
+ { }
+
+ int traceId;
+ QVariantList points;
+ QMap<QString, QVariantList> channels;
+ bool final;
+ bool canceled;
+ qreal opacity;
+};
+
+/*!
+ \class QVirtualKeyboardTrace
+ \inmodule QtVirtualKeyboard
+ \since QtQuick.VirtualKeyboard 2.0
+ \brief Trace is a data model for touch input data.
+
+ Trace provides the data model for coordinate data and other
+ optional data associated with a single stroke.
+
+ A typical use case for the trace object is as follows:
+ \list
+ \li TraceInputArea or other input device initiates
+ the trace event by calling \l {InputEngine::traceBegin()}
+ {InputEngine.traceBegin()} method.
+ \li If the current input method accepts the event it creates
+ a trace object and configures the required data channels
+ (if any).
+ \li TraceInputArea collects the data for the Trace object.
+ \li TraceInputArea calls the \l {InputEngine::traceEnd()}
+ {InputEngine.traceEnd()} method to finish the trace and
+ passing the trace object back to input method.
+ \li The input method processes the data and discards the object
+ when it is no longer needed.
+ \endlist
+
+ The coordinate data is retrieved using the points() function.
+
+ In addition to coordinate based data, it is possible
+ to attach an arbitrary data channel for each data point.
+
+ The data channels must be defined before the points are added.
+ The data channels supported by the TraceInputArea are listed below:
+
+ \list
+ \li \c "t" Collects time for each data point. The time is
+ the number of milliseconds since 1970/01/01:
+ \endlist
+
+ For example, to configure the object to collect the times for
+ each point:
+
+ \code
+ QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace(this);
+ trace->setChannels(QStringList() << "t");
+ \endcode
+
+ The collected data can be accessed using the channelData() function:
+
+ \code
+ QVariantList timeData = trace->channelData("t");
+ \endcode
+
+ QVirtualKeyboardTrace objects are owned by their creator, which is the input method in
+ normal case. This means the objects are constructed in the
+ \l {InputMethod::traceBegin()}{InputMethod.traceBegin()} (QML) method.
+
+ By definition, the trace object can be destroyed at earliest in the
+ \l {InputMethod::traceEnd()}{InputMethod.traceEnd()} (QML) method.
+*/
+
+/*!
+ \qmltype Trace
+ \instantiates QVirtualKeyboardTrace
+ \inqmlmodule QtQuick.VirtualKeyboard
+ \ingroup qtvirtualkeyboard-qml
+ \since QtQuick.VirtualKeyboard 2.0
+ \brief Trace is a data model for touch input data.
+
+ Trace provides the data model for coordinate data and other
+ optional data associated with a single stroke.
+
+ A typical use case for the trace object is as follows:
+ \list
+ \li TraceInputArea or other input device initiates
+ the trace event by calling \l {InputEngine::traceBegin()}
+ {InputEngine.traceBegin()} method.
+ \li If the current input method accepts the event it creates
+ a trace object and configures the required data channels
+ (if any).
+ \li TraceInputArea collects the data for the trace object.
+ \li TraceInputArea calls the \l {InputEngine::traceEnd()}
+ {InputEngine.traceEnd()} method to finish the trace and
+ passing the trace object back to input method.
+ \li The input method processes the data and discards the object
+ when it is no longer needed.
+ \endlist
+
+ The coordinate data is retrieved using the points() function.
+
+ In addition to coordinate based data, it is possible
+ to attach an arbitrary data channel for each data point.
+
+ The data channels must be defined before the points are added.
+ The data channels supported by the TraceInputArea are listed below:
+
+ \list
+ \li \c "t" Collects time for each data point. The time is
+ the number of milliseconds since 1970/01/01:
+ \endlist
+
+ For example, to configure the object to collect the times for
+ each point:
+
+ \code
+ QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace(this);
+ trace->setChannels(QStringList() << "t");
+ \endcode
+
+ The collected data can be accessed using the channelData() function:
+
+ \code
+ QVariantList timeData = trace->channelData("t");
+ \endcode
+
+ Trace objects are owned by their creator, which is the input method in
+ normal case. This means the objects are constructed in the
+ \l {InputMethod::traceBegin()}{InputMethod.traceBegin()} (QML) method.
+
+ By definition, the trace object can be destroyed at earliest in the
+ \l {InputMethod::traceEnd()}{InputMethod.traceEnd()} (QML) method.
+*/
+
+/*! \internal */
+QVirtualKeyboardTrace::QVirtualKeyboardTrace(QObject *parent) :
+ QObject(*new QVirtualKeyboardTracePrivate(), parent)
+{
+}
+
+/*! \internal */
+QVirtualKeyboardTrace::~QVirtualKeyboardTrace()
+{
+}
+
+int QVirtualKeyboardTrace::traceId() const
+{
+ Q_D(const QVirtualKeyboardTrace);
+ return d->traceId;
+}
+
+void QVirtualKeyboardTrace::setTraceId(int id)
+{
+ Q_D(QVirtualKeyboardTrace);
+ if (d->traceId != id) {
+ d->traceId = id;
+ emit traceIdChanged(id);
+ }
+}
+
+QStringList QVirtualKeyboardTrace::channels() const
+{
+ Q_D(const QVirtualKeyboardTrace);
+ return d->channels.keys();
+}
+
+void QVirtualKeyboardTrace::setChannels(const QStringList &channels)
+{
+ Q_D(QVirtualKeyboardTrace);
+ Q_ASSERT(d->points.isEmpty());
+ if (d->points.isEmpty()) {
+ d->channels.clear();
+ for (QStringList::ConstIterator i = channels.constBegin();
+ i != channels.constEnd(); i++) {
+ d->channels[*i] = QVariantList();
+ }
+ emit channelsChanged();
+ }
+}
+
+int QVirtualKeyboardTrace::length() const
+{
+ Q_D(const QVirtualKeyboardTrace);
+ return d->points.size();
+}
+
+/*! \qmlmethod var Trace::points(int pos, int count)
+
+ Returns list of points. If no parameters are given, the
+ function returns all the points.
+
+ If the \a pos parameter is given, the function returns points starting
+ at the position. The \a count parameter limits how many points are
+ returned.
+
+ The returned list contains \c point types.
+*/
+
+/*! Returns list of points. If no parameters are given, the
+ method returns all the data.
+
+ If the \a pos parameter is given, the method returns points starting
+ at the position. The \a count parameter limits how many points are
+ returned.
+
+ The returned list contains QPointF types.
+*/
+
+QVariantList QVirtualKeyboardTrace::points(int pos, int count) const
+{
+ Q_D(const QVirtualKeyboardTrace);
+ return d->points.mid(pos, count);
+}
+
+/*! \qmlmethod int Trace::addPoint(point point)
+
+ Adds a \a point to the Trace.
+
+ The method returns index of the point added, or -1 if
+ the points cannot be added (i.e. the \l final is true).
+
+ \note The returned index is required to associate additional
+ data with the point using the setChannelData() function.
+*/
+
+/*! Adds a \a point to the QVirtualKeyboardTrace.
+
+ The method returns index of the point added, or -1 if
+ the points cannot be added (i.e. the \l final is true).
+
+ \note The returned index is required to associate additional
+ data with the point using the setChannelData() method.
+*/
+
+int QVirtualKeyboardTrace::addPoint(const QPointF &point)
+{
+ Q_D(QVirtualKeyboardTrace);
+ int index;
+ if (!d->final) {
+ index = d->points.size();
+ d->points.append(point);
+ emit lengthChanged(d->points.size());
+ } else {
+ index = -1;
+ }
+ return index;
+}
+
+/*! \qmlmethod void Trace::setChannelData(int index, string channel, var data)
+
+ Sets \a data for the point at \a index in the given data \a channel.
+
+ If this method is not called for each data point, the channel data
+ will be padded with empty values. However, the data cannot be added at
+ arbitrary index, i.e., it must be added in synchronously with the point data.
+*/
+
+/*! Sets \a data for the point at \a index in the given data \a channel.
+
+ If this method is not called for each data point, the channel data
+ will be padded with empty values. However, the data cannot be added at
+ arbitrary index, i.e., it must be added in synchronously with the point data.
+*/
+
+void QVirtualKeyboardTrace::setChannelData(const QString &channel, int index, const QVariant &data)
+{
+ Q_D(QVirtualKeyboardTrace);
+ if (!d->final && (index + 1) == d->points.size() && d->channels.contains(channel)) {
+ QVariantList &channelData = d->channels[channel];
+ while (index > channelData.size())
+ channelData.append(QVariant());
+ if (index == channelData.size())
+ channelData.append(data);
+ }
+}
+
+/*! \qmlmethod var Trace::channelData(string channel, int pos, int count)
+
+ Returns data from the specified \a channel. If no other parameters
+ are given, the function returns all the data.
+
+ If the \a pos parameter is given, the function returns data starting
+ at the position. The \a count parameter limits how many items are
+ returned.
+*/
+
+/*! Returns data from the specified \a channel. If no other parameters
+ are given, the method returns all the data.
+
+ If the \a pos parameter is given, the method returns data starting
+ at the position. The \a count parameter limits how many items are
+ returned.
+*/
+
+QVariantList QVirtualKeyboardTrace::channelData(const QString &channel, int pos, int count) const
+{
+ Q_D(const QVirtualKeyboardTrace);
+ return d->channels.value(channel).mid(pos, count);
+}
+
+bool QVirtualKeyboardTrace::isFinal() const
+{
+ Q_D(const QVirtualKeyboardTrace);
+ return d->final;
+}
+
+void QVirtualKeyboardTrace::setFinal(bool final)
+{
+ Q_D(QVirtualKeyboardTrace);
+ if (d->final != final) {
+ d->final = final;
+ emit finalChanged(final);
+ }
+}
+
+bool QVirtualKeyboardTrace::isCanceled() const
+{
+ Q_D(const QVirtualKeyboardTrace);
+ return d->canceled;
+}
+
+void QVirtualKeyboardTrace::setCanceled(bool canceled)
+{
+ Q_D(QVirtualKeyboardTrace);
+ if (d->canceled != canceled) {
+ d->canceled = canceled;
+ emit canceledChanged(canceled);
+ }
+}
+
+qreal QVirtualKeyboardTrace::opacity() const
+{
+ Q_D(const QVirtualKeyboardTrace);
+ return d->opacity;
+}
+
+void QVirtualKeyboardTrace::setOpacity(qreal opacity)
+{
+ Q_D(QVirtualKeyboardTrace);
+ if (d->opacity != opacity) {
+ d->opacity = opacity;
+ emit opacityChanged(opacity);
+ }
+}
+
+/*! \qmlproperty int Trace::traceId
+
+ Unique id of this Trace.
+*/
+
+/*! \property QVirtualKeyboardTrace::traceId
+ \brief unique id of this QVirtualKeyboardTrace.
+*/
+
+/*! \qmlproperty list<strings> Trace::channels
+
+ List of additional data channels in the Trace.
+ This property must be initialized before the data
+ is added.
+*/
+
+/*! \property QVirtualKeyboardTrace::channels
+ \brief list of data channels in the QQTrace.
+
+ This property must be initialized before the data
+ is added.
+*/
+
+/*! \qmlproperty int QVirtualKeyboardTrace::length
+
+ The number of points in the QVirtualKeyboardTrace.
+*/
+
+/*! \property QVirtualKeyboardTrace::length
+ \brief the number of of points in the QVirtualKeyboardTrace.
+*/
+
+/*! \qmlproperty bool Trace::final
+
+ This property defines whether the Trace can accept more data.
+ If the value is \c true, no more data is accepted.
+*/
+
+/*! \property QVirtualKeyboardTrace::final
+ \brief defines whether the QVirtualKeyboardTrace can accept more data.
+ If the value is \c true, no more data is accepted.
+*/
+
+/*! \qmlproperty bool Trace::canceled
+
+ This property defines whether the Trace is canceled.
+ The input data should not be processed from the Traces
+ whose \c canceled property set to true.
+*/
+
+/*! \property QVirtualKeyboardTrace::canceled
+ \brief defines whether the QVirtualKeyboardTrace is canceled.
+
+ The input data should not be processed from the Traces
+ whose \c canceled property set to true.
+*/
+
+/*! \qmlproperty qreal Trace::opacity
+ \since QtQuick.VirtualKeyboard 2.4
+
+ This property defines how opaque the Trace is.
+
+ A lower value results in a more transparent trace: \c 0.0 is fully
+ transparent, and \c 1.0 is fully opaque.
+
+ This property is useful for making older traces more transparent as new
+ ones are added.
+*/
+
+/*! \property QVirtualKeyboardTrace::opacity
+
+ This property defines how opaque the QVirtualKeyboardTrace is.
+
+ A lower value results in a more transparent trace: \c 0.0 is fully
+ transparent, and \c 1.0 is fully opaque.
+
+ This property is useful for making older traces more transparent as new
+ ones are added.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardtrace.h b/src/virtualkeyboard/qvirtualkeyboardtrace.h
new file mode 100644
index 00000000..18544742
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardtrace.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** 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 QVIRTUALKEYBOARDTRACE_H
+#define QVIRTUALKEYBOARDTRACE_H
+
+#include <QObject>
+#include <QVariant>
+#include <QPointF>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardTracePrivate;
+
+class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardTrace : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QVirtualKeyboardTrace)
+ Q_PROPERTY(int traceId READ traceId WRITE setTraceId NOTIFY traceIdChanged)
+ Q_PROPERTY(QStringList channels READ channels WRITE setChannels NOTIFY channelsChanged)
+ Q_PROPERTY(int length READ length NOTIFY lengthChanged)
+ 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)
+public:
+ explicit QVirtualKeyboardTrace(QObject *parent = nullptr);
+ ~QVirtualKeyboardTrace();
+
+ int traceId() const;
+ void setTraceId(int id);
+
+ QStringList channels() const;
+ void setChannels(const QStringList &channels);
+
+ int length() const;
+
+ Q_INVOKABLE QVariantList points(int pos = 0, int count = -1) const;
+ Q_INVOKABLE int addPoint(const QPointF &point);
+
+ Q_INVOKABLE void setChannelData(const QString &channel, int index, const QVariant &data);
+ Q_INVOKABLE QVariantList channelData(const QString &channel, int pos = 0, int count = -1) const;
+
+ bool isFinal() const;
+ void setFinal(bool final);
+
+ bool isCanceled() const;
+ void setCanceled(bool canceled);
+
+ qreal opacity() const;
+ void setOpacity(qreal opacity);
+
+Q_SIGNALS:
+ void traceIdChanged(int traceId);
+ void channelsChanged();
+ void lengthChanged(int length);
+ void finalChanged(bool isFinal);
+ void canceledChanged(bool isCanceled);
+ void opacityChanged(qreal opacity);
+};
+
+QT_END_NAMESPACE
+
+#endif // QVIRTUALKEYBOARDTRACE_H
diff --git a/src/virtualkeyboard/selectionlistmodel.cpp b/src/virtualkeyboard/selectionlistmodel.cpp
deleted file mode 100644
index 78316465..00000000
--- a/src/virtualkeyboard/selectionlistmodel.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include "selectionlistmodel.h"
-#include "abstractinputmethod.h"
-#include "settings.h"
-#include <QtCore/private/qabstractitemmodel_p.h>
-#include <QtCore/qpointer.h>
-
-namespace QtVirtualKeyboard {
-
-class SelectionListModelPrivate : public QAbstractItemModelPrivate
-{
-public:
- SelectionListModelPrivate() :
- QAbstractItemModelPrivate(),
- dataSource(0),
- type(SelectionListModel::WordCandidateList),
- rowCount(0),
- wclAutoCommitWord(false)
- {
- }
-
- QHash<int, QByteArray> roles;
- QPointer<AbstractInputMethod> dataSource;
- SelectionListModel::Type type;
- int rowCount;
- bool wclAutoCommitWord;
-};
-
-/*!
- \qmltype SelectionListModel
- \instantiates QtVirtualKeyboard::SelectionListModel
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \brief Provides a data model for the selection lists.
-
- The SelectionListModel is a data model for word candidates
- provided by the input method.
-
- An instance of SelectionListModel cannot be created directly.
- Instead, the InputEngine manages the instances and provides
- access to the model by InputEngine::wordCandidateListModel
- property.
-
- The model exposes the following data roles for the list delegate:
- \list
- \li \c display Display text for item
- \li \c wordCompletionLength Word completion length for item
- \endlist
-
- The activeItemChanged signal indicates which item is currently
- highlighted by the input method. The view should respond to this
- signal by highlighting the corresponding item in the list.
-
- The user selection is handled by the selectItem() method. The view
- should be invoke this method when the user selects an item from the
- list.
-*/
-
-/*!
- \class QtVirtualKeyboard::SelectionListModel
-
- \inmodule QtVirtualKeyboard
-
- \brief List model for selection lists.
-
- \internal
-
- This class acts as a bridge between the UI and the
- input method that provides the data for selection
- lists.
-*/
-
-/*!
- \enum QtVirtualKeyboard::SelectionListModel::Type
-
- This enum specifies the type of selection list.
-
- \value WordCandidateList
- Shows list of word candidates
-*/
-
-/*!
- \enum QtVirtualKeyboard::SelectionListModel::Role
-
- This enum specifies a role of the data requested.
-
- \value DisplayRole
- The data to be rendered in form of text.
- \value WordCompletionLengthRole
- An integer specifying the length of the word
- the completion part expressed as the
- number of characters counted from the
- end of the string.
-*/
-
-SelectionListModel::SelectionListModel(QObject *parent) :
- QAbstractListModel(*new SelectionListModelPrivate(), parent)
-{
- Q_D(SelectionListModel);
- d->roles[DisplayRole] = "display";
- d->roles[WordCompletionLengthRole] = "wordCompletionLength";
-}
-
-/*!
- \internal
-*/
-SelectionListModel::~SelectionListModel()
-{
-}
-
-/*!
- \internal
-*/
-void SelectionListModel::setDataSource(AbstractInputMethod *dataSource, Type type)
-{
- Q_D(SelectionListModel);
- if (d->dataSource) {
- disconnect(this, SLOT(selectionListChanged(int)));
- disconnect(this, SLOT(selectionListActiveItemChanged(int, int)));
- }
- d->type = type;
- if (d->dataSource) {
- d->dataSource = 0;
- selectionListChanged(type);
- selectionListActiveItemChanged(type, -1);
- }
- d->dataSource = dataSource;
- if (d->dataSource) {
- connect(d->dataSource, SIGNAL(selectionListChanged(int)), SLOT(selectionListChanged(int)));
- connect(d->dataSource, SIGNAL(selectionListActiveItemChanged(int, int)), SLOT(selectionListActiveItemChanged(int, int)));
- }
-}
-
-/*!
- \internal
-*/
-AbstractInputMethod *SelectionListModel::dataSource() const
-{
- Q_D(const SelectionListModel);
- return d->dataSource;
-}
-
-/*!
- \internal
-*/
-int SelectionListModel::rowCount(const QModelIndex &parent) const
-{
- Q_D(const SelectionListModel);
- Q_UNUSED(parent)
- return d->rowCount;
-}
-
-/*!
- \internal
-*/
-QVariant SelectionListModel::data(const QModelIndex &index, int role) const
-{
- Q_D(const SelectionListModel);
- return d->dataSource ? d->dataSource->selectionListData(d->type, index.row(), role) : QVariant();
-}
-
-/*!
- \internal
-*/
-QHash<int,QByteArray> SelectionListModel::roleNames() const
-{
- Q_D(const SelectionListModel);
- return d->roles;
-}
-
-/*!
- \internal
-*/
-int SelectionListModel::count() const
-{
- Q_D(const SelectionListModel);
- return d->rowCount;
-}
-
-/*! \qmlmethod void SelectionListModel::selectItem(int index)
-
- This method should be called when the user selects an item at position
- \a index from the list.
- The selection is forwarded to the input method for further processing.
-*/
-/*!
- \fn void QtVirtualKeyboard::SelectionListModel::selectItem(int index)
-
- This method should be called when the user selects an item at position
- \a index from the list.
- The selection is forwarded to the input method for further processing.
-*/
-void SelectionListModel::selectItem(int index)
-{
- Q_D(SelectionListModel);
- if (index >= 0 && index < d->rowCount && d->dataSource) {
- emit itemSelected(index);
- d->dataSource->selectionListItemSelected(d->type, index);
- }
-}
-
-/*!
- * \internal
- */
-QVariant SelectionListModel::dataAt(int index, int role) const
-{
- return data(this->index(index, 0), role);
-}
-
-/*!
- \internal
-*/
-void SelectionListModel::selectionListChanged(int type)
-{
- Q_D(SelectionListModel);
- if (static_cast<Type>(type) == d->type) {
- int oldCount = d->rowCount;
- int newCount = d->dataSource ? d->dataSource->selectionListItemCount(d->type) : 0;
- if (newCount) {
- int changedCount = qMin(oldCount, newCount);
- if (changedCount)
- emit dataChanged(index(0), index(changedCount - 1));
- if (oldCount > newCount) {
- beginRemoveRows(QModelIndex(), newCount, oldCount - 1);
- d->rowCount = newCount;
- endRemoveRows();
- } else if (oldCount < newCount) {
- beginInsertRows(QModelIndex(), oldCount, newCount - 1);
- d->rowCount = newCount;
- endInsertRows();
- }
- } else {
- beginResetModel();
- d->rowCount = 0;
- endResetModel();
- }
- if (type == SelectionListModel::WordCandidateList)
- d->wclAutoCommitWord = ((oldCount > 1 || (oldCount == 1 && d->wclAutoCommitWord)) && newCount == 1 &&
- Settings::instance()->wclAutoCommitWord() &&
- dataAt(0).toString().length() > 1);
- if (d->rowCount != oldCount)
- emit countChanged();
- }
-}
-
-/*!
- \internal
-*/
-void SelectionListModel::selectionListActiveItemChanged(int type, int index)
-{
- Q_D(SelectionListModel);
- if (static_cast<Type>(type) == d->type && index < d->rowCount) {
- emit activeItemChanged(index);
- if (index == 0 && d->wclAutoCommitWord)
- selectItem(0);
- }
-}
-
-/*!
- \qmlsignal void SelectionListModel::activeItemChanged(int index)
-
- This signal is emitted when the active item in the list changes. The
- UI should react to this signal by highlighting the item at \a index in
- the list.
-*/
-/*!
- \fn void QtVirtualKeyboard::SelectionListModel::activeItemChanged(int index)
-
- This signal is emitted when the active item in the list changes. The
- UI should react to this signal by highlighting the item at \a index in
- the list.
-*/
-
-/*!
- \qmlsignal void SelectionListModel::itemSelected(int index)
-
- This signal is emitted when an item at \a index is selected by the user.
-*/
-/*!
- \fn void QtVirtualKeyboard::SelectionListModel::itemSelected(int index)
-
- This signal is emitted when an item at \a index is selected by the user.
-*/
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/selectionlistmodel.h b/src/virtualkeyboard/selectionlistmodel.h
deleted file mode 100644
index f129637b..00000000
--- a/src/virtualkeyboard/selectionlistmodel.h
+++ /dev/null
@@ -1,93 +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 SELECTIONLISTMODEL_H
-#define SELECTIONLISTMODEL_H
-
-#include <QAbstractListModel>
-
-namespace QtVirtualKeyboard {
-
-class AbstractInputMethod;
-class InputEngine;
-class SelectionListModelPrivate;
-
-class SelectionListModel : public QAbstractListModel
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(SelectionListModel)
- Q_PROPERTY(int count READ count NOTIFY countChanged)
-
- explicit SelectionListModel(QObject *parent = 0);
-
-public:
- enum Type
- {
- WordCandidateList = 0
- };
- enum Role
- {
- DisplayRole = Qt::DisplayRole,
- WordCompletionLengthRole = Qt::UserRole + 1
- };
-
- Q_ENUM(Type)
- Q_ENUM(Role)
-
- ~SelectionListModel();
- void setDataSource(AbstractInputMethod *dataSource, Type type);
- AbstractInputMethod *dataSource() const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- QHash<int,QByteArray> roleNames() const;
-
- int count() const;
-
- Q_INVOKABLE void selectItem(int index);
- Q_INVOKABLE QVariant dataAt(int index, int role = Qt::DisplayRole) const;
-
-signals:
- void countChanged();
- void activeItemChanged(int index);
- void itemSelected(int index);
-
-protected slots:
- void selectionListChanged(int type);
- void selectionListActiveItemChanged(int type, int index);
-
-private:
- friend class InputEngine;
-};
-
-} // namespace QtVirtualKeyboard
-
-Q_DECLARE_METATYPE(QtVirtualKeyboard::SelectionListModel::Type)
-Q_DECLARE_METATYPE(QtVirtualKeyboard::SelectionListModel::Role)
-
-#endif // SELECTIONLISTMODEL_H
diff --git a/src/virtualkeyboard/settings.cpp b/src/virtualkeyboard/settings.cpp
index 259516aa..1d324687 100644
--- a/src/virtualkeyboard/settings.cpp
+++ b/src/virtualkeyboard/settings.cpp
@@ -27,9 +27,10 @@
**
****************************************************************************/
-#include "settings.h"
+#include <QtVirtualKeyboard/private/settings_p.h>
#include <QtCore/private/qobject_p.h>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
class SettingsPrivate : public QObjectPrivate
@@ -231,3 +232,4 @@ void Settings::setFullScreenMode(bool fullScreenMode)
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/settings.h b/src/virtualkeyboard/settings.h
deleted file mode 100644
index 9d4684fa..00000000
--- a/src/virtualkeyboard/settings.h
+++ /dev/null
@@ -1,96 +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 SETTINGS_H
-#define SETTINGS_H
-
-#include <QObject>
-#include <QUrl>
-
-namespace QtVirtualKeyboard {
-
-class SettingsPrivate;
-
-class Settings : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(Settings)
- Q_DECLARE_PRIVATE(Settings)
-
- Settings(QObject *parent = 0);
-
-public:
- static Settings *instance();
-
- QString style() const;
- void setStyle(const QString &style);
-
- QString styleName() const;
- void setStyleName(const QString &name);
-
- QString locale() const;
- void setLocale(const QString &locale);
-
- QStringList availableLocales() const;
- void setAvailableLocales(const QStringList &availableLocales);
-
- QStringList activeLocales() const;
- void setActiveLocales(const QStringList &activeLocales);
-
- QUrl layoutPath() const;
- void setLayoutPath(const QUrl &layoutPath);
-
- int wclAutoHideDelay() const;
- void setWclAutoHideDelay(int wclAutoHideDelay);
-
- bool wclAlwaysVisible() const;
- void setWclAlwaysVisible(bool wclAlwaysVisible);
-
- bool wclAutoCommitWord() const;
- void setWclAutoCommitWord(bool wclAutoCommitWord);
-
- bool fullScreenMode() const;
- void setFullScreenMode(bool fullScreenMode);
-
-signals:
- void styleChanged();
- void styleNameChanged();
- void localeChanged();
- void availableLocalesChanged();
- void activeLocalesChanged();
- void layoutPathChanged();
- void wclAutoHideDelayChanged();
- void wclAlwaysVisibleChanged();
- void wclAutoCommitWordChanged();
- void fullScreenModeChanged();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // SETTINGS_H
diff --git a/src/virtualkeyboard/settings/plugins.qmltypes b/src/virtualkeyboard/settings/plugins.qmltypes
deleted file mode 100644
index 6e29d9fc..00000000
--- a/src/virtualkeyboard/settings/plugins.qmltypes
+++ /dev/null
@@ -1,1335 +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 QtQuick.VirtualKeyboard.Settings 2.1'
-
-Module {
- dependencies: ["QtQuick 2.8"]
- 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/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/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 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/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/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 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/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/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 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/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/InputPanel 1.3"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.3"]
- exportMetaObjectRevisions: [3]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_15"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.2"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.2"]
- exportMetaObjectRevisions: [2]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_15"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.1"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_15"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 1.0"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_15"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.0"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_15"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 1.2"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.2"]
- exportMetaObjectRevisions: [2]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_15"; isReadonly: true; isPointer: true }
- }
- 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 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" }
- Property { name: "preferNumbers"; type: "bool" }
- 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: "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: "updateInputMethod"; type: "QVariant" }
- Method { name: "updateLayout"; type: "QVariant" }
- Method { name: "updateDefaultLocale"; type: "QVariant" }
- Method { name: "updateAvailableLocaleIndices"; type: "QVariant" }
- Method {
- name: "listLocales"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; 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: "isValidLocale"
- type: "QVariant"
- Parameter { name: "localeNameOrIndex"; type: "QVariant" }
- }
- Method {
- name: "getLayoutFile"
- 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" }
- }
- 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" }
- Property { name: "preferNumbers"; type: "bool" }
- 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: "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: "updateInputMethod"; type: "QVariant" }
- Method { name: "updateLayout"; type: "QVariant" }
- Method { name: "updateDefaultLocale"; type: "QVariant" }
- Method { name: "updateAvailableLocaleIndices"; type: "QVariant" }
- Method {
- name: "listLocales"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; 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: "isValidLocale"
- type: "QVariant"
- Parameter { name: "localeNameOrIndex"; type: "QVariant" }
- }
- Method {
- name: "getLayoutFile"
- 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" }
- }
- Component {
- prototype: "QQuickItem"
- 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" }
- Property { name: "spacing"; type: "double" }
- Property { name: "layoutDirection"; revision: 1; type: "Qt::LayoutDirection" }
- }
- Component {
- prototype: "QQuickItem"
- 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" }
- Property { name: "spacing"; type: "double" }
- Property { name: "layoutDirection"; revision: 1; type: "Qt::LayoutDirection" }
- }
- Component {
- prototype: "QQuickItem"
- 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" }
- Property { name: "spacing"; type: "double" }
- Property { name: "layoutDirection"; revision: 1; type: "Qt::LayoutDirection" }
- }
- Component {
- prototype: "QQuickItem"
- 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" }
- Property { name: "spacing"; type: "double" }
- Property { name: "layoutDirection"; revision: 1; type: "Qt::LayoutDirection" }
- }
- 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: "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: "QQuickItem"
- 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" }
- Property { name: "spacing"; type: "double" }
- Property { name: "layoutDirection"; revision: 1; type: "Qt::LayoutDirection" }
- }
- Component {
- prototype: "QQuickItem"
- 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" }
- Property { name: "spacing"; type: "double" }
- Property { name: "layoutDirection"; revision: 1; type: "Qt::LayoutDirection" }
- }
- Component {
- prototype: "QQuickListView"
- name: "QtQuick.VirtualKeyboard/LanguagePopupList 2.1"
- exports: ["QtQuick.VirtualKeyboard/LanguagePopupList 2.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- defaultProperty: "data"
- Property { name: "maxVisibleItems"; type: "int" }
- Property { name: "preferredVisibleItems"; type: "int"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- }
- 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: "QtVirtualKeyboard::InputMethod"
- 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" }
- }
- }
- Component {
- prototype: "QtVirtualKeyboard::InputMethod"
- 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" }
- }
- }
- 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: "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: "maxVisibleItems"; type: "int" }
- Property { name: "preferredVisibleItems"; type: "int"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "flipVertical"; type: "bool"; isReadonly: true }
- }
-}
diff --git a/src/virtualkeyboard/settings/qmldir b/src/virtualkeyboard/settings/qmldir
deleted file mode 100644
index 619e9d70..00000000
--- a/src/virtualkeyboard/settings/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtQuick.VirtualKeyboard.Settings
-typeinfo plugins.qmltypes
-depends QtQuick 2.8
-depends QtQuick.VirtualKeyboard 2.1
diff --git a/src/virtualkeyboard/settings/settings.pro b/src/virtualkeyboard/settings/settings.pro
deleted file mode 100644
index f33503d8..00000000
--- a/src/virtualkeyboard/settings/settings.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGETPATH = QtQuick/VirtualKeyboard/Settings
-QML_FILES += plugins.qmltypes
-
-load(qml_module)
-
-# qmltypes target
-!cross_compile:if(build_pass|!debug_and_release) {
- qtPrepareTool(QMLPLUGINDUMP, qmlplugindump)
-
- qmltypes.commands = QT_IM_MODULE=qtvirtualkeyboard $$QMLPLUGINDUMP -defaultplatform -nonrelocatable QtQuick.VirtualKeyboard.Settings 2.1 > $$PWD/plugins.qmltypes
- QMAKE_EXTRA_TARGETS += qmltypes
-}
diff --git a/src/virtualkeyboard/settings_p.h b/src/virtualkeyboard/settings_p.h
new file mode 100644
index 00000000..843592fe
--- /dev/null
+++ b/src/virtualkeyboard/settings_p.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** 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 SETTINGS_P_H
+#define SETTINGS_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 <QUrl>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class SettingsPrivate;
+
+class QVIRTUALKEYBOARD_EXPORT Settings : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(Settings)
+ Q_DECLARE_PRIVATE(Settings)
+
+ Settings(QObject *parent = nullptr);
+
+public:
+ static Settings *instance();
+
+ QString style() const;
+ void setStyle(const QString &style);
+
+ QString styleName() const;
+ void setStyleName(const QString &name);
+
+ QString locale() const;
+ void setLocale(const QString &locale);
+
+ QStringList availableLocales() const;
+ void setAvailableLocales(const QStringList &availableLocales);
+
+ QStringList activeLocales() const;
+ void setActiveLocales(const QStringList &activeLocales);
+
+ QUrl layoutPath() const;
+ void setLayoutPath(const QUrl &layoutPath);
+
+ int wclAutoHideDelay() const;
+ void setWclAutoHideDelay(int wclAutoHideDelay);
+
+ bool wclAlwaysVisible() const;
+ void setWclAlwaysVisible(bool wclAlwaysVisible);
+
+ bool wclAutoCommitWord() const;
+ void setWclAutoCommitWord(bool wclAutoCommitWord);
+
+ bool fullScreenMode() const;
+ void setFullScreenMode(bool fullScreenMode);
+
+signals:
+ void styleChanged();
+ void styleNameChanged();
+ void localeChanged();
+ void availableLocalesChanged();
+ void activeLocalesChanged();
+ void layoutPathChanged();
+ void wclAutoHideDelayChanged();
+ void wclAlwaysVisibleChanged();
+ void wclAutoCommitWordChanged();
+ void fullScreenModeChanged();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // SETTINGS_P_H
diff --git a/src/virtualkeyboard/shadowinputcontext.cpp b/src/virtualkeyboard/shadowinputcontext.cpp
index b350e249..dc49f513 100644
--- a/src/virtualkeyboard/shadowinputcontext.cpp
+++ b/src/virtualkeyboard/shadowinputcontext.cpp
@@ -27,9 +27,9 @@
**
****************************************************************************/
-#include "shadowinputcontext.h"
-#include "inputcontext.h"
-#include "virtualkeyboarddebug.h"
+#include <QtVirtualKeyboard/private/shadowinputcontext_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
#include <QtCore/private/qobject_p.h>
#include <QGuiApplication>
@@ -37,7 +37,6 @@
QT_BEGIN_NAMESPACE
bool operator==(const QInputMethodEvent::Attribute &attribute1, const QInputMethodEvent::Attribute &attribute2);
-QT_END_NAMESPACE
namespace QtVirtualKeyboard {
@@ -46,14 +45,14 @@ class ShadowInputContextPrivate : public QObjectPrivate
public:
ShadowInputContextPrivate() :
QObjectPrivate(),
- inputContext(0),
+ inputContext(nullptr),
anchorRectIntersectsClipRect(false),
cursorRectIntersectsClipRect(false),
selectionControlVisible(false)
{
}
- InputContext *inputContext;
+ QVirtualKeyboardInputContext *inputContext;
QPointer<QObject> inputItem;
QString preeditText;
QList<QInputMethodEvent::Attribute> preeditTextAttributes;
@@ -69,7 +68,7 @@ ShadowInputContext::ShadowInputContext(QObject *parent) :
{
}
-void ShadowInputContext::setInputContext(InputContext *inputContext)
+void ShadowInputContext::setInputContext(QVirtualKeyboardInputContext *inputContext)
{
Q_D(ShadowInputContext);
d->inputContext = inputContext;
@@ -160,7 +159,7 @@ void ShadowInputContext::updateSelectionProperties()
const QRectF inputItemClipRect = imQueryEvent.value(Qt::ImInputItemClipRectangle).toRectF();
const bool anchorRectIntersectsClipRect = inputItemClipRect.intersects(anchorRect);
const bool cursorRectIntersectsClipRect = inputItemClipRect.intersects(cursorRect);
- const bool selectionControlVisible = d->inputContext->selectionControlVisible();
+ const bool selectionControlVisible = d->inputContext->isSelectionControlVisible();
const bool newAnchorRectangle = anchorRectangle != d->anchorRectangle;
const bool newCursorRectangle = cursorRectangle != d->cursorRectangle;
@@ -251,3 +250,4 @@ QVariant ShadowInputContext::queryFocusObject(Qt::InputMethodQuery query, QVaria
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/shadowinputcontext.h b/src/virtualkeyboard/shadowinputcontext.h
deleted file mode 100644
index 1a2e0577..00000000
--- a/src/virtualkeyboard/shadowinputcontext.h
+++ /dev/null
@@ -1,90 +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 SHADOWINPUTCONTEXT_H
-#define SHADOWINPUTCONTEXT_H
-
-#include <QObject>
-#include <QPointer>
-#include <QMetaType>
-#include <QRectF>
-
-namespace QtVirtualKeyboard {
-
-class InputContext;
-class ShadowInputContextPrivate;
-
-class ShadowInputContext : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(ShadowInputContext)
- Q_DECLARE_PRIVATE(ShadowInputContext)
- Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged)
- Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged)
- Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
- Q_PROPERTY(bool anchorRectIntersectsClipRect READ anchorRectIntersectsClipRect NOTIFY anchorRectIntersectsClipRectChanged)
- Q_PROPERTY(bool cursorRectIntersectsClipRect READ cursorRectIntersectsClipRect NOTIFY cursorRectIntersectsClipRectChanged)
- Q_PROPERTY(bool selectionControlVisible READ selectionControlVisible NOTIFY selectionControlVisibleChanged)
-
- explicit ShadowInputContext(QObject *parent = 0);
-
- void setInputContext(InputContext *inputContext);
-
-public:
- QObject *inputItem() const;
- void setInputItem(QObject *inputItem);
- QRectF anchorRectangle() const;
- QRectF cursorRectangle() const;
- bool anchorRectIntersectsClipRect() const;
- bool cursorRectIntersectsClipRect() const;
- bool selectionControlVisible() const;
-
- Q_INVOKABLE void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos);
- Q_INVOKABLE void updateSelectionProperties();
-
-signals:
- void inputItemChanged();
- void anchorRectangleChanged();
- void cursorRectangleChanged();
- void anchorRectIntersectsClipRectChanged();
- void cursorRectIntersectsClipRectChanged();
- void selectionControlVisibleChanged();
-
-private:
- void update(Qt::InputMethodQueries queries);
- QVariant queryFocusObject(Qt::InputMethodQuery query, QVariant argument);
-
-private:
- friend class InputContextPrivate;
- friend class InputContext;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // SHADOWINPUTCONTEXT_H
diff --git a/src/virtualkeyboard/shadowinputcontext_p.h b/src/virtualkeyboard/shadowinputcontext_p.h
new file mode 100644
index 00000000..f77aba08
--- /dev/null
+++ b/src/virtualkeyboard/shadowinputcontext_p.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** 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 SHADOWINPUTCONTEXT_P_H
+#define SHADOWINPUTCONTEXT_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 <QPointer>
+#include <QMetaType>
+#include <QRectF>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardInputContext;
+class QVirtualKeyboardInputContextPrivate;
+
+namespace QtVirtualKeyboard {
+
+class ShadowInputContextPrivate;
+
+class QVIRTUALKEYBOARD_EXPORT ShadowInputContext : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(ShadowInputContext)
+ Q_DECLARE_PRIVATE(ShadowInputContext)
+ Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged)
+ Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged)
+ Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
+ Q_PROPERTY(bool anchorRectIntersectsClipRect READ anchorRectIntersectsClipRect NOTIFY anchorRectIntersectsClipRectChanged)
+ Q_PROPERTY(bool cursorRectIntersectsClipRect READ cursorRectIntersectsClipRect NOTIFY cursorRectIntersectsClipRectChanged)
+ Q_PROPERTY(bool selectionControlVisible READ selectionControlVisible NOTIFY selectionControlVisibleChanged)
+
+ explicit ShadowInputContext(QObject *parent = nullptr);
+
+ void setInputContext(QVirtualKeyboardInputContext *inputContext);
+
+public:
+ QObject *inputItem() const;
+ void setInputItem(QObject *inputItem);
+ QRectF anchorRectangle() const;
+ QRectF cursorRectangle() const;
+ bool anchorRectIntersectsClipRect() const;
+ bool cursorRectIntersectsClipRect() const;
+ bool selectionControlVisible() const;
+
+ Q_INVOKABLE void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos);
+ Q_INVOKABLE void updateSelectionProperties();
+
+signals:
+ void inputItemChanged();
+ void anchorRectangleChanged();
+ void cursorRectangleChanged();
+ void anchorRectIntersectsClipRectChanged();
+ void cursorRectIntersectsClipRectChanged();
+ void selectionControlVisibleChanged();
+
+private:
+ void update(Qt::InputMethodQueries queries);
+ QVariant queryFocusObject(Qt::InputMethodQuery query, QVariant argument);
+
+private:
+ friend class ::QVirtualKeyboardInputContextPrivate;
+ friend class ::QVirtualKeyboardInputContext;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // SHADOWINPUTCONTEXT_P_H
diff --git a/src/virtualkeyboard/shifthandler.cpp b/src/virtualkeyboard/shifthandler.cpp
index 8f42a762..ab37ee21 100644
--- a/src/virtualkeyboard/shifthandler.cpp
+++ b/src/virtualkeyboard/shifthandler.cpp
@@ -27,15 +27,17 @@
**
****************************************************************************/
-#include "shifthandler.h"
-#include "inputcontext.h"
-#include "inputengine.h"
+#include <QtVirtualKeyboard/private/shifthandler_p.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
#include <QtCore/private/qobject_p.h>
#include <QSet>
#include <QGuiApplication>
#include <QTime>
#include <QStyleHints>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
class ShiftHandlerPrivate : public QObjectPrivate
@@ -43,31 +45,35 @@ class ShiftHandlerPrivate : public QObjectPrivate
public:
ShiftHandlerPrivate() :
QObjectPrivate(),
- inputContext(0),
- sentenceEndingCharacters(QString(".!?") + QChar(Qt::Key_exclamdown) + QChar(Qt::Key_questiondown)),
+ inputContext(nullptr),
+ sentenceEndingCharacters(QLatin1String(".!?") + QChar(Qt::Key_exclamdown) + QChar(Qt::Key_questiondown)),
autoCapitalizationEnabled(false),
toggleShiftEnabled(false),
+ shift(false),
shiftChanged(false),
+ capsLock(false),
resetWhenVisible(false),
- manualShiftLanguageFilter(QSet<QLocale::Language>() << QLocale::Arabic << QLocale::Persian << QLocale::Hindi << QLocale::Korean),
- manualCapsInputModeFilter(QSet<InputEngine::InputMode>() << InputEngine::Cangjie << InputEngine::Zhuyin << InputEngine::Hebrew),
- noAutoUppercaseInputModeFilter(QSet<InputEngine::InputMode>() << InputEngine::FullwidthLatin << InputEngine::Pinyin << InputEngine::Cangjie << InputEngine::Zhuyin << InputEngine::ChineseHandwriting << InputEngine::JapaneseHandwriting << InputEngine::KoreanHandwriting),
- allCapsInputModeFilter(QSet<InputEngine::InputMode>() << InputEngine::Hiragana << InputEngine::Katakana)
+ 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),
+ allCapsInputModeFilter(QSet<QVirtualKeyboardInputEngine::InputMode>() << QVirtualKeyboardInputEngine::InputMode::Hiragana << QVirtualKeyboardInputEngine::InputMode::Katakana)
{
}
- InputContext *inputContext;
+ QVirtualKeyboardInputContext *inputContext;
QString sentenceEndingCharacters;
bool autoCapitalizationEnabled;
bool toggleShiftEnabled;
+ bool shift;
bool shiftChanged;
+ bool capsLock;
bool resetWhenVisible;
QLocale locale;
QTime timer;
const QSet<QLocale::Language> manualShiftLanguageFilter;
- const QSet<InputEngine::InputMode> manualCapsInputModeFilter;
- const QSet<InputEngine::InputMode> noAutoUppercaseInputModeFilter;
- const QSet<InputEngine::InputMode> allCapsInputModeFilter;
+ const QSet<QVirtualKeyboardInputEngine::InputMode> manualCapsInputModeFilter;
+ const QSet<QVirtualKeyboardInputEngine::InputMode> noAutoUppercaseInputModeFilter;
+ const QSet<QVirtualKeyboardInputEngine::InputMode> allCapsInputModeFilter;
};
/*!
@@ -80,30 +86,30 @@ public:
/*!
\class QtVirtualKeyboard::ShiftHandler
+ \internal
\inmodule QtVirtualKeyboard
\brief Manages the shift state.
-
- \internal
*/
-ShiftHandler::ShiftHandler(InputContext *parent) :
+ShiftHandler::ShiftHandler(QVirtualKeyboardInputContext *parent) :
QObject(*new ShiftHandlerPrivate(), parent)
{
Q_D(ShiftHandler);
d->inputContext = parent;
- if (d->inputContext) {
- connect(d->inputContext, SIGNAL(inputMethodHintsChanged()), SLOT(restart()));
- connect(d->inputContext, SIGNAL(inputItemChanged()), SLOT(restart()));
- connect(d->inputContext->inputEngine(), SIGNAL(inputModeChanged()), SLOT(restart()));
- connect(d->inputContext, SIGNAL(preeditTextChanged()), SLOT(autoCapitalize()));
- connect(d->inputContext, SIGNAL(surroundingTextChanged()), SLOT(autoCapitalize()));
- connect(d->inputContext, SIGNAL(cursorPositionChanged()), SLOT(autoCapitalize()));
- connect(d->inputContext, SIGNAL(shiftChanged()), SLOT(shiftChanged()));
- connect(d->inputContext, SIGNAL(capsLockChanged()), SLOT(shiftChanged()));
- connect(d->inputContext, SIGNAL(localeChanged()), SLOT(localeChanged()));
- connect(qGuiApp->inputMethod(), SIGNAL(visibleChanged()), SLOT(inputMethodVisibleChanged()));
- d->locale = QLocale(d->inputContext->locale());
- }
+}
+
+void ShiftHandler::init()
+{
+ Q_D(ShiftHandler);
+ connect(d->inputContext, SIGNAL(inputMethodHintsChanged()), SLOT(restart()));
+ connect(d->inputContext->priv(), SIGNAL(inputItemChanged()), SLOT(restart()));
+ connect(d->inputContext->inputEngine(), SIGNAL(inputModeChanged()), SLOT(restart()));
+ connect(d->inputContext, SIGNAL(preeditTextChanged()), SLOT(autoCapitalize()));
+ connect(d->inputContext, SIGNAL(surroundingTextChanged()), SLOT(autoCapitalize()));
+ connect(d->inputContext, SIGNAL(cursorPositionChanged()), SLOT(autoCapitalize()));
+ connect(d->inputContext, SIGNAL(localeChanged()), SLOT(localeChanged()));
+ connect(qGuiApp->inputMethod(), SIGNAL(visibleChanged()), SLOT(inputMethodVisibleChanged()));
+ d->locale = QLocale(d->inputContext->locale());
}
/*!
@@ -130,18 +136,59 @@ void ShiftHandler::setSentenceEndingCharacters(const QString &value)
}
}
-bool ShiftHandler::autoCapitalizationEnabled() const
+bool ShiftHandler::isAutoCapitalizationEnabled() const
{
Q_D(const ShiftHandler);
return d->autoCapitalizationEnabled;
}
-bool ShiftHandler::toggleShiftEnabled() const
+bool ShiftHandler::isToggleShiftEnabled() const
{
Q_D(const ShiftHandler);
return d->toggleShiftEnabled;
}
+bool ShiftHandler::isShiftActive() const
+{
+ Q_D(const ShiftHandler);
+ return d->shift;
+}
+
+void ShiftHandler::setShiftActive(bool active)
+{
+ Q_D(ShiftHandler);
+ if (d->shift != active) {
+ d->shift = active;
+ d->shiftChanged = true;
+ emit shiftActiveChanged();
+ if (!d->capsLock)
+ emit uppercaseChanged();
+ }
+}
+
+bool ShiftHandler::isCapsLockActive() const
+{
+ Q_D(const ShiftHandler);
+ return d->capsLock;
+}
+
+void ShiftHandler::setCapsLockActive(bool active)
+{
+ Q_D(ShiftHandler);
+ if (d->capsLock != active) {
+ d->capsLock = active;
+ emit capsLockActiveChanged();
+ if (!d->shift)
+ emit uppercaseChanged();
+ }
+}
+
+bool ShiftHandler::isUppercase() const
+{
+ Q_D(const ShiftHandler);
+ return d->shift || d->capsLock;
+}
+
/*!
\since 1.2
@@ -170,32 +217,33 @@ void ShiftHandler::toggleShift()
if (!d->toggleShiftEnabled)
return;
if (d->manualShiftLanguageFilter.contains(d->locale.language())) {
- d->inputContext->setCapsLock(false);
- d->inputContext->setShift(!d->inputContext->shift());
+ setCapsLockActive(false);
+ setShiftActive(!d->shift);
} else if (d->inputContext->inputMethodHints() & Qt::ImhNoAutoUppercase ||
d->manualCapsInputModeFilter.contains(d->inputContext->inputEngine()->inputMode())) {
- bool capsLock = d->inputContext->capsLock();
- d->inputContext->setCapsLock(!capsLock);
- d->inputContext->setShift(!capsLock);
+ bool capsLock = d->capsLock;
+ setCapsLockActive(!capsLock);
+ setShiftActive(!capsLock);
} else {
- if (d->inputContext->capsLock()) {
- d->inputContext->setCapsLock(!d->inputContext->capsLock() && d->inputContext->shift() && !d->shiftChanged);
+ if (d->capsLock) {
+ setCapsLockActive(!d->capsLock && d->shift && !d->shiftChanged);
}
QStyleHints *style = QGuiApplication::styleHints();
if (d->timer.isNull() || d->timer.elapsed() > style->mouseDoubleClickInterval()) {
d->timer.restart();
- } else if (d->timer.elapsed() < style->mouseDoubleClickInterval() && !d->inputContext->capsLock()) {
- d->inputContext->setCapsLock(!d->inputContext->capsLock() && d->inputContext->shift() && !d->shiftChanged);
+ } else if (d->timer.elapsed() < style->mouseDoubleClickInterval() && !d->capsLock) {
+ setCapsLockActive(!d->capsLock && d->shift && !d->shiftChanged);
}
- d->inputContext->setShift(d->inputContext->capsLock() || !d->inputContext->shift());
+ setShiftActive(d->capsLock || !d->shift);
d->shiftChanged = false;
}
}
/*! Clears the toggle shift timer.
+ \internal
*/
void ShiftHandler::clearToggleShiftTimer()
@@ -207,9 +255,9 @@ void ShiftHandler::clearToggleShiftTimer()
void ShiftHandler::reset()
{
Q_D(ShiftHandler);
- if (d->inputContext->inputItem()) {
+ if (d->inputContext->priv()->inputItem()) {
Qt::InputMethodHints inputMethodHints = d->inputContext->inputMethodHints();
- InputEngine::InputMode inputMode = d->inputContext->inputEngine()->inputMode();
+ QVirtualKeyboardInputEngine::InputMode inputMode = d->inputContext->inputEngine()->inputMode();
bool preferUpperCase = (inputMethodHints & (Qt::ImhPreferUppercase | Qt::ImhUppercaseOnly));
bool autoCapitalizationEnabled = !(d->inputContext->inputMethodHints() & (Qt::ImhNoAutoUppercase |
Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly | Qt::ImhEmailCharactersOnly |
@@ -230,9 +278,9 @@ void ShiftHandler::reset()
}
setToggleShiftEnabled(toggleShiftEnabled);
setAutoCapitalizationEnabled(autoCapitalizationEnabled);
- d->inputContext->setCapsLock(preferUpperCase);
+ setCapsLockActive(preferUpperCase);
if (preferUpperCase)
- d->inputContext->setShift(preferUpperCase);
+ setShiftActive(preferUpperCase);
else
autoCapitalize();
}
@@ -241,25 +289,25 @@ void ShiftHandler::reset()
void ShiftHandler::autoCapitalize()
{
Q_D(ShiftHandler);
- if (d->inputContext->capsLock())
+ if (d->capsLock)
return;
if (!d->autoCapitalizationEnabled || !d->inputContext->preeditText().isEmpty()) {
- d->inputContext->setShift(false);
+ setShiftActive(false);
} else {
int cursorPosition = d->inputContext->cursorPosition();
bool preferLowerCase = d->inputContext->inputMethodHints() & Qt::ImhPreferLowercase;
if (cursorPosition == 0) {
- d->inputContext->setShift(!preferLowerCase);
+ setShiftActive(!preferLowerCase);
} else {
QString text = d->inputContext->surroundingText();
text.truncate(cursorPosition);
text = text.trimmed();
if (text.length() == 0)
- d->inputContext->setShift(!preferLowerCase);
+ setShiftActive(!preferLowerCase);
else if (text.length() > 0 && d->sentenceEndingCharacters.indexOf(text[text.length() - 1]) >= 0)
- d->inputContext->setShift(!preferLowerCase);
+ setShiftActive(!preferLowerCase);
else
- d->inputContext->setShift(false);
+ setShiftActive(false);
}
}
}
@@ -275,12 +323,6 @@ void ShiftHandler::restart()
reset();
}
-void ShiftHandler::shiftChanged()
-{
- Q_D(ShiftHandler);
- d->shiftChanged = true;
-}
-
void ShiftHandler::localeChanged()
{
Q_D(ShiftHandler);
@@ -378,3 +420,4 @@ void ShiftHandler::setToggleShiftEnabled(bool enabled)
*/
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/shifthandler.h b/src/virtualkeyboard/shifthandler.h
deleted file mode 100644
index 93ba3e34..00000000
--- a/src/virtualkeyboard/shifthandler.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef SHIFTHANDLER_H
-#define SHIFTHANDLER_H
-
-#include <QObject>
-
-namespace QtVirtualKeyboard {
-
-class InputContext;
-class ShiftHandlerPrivate;
-
-class ShiftHandler : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(ShiftHandler)
- Q_DECLARE_PRIVATE(ShiftHandler)
- Q_PROPERTY(QString sentenceEndingCharacters READ sentenceEndingCharacters WRITE setSentenceEndingCharacters NOTIFY sentenceEndingCharactersChanged)
- Q_PROPERTY(bool autoCapitalizationEnabled READ autoCapitalizationEnabled NOTIFY autoCapitalizationEnabledChanged)
- Q_PROPERTY(bool toggleShiftEnabled READ toggleShiftEnabled NOTIFY toggleShiftEnabledChanged)
-
- explicit ShiftHandler(InputContext *parent = 0);
-
-public:
- ~ShiftHandler();
-
- QString sentenceEndingCharacters() const;
- void setSentenceEndingCharacters(const QString &value);
- bool autoCapitalizationEnabled() const;
- bool toggleShiftEnabled() const;
-
- Q_INVOKABLE void toggleShift();
- Q_INVOKABLE void clearToggleShiftTimer();
-
-signals:
- void sentenceEndingCharactersChanged();
- void toggleShiftEnabledChanged();
- void autoCapitalizationEnabledChanged();
-
-private slots:
- void reset();
- void autoCapitalize();
- void restart();
- void localeChanged();
- void shiftChanged();
- void inputMethodVisibleChanged();
-
-private:
- void setAutoCapitalizationEnabled(bool enabled);
- void setToggleShiftEnabled(bool enabled);
-
-private:
- friend class InputContext;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // SHIFTHANDLER_H
diff --git a/src/virtualkeyboard/shifthandler_p.h b/src/virtualkeyboard/shifthandler_p.h
new file mode 100644
index 00000000..1dcce96c
--- /dev/null
+++ b/src/virtualkeyboard/shifthandler_p.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** 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 SHIFTHANDLER_P_H
+#define SHIFTHANDLER_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/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardInputContext;
+class QVirtualKeyboardInputContextPrivate;
+
+namespace QtVirtualKeyboard {
+
+class ShiftHandlerPrivate;
+
+class QVIRTUALKEYBOARD_EXPORT ShiftHandler : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(ShiftHandler)
+ Q_DECLARE_PRIVATE(ShiftHandler)
+ Q_PROPERTY(QString sentenceEndingCharacters READ sentenceEndingCharacters WRITE setSentenceEndingCharacters NOTIFY sentenceEndingCharactersChanged)
+ Q_PROPERTY(bool autoCapitalizationEnabled READ isAutoCapitalizationEnabled NOTIFY autoCapitalizationEnabledChanged)
+ Q_PROPERTY(bool toggleShiftEnabled READ isToggleShiftEnabled NOTIFY toggleShiftEnabledChanged)
+ 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)
+
+ explicit ShiftHandler(QVirtualKeyboardInputContext *parent = nullptr);
+ void init();
+
+public:
+ ~ShiftHandler();
+
+ QString sentenceEndingCharacters() const;
+ void setSentenceEndingCharacters(const QString &value);
+ bool isAutoCapitalizationEnabled() const;
+ bool isToggleShiftEnabled() const;
+ bool isShiftActive() const;
+ void setShiftActive(bool active);
+ bool isCapsLockActive() const;
+ void setCapsLockActive(bool active);
+ bool isUppercase() const;
+
+ Q_INVOKABLE void toggleShift();
+ Q_INVOKABLE void clearToggleShiftTimer();
+
+signals:
+ void sentenceEndingCharactersChanged();
+ void toggleShiftEnabledChanged();
+ void autoCapitalizationEnabledChanged();
+ void shiftActiveChanged();
+ void capsLockActiveChanged();
+ void uppercaseChanged();
+
+private slots:
+ void reset();
+ void autoCapitalize();
+ void restart();
+ void localeChanged();
+ void inputMethodVisibleChanged();
+
+private:
+ void setAutoCapitalizationEnabled(bool enabled);
+ void setToggleShiftEnabled(bool enabled);
+
+private:
+ friend class ::QVirtualKeyboardInputContext;
+ friend class ::QVirtualKeyboardInputContextPrivate;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // SHIFTHANDLER_P_H
diff --git a/src/virtualkeyboard/styles/KeyboardStyle.qml b/src/virtualkeyboard/styles/KeyboardStyle.qml
deleted file mode 100644
index 1d1c8222..00000000
--- a/src/virtualkeyboard/styles/KeyboardStyle.qml
+++ /dev/null
@@ -1,527 +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 KeyboardStyle
- \inqmlmodule QtQuick.VirtualKeyboard.Styles
- \brief Provides a styling interface for the Virtual Keyboard.
- \ingroup qtvirtualkeyboard-styles-qml
-
- The style type provides the style definitions that are used by
- the InputPanel to decorate the virtual keyboard.
-
- The design size specifies the aspect ratio of the virtual keyboard.
- Styles are scalable according to \l scaleHint, which is
- calculated from the keyboard's actual height and design height.
-*/
-
-QtObject {
- /*! The current height of the keyboard. */
- property real keyboardHeight
-
- /*! The design width of the keyboard. */
- property real keyboardDesignWidth
-
- /*! The design height of the keyboard. */
- property real keyboardDesignHeight
-
- /*! The keyboard style scale hint. This value is determined by dividing
- \l keyboardHeight by \l keyboardDesignHeight. All pixel
- dimensions must be proportional to this value.
- */
- readonly property real scaleHint: keyboardHeight / keyboardDesignHeight
-
- /*!
- The distance between the left-most keys and the left edge of the
- keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
- width.
- */
- property real keyboardRelativeLeftMargin: 0
-
- /*!
- The distance between the right-most keys and the right edge of the
- keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
- width.
-
- This value is proportional to the keyboard's width.
- */
- property real keyboardRelativeRightMargin: 0
-
- /*!
- The distance between the top-most keys and the top edge of the
- keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
- height.
- */
- property real keyboardRelativeTopMargin: 0
-
- /*!
- The distance between the bottom-most keys and the bottom edge of the
- keyboard container, expressed as a percentage (\c 0.0 - \c 1.0) of the
- keyboard's height.
- */
- property real keyboardRelativeBottomMargin: 0
-
- /*! Template for the keyboard background.
-
- Example:
- \code
- keyboardBackground: Rectangle {
- color: "black"
- }
- \endcode
- */
- property Component keyboardBackground: null
-
- /*! Template for the regular keys.
-
- \note The delegate must be based on the KeyPanel type.
-
- Example:
- \code
- keyPanel: KeyPanel {
- Rectangle {
- anchors.fill: parent
- ...
- Text {
- anchors.fill: parent
- text: control.displayText
- ...
- }
- }
- }
- \endcode
- */
- property Component keyPanel: null
-
- /*! Template for the backspace key.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component backspaceKeyPanel: null
-
- /*! Template for the language key.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component languageKeyPanel: null
-
- /*! Template for the enter key.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component enterKeyPanel: null
-
- /*! Template for the hide key.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component hideKeyPanel: null
-
- /*! Template for the shift key.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component shiftKeyPanel: null
-
- /*! Template for the space key.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component spaceKeyPanel: null
-
- /*! Template for the symbol mode key.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component symbolKeyPanel: null
-
- /*! Template for the generic mode key.
-
- This template provides a visualization of the key in which the state
- can be on or off. This template is used in situations where the key label
- will remain the same regardless of status.
-
- The current state is available in the \c control.mode property.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component modeKeyPanel: null
-
- /*! Template for the handwriting mode key.
-
- \note The delegate must be based on the KeyPanel type.
- */
- property Component handwritingKeyPanel: null
-
- /*!
- Number of pixels between the top of each key and the bottom of the
- characterPreviewDelegate.
- */
- property real characterPreviewMargin: 0
-
- /*! Template for the character preview popup.
-
- If the delegate contains the \c text property, the property is updated
- with the display text when the component becomes active.
-
- \code
- property string text
- \endcode
-
- Example:
- \code
- characterPreviewDelegate: Item {
- property string text
- id: characterPreview
- Rectangle {
- id: characterPreviewBackground
- anchors.fill: parent
- ...
- Text {
- text: characterPreview.text
- anchors.fill: parent
- ...
- }
- }
- }
- \endcode
- */
- property Component characterPreviewDelegate: null
-
- /*! Width of the alternate keys list item. */
- property real alternateKeysListItemWidth: 0
-
- /*! Height of the alternate keys list item. */
- property real alternateKeysListItemHeight: 0
-
- /*! Top margin for the alternate keys list panel. */
- property real alternateKeysListTopMargin: 0
-
- /*! Bottom margin for the alternate keys list panel. */
- property real alternateKeysListBottomMargin: 0
-
- /*! Left margin for the alternate keys list panel. */
- property real alternateKeysListLeftMargin: 0
-
- /*! Right margin for the alternate keys list panel. */
- property real alternateKeysListRightMargin: 0
-
- /*! Template for the alternative keys list item.
-
- \note The delegate is used in a \l ListView.
- */
- property Component alternateKeysListDelegate: null
-
- /*! Template for the alternative keys list highlight.
-
- \note The delegate is used as \c ListView.highlight.
- */
- property Component alternateKeysListHighlight: null
-
- /*! Template for the alternative keys list background. */
- property Component alternateKeysListBackground: null
-
- /*! Selection list height. */
- property real selectionListHeight: 0
-
- /*! Template for the selection list item.
-
- \note The delegate is used in a \l ListView.
- \note The delegate must be based on the \l SelectionListItem type.
-
- The following properties are available to the item:
- \list
- \li \c display Display text for the current item.
- \li \c wordCompletionLength Word completion length measured from the end of the display text.
- \endlist
- */
- property Component selectionListDelegate: null
-
- /*! Template for the selection list highlight.
-
- \note The delegate is used as \c ListView.highlight.
- */
- property Component selectionListHighlight: null
-
- /*! Template for the selection list background. */
- property Component selectionListBackground: null
-
- /*! \since QtQuick.VirtualKeyboard.Styles 1.3
-
- This property holds the transition to apply to items that
- are added to the selection list view.
- */
- property Transition selectionListAdd
-
- /*! \since QtQuick.VirtualKeyboard.Styles 1.3
-
- This property holds the transition to apply to items that
- are removed from the selection list view.
- */
- property Transition selectionListRemove
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 1.1
-
- Template for the navigation highlight item.
-
- This item is used in \l {Configuration Options}{arrow-key-navigation}
- mode to highlight the navigation focus on the keyboard.
-
- The item is typically a transparent rectangle with a
- high contrast border.
- */
- property Component navigationHighlight: null
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.1
-
- Template for the trace input key.
-
- \note The delegate must be based on the TraceInputKeyPanel type.
- */
- property Component traceInputKeyPanelDelegate: null
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.1
-
- Template for rendering a Trace object.
-
- \note The delegate must be based on the TraceCanvas type.
- */
- property Component traceCanvasDelegate: null
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- Template for the popup list item.
-
- \note The delegate is used in a \l ListView.
- \note The delegate must be based on the \l SelectionListItem type.
-
- The following properties are available to the item:
- \list
- \li \c display Display text for the current item.
- \li \c wordCompletionLength Word completion length measured from the end of the display text.
- \endlist
- */
- property Component popupListDelegate: null
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- Template for the popup list highlight.
-
- \note The delegate is used as \c ListView.highlight.
- */
- property Component popupListHighlight: null
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- Template for the popup list background.
- */
- property Component popupListBackground: null
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- This property holds the transition to apply to items that
- are added to the popup list view.
- */
- property Transition popupListAdd
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- This property holds the transition to apply to items that
- are removed from the popup list view.
- */
- property Transition popupListRemove
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- This property determines whether a popup list will be shown when the
- language key is clicked. If this property is \c false, clicking the
- language key cycles through the available languages one at a time.
-
- The default value is \c false.
- */
- property bool languagePopupListEnabled: false
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- Template for the language list item.
-
- \note The delegate is used in a \l ListView.
- \note The delegate must be based on the \l SelectionListItem type.
-
- The following properties are available to the item:
- \list
- \li \c display Display text for the current item.
- \li \c wordCompletionLength Word completion length measured from the end of the display text.
- \endlist
- */
- property Component languageListDelegate: null
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- Template for the language list highlight.
-
- \note The delegate is used as \c ListView.highlight.
- */
- property Component languageListHighlight: null
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- Template for the language list background.
- */
- property Component languageListBackground: null
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- This property holds the transition to apply to items that
- are added to the language list view.
- */
- property Transition languageListAdd
-
- /*! \since QtQuick.VirtualKeyboard.Styles 2.1
-
- This property holds the transition to apply to items that
- are removed from the language list view.
- */
- property Transition languageListRemove
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.1
-
- This item is used to indicate where the bounds of the text selection is
- and to be able to interactively move the start or end of the selection.
- The same item is used for both start and end selection.
-
- Selection handles are currently only supported for the
- \l {Integration Method}{application-based integration method}.
- */
- property Component selectionHandle: null
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the delegate for the background of the full screen
- input container.
- */
- property Component fullScreenInputContainerBackground: null
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the delegate for the background of the full screen
- input.
- */
- property Component fullScreenInputBackground: null
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the margins around the full screen input field.
-
- The default value is \c 0.
- */
- property real fullScreenInputMargins: 0
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the padding around the full screen input content.
-
- The default value is \c 0.
- */
- property real fullScreenInputPadding: 0
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the delegate for the cursor in the full screen input
- field.
-
- The delegate should toggle the visibility of the cursor according to
- the \c {parent.blinkStatus} property defined for the full screen input
- field. For example:
-
- \code
- fullScreenInputCursor: Rectangle {
- width: 1
- color: "#000"
- visible: parent.blinkStatus
- }
- \endcode
- */
- property Component fullScreenInputCursor: null
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the \c font for the full screen input field.
- */
- property font fullScreenInputFont
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the password mask character for the full screen
- input field.
- */
- property string fullScreenInputPasswordCharacter: "\u2022"
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the text color for the full screen input field.
-
- The default color is black.
- */
- property color fullScreenInputColor: "#000"
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the selection color for the full screen input
- field.
-
- The default color is semi-transparent black.
- */
- property color fullScreenInputSelectionColor: Qt.rgba(0, 0, 0, 0.15)
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 2.2
-
- This property holds the selected text color for the full screen input
- field.
-
- The default color is set to \c fullScreenInputColor.
- */
- property color fullScreenInputSelectedTextColor: fullScreenInputColor
-}
diff --git a/src/virtualkeyboard/styles/SelectionListItem.qml b/src/virtualkeyboard/styles/SelectionListItem.qml
deleted file mode 100644
index f3c9fdc9..00000000
--- a/src/virtualkeyboard/styles/SelectionListItem.qml
+++ /dev/null
@@ -1,64 +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 SelectionListItem
- \inqmlmodule QtQuick.VirtualKeyboard.Styles
- \brief A base type for selection list item delegates.
- \ingroup qtvirtualkeyboard-styles-qml
-
- The SelectionListItem enables mouse handling for the selection list item
- delegates.
-*/
-
-Item {
- id: selectionListItem
- height: parent.height
-
- /*!
- \since QtQuick.VirtualKeyboard.Styles 1.1
-
- Sets the sound effect to be played on touch event.
- */
- property url soundEffect
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- hoverEnabled: true
- onClicked: {
- if (index === -1)
- return
- selectionListItem.ListView.view.currentIndex = index
- selectionListItem.ListView.view.model.selectItem(index)
- }
- }
-}
diff --git a/src/virtualkeyboard/styles/TraceCanvas.qml b/src/virtualkeyboard/styles/TraceCanvas.qml
deleted file mode 100644
index ffee8538..00000000
--- a/src/virtualkeyboard/styles/TraceCanvas.qml
+++ /dev/null
@@ -1,152 +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 "TraceUtils.js" as TraceUtils
-
-/*!
- \qmltype TraceCanvas
- \inqmlmodule QtQuick.VirtualKeyboard.Styles
- \brief A specialized Canvas type for rendering Trace objects.
- \ingroup qtvirtualkeyboard-styles-qml
- \inherits Canvas
- \since QtQuick.VirtualKeyboard 2.0
-
- This type provides capabilities for rendering Trace objects on the screen.
-
- To make the Trace rendering available in the keyboard, this type must be
- declared as the \l {KeyboardStyle::traceCanvasDelegate}
- {KeyboardStyle.traceCanvasDelegate} component.
-
- \code
- traceCanvasDelegate: TraceCanvas {
- }
- \endcode
-
- Custom drawing attributes can be initialized in the Canvas.available
- signal. For example:
-
- \code
- onAvailableChanged: {
- if (!available)
- return;
- var ctx = getContext("2d")
- ctx.lineWidth = 8 * scaleHint
- ctx.lineCap = "round"
- ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
- ctx.fillStyle = ctx.strokeStyle
- }
- \endcode
-
- The type offers built-in options for Trace rendering. Currently
- the following rendering options are available:
-
- \list
- \li \c renderSmoothedLine Renders smoothed line with round corners (the default)
- \endlist
-
- The rendering function can be changed with the renderFunction property.
-
- \code
- renderFunction: renderSmoothedLine
- \endcode
-
- Custom rendering function is also supported. Consider the following example:
-
- \code
- renderFunction: renderCustomLine
-
- function renderCustomLine() {
- getContext("2d")
- var points = trace.points()
-
- ...
- }
- \endcode
-*/
-
-Canvas {
- id: canvas
-
- /*! Provides access to \l Trace object.
- */
- property var trace
-
- /*! Enables auto destruction mode.
-
- If enabled, this item will be destroyed when the \c trace object is
- destroyed.
-
- The default value is false.
- */
- property bool autoDestroy
-
- /*! Specifies the approximate delay in milliseconds, counted from the beginning of the
- auto destruction, before the object is to be destroyed.
-
- This delay makes it possible, for example, to animate the item before destruction.
-
- The default value is 0.
- */
- property int autoDestroyDelay
-
- /*! This property defines the rendering function.
-
- The default value is \c renderSmoothedLine
- */
- property var renderFunction: renderSmoothedLine
-
- property int __renderPos
-
- property bool __renderingEnabled
-
- /*! Renders smoothed line with round corners.
-
- This function is incremental and renders only the new part added to the Trace.
-
- This function does not alter any of the canvas attributes (i.e. they can be set elsewhere.)
- */
- function renderSmoothedLine() {
- __renderPos = TraceUtils.renderSmoothedLine(getContext("2d"), trace, __renderPos)
- }
-
- onTraceChanged: if (trace === null && autoDestroy) destroy(autoDestroyDelay)
-
- onAvailableChanged: {
- __renderingEnabled = available
- if (__renderingEnabled)
- requestAnimationFrame(renderFunction)
- }
-
- Connections {
- target: canvas.__renderingEnabled && trace ? trace : null
- onLengthChanged: if (renderFunction) canvas.requestAnimationFrame(renderFunction)
- onFinalChanged: if (renderFunction) canvas.requestAnimationFrame(renderFunction)
- }
-}
diff --git a/src/virtualkeyboard/styles/TraceUtils.js b/src/virtualkeyboard/styles/TraceUtils.js
deleted file mode 100644
index f2dd9bbb..00000000
--- a/src/virtualkeyboard/styles/TraceUtils.js
+++ /dev/null
@@ -1,89 +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$
-**
-****************************************************************************/
-
-.pragma library
-
-function renderSmoothedLine(ctx, trace, renderPos) {
-
- if (!trace)
- return renderPos
-
- if (renderPos >= trace.length)
- return renderPos
-
- // Fetch points and draw the initial "dot"
- var points, tp
- if (renderPos === 0) {
- points = trace.points()
- tp = points[renderPos++]
- ctx.beginPath()
- ctx.moveTo(tp.x, tp.y)
- ctx.lineTo(tp.x, tp.y + 0.000001)
- ctx.stroke()
- } else {
- points = trace.points(renderPos - 1)
- }
-
- // Draw smoothed line using quadratic curve
- var i = 1
- if (i + 1 < points.length) {
- var pt1, pt2
- if (renderPos === 1) {
- tp = points[i - 1]
- } else {
- pt1 = points[i - 1]
- pt2 = points[i]
- tp = Qt.point((pt1.x + pt2.x) / 2, (pt1.y + pt2.y) / 2)
- }
- ctx.beginPath()
- ctx.moveTo(tp.x, tp.y)
- while (i + 1 < points.length) {
- pt1 = points[i++]
- pt2 = points[i]
- tp = Qt.point((pt1.x + pt2.x) / 2, (pt1.y + pt2.y) / 2)
- ctx.quadraticCurveTo(pt1.x, pt1.y, tp.x, tp.y)
- ctx.moveTo(tp.x, tp.y)
- }
- ctx.stroke()
- }
-
- // Draw the remainder of the line
- if (trace.isFinal) {
- if (i < points.length) {
- tp = points[i - 1]
- ctx.beginPath()
- ctx.moveTo(tp.x, tp.y)
- tp = points[i++]
- ctx.lineTo(tp.x, tp.y)
- ctx.stroke()
- }
- }
-
- return renderPos + i - 1
-}
diff --git a/src/virtualkeyboard/styles/plugins.qmltypes b/src/virtualkeyboard/styles/plugins.qmltypes
deleted file mode 100644
index 3ef80efb..00000000
--- a/src/virtualkeyboard/styles/plugins.qmltypes
+++ /dev/null
@@ -1,4 +0,0 @@
-import QtQuick.tooling 1.1
-
-Module {
-}
diff --git a/src/virtualkeyboard/styles/qmldir b/src/virtualkeyboard/styles/qmldir
deleted file mode 100644
index 26544a54..00000000
--- a/src/virtualkeyboard/styles/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtQuick.VirtualKeyboard.Styles
-plugin qtvirtualkeyboardstylesplugin
-classname QtVirtualKeyboardStylesPlugin
-typeinfo plugins.qmltypes
diff --git a/src/virtualkeyboard/styles/styles.pro b/src/virtualkeyboard/styles/styles.pro
deleted file mode 100644
index f5ce051f..00000000
--- a/src/virtualkeyboard/styles/styles.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TARGET = qtvirtualkeyboardstylesplugin
-TARGETPATH = QtQuick/VirtualKeyboard/Styles
-QT += qml quick svg
-
-CONFIG += no_cxx_module
-
-SOURCES += \
- svgimageprovider.cpp \
- styles_plugin.cpp
-
-HEADERS += \
- svgimageprovider.h \
- styles_plugin.h
-
-RESOURCES += \
- styles.qrc
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-}
-
-load(qml_plugin)
diff --git a/src/virtualkeyboard/styles/styles_plugin.cpp b/src/virtualkeyboard/styles/styles_plugin.cpp
deleted file mode 100644
index 9a73d728..00000000
--- a/src/virtualkeyboard/styles/styles_plugin.cpp
+++ /dev/null
@@ -1,76 +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 "styles_plugin.h"
-#include "svgimageprovider.h"
-
-#include <qqml.h>
-#include <QtCore/QLibraryInfo>
-
-/*!
- \qmlmodule QtQuick.VirtualKeyboard.Styles 2.2
- \title Qt Quick Virtual Keyboard Styles QML Types
- \ingroup qmlmodules
-
- \brief Provides styling for Qt Virtual Keyboard.
-
- The QML types can be imported into your application using the following
- import statements in your .qml file:
-
- \code
- import QtQuick.VirtualKeyboard.Styles 2.2
- \endcode
-*/
-
-void QtVirtualKeyboardStylesPlugin::registerTypes(const char *uri)
-{
- Q_INIT_RESOURCE(styles);
- 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");
-}
-
-void QtVirtualKeyboardStylesPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
-{
- Q_UNUSED(uri)
- engine->addImageProvider(QStringLiteral("qtvkbsvg"), new SvgImageProvider());
-}
diff --git a/src/virtualkeyboard/styles/styles_plugin.h b/src/virtualkeyboard/styles/styles_plugin.h
deleted file mode 100644
index 9673a23a..00000000
--- a/src/virtualkeyboard/styles/styles_plugin.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef STYLES_PLUGIN_H
-#define STYLES_PLUGIN_H
-
-#include <QQmlExtensionPlugin>
-
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_VirtualKeyboard_Styles);
-#endif
-}
-
-class QtVirtualKeyboardStylesPlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- QtVirtualKeyboardStylesPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri);
- void initializeEngine(QQmlEngine *engine, const char *uri);
-};
-
-#endif // STYLES_PLUGIN_H
-
diff --git a/src/virtualkeyboard/styles/svgimageprovider.cpp b/src/virtualkeyboard/styles/svgimageprovider.cpp
deleted file mode 100644
index 1dd2930f..00000000
--- a/src/virtualkeyboard/styles/svgimageprovider.cpp
+++ /dev/null
@@ -1,108 +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 "svgimageprovider.h"
-#include <QImage>
-#include <QPixmap>
-#include <QSvgRenderer>
-#include <QPainter>
-
-SvgImageProvider::SvgImageProvider() :
- QQuickImageProvider(QQuickImageProvider::Pixmap)
-{
-}
-
-SvgImageProvider::~SvgImageProvider()
-{
-}
-
-QPixmap SvgImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
-{
- QSize imageSize(-1, -1);
- QUrl request(id);
- QString imagePath = ":/" + request.path();
- if (request.hasQuery()) {
- const QString query = request.query();
- const QStringList paramList = query.split(QChar('&'), QString::SkipEmptyParts);
- QVariantMap params;
- for (const QString &param : paramList) {
- QStringList keyValue = param.split(QChar('='), QString::SkipEmptyParts);
- if (keyValue.length() == 2)
- params[keyValue[0]] = keyValue[1];
- }
- const auto widthIt = params.constFind("width");
- if (widthIt != params.cend()) {
- bool ok = false;
- int value = widthIt.value().toInt(&ok);
- if (ok)
- imageSize.setWidth(value);
- }
- const auto heightIt = params.constFind("height");
- if (heightIt != params.cend()) {
- bool ok = false;
- int value = heightIt.value().toInt(&ok);
- if (ok)
- imageSize.setHeight(value);
- }
- } else {
- imageSize = requestedSize;
- }
-
- QPixmap image;
- if ((imageSize.width() > 0 || imageSize.height() > 0) && imagePath.endsWith(".svg")) {
- QSvgRenderer renderer(imagePath);
- QSize defaultSize(renderer.defaultSize());
- if (defaultSize.isEmpty())
- return image;
- if (imageSize.width() <= 0 && imageSize.height() > 0) {
- double aspectRatio = (double)defaultSize.width() / (double)defaultSize.height();
- imageSize.setWidth(qRound(imageSize.height() * aspectRatio));
- } else if (imageSize.width() > 0 && imageSize.height() <= 0) {
- double aspectRatio = (double)defaultSize.width() / (double)defaultSize.height();
- imageSize.setHeight(qRound(imageSize.width() / aspectRatio));
- }
- image = QPixmap(imageSize);
- image.fill(Qt::transparent);
- QPainter painter(&image);
- renderer.render(&painter, image.rect());
- } else {
- image = QPixmap(imagePath);
- imageSize = image.size();
- }
-
- QPixmap result;
- if (requestedSize.isValid() && requestedSize != imageSize)
- result = image.scaled(requestedSize, Qt::KeepAspectRatio);
- else
- result = image;
-
- *size = result.size();
-
- return result;
-}
diff --git a/src/virtualkeyboard/t9write.h b/src/virtualkeyboard/t9write.h
deleted file mode 100644
index beebbaa2..00000000
--- a/src/virtualkeyboard/t9write.h
+++ /dev/null
@@ -1,50 +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_H
-#define T9WRITE_H
-
-#include "t9write_api_version.h"
-#ifdef HAVE_T9WRITE_ALPHABETIC
-#include "decuma_hwr.h"
-#endif
-#ifdef HAVE_T9WRITE_CJK
-#include "decuma_hwr_cjk.h"
-#endif
-#include "decumaFunctionalSupport.h"
-
-#if defined(HAVE_T9WRITE_CJK) && defined(HAVE_T9WRITE_ALPHABETIC)
-#define DECUMA_API(FUNC_NAME) (cjk ? decumaCJK ## FUNC_NAME : decuma ## FUNC_NAME)
-#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_H
diff --git a/src/virtualkeyboard/t9writedictionary.cpp b/src/virtualkeyboard/t9writedictionary.cpp
deleted file mode 100644
index d15b16e3..00000000
--- a/src/virtualkeyboard/t9writedictionary.cpp
+++ /dev/null
@@ -1,117 +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.h"
-#include "virtualkeyboarddebug.h"
-
-namespace QtVirtualKeyboard {
-
-T9WriteDictionary::T9WriteDictionary(DECUMA_SESSION *decumaSession,
- const DECUMA_MEM_FUNCTIONS &memFuncs,
- bool cjk) :
- decumaSession(decumaSession),
- memFuncs(memFuncs),
- cjk(cjk),
- sourceData(0),
- sourceSize(0),
- convertedData(0),
- convertedSize(0)
-{
-}
-
-T9WriteDictionary::~T9WriteDictionary()
-{
- if (convertedData) {
- DECUMA_STATUS status = DECUMA_API(DestroyConvertedDictionary)(&convertedData, &memFuncs);
- Q_ASSERT(status == decumaNoError);
- Q_ASSERT(convertedData == 0);
- }
-}
-
-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;
- qWarning() << "Could not read dictionary file" << fileName;
- }
- file.close();
- } else {
- qWarning() << "Could not open dictionary file" << fileName;
- }
-
- return sourceData != 0;
-}
-
-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) {
- qWarning() << "Could not convert dictionary" << file.fileName();
- file.unmap((uchar *)sourceData);
- sourceSize = 0;
- sourceData = 0;
- }
-
- 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 != 0;
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/t9writedictionary.h b/src/virtualkeyboard/t9writedictionary.h
deleted file mode 100644
index dc2d9475..00000000
--- a/src/virtualkeyboard/t9writedictionary.h
+++ /dev/null
@@ -1,67 +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_H
-#define T9WRITEDICTIONARY_H
-
-#include <QtGlobal>
-#include <QFile>
-#include "t9write.h"
-
-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;
-};
-
-}
-
-#endif // T9WRITEDICTIONARY_H
diff --git a/src/virtualkeyboard/t9writeinputmethod.cpp b/src/virtualkeyboard/t9writeinputmethod.cpp
deleted file mode 100644
index 329bdbd3..00000000
--- a/src/virtualkeyboard/t9writeinputmethod.cpp
+++ /dev/null
@@ -1,2129 +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.h"
-#include "inputengine.h"
-#include "inputcontext.h"
-#include "trace.h"
-#include "t9writeworker.h"
-#include "virtualkeyboarddebug.h"
-#include <QDirIterator>
-#include <QCryptographicHash>
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
-#include <QTime>
-#endif
-#include "handwritinggesturerecognizer.h"
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
-#include "unipentrace.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
-
-namespace QtVirtualKeyboard {
-
-class T9WriteCaseFormatter
-{
-public:
- T9WriteCaseFormatter() :
- preferLowercase(false)
- {
- }
-
- void clear()
- {
- textCaseList.clear();
- }
-
- void ensureLength(int length, InputEngine::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;
- InputEngine::TextCase textCase = InputEngine::Lower;
- for (int i = 0; i < str.length(); ++i) {
- if (i < textCaseList.length())
- textCase = textCaseList.at(i);
- result.append(textCase == InputEngine::Upper ? str.at(i).toUpper() : (preferLowercase ? str.at(i).toLower() : str.at(i)));
- }
- return result;
- }
-
- bool preferLowercase;
-
-private:
- QList<InputEngine::TextCase> textCaseList;
-};
-
-class T9WriteInputMethodPrivate : public AbstractInputMethodPrivate
-{
- Q_DECLARE_PUBLIC(T9WriteInputMethod)
-public:
-
- enum EngineMode {
- EngineUninitialized,
- Alphabetic,
- Arabic,
- Hebrew,
- SimplifiedChinese,
- TraditionalChinese,
- HongKongChinese,
- Japanese,
- Korean
- };
-
- T9WriteInputMethodPrivate(T9WriteInputMethod *q_ptr) :
- AbstractInputMethodPrivate(),
- q_ptr(q_ptr),
- cjk(false),
- engineMode(EngineUninitialized),
- defaultHwrDbPath(QLatin1String(":/QtQuick/VirtualKeyboard/T9Write/data/")),
- defaultDictionaryDbPath(defaultHwrDbPath),
- dictionaryLock(QMutex::Recursive),
- attachedDictionary(0),
- traceListHardLimit(32),
- resultId(0),
- lastResultId(0),
- resultTimer(0),
- decumaSession(0),
- activeWordIndex(-1),
- arcAdditionStarted(false),
- ignoreUpdate(false),
- textCase(InputEngine::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
-
- bool initEngine(EngineMode newEngineMode)
- {
- if (engineMode == newEngineMode)
- return engineMode != EngineUninitialized;
-
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::initEngine()" << newEngineMode;
-
- if (decumaSession)
- exitEngine();
-
- if (newEngineMode == EngineUninitialized)
- return false;
-
- switch (newEngineMode) {
- case Alphabetic:
- case Arabic:
- case Hebrew:
- cjk = false;
- break;
- case SimplifiedChinese:
- case TraditionalChinese:
- case HongKongChinese:
- case Japanese:
- case Korean:
- cjk = true;
- break;
- default:
- Q_ASSERT(0 && "Invalid EngineMode!");
- return false;
- }
- engineMode = newEngineMode;
-
- memset(&sessionSettings, 0, sizeof(sessionSettings));
-
- QString hwrDb = findHwrDb(engineMode, defaultHwrDbPath);
- hwrDbFile.setFileName(hwrDb);
- if (!hwrDbFile.open(QIODevice::ReadOnly)) {
- qCritical() << "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) {
- qCritical() << "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() : 0);
-
- DECUMA_STATUS status = DECUMA_API(BeginSession)(decumaSession, &sessionSettings, &memFuncs);
- Q_ASSERT(status == decumaNoError);
- if (status != decumaNoError) {
- qCritical() << "Could not initialize T9Write 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()
- {
- VIRTUALKEYBOARD_DEBUG() << "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 = 0;
- session.clear();
- }
-
- memset(&sessionSettings, 0, sizeof(sessionSettings));
-
- symbolCategories.clear();
- languageCategories.clear();
-
- engineMode = EngineUninitialized;
- cjk = false;
- }
-
- QString findHwrDb(EngineMode mode, const QString &dir) const
- {
- QString hwrDbPath(dir);
- switch (mode) {
- case Alphabetic:
-#if T9WRITEAPIMAJORVERNUM >= 21
- hwrDbPath.append(QLatin1String("hwrDB_le.bin"));
-#else
- hwrDbPath.append(QLatin1String("_databas_le.bin"));
-#endif
- break;
- case Arabic:
-#if T9WRITEAPIMAJORVERNUM >= 21
- hwrDbPath.append(QLatin1String("arabic/hwrDB_le.bin"));
-#else
- hwrDbPath.append(QLatin1String("arabic/_databas_le.bin"));
-#endif
- break;
- case Hebrew:
-#if T9WRITEAPIMAJORVERNUM >= 21
- hwrDbPath.append(QLatin1String("hebrew/hwrDB_le.bin"));
-#else
- hwrDbPath.append(QLatin1String("hebrew/_databas_le.bin"));
-#endif
- break;
- case SimplifiedChinese:
- hwrDbPath.append(QLatin1String("cjk_S_gb18030_le.hdb"));
- break;
- case TraditionalChinese:
- hwrDbPath.append(QLatin1String("cjk_T_std_le.hdb"));
- break;
- case HongKongChinese:
- hwrDbPath.append(QLatin1String("cjk_HK_std_le.hdb"));
- break;
- case Japanese:
- hwrDbPath.append(QLatin1String("cjk_J_std_le.hdb"));
- break;
- case Korean:
- hwrDbPath.append(QLatin1String("cjk_K_mkt_le.hdb"));
- break;
- default:
- return QString();
- }
- return QFileInfo::exists(hwrDbPath) ? hwrDbPath : QString();
- }
-
- QString findDictionary(const QString &dir, const QLocale &locale, DECUMA_SRC_DICTIONARY_TYPE &srcType)
- {
- srcType = numberOfSrcDictionaryTypes;
-
- QStringList languageCountry = locale.name().split("_");
- if (languageCountry.length() != 2)
- return QString();
-
- QString dictionary;
- QDirIterator it(dir, QDirIterator::NoIteratorFlags);
- while (it.hasNext()) {
- QString fileEntry = it.next();
-
- if (!fileEntry.contains("_" + languageCountry[0].toUpper()))
- continue;
-
- if (fileEntry.endsWith(QLatin1String(".ldb"))) {
-#if T9WRITEAPIMAJORVERNUM >= 20
- qCritical() << "Incompatible T9 Write dictionary" << fileEntry;
- continue;
-#else
- srcType = decumaXT9LDB;
-#endif
- } else if (fileEntry.endsWith(QLatin1String(".phd"))) {
-#if T9WRITEAPIMAJORVERNUM >= 20
- srcType = decumaPortableHWRDictionary;
-#else
- qCritical() << "Incompatible T9 Write dictionary" << fileEntry;
- continue;
-#endif
- } else {
- qWarning() << "Incompatible T9 Write dictionary" << fileEntry;
- continue;
- }
-
- dictionary = fileEntry;
- break;
- }
-
- return dictionary;
- }
-
- bool attachDictionary(const QSharedPointer<T9WriteDictionary> &dictionary)
- {
- QMutexLocker dictionaryGuard(&dictionaryLock);
- Q_ASSERT(decumaSession != 0);
- Q_ASSERT(dictionary != 0);
- VIRTUALKEYBOARD_DEBUG() << "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)
- {
- QMutexLocker dictionaryGuard(&dictionaryLock);
- if (!dictionary)
- return;
-
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::detachDictionary():" << dictionary->fileName();
-
- Q_ASSERT(decumaSession != 0);
- DECUMA_STATUS status = DECUMA_API(DetachDictionary)(decumaSession, dictionary->data());
- Q_UNUSED(status)
- Q_ASSERT(status == decumaNoError);
- }
-
- bool setInputMode(const QLocale &locale, InputEngine::InputMode inputMode)
- {
- Q_Q(T9WriteInputMethod);
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::setInputMode():" << locale << inputMode;
-
- finishRecognition();
-
- if (!initEngine(mapLocaleToEngineMode(locale)))
- return false;
-
- DECUMA_UINT32 language = mapToDecumaLanguage(locale, inputMode);
- if (language == DECUMA_LANG_GSMDEFAULT) {
- qWarning() << "Handwriting is not supported in" << locale.name();
- return false;
- }
-
- int isLanguageSupported = 0;
- DECUMA_API(DatabaseIsLanguageSupported)(sessionSettings.pStaticDB, language, &isLanguageSupported);
- if (!isLanguageSupported) {
- qWarning() << "Handwriting is not supported in" << 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
-
- VIRTUALKEYBOARD_DEBUG() << " -> language categories:" << languageCategories;
- VIRTUALKEYBOARD_DEBUG() << " -> symbol categories:" << symbolCategories;
- VIRTUALKEYBOARD_DEBUG() << " -> 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;
- }
-
- EngineMode mapLocaleToEngineMode(const QLocale &locale)
- {
-#ifdef HAVE_T9WRITE_CJK
- switch (locale.language()) {
- case QLocale::Chinese: {
- if (locale.script() == QLocale::TraditionalChineseScript)
- return locale.country() == QLocale::HongKong ? HongKongChinese : TraditionalChinese;
- return SimplifiedChinese;
- break;
- }
- case QLocale::Japanese:
- return Japanese;
- break;
- case QLocale::Korean:
- return Korean;
- default:
- break;
- }
-#else
- Q_UNUSED(locale)
-#endif
-
-#ifdef HAVE_T9WRITE_ALPHABETIC
- switch (locale.script()) {
- case QLocale::ArabicScript:
- return T9WriteInputMethodPrivate::Arabic;
- case QLocale::HebrewScript:
- return T9WriteInputMethodPrivate::Hebrew;
- default:
- return T9WriteInputMethodPrivate::Alphabetic;
- }
-#else
- return T9WriteInputMethodPrivate::EngineUninitialized;
-#endif
- }
-
- DECUMA_UINT32 mapToDecumaLanguage(const QLocale &locale, InputEngine::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 != InputEngine::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 != InputEngine::JapaneseHandwriting)
- language = DECUMA_LANG_EN;
- } else if (language == DECUMA_LANG_KO) {
- if (inputMode != InputEngine::KoreanHandwriting)
- language = DECUMA_LANG_EN;
- } else if (language == DECUMA_LANG_SRCY) {
- if (inputMode != InputEngine::Cyrillic)
- language = DECUMA_LANG_SRLA;
- } else if (language == DECUMA_LANG_AR || language == DECUMA_LANG_FA) {
- if (inputMode != InputEngine::Arabic && inputMode != InputEngine::Numeric)
- language = DECUMA_LANG_EN;
- } else if (language == DECUMA_LANG_IW) {
- if (inputMode != InputEngine::Hebrew)
- language = DECUMA_LANG_EN;
- }
-
- return language;
- }
-
- void updateRecognitionMode(DECUMA_UINT32 language, const QLocale &locale,
- InputEngine::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 InputEngine::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 InputEngine::Arabic:
- sessionSettings.recognitionMode = ucrMode;
- break;
- default:
- break;
- }
- }
-#endif
-
- // Use scrMode with hidden text or with no predictive mode
- if (inputMode != InputEngine::ChineseHandwriting &&
- inputMode != InputEngine::JapaneseHandwriting &&
- inputMode != InputEngine::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,
- InputEngine::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 InputEngine::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)
- 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);
- }
- break;
-
- case InputEngine::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 InputEngine::Dialable:
- symbolCategories.append(DECUMA_CATEGORY_PHONE_NUMBER);
- break;
-
- case InputEngine::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 InputEngine::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 InputEngine::Arabic:
- symbolCategories.append(DECUMA_CATEGORY_ARABIC_ISOLATED_LETTER_MODE);
- symbolCategories.append(DECUMA_CATEGORY_ARABIC_GESTURES);
- leftToRightGestures = false;
- break;
-
- case InputEngine::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;
-
- default:
- qWarning() << "Handwriting is not supported in" << locale.name();
- 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,
- InputEngine::InputMode inputMode)
- {
- Q_ASSERT(cjk);
-
- symbolCategories.clear();
-
- switch (inputMode) {
- case InputEngine::Latin:
- symbolCategories.append(DECUMA_CATEGORY_ANSI);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
- break;
-
- case InputEngine::Numeric:
- symbolCategories.append(DECUMA_CATEGORY_DIGIT);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
- break;
-
- case InputEngine::Dialable:
- symbolCategories.append(DECUMA_CATEGORY_DIGIT);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- break;
-
- case InputEngine::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:
- qWarning() << "Chinese handwriting is not supported in" << locale.name();
- return false;
- }
- break;
-
- case InputEngine::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 InputEngine::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.
- */
- QMutexLocker 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) {
- VIRTUALKEYBOARD_DEBUG() << " -> 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(InputEngine::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(InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo,
- const QVariantMap &traceScreenInfo,
- const QByteArray &context)
- {
- Q_UNUSED(patternRecognitionMode)
- if (context == currentContext)
- return;
- currentContext = context;
-
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::setContext():" << QString(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(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList, activeWordIndex);
- }
-
- const int dpi = traceCaptureDeviceInfo.value("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("horizontalRulers", QVariantList()).toList());
- if (horizontalRulers.count() >= 2) {
- sessionSettings.baseline = horizontalRulers.last().toInt();
- sessionSettings.helpline = 0;
- sessionSettings.topline = horizontalRulers.first().toInt();
- sessionSettings.supportLineSet = baselineAndTopline;
- } else {
- sessionSettings.baseline = 0;
- sessionSettings.helpline = 0;
- sessionSettings.topline = 0;
- sessionSettings.supportLineSet = baselineAndTopline;
- }
-
- DECUMA_STATUS status = DECUMA_API(ChangeSessionSettings)(decumaSession, &sessionSettings);
- Q_ASSERT(status == decumaNoError);
- }
-
- Trace *traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
- {
- if (!worker)
- return 0;
-
- // 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;
- }
-
- Trace *trace = new Trace();
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- trace->setChannels(QStringList("t"));
-#endif
- traceList.append(trace);
-
- return trace;
- }
-
- void traceEnd(Trace *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 (Trace *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;
-
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::noteSelected():" << index;
- Q_ASSERT(index >= 0 && index < wordCandidatesHwrResultIndex.length());
- int resultIndex = wordCandidatesHwrResultIndex[index];
- DECUMA_STATUS status = DECUMA_API(NoteSelectedCandidate)(decumaSession, resultIndex);
- Q_UNUSED(status)
- Q_ASSERT(status == decumaNoError);
- }
-
- void restartRecognition()
- {
- VIRTUALKEYBOARD_DEBUG() << "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;
-
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::waitForRecognitionResults()";
- worker->waitForAllTasks();
- processResult();
- }
-
- bool finishRecognition(bool emitSelectionListChanged = true)
- {
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::finishRecognition()";
- if (!worker)
- return false;
-
- bool result = !traceList.isEmpty();
-
- Q_ASSERT(decumaSession != 0);
-
- 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(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::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;
- }
-
- VIRTUALKEYBOARD_DEBUG() << "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 == InputEngine::Upper))) {
- QStringList homeLocations = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
- if (!homeLocations.isEmpty()) {
- unipenTrace->setDirectory(QStringLiteral("%1/%2").arg(homeLocations.at(0)).arg("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)
- {
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::resetResultTimer():" << interval;
- Q_Q(T9WriteInputMethod);
- stopResultTimer();
- resultTimer = q->startTimer(interval);
- }
-
- void stopResultTimer()
- {
- if (resultTimer) {
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::stopResultTimer()";
- Q_Q(T9WriteInputMethod);
- q->killTimer(resultTimer);
- resultTimer = 0;
- }
- }
-
- void processResult()
- {
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::processResult()";
- Q_Q(T9WriteInputMethod);
- InputContext *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()["resultId"] != resultId) {
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethodPrivate::processResult(): resultId mismatch" << resultList.first().toMap()["resultId"] << "(" << resultId << ")";
- resultList.clear();
- return;
- }
- lastResultId = resultId;
-
- for (int i = 0; i < resultList.size(); i++) {
- QVariantMap result = resultList.at(i).toMap();
- QString resultChars = result["chars"].toString();
- if (i == 0) {
- if (ic->shift()) {
- caseFormatter.ensureLength(1, textCase);
- caseFormatter.ensureLength(resultChars.length(), InputEngine::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("gesture"))
- gesture = result["gesture"].toString();
- if (sessionSettings.recognitionMode != scrMode && result.contains("symbolStrokes"))
- symbolStrokes = result["symbolStrokes"].toList();
- if (sessionSettings.recognitionMode == scrMode)
- break;
- } else {
- // Add a gesture symbol to the secondary candidate
- if (sessionSettings.recognitionMode != scrMode && result.contains("gesture")) {
- QString gesture2 = result["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 Trace objects consumed there.
- if (worker->numberOfPendingTasks() == 0) {
-
- const InputEngine::InputMode inputMode = q->inputEngine()->inputMode();
- if (sessionSettings.recognitionMode == mcrMode && !symbolStrokes.isEmpty() &&
- inputMode != InputEngine::ChineseHandwriting &&
- inputMode != InputEngine::JapaneseHandwriting &&
- inputMode != InputEngine::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) {
- VIRTUALKEYBOARD_DEBUG() << "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(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::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 QChar('\r');
- case 0x2423:
- return QChar(' ');
- default:
- return QChar();
- }
- }
-
- bool applyGesture(const QChar &gesture)
- {
- Q_Q(T9WriteInputMethod);
- InputContext *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;
-
- VIRTUALKEYBOARD_DEBUG() << "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);
- InputContext *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 InputEngine::InputMode inputMode = q->inputEngine()->inputMode();
- if (inputMode != InputEngine::ChineseHandwriting &&
- inputMode != InputEngine::JapaneseHandwriting &&
- inputMode != InputEngine::KoreanHandwriting) {
- if (swipeAngle <= SWIPE_ANGLE_THRESHOLD || swipeAngle >= 360 - SWIPE_ANGLE_THRESHOLD) {
- if (swipeTouchCount == 1) {
- // Single swipe: space
- ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QString(" "), 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(InputEngine::Numeric);
- int indexOfDialableInputMode = inputModes.indexOf(InputEngine::Dialable);
- if (indexOfNumericInputMode != -1 && indexOfDialableInputMode != -1)
- inputModes.removeAt(inputMode != InputEngine::Dialable ?
- indexOfDialableInputMode :
- indexOfNumericInputMode);
- if (inputModes.count() > 1) {
- int inputModeIndex = inputModes.indexOf((int)inputMode) + 1;
- if (inputModeIndex >= inputModes.count())
- inputModeIndex = 0;
- ic->inputEngine()->setInputMode((InputEngine::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);
- InputContext *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;
- EngineMode engineMode;
- QByteArray currentContext;
- DECUMA_SESSION_SETTINGS sessionSettings;
- DECUMA_INSTANT_GESTURE_SETTINGS instantGestureSettings;
- QString defaultHwrDbPath;
- QString defaultDictionaryDbPath;
- QFile hwrDbFile;
- QVector<DECUMA_UINT32> languageCategories;
- QVector<DECUMA_UINT32> symbolCategories;
- QScopedPointer<T9WriteWorker> worker;
- QList<Trace *> traceList;
- int traceListHardLimit;
- QMutex 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;
- InputEngine::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,
- NULL
-};
-
-/*!
- \class QtVirtualKeyboard::T9WriteInputMethod
- \internal
-*/
-
-T9WriteInputMethod::T9WriteInputMethod(QObject *parent) :
- AbstractInputMethod(*new T9WriteInputMethodPrivate(this), parent)
-{
-}
-
-T9WriteInputMethod::~T9WriteInputMethod()
-{
- Q_D(T9WriteInputMethod);
- d->exitEngine();
-}
-
-QList<InputEngine::InputMode> T9WriteInputMethod::inputModes(const QString &locale)
-{
- Q_D(T9WriteInputMethod);
- QList<InputEngine::InputMode> availableInputModes;
- const Qt::InputMethodHints inputMethodHints(inputContext()->inputMethodHints());
- const QLocale loc(locale);
- T9WriteInputMethodPrivate::EngineMode mode = d->mapLocaleToEngineMode(loc);
-
- // Add primary input mode
- switch (mode) {
-#ifdef HAVE_T9WRITE_ALPHABETIC
- case T9WriteInputMethodPrivate::Alphabetic:
- if (d->findHwrDb(T9WriteInputMethodPrivate::Alphabetic, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly))) {
- switch (loc.script()) {
- case QLocale::GreekScript:
- availableInputModes.append(InputEngine::Greek);
- break;
- case QLocale::CyrillicScript:
- availableInputModes.append(InputEngine::Cyrillic);
- break;
- default:
- break;
- }
- availableInputModes.append(InputEngine::Latin);
- }
- break;
- case T9WriteInputMethodPrivate::Arabic:
- if (d->findHwrDb(T9WriteInputMethodPrivate::Arabic, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(InputEngine::Arabic);
- break;
- case T9WriteInputMethodPrivate::Hebrew:
- if (d->findHwrDb(T9WriteInputMethodPrivate::Hebrew, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(InputEngine::Hebrew);
- break;
-#endif
-#ifdef HAVE_T9WRITE_CJK
- case T9WriteInputMethodPrivate::SimplifiedChinese:
- case T9WriteInputMethodPrivate::TraditionalChinese:
- case T9WriteInputMethodPrivate::HongKongChinese:
- if (d->findHwrDb(mode, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(InputEngine::ChineseHandwriting);
- break;
- case T9WriteInputMethodPrivate::Japanese:
- if (d->findHwrDb(T9WriteInputMethodPrivate::Japanese, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(InputEngine::JapaneseHandwriting);
- break;
- case T9WriteInputMethodPrivate::Korean:
- if (d->findHwrDb(T9WriteInputMethodPrivate::Korean, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(InputEngine::KoreanHandwriting);
- break;
-#endif
- default:
- return availableInputModes;
- }
-
- // Add exclusive input modes
- if (inputMethodHints.testFlag(Qt::ImhDialableCharactersOnly) || inputMethodHints.testFlag(Qt::ImhDigitsOnly)) {
- availableInputModes.append(InputEngine::Dialable);
- } else if (inputMethodHints.testFlag(Qt::ImhFormattedNumbersOnly)) {
- availableInputModes.append(InputEngine::Numeric);
- } else if (inputMethodHints.testFlag(Qt::ImhLatinOnly)) {
- availableInputModes.append(InputEngine::Latin);
- } else {
- // Add other input modes
- Q_ASSERT(!availableInputModes.isEmpty());
- if (!availableInputModes.contains(InputEngine::Latin))
- availableInputModes.append(InputEngine::Latin);
- availableInputModes.append(InputEngine::Numeric);
- }
-
- return availableInputModes;
-}
-
-bool T9WriteInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
-{
- Q_D(T9WriteInputMethod);
- d->select();
- return d->setInputMode(QLocale(locale), inputMode);
-}
-
-bool T9WriteInputMethod::setTextCase(InputEngine::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:
- {
- InputContext *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(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::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();
- InputContext *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(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::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<SelectionListModel::Type> T9WriteInputMethod::selectionLists()
-{
- return QList<SelectionListModel::Type>() << SelectionListModel::WordCandidateList;
-}
-
-int T9WriteInputMethod::selectionListItemCount(SelectionListModel::Type type)
-{
- Q_UNUSED(type)
- Q_D(T9WriteInputMethod);
- return d->wordCandidates.count();
-}
-
-QVariant T9WriteInputMethod::selectionListData(SelectionListModel::Type type, int index, int role)
-{
- QVariant result;
- Q_D(T9WriteInputMethod);
- switch (role) {
- case SelectionListModel::DisplayRole:
- result = QVariant(d->wordCandidates.at(index));
- break;
- case SelectionListModel::WordCompletionLengthRole:
- result.setValue(0);
- break;
- default:
- result = AbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void T9WriteInputMethod::selectionListItemSelected(SelectionListModel::Type type, int index)
-{
- Q_UNUSED(type)
- Q_D(T9WriteInputMethod);
- d->select(index);
-}
-
-QList<InputEngine::PatternRecognitionMode> T9WriteInputMethod::patternRecognitionModes() const
-{
- return QList<InputEngine::PatternRecognitionMode>()
- << InputEngine::HandwritingRecoginition;
-}
-
-Trace *T9WriteInputMethod::traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
-{
- Q_D(T9WriteInputMethod);
- return d->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
-}
-
-bool T9WriteInputMethod::traceEnd(Trace *trace)
-{
- Q_D(T9WriteInputMethod);
- d->traceEnd(trace);
- return true;
-}
-
-bool T9WriteInputMethod::reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags)
-{
- Q_D(T9WriteInputMethod);
-
- if (d->sessionSettings.recognitionMode == scrMode)
- return false;
-
- InputContext *ic = inputContext();
- if (!ic)
- return false;
-
- const InputEngine::InputMode inputMode = inputEngine()->inputMode();
- const int maxLength = (inputMode == InputEngine::ChineseHandwriting ||
- inputMode == InputEngine::JapaneseHandwriting ||
- inputMode == InputEngine::KoreanHandwriting) ? 0 : 32;
- const QString surroundingText = ic->surroundingText();
- int replaceFrom = 0;
-
- if (reselectFlags.testFlag(InputEngine::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(InputEngine::WordAtCursor) && replaceFrom == 0) {
- d->stringStart.clear();
- return false;
- }
-
- if (reselectFlags.testFlag(InputEngine::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(InputEngine::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() ? InputEngine::Upper : InputEngine::Lower);
- d->wordCandidates.append(d->stringStart);
- d->activeWordIndex = 0;
- emit selectionListChanged(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::WordCandidateList, d->activeWordIndex);
-
- return true;
-}
-
-void T9WriteInputMethod::timerEvent(QTimerEvent *timerEvent)
-{
- Q_D(T9WriteInputMethod);
- int timerId = timerEvent->timerId();
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethod::timerEvent():" << timerId;
- if (timerId == d->resultTimer) {
- d->stopResultTimer();
-
- // Ignore if the result is not yet available
- if (d->resultId != d->lastResultId) {
- VIRTUALKEYBOARD_DEBUG() << "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) {
- QMutexLocker dictionaryGuard(&d->dictionaryLock);
- if (d->attachedDictionary)
- return;
- }
-
- const InputEngine::InputMode inputMode = inputEngine()->inputMode();
- if (inputMode != InputEngine::ChineseHandwriting &&
- inputMode != InputEngine::JapaneseHandwriting &&
- inputMode != InputEngine::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
- QMutexLocker dictionaryGuard(&d->dictionaryLock);
-
- if (!dictionary)
- return;
-
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethod::dictionaryLoadCompleted():"
- << dictionary->fileName() << dictionary->data() << dictionary->size();
-
- InputContext *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 QT_VIRTUALKEYBOARD_DEBUG
- {
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethod::resultsAvailable():";
- for (int i = 0; i < resultList.size(); i++) {
- QVariantMap result = resultList.at(i).toMap();
- QString resultPrint = QString("%1: ").arg(i + 1);
- QString resultChars = result.value("chars").toString();
- if (!resultChars.isEmpty())
- resultPrint.append(resultChars);
- if (result.contains("gesture")) {
- if (!resultChars.isEmpty())
- resultPrint.append(", ");
- resultPrint.append("gesture = 0x");
- resultPrint.append(result["gesture"].toString().toUtf8().toHex());
- }
- VIRTUALKEYBOARD_DEBUG() << 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)
-{
- VIRTUALKEYBOARD_DEBUG() << "T9WriteInputMethod::recognitionError():" << status;
- reset();
-}
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/t9writeinputmethod.h b/src/virtualkeyboard/t9writeinputmethod.h
deleted file mode 100644
index 9d922537..00000000
--- a/src/virtualkeyboard/t9writeinputmethod.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 T9WRITEINPUTMETHOD_H
-#define T9WRITEINPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-#include <QSharedPointer>
-
-namespace QtVirtualKeyboard {
-
-class T9WriteInputMethodPrivate;
-class T9WriteDictionary;
-
-class T9WriteInputMethod : public AbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(T9WriteInputMethod)
-
-public:
- explicit T9WriteInputMethod(QObject *parent = 0);
- ~T9WriteInputMethod();
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- void reset();
- void update();
-
- QList<SelectionListModel::Type> selectionLists();
- int selectionListItemCount(SelectionListModel::Type type);
- QVariant selectionListData(SelectionListModel::Type type, int index, int role);
- void selectionListItemSelected(SelectionListModel::Type type, int index);
-
- QList<InputEngine::PatternRecognitionMode> patternRecognitionModes() const;
- Trace *traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
- bool traceEnd(Trace *trace);
-
- bool reselect(int cursorPosition, const InputEngine::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);
-};
-
-}
-
-#endif
diff --git a/src/virtualkeyboard/t9writeworker.cpp b/src/virtualkeyboard/t9writeworker.cpp
deleted file mode 100644
index cc4564dd..00000000
--- a/src/virtualkeyboard/t9writeworker.cpp
+++ /dev/null
@@ -1,414 +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.h"
-#include "virtualkeyboarddebug.h"
-
-#include <QFile>
-#include <QTime>
-
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::T9WriteTask
- \internal
-*/
-
-T9WriteTask::T9WriteTask(QObject *parent) :
- QObject(parent),
- decumaSession(0),
- 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()
-{
- VIRTUALKEYBOARD_DEBUG() << "T9WriteDictionaryTask::run()";
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
-
- bool result = false;
- if (dictionary) {
- result = dictionary->load(dictionaryFileName);
- if (result && convertDictionary)
- result = dictionary->convert(dictionaryInfo);
- }
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- VIRTUALKEYBOARD_DEBUG() << "T9WriteDictionaryTask::run(): time:" << perf.elapsed() << "ms";
-#endif
-
- if (result)
- emit completed(dictionary);
-}
-
-T9WriteAddArcTask::T9WriteAddArcTask(Trace *trace) :
- trace(trace)
-{
-}
-
-void T9WriteAddArcTask::run()
-{
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
- DECUMA_UINT32 arcID = (DECUMA_UINT32)trace->traceId();
- DECUMA_STATUS status = DECUMA_API(StartNewArc)(decumaSession, arcID);
- Q_ASSERT(status == decumaNoError);
- if (status != decumaNoError) {
- qWarning() << "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) {
- qWarning() << "T9WriteAddArcTask::run(): Failed to add point, status:" << status;
- DECUMA_API(CancelArc)(decumaSession, arcID);
- return;
- }
- }
-
- status = DECUMA_API(CommitArc)(decumaSession, arcID);
- if (status != decumaNoError)
- qWarning() << "T9WriteAddArcTask::run(): Failed to commit arc, status:" << status;
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- else
- VIRTUALKEYBOARD_DEBUG() << "T9WriteAddArcTask::run(): time:" << perf.elapsed() << "ms";
-#endif
-}
-
-/*!
- \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)
-{
- VIRTUALKEYBOARD_DEBUG() << "T9WriteRecognitionTask():" << "boostLevel:" << boostLevel << "stringStart:" << stringStart;
-}
-
-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();
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- QTime perf;
- perf.start();
-#endif
-
-#if SUPPORTS_ABORTRECOGNITION
- DECUMA_INTERRUPT_FUNCTIONS interruptFunctions;
- interruptFunctions.pShouldAbortRecognize = shouldAbortRecognize;
- interruptFunctions.pUserData = (void *)this;
- DECUMA_INTERRUPT_FUNCTIONS *pInterruptFunctions = &interruptFunctions;
-#else
- DECUMA_INTERRUPT_FUNCTIONS *pInterruptFunctions = NULL;
-#endif
- result->status = DECUMA_API(Recognize)(decumaSession, result->results.data(), result->results.size(), &result->numResults, result->maxCharsPerWord, &recSettings, pInterruptFunctions);
- if (result->status != decumaNoError)
- qWarning() << "T9WriteRecognitionTask::run(): Recognition failed, status:" << result->status;
-
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- int perfElapsed = perf.elapsed();
-#endif
-
- {
- QMutexLocker stateGuard(&stateLock);
- Q_UNUSED(stateGuard)
- if (stateCancelled)
- result.reset();
-#ifdef QT_VIRTUALKEYBOARD_DEBUG
- VIRTUALKEYBOARD_DEBUG() << "T9WriteRecognitionTask::run(): time:" << perfElapsed << "ms" << (stateCancelled ? "(cancelled)" : "");
-#endif
- }
-}
-
-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 != 0 ? 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["resultId"] = result->id;
- resultMap["chars"] = resultString;
- resultMap["symbolStrokes"] = symbolStrokes;
- if (!gesture.isEmpty())
- resultMap["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
diff --git a/src/virtualkeyboard/t9writeworker.h b/src/virtualkeyboard/t9writeworker.h
deleted file mode 100644
index f34eef67..00000000
--- a/src/virtualkeyboard/t9writeworker.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef T9WRITEWORKER_H
-#define T9WRITEWORKER_H
-
-#include "trace.h"
-
-#include <QThread>
-#include <QSemaphore>
-#include <QMutex>
-#include <QStringList>
-#include <QSharedPointer>
-#include <QPointer>
-#include <QMap>
-#include <QVector>
-
-#include "t9write.h"
-#include "t9writedictionary.h"
-
-namespace QtVirtualKeyboard {
-
-class T9WriteTask : public QObject
-{
- Q_OBJECT
-public:
- explicit T9WriteTask(QObject *parent = 0);
-
- 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(Trace *trace);
-
- void run();
-
-private:
- Trace *trace;
-};
-
-class T9WriteRecognitionResult
-{
- Q_DISABLE_COPY(T9WriteRecognitionResult)
-
-public:
- explicit T9WriteRecognitionResult(int id, int maxResults, int maxCharsPerWord);
-
- DECUMA_STATUS status;
- QVector<DECUMA_HWR_RESULT> results;
- DECUMA_UINT16 numResults;
- int instantGesture;
- const int id;
- const int maxResults;
- const int maxCharsPerWord;
-
-private:
- QVector<DECUMA_UNICODE> _chars;
- QVector<DECUMA_INT16> _symbolChars;
- QVector<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 = 0);
- ~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
-
-#endif // T9WRITEWORKER_H
diff --git a/src/virtualkeyboard/tcinputmethod.cpp b/src/virtualkeyboard/tcinputmethod.cpp
deleted file mode 100644
index 27686eda..00000000
--- a/src/virtualkeyboard/tcinputmethod.cpp
+++ /dev/null
@@ -1,540 +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.h"
-#include "inputengine.h"
-#include "inputcontext.h"
-#if defined(HAVE_TCIME_CANGJIE)
-#include "cangjiedictionary.h"
-#include "cangjietable.h"
-#endif
-#if defined(HAVE_TCIME_ZHUYIN)
-#include "zhuyindictionary.h"
-#include "zhuyintable.h"
-#endif
-#include "phrasedictionary.h"
-#include "virtualkeyboarddebug.h"
-
-#include <QLibraryInfo>
-
-namespace QtVirtualKeyboard {
-
-using namespace tcime;
-
-class TCInputMethodPrivate : public AbstractInputMethodPrivate
-{
- Q_DECLARE_PUBLIC(TCInputMethod)
-public:
-
- TCInputMethodPrivate(TCInputMethod *q_ptr) :
- AbstractInputMethodPrivate(),
- q_ptr(q_ptr),
- inputMode(InputEngine::Latin),
- wordDictionary(0),
- 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(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList, highlightIndex);
- }
- input.clear();
- }
-
- bool compose(const QChar &c)
- {
- bool accept;
- Q_Q(TCInputMethod);
- InputContext *ic = q->inputContext();
- switch (inputMode)
- {
-#if defined(HAVE_TCIME_CANGJIE)
- case InputEngine::Cangjie:
- accept = composeCangjie(ic, c);
- break;
-#endif
-#if defined(HAVE_TCIME_ZHUYIN)
- case InputEngine::Zhuyin:
- accept = composeZhuyin(ic, c);
- break;
-#endif
- default:
- accept = false;
- break;
- }
- return accept;
- }
-
-#if defined(HAVE_TCIME_CANGJIE)
- bool composeCangjie(InputContext *ic, const QChar &c)
- {
- bool accept = false;
- if (!input.contains(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(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::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(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::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(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList, highlightIndex);
- }
- q->inputContext()->setPreeditText(candidates[highlightIndex]);
- return true;
- }
- return false;
- }
-#endif
-
-#if defined(HAVE_TCIME_ZHUYIN)
- bool composeZhuyin(InputContext *ic, const QChar &c)
- {
- if (ZhuyinTable::isTone(c)) {
- if (input.isEmpty())
- // Tones are accepted only when there's text in composing.
- return false;
-
- QStringList pair = ZhuyinTable::stripTones(input);
- if (pair.isEmpty())
- // 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 = 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(QString(c)) > 0) {
- // Replace the finals in the decomposed of syllables and tones.
- QList<QChar> decomposed = decomposeZhuyin();
- if (ZhuyinTable::isYiWuYuFinals(c)) {
- decomposed[1] = c;
- } else {
- decomposed[2] = c;
- }
-
- // Compose back the text after the finals replacement.
- input.clear();
- for (int i = 0; i < decomposed.length(); ++i) {
- if (!decomposed[i].isNull())
- input.append(decomposed[i]);
- }
- } else {
- return false;
- }
-
- ic->setPreeditText(input);
- if (setCandidates(wordDictionary->getWords(input), true)) {
- Q_Q(TCInputMethod);
- emit q->selectionListChanged(SelectionListModel::WordCandidateList);
- emit q->selectionListActiveItemChanged(SelectionListModel::WordCandidateList, highlightIndex);
- }
-
- return true;
- }
-
- QList<QChar> decomposeZhuyin()
- {
- QList<QChar> results = QList<QChar>() << 0 << 0 << 0 << 0;
- QStringList pair = ZhuyinTable::stripTones(input);
- if (!pair.isEmpty()) {
- // Decompose tones.
- QChar tone = pair[1].at(0);
- if (tone != ZhuyinTable::DEFAULT_TONE)
- results[3] = tone;
-
- // Decompose initials.
- QString syllables = 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;
- InputEngine::InputMode inputMode;
-#if defined(HAVE_TCIME_CANGJIE)
- CangjieDictionary cangjieDictionary;
-#endif
-#if defined(HAVE_TCIME_ZHUYIN)
- ZhuyinDictionary zhuyinDictionary;
-#endif
- PhraseDictionary phraseDictionary;
- WordDictionary *wordDictionary;
- QString input;
- QStringList candidates;
- int highlightIndex;
-};
-
-/*!
- \class QtVirtualKeyboard::TCInputMethod
- \internal
-*/
-
-TCInputMethod::TCInputMethod(QObject *parent) :
- AbstractInputMethod(*new TCInputMethodPrivate(this), parent)
-{
-}
-
-TCInputMethod::~TCInputMethod()
-{
-}
-
-bool TCInputMethod::simplified() const
-{
-#if defined(HAVE_TCIME_CANGJIE)
- Q_D(const TCInputMethod);
- return d->cangjieDictionary.simplified();
-#else
- return false;
-#endif
-}
-
-void TCInputMethod::setSimplified(bool simplified)
-{
- VIRTUALKEYBOARD_DEBUG() << "TCInputMethod::setSimplified(): " << simplified;
-#if defined(HAVE_TCIME_CANGJIE)
- Q_D(TCInputMethod);
- if (d->cangjieDictionary.simplified() != simplified) {
- d->reset();
- InputContext *ic = inputContext();
- if (ic)
- ic->clear();
- d->cangjieDictionary.setSimplified(simplified);
- emit simplifiedChanged();
- }
-#else
- Q_UNUSED(simplified)
-#endif
-}
-
-QList<InputEngine::InputMode> TCInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale)
- return QList<InputEngine::InputMode>()
-#if defined(HAVE_TCIME_ZHUYIN)
- << InputEngine::Zhuyin
-#endif
-#if defined(HAVE_TCIME_CANGJIE)
- << InputEngine::Cangjie
-#endif
- ;
-}
-
-bool TCInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale)
- Q_D(TCInputMethod);
- if (d->inputMode == inputMode)
- return true;
- update();
- bool result = false;
- d->inputMode = inputMode;
- d->wordDictionary = 0;
-#if defined(HAVE_TCIME_CANGJIE)
- if (inputMode == InputEngine::Cangjie) {
- if (d->cangjieDictionary.isEmpty()) {
- QString cangjieDictionary(qEnvironmentVariable("QT_VIRTUALKEYBOARD_CANGJIE_DICTIONARY"));
- if (cangjieDictionary.isEmpty())
- cangjieDictionary = QLibraryInfo::location(QLibraryInfo::DataPath) + "/qtvirtualkeyboard/tcime/dict_cangjie.dat";
- d->cangjieDictionary.load(cangjieDictionary);
- }
- d->wordDictionary = &d->cangjieDictionary;
- }
-#endif
-#if defined(HAVE_TCIME_ZHUYIN)
- if (inputMode == InputEngine::Zhuyin) {
- if (d->zhuyinDictionary.isEmpty()) {
- QString zhuyinDictionary(qEnvironmentVariable("QT_VIRTUALKEYBOARD_ZHUYIN_DICTIONARY"));
- if (zhuyinDictionary.isEmpty())
- zhuyinDictionary = QLibraryInfo::location(QLibraryInfo::DataPath) + "/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 (phraseDictionary.isEmpty())
- phraseDictionary = QLibraryInfo::location(QLibraryInfo::DataPath) + "/qtvirtualkeyboard/tcime/dict_phrases.dat";
- d->phraseDictionary.load(phraseDictionary);
- }
- if (!result)
- inputMode = InputEngine::Latin;
- return result;
-}
-
-bool TCInputMethod::setTextCase(InputEngine::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);
- InputContext *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(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::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 defined(HAVE_TCIME_CANGJIE)
- if (!d->checkSpecialCharInput()) {
-#endif
- if (d->setCandidates(d->wordDictionary->getWords(d->input), true)) {
- emit selectionListChanged(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::WordCandidateList, d->highlightIndex);
- }
-#if defined(HAVE_TCIME_CANGJIE)
- }
-#endif
- accept = true;
- } else if (d->clearCandidates()) {
- emit selectionListChanged(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::WordCandidateList, d->highlightIndex);
- }
- break;
-
- default:
- if (text.length() == 1)
- accept = d->compose(text.at(0));
- if (!accept)
- update();
- break;
- }
- return accept;
-}
-
-QList<SelectionListModel::Type> TCInputMethod::selectionLists()
-{
- return QList<SelectionListModel::Type>() << SelectionListModel::WordCandidateList;
-}
-
-int TCInputMethod::selectionListItemCount(SelectionListModel::Type type)
-{
- Q_UNUSED(type)
- Q_D(TCInputMethod);
- return d->candidates.count();
-}
-
-QVariant TCInputMethod::selectionListData(SelectionListModel::Type type, int index, int role)
-{
- QVariant result;
- Q_D(TCInputMethod);
- switch (role) {
- case SelectionListModel::DisplayRole:
- result = QVariant(d->candidates.at(index));
- break;
- case SelectionListModel::WordCompletionLengthRole:
- result.setValue(0);
- break;
- default:
- result = AbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void TCInputMethod::selectionListItemSelected(SelectionListModel::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(SelectionListModel::WordCandidateList);
- emit selectionListActiveItemChanged(SelectionListModel::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
diff --git a/src/virtualkeyboard/tcinputmethod.h b/src/virtualkeyboard/tcinputmethod.h
deleted file mode 100644
index 94f0a045..00000000
--- a/src/virtualkeyboard/tcinputmethod.h
+++ /dev/null
@@ -1,72 +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_H
-#define TCINPUTMETHOD_H
-
-#include "abstractinputmethod.h"
-
-namespace QtVirtualKeyboard {
-
-class TCInputMethodPrivate;
-
-class TCInputMethod : public AbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(TCInputMethod)
- Q_PROPERTY(bool simplified READ simplified WRITE setSimplified NOTIFY simplifiedChanged)
-
-public:
- explicit TCInputMethod(QObject *parent = 0);
- ~TCInputMethod();
-
- bool simplified() const;
- void setSimplified(bool simplified);
-
- QList<InputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, InputEngine::InputMode inputMode);
- bool setTextCase(InputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- QList<SelectionListModel::Type> selectionLists();
- int selectionListItemCount(SelectionListModel::Type type);
- QVariant selectionListData(SelectionListModel::Type type, int index, int role);
- void selectionListItemSelected(SelectionListModel::Type type, int index);
-
- void reset();
- void update();
-
-signals:
- void simplifiedChanged();
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif
diff --git a/src/virtualkeyboard/trace.cpp b/src/virtualkeyboard/trace.cpp
deleted file mode 100644
index e74793e1..00000000
--- a/src/virtualkeyboard/trace.cpp
+++ /dev/null
@@ -1,428 +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 "trace.h"
-#include <QtCore/private/qobject_p.h>
-
-namespace QtVirtualKeyboard {
-
-class TracePrivate : public QObjectPrivate
-{
-public:
- TracePrivate() :
- QObjectPrivate(),
- traceId(0),
- final(false),
- canceled(false)
- { }
-
- int traceId;
- QVariantList points;
- QMap<QString, QVariantList> channels;
- bool final;
- bool canceled;
-};
-
-/*!
- \class QtVirtualKeyboard::Trace
- \inmodule qtvirtualkeyboard
- \since QtQuick.VirtualKeyboard 2.0
- \brief Trace is a data model for touch input data.
- \internal
-
- Trace provides the data model for coordinate data and other
- optional data associated with a single stroke.
-
- A typical use case for the trace object is as follows:
- \list
- \li TraceInputArea or other input device initiates
- the trace event by calling \l {InputEngine::traceBegin()}
- {InputEngine.traceBegin()} method.
- \li If the current input method accepts the event it creates
- a trace object and configures the required data channels
- (if any).
- \li TraceInputArea collects the data for the Trace object.
- \li TraceInputArea calls the \l {InputEngine::traceEnd()}
- {InputEngine.traceEnd()} method to finish the trace and
- passing the trace object back to input method.
- \li The input method processes the data and discards the object
- when it is no longer needed.
- \endlist
-
- The coordinate data is retrieved using the points() function.
-
- In addition to coordinate based data, it is possible
- to attach an arbitrary data channel for each data point.
-
- The data channels must be defined before the points are added.
- The data channels supported by the TraceInputArea are listed below:
-
- \list
- \li \c "t" Collects time for each data point. The time is
- the number of milliseconds since 1970/01/01:
- \endlist
-
- For example, to configure the object to collect the times for
- each point:
-
- \code
- Trace *trace = new Trace(this);
- trace->setChannels(QStringList() << "t");
- \endcode
-
- The collected data can be accessed using the channelData() function:
-
- \code
- QVariantList timeData = trace->channelData("t");
- \endcode
-
- Trace objects are owned by their creator, which is the input method in
- normal case. This means the objects are constructed in the
- \l {InputMethod::traceBegin()}{InputMethod.traceBegin()} (QML) method.
-
- By definition, the trace object can be destroyed at earliest in the
- \l {InputMethod::traceEnd()}{InputMethod.traceEnd()} (QML) method.
-*/
-
-/*!
- \qmltype Trace
- \instantiates QtVirtualKeyboard::Trace
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \since QtQuick.VirtualKeyboard 2.0
- \brief Trace is a data model for touch input data.
-
- Trace provides the data model for coordinate data and other
- optional data associated with a single stroke.
-
- A typical use case for the trace object is as follows:
- \list
- \li TraceInputArea or other input device initiates
- the trace event by calling \l {InputEngine::traceBegin()}
- {InputEngine.traceBegin()} method.
- \li If the current input method accepts the event it creates
- a trace object and configures the required data channels
- (if any).
- \li TraceInputArea collects the data for the trace object.
- \li TraceInputArea calls the \l {InputEngine::traceEnd()}
- {InputEngine.traceEnd()} method to finish the trace and
- passing the trace object back to input method.
- \li The input method processes the data and discards the object
- when it is no longer needed.
- \endlist
-
- The coordinate data is retrieved using the points() function.
-
- In addition to coordinate based data, it is possible
- to attach an arbitrary data channel for each data point.
-
- The data channels must be defined before the points are added.
- The data channels supported by the TraceInputArea are listed below:
-
- \list
- \li \c "t" Collects time for each data point. The time is
- the number of milliseconds since 1970/01/01:
- \endlist
-
- For example, to configure the object to collect the times for
- each point:
-
- \code
- Trace *trace = new Trace(this);
- trace->setChannels(QStringList() << "t");
- \endcode
-
- The collected data can be accessed using the channelData() function:
-
- \code
- QVariantList timeData = trace->channelData("t");
- \endcode
-
- Trace objects are owned by their creator, which is the input method in
- normal case. This means the objects are constructed in the
- \l {InputMethod::traceBegin()}{InputMethod.traceBegin()} (QML) method.
-
- By definition, the trace object can be destroyed at earliest in the
- \l {InputMethod::traceEnd()}{InputMethod.traceEnd()} (QML) method.
-*/
-
-/*! \internal */
-Trace::Trace(QObject *parent) :
- QObject(*new TracePrivate(), parent)
-{
-}
-
-/*! \internal */
-Trace::~Trace()
-{
-}
-
-int Trace::traceId() const
-{
- Q_D(const Trace);
- return d->traceId;
-}
-
-void Trace::setTraceId(int id)
-{
- Q_D(Trace);
- if (d->traceId != id) {
- d->traceId = id;
- emit traceIdChanged(id);
- }
-}
-
-QStringList Trace::channels() const
-{
- Q_D(const Trace);
- return d->channels.keys();
-}
-
-void Trace::setChannels(const QStringList &channels)
-{
- Q_D(Trace);
- Q_ASSERT(d->points.isEmpty());
- if (d->points.isEmpty()) {
- d->channels.clear();
- for (QStringList::ConstIterator i = channels.constBegin();
- i != channels.constEnd(); i++) {
- d->channels[*i] = QVariantList();
- }
- emit channelsChanged();
- }
-}
-
-int Trace::length() const
-{
- Q_D(const Trace);
- return d->points.size();
-}
-
-/*! \qmlmethod var Trace::points(int pos, int count)
-
- Returns list of points. If no parameters are given, the
- function returns all the points.
-
- If the \a pos parameter is given, the function returns points starting
- at the position. The \a count parameter limits how many points are
- returned.
-
- The returned list contains \c point types.
-*/
-
-/*! Returns list of points. If no parameters are given, the
- method returns all the data.
-
- If the \a pos parameter is given, the method returns points starting
- at the position. The \a count parameter limits how many points are
- returned.
-
- The returned list contains QPointF types.
-*/
-
-QVariantList Trace::points(int pos, int count) const
-{
- Q_D(const Trace);
- return d->points.mid(pos, count);
-}
-
-/*! \qmlmethod int Trace::addPoint(point point)
-
- Adds a \a point to the Trace.
-
- The method returns index of the point added, or -1 if
- the points cannot be added (i.e. the isFinal is true).
-
- \note The returned index is required to associate additional
- data with the point using the setChannelData() function.
-*/
-
-/*! Adds a \a point to the Trace.
-
- The method returns index of the point added, or -1 if
- the points cannot be added (i.e. the isFinal is true).
-
- \note The returned index is required to associate additional
- data with the point using the setChannelData() method.
-*/
-
-int Trace::addPoint(const QPointF &point)
-{
- Q_D(Trace);
- int index;
- if (!d->final) {
- index = d->points.size();
- d->points.append(point);
- emit lengthChanged(d->points.size());
- } else {
- index = -1;
- }
- return index;
-}
-
-/*! \qmlmethod void Trace::setChannelData(int index, string channel, var data)
-
- Sets \a data for the point at \a index in the given data \a channel.
-
- If this method is not called for each data point, the channel data
- will be padded with empty values. However, the data cannot be added at
- arbitrary index, i.e., it must be added in synchronously with the point data.
-*/
-
-/*! Sets \a data for the point at \a index in the given data \a channel.
-
- If this method is not called for each data point, the channel data
- will be padded with empty values. However, the data cannot be added at
- arbitrary index, i.e., it must be added in synchronously with the point data.
-*/
-
-void Trace::setChannelData(const QString &channel, int index, const QVariant &data)
-{
- Q_D(Trace);
- if (!d->final && (index + 1) == d->points.size() && d->channels.contains(channel)) {
- QVariantList &channelData = d->channels[channel];
- while (index > channelData.size())
- channelData.append(QVariant());
- if (index == channelData.size())
- channelData.append(data);
- }
-}
-
-/*! \qmlmethod var Trace::channelData(string channel, int pos, int count)
-
- Returns data from the specified \a channel. If no other parameters
- are given, the function returns all the data.
-
- If the \a pos parameter is given, the function returns data starting
- at the position. The \a count parameter limits how many items are
- returned.
-*/
-
-/*! Returns data from the specified \a channel. If no other parameters
- are given, the method returns all the data.
-
- If the \a pos parameter is given, the method returns data starting
- at the position. The \a count parameter limits how many items are
- returned.
-*/
-
-QVariantList Trace::channelData(const QString &channel, int pos, int count) const
-{
- Q_D(const Trace);
- return d->channels.value(channel).mid(pos, count);
-}
-
-bool Trace::isFinal() const
-{
- Q_D(const Trace);
- return d->final;
-}
-
-void Trace::setFinal(bool final)
-{
- Q_D(Trace);
- if (d->final != final) {
- d->final = final;
- emit finalChanged(final);
- }
-}
-
-bool Trace::isCanceled() const
-{
- Q_D(const Trace);
- return d->canceled;
-}
-
-void Trace::setCanceled(bool canceled)
-{
- Q_D(Trace);
- if (d->canceled != canceled) {
- d->canceled = canceled;
- emit canceledChanged(canceled);
- }
-}
-
-/*! \qmlproperty int Trace::traceId
-
- Unique id of this Trace.
-*/
-
-/*! \property QtVirtualKeyboard::Trace::traceId
- \brief unique id of this Trace.
-*/
-
-/*! \qmlproperty list<strings> Trace::channels
-
- List of additional data channels in the Trace.
- This property must be initialized before the data
- is added.
-*/
-
-/*! \property QtVirtualKeyboard::Trace::channels
- \brief list of data channels in the Trace.
-
- This property must be initialized before the data
- is added.
-*/
-
-/*! \qmlproperty int Trace::length
-
- The number of points in the Trace.
-*/
-
-/*! \property QtVirtualKeyboard::Trace::length
- \brief the number of of points in the Trace.
-*/
-
-/*! \qmlproperty bool Trace::isFinal
-
- This property defines whether the Trace can accept more data.
- If the value is true, no more data is accepted.
-*/
-
-/*! \property QtVirtualKeyboard::Trace::isFinal
- \brief defines whether the Trace can accept more data.
- If the value is true, no more data is accepted.
-*/
-
-/*! \qmlproperty bool Trace::isCanceled
-
- This property defines whether the Trace is canceled.
- The input data should not be processed from the Traces
- whose isCanceled property set to true.
-*/
-
-/*! \property QtVirtualKeyboard::Trace::isCanceled
- \brief defines whether the Trace is canceled.
-
- The input data should not be processed from the Traces
- whose isCanceled property set to true.
-*/
-
-} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/trace.h b/src/virtualkeyboard/trace.h
deleted file mode 100644
index ca98e71d..00000000
--- a/src/virtualkeyboard/trace.h
+++ /dev/null
@@ -1,84 +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 TRACE_H
-#define TRACE_H
-
-#include <QObject>
-#include <QVariant>
-#include <QPointF>
-
-namespace QtVirtualKeyboard {
-
-class TracePrivate;
-
-class Trace : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(Trace)
- Q_PROPERTY(int traceId READ traceId WRITE setTraceId NOTIFY traceIdChanged)
- Q_PROPERTY(QStringList channels READ channels WRITE setChannels NOTIFY channelsChanged)
- Q_PROPERTY(int length READ length NOTIFY lengthChanged)
- Q_PROPERTY(bool isFinal READ isFinal WRITE setFinal NOTIFY finalChanged)
- Q_PROPERTY(bool isCanceled READ isCanceled WRITE setCanceled NOTIFY canceledChanged)
-public:
- explicit Trace(QObject *parent = 0);
- ~Trace();
-
- int traceId() const;
- void setTraceId(int id);
-
- QStringList channels() const;
- void setChannels(const QStringList &channels);
-
- int length() const;
-
- Q_INVOKABLE QVariantList points(int pos = 0, int count = -1) const;
- Q_INVOKABLE int addPoint(const QPointF &point);
-
- Q_INVOKABLE void setChannelData(const QString &channel, int index, const QVariant &data);
- Q_INVOKABLE QVariantList channelData(const QString &channel, int pos = 0, int count = -1) const;
-
- bool isFinal() const;
- void setFinal(bool final);
-
- bool isCanceled() const;
- void setCanceled(bool canceled);
-
-signals:
- void traceIdChanged(int traceId);
- void channelsChanged();
- void lengthChanged(int length);
- void finalChanged(bool isFinal);
- void canceledChanged(bool isCanceled);
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // TRACE_H
diff --git a/src/virtualkeyboard/unipentrace.cpp b/src/virtualkeyboard/unipentrace.cpp
index 74c1b23e..eca531c2 100644
--- a/src/virtualkeyboard/unipentrace.cpp
+++ b/src/virtualkeyboard/unipentrace.cpp
@@ -27,12 +27,13 @@
**
****************************************************************************/
-#include "unipentrace.h"
+#include <QtVirtualKeyboard/private/unipentrace_p.h>
#include <QRectF>
#include <QDir>
#include <QFile>
#include <QDebug>
+QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
UnipenTrace::UnipenTrace(const QVariantMap &traceCaptureDeviceInfo,
@@ -44,30 +45,30 @@ UnipenTrace::UnipenTrace(const QVariantMap &traceCaptureDeviceInfo,
m_lines.append(QLatin1String(".HIERARCHY CHARACTER"));
m_lines.append(QLatin1String(".COORD X Y T"));
m_lines.append(QLatin1String(".SEGMENT CHARACTER"));
- const QRectF boundingBox = traceScreenInfo["boundingBox"].toRectF();
+ const QRectF boundingBox = traceScreenInfo[QLatin1String("boundingBox")].toRectF();
if (!boundingBox.isEmpty()) {
m_lines.append(QStringLiteral(".X_DIM %1").arg(qRound(boundingBox.right())));
m_lines.append(QStringLiteral(".Y_DIM %1").arg(qRound(boundingBox.bottom())));
}
bool ok = false;
- int dpi = traceCaptureDeviceInfo["dpi"].toInt(&ok);
+ int dpi = traceCaptureDeviceInfo[QLatin1String("dpi")].toInt(&ok);
if (ok) {
m_lines.append(QStringLiteral(".X_POINTS_PER_INCH %1").arg(dpi));
m_lines.append(QStringLiteral(".Y_POINTS_PER_INCH %1").arg(dpi));
}
ok = false;
- int sampleRate = traceCaptureDeviceInfo["sampleRate"].toInt(&ok);
+ int sampleRate = traceCaptureDeviceInfo[QLatin1String("sampleRate")].toInt(&ok);
if (ok)
m_lines.append(QStringLiteral(".POINTS_PER_SECOND %1").arg(sampleRate));
}
-void UnipenTrace::record(const QList<Trace *> &traceList)
+void UnipenTrace::record(const QList<QVirtualKeyboardTrace *> &traceList)
{
qlonglong t0 = 0;
- for (const Trace *trace : qAsConst(traceList)) {
+ for (const QVirtualKeyboardTrace *trace : qAsConst(traceList)) {
const QVariantList &points = trace->points();
- const bool hasTime = trace->channels().contains("t");
- const QVariantList timeData = hasTime ? trace->channelData("t") : QVariantList();
+ const bool hasTime = trace->channels().contains(QLatin1String("t"));
+ const QVariantList timeData = hasTime ? trace->channelData(QLatin1String("t")) : QVariantList();
QVariantList::ConstIterator t = timeData.constBegin();
if (t0 == 0 && hasTime)
t0 = t->toLongLong();
@@ -106,8 +107,8 @@ void UnipenTrace::save(uint unicode, uint confidence)
} while (QFileInfo::exists(fileName));
}
- QString dataStr(m_lines.join('\n'));
- dataStr.append('\n');
+ QString dataStr(m_lines.join(QLatin1Char('\n')));
+ dataStr.append(QLatin1Char('\n'));
QFile file(fileName);
if (file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
file.write(dataStr.toUtf8().constData());
diff --git a/src/virtualkeyboard/unipentrace.h b/src/virtualkeyboard/unipentrace.h
deleted file mode 100644
index f7e182dd..00000000
--- a/src/virtualkeyboard/unipentrace.h
+++ /dev/null
@@ -1,57 +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 UNIPENTRACE_H
-#define UNIPENTRACE_H
-
-#include <QObject>
-#include "trace.h"
-
-namespace QtVirtualKeyboard {
-
-class UnipenTrace : public QObject
-{
- Q_OBJECT
-public:
- explicit UnipenTrace(const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo, QObject *parent = 0);
-
- void record(const QList<Trace *> &traceList);
- void save(uint unicode, uint confidence);
-
- QString directory() const;
- void setDirectory(const QString &directory);
-
-private:
- QStringList m_lines;
- QString m_directory;
-};
-
-} // namespace QtVirtualKeyboard
-
-#endif // UNIPENTRACE_H
diff --git a/src/virtualkeyboard/unipentrace_p.h b/src/virtualkeyboard/unipentrace_p.h
new file mode 100644
index 00000000..09441e59
--- /dev/null
+++ b/src/virtualkeyboard/unipentrace_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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 UNIPENTRACE_H
+#define UNIPENTRACE_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/qvirtualkeyboardtrace.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class QVIRTUALKEYBOARD_EXPORT UnipenTrace : public QObject
+{
+ Q_OBJECT
+public:
+ explicit UnipenTrace(const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo, QObject *parent = nullptr);
+
+ void record(const QList<QVirtualKeyboardTrace *> &traceList);
+ void save(uint unicode, uint confidence);
+
+ QString directory() const;
+ void setDirectory(const QString &directory);
+
+private:
+ QStringList m_lines;
+ QString m_directory;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // UNIPENTRACE_H
diff --git a/src/virtualkeyboard/virtualkeyboard.pro b/src/virtualkeyboard/virtualkeyboard.pro
index dabd7da2..cb28d6a1 100644
--- a/src/virtualkeyboard/virtualkeyboard.pro
+++ b/src/virtualkeyboard/virtualkeyboard.pro
@@ -1,5 +1,6 @@
-TARGET = qtvirtualkeyboardplugin
-DATAPATH = $$[QT_INSTALL_DATA]/qtvirtualkeyboard
+TARGET = QtVirtualKeyboard
+MODULE = virtualkeyboard
+MODULE_PLUGIN_TYPES = virtualkeyboard
QMAKE_DOCS = $$PWD/doc/qtvirtualkeyboard.qdocconf
include(doc/doc.pri)
@@ -7,278 +8,378 @@ include(doc/doc.pri)
QT += qml quick gui gui-private core-private
CONFIG += qtquickcompiler
-win32 {
- CONFIG += no-pkg-config
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-}
-
-!no-pkg-config: CONFIG += link_pkgconfig
+DEFINES += QVIRTUALKEYBOARD_LIBRARY
include(../config.pri)
-SOURCES += platforminputcontext.cpp \
- inputcontext.cpp \
- abstractinputmethod.cpp \
+SOURCES += \
+ platforminputcontext.cpp \
+ qvirtualkeyboardinputcontext.cpp \
+ qvirtualkeyboardinputcontext_p.cpp \
+ qvirtualkeyboardabstractinputmethod.cpp \
plaininputmethod.cpp \
- inputengine.cpp \
+ qvirtualkeyboardinputengine.cpp \
shifthandler.cpp \
- plugin.cpp \
inputmethod.cpp \
inputselectionhandle.cpp \
- selectionlistmodel.cpp \
- defaultinputmethod.cpp \
+ qvirtualkeyboardselectionlistmodel.cpp \
+ fallbackinputmethod.cpp \
abstractinputpanel.cpp \
+ appinputpanel.cpp \
enterkeyaction.cpp \
enterkeyactionattachedtype.cpp \
settings.cpp \
virtualkeyboardsettings.cpp \
- trace.cpp \
+ qvirtualkeyboardtrace.cpp \
desktopinputselectioncontrol.cpp \
shadowinputcontext.cpp \
gesturerecognizer.cpp \
- handwritinggesturerecognizer.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 \
+ qvirtualkeyboardextensionplugin.h \
+ qvirtualkeyboard_staticplugin_p.h
-HEADERS += platforminputcontext.h \
- inputcontext.h \
- abstractinputmethod.h \
- plaininputmethod.h \
- inputengine.h \
- shifthandler.h \
- inputmethod.h \
- inputselectionhandle.h \
- selectionlistmodel.h \
- defaultinputmethod.h \
- abstractinputpanel.h \
- virtualkeyboarddebug.h \
- enterkeyaction.h \
- enterkeyactionattachedtype.h \
- settings.h \
- virtualkeyboardsettings.h \
- plugin.h \
- trace.h \
- desktopinputselectioncontrol.h \
- shadowinputcontext.h \
- gesturerecognizer.h \
- handwritinggesturerecognizer.h
+!no-builtin-style: RESOURCES += \
+ content/styles/default/virtualkeyboard_default_style.qrc \
+ content/styles/retro/virtualkeyboard_retro_style.qrc
RESOURCES += \
- content/styles/default/default_style.qrc \
- content/styles/retro/retro_style.qrc \
- content/content.qrc
+ content/virtualkeyboard_content.qrc
# Fallback for languages which don't have these special layouts
LAYOUT_FILES += \
- content/layouts/en_GB/dialpad.qml \
- content/layouts/en_GB/digits.qml \
- content/layouts/en_GB/numbers.qml
-contains(CONFIG, lang-en.*) {
+ 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
+contains(CONFIG, lang-en(_GB)?) {
LAYOUT_FILES += \
- content/layouts/en_GB/main.qml \
- content/layouts/en_GB/symbols.qml
-t9write-alphabetic|lipi-toolkit: LAYOUT_FILES += \
- content/layouts/en_GB/handwriting.qml
+ 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
+}
+contains(CONFIG, 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
}
contains(CONFIG, lang-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
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/ar_AR/handwriting.qml
}
contains(CONFIG, lang-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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/bg_BG/handwriting.qml
+ content/layouts/bg_BG/numbers.fallback \
+ content/layouts/bg_BG/symbols.fallback
}
contains(CONFIG, lang-cs.*) {
LAYOUT_FILES += \
+ content/layouts/cs_CZ/dialpad.fallback \
+ content/layouts/cs_CZ/digits.fallback \
content/layouts/cs_CZ/main.qml \
- content/layouts/cs_CZ/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/cs_CZ/handwriting.qml
+ content/layouts/cs_CZ/numbers.fallback \
+ content/layouts/cs_CZ/symbols.fallback
}
contains(CONFIG, lang-da.*) {
LAYOUT_FILES += \
+ content/layouts/da_DK/dialpad.fallback \
+ content/layouts/da_DK/digits.fallback \
content/layouts/da_DK/main.qml \
- content/layouts/da_DK/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/da_DK/handwriting.qml
+ content/layouts/da_DK/numbers.fallback \
+ content/layouts/da_DK/symbols.fallback
}
contains(CONFIG, lang-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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/de_DE/handwriting.qml
+ content/layouts/de_DE/numbers.fallback \
+ content/layouts/de_DE/symbols.fallback
}
contains(CONFIG, lang-el.*) {
LAYOUT_FILES += \
+ content/layouts/el_GR/dialpad.fallback \
+ content/layouts/el_GR/digits.fallback \
content/layouts/el_GR/main.qml \
- content/layouts/el_GR/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/el_GR/handwriting.qml
+ content/layouts/el_GR/numbers.fallback \
+ content/layouts/el_GR/symbols.fallback
}
-contains(CONFIG, lang-es.*) {
+contains(CONFIG, 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
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/es_ES/handwriting.qml
+}
+contains(CONFIG, 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
}
contains(CONFIG, lang-et.*) {
LAYOUT_FILES += \
+ content/layouts/et_EE/dialpad.fallback \
+ content/layouts/et_EE/digits.fallback \
content/layouts/et_EE/main.qml \
- content/layouts/et_EE/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/et_EE/handwriting.qml
+ content/layouts/et_EE/numbers.fallback \
+ content/layouts/et_EE/symbols.fallback
}
contains(CONFIG, lang-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
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/fa_FA/handwriting.qml
}
contains(CONFIG, lang-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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/fi_FI/handwriting.qml
+ content/layouts/fi_FI/numbers.fallback \
+ content/layouts/fi_FI/symbols.fallback
+}
+contains(CONFIG, 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
}
-contains(CONFIG, lang-fr.*) {
+contains(CONFIG, 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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/fr_FR/handwriting.qml
+ content/layouts/fr_FR/numbers.fallback \
+ content/layouts/fr_FR/symbols.fallback
}
contains(CONFIG, lang-he.*) {
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
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/he_IL/handwriting.qml
}
contains(CONFIG, lang-hi.*) {
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
}
contains(CONFIG, lang-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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/hr_HR/handwriting.qml
+ content/layouts/hr_HR/numbers.fallback \
+ content/layouts/hr_HR/symbols.fallback
}
contains(CONFIG, lang-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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/hu_HU/handwriting.qml
-}
-contains(CONFIG, lang-it.*) {
- LAYOUT_FILES += \
- content/layouts/it_IT/main.qml \
- content/layouts/it_IT/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/it_IT/handwriting.qml
+ content/layouts/hu_HU/numbers.fallback \
+ content/layouts/hu_HU/symbols.fallback
}
-contains(CONFIG, lang-ja.*) {
+contains(CONFIG, lang-id.*) {
LAYOUT_FILES += \
- content/layouts/ja_JP/main.qml \
- content/layouts/ja_JP/symbols.qml
-t9write-cjk: LAYOUT_FILES += \
- content/layouts/ja_JP/handwriting.qml
+ 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
}
-contains(CONFIG, lang-ko.*) {
+contains(CONFIG, lang-it.*) {
LAYOUT_FILES += \
- content/layouts/ko_KR/main.qml \
- content/layouts/ko_KR/symbols.qml
-t9write-cjk: LAYOUT_FILES += \
- content/layouts/ko_KR/handwriting.qml
+ 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
}
contains(CONFIG, lang-nb.*) {
LAYOUT_FILES += \
+ content/layouts/nb_NO/dialpad.fallback \
+ content/layouts/nb_NO/digits.fallback \
content/layouts/nb_NO/main.qml \
- content/layouts/nb_NO/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/nb_NO/handwriting.qml
+ content/layouts/nb_NO/numbers.fallback \
+ content/layouts/nb_NO/symbols.fallback
+}
+contains(CONFIG, lang-ms.*) {
+ 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
}
contains(CONFIG, lang-nl.*) {
LAYOUT_FILES += \
- content/layouts/nl_NL/main.qml \
- content/layouts/nl_NL/symbols.qml
-t9write-alphabetic|lipi-toolkit: LAYOUT_FILES += \
- content/layouts/nl_NL/handwriting.qml
+ 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
}
contains(CONFIG, lang-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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/pl_PL/handwriting.qml
+ content/layouts/pl_PL/numbers.fallback \
+ content/layouts/pl_PL/symbols.fallback
+}
+contains(CONFIG, 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
}
-contains(CONFIG, lang-pt.*) {
+contains(CONFIG, 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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/pt_PT/handwriting.qml
+ content/layouts/pt_PT/numbers.fallback \
+ content/layouts/pt_PT/symbols.fallback
}
contains(CONFIG, lang-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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/ro_RO/handwriting.qml
+ content/layouts/ro_RO/numbers.fallback \
+ content/layouts/ro_RO/symbols.fallback
}
contains(CONFIG, lang-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/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/ru_RU/handwriting.qml
+ content/layouts/ru_RU/numbers.fallback \
+ content/layouts/ru_RU/symbols.fallback
+}
+contains(CONFIG, lang-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
+}
+contains(CONFIG, lang-sl.*) {
+ 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
+}
+contains(CONFIG, lang-sq.*) {
+ 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
}
contains(CONFIG, lang-sr.*) {
LAYOUT_FILES += \
+ content/layouts/sr_SP/dialpad.fallback \
+ content/layouts/sr_SP/digits.fallback \
content/layouts/sr_SP/main.qml \
- content/layouts/sr_SP/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/sr_SP/handwriting.qml
+ content/layouts/sr_SP/numbers.fallback \
+ content/layouts/sr_SP/symbols.fallback
}
contains(CONFIG, lang-sv.*) {
LAYOUT_FILES += \
+ content/layouts/sv_SE/dialpad.fallback \
+ content/layouts/sv_SE/digits.fallback \
content/layouts/sv_SE/main.qml \
- content/layouts/sv_SE/symbols.qml
-t9write-alphabetic: LAYOUT_FILES += \
- content/layouts/sv_SE/handwriting.qml
+ content/layouts/sv_SE/numbers.fallback \
+ content/layouts/sv_SE/symbols.fallback
+}
+contains(CONFIG, lang-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
}
-contains(CONFIG, lang-zh(_CN)?) {
+contains(CONFIG, lang-uk.*) {
LAYOUT_FILES += \
- content/layouts/zh_CN/main.qml \
- content/layouts/zh_CN/symbols.qml
-t9write-cjk: LAYOUT_FILES += \
- content/layouts/zh_CN/handwriting.qml
+ 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
}
-contains(CONFIG, lang-zh(_TW)?) {
+contains(CONFIG, lang-vi.*) {
LAYOUT_FILES += \
- content/layouts/zh_TW/main.qml \
- content/layouts/zh_TW/symbols.qml
-t9write-cjk: LAYOUT_FILES += \
- content/layouts/zh_TW/handwriting.qml
+ 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
}
-retro-style {
+no-builtin-style {
+ DEFINES += QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"\\\"
+} else:retro-style {
DEFINES += QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"retro\\\"
} else {
DEFINES += QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"default\\\"
@@ -286,188 +387,43 @@ retro-style {
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
+ qtvirtualkeyboard.json \
+ $$LAYOUT_FILES
!disable-desktop:isEmpty(CROSS_COMPILE):!android-embedded:!qnx {
SOURCES += desktopinputpanel.cpp inputview.cpp
- HEADERS += desktopinputpanel.h inputview.h
+ HEADERS += desktopinputpanel_p.h inputview_p.h
DEFINES += QT_VIRTUALKEYBOARD_DESKTOP
!no-pkg-config:packagesExist(xcb) {
PKGCONFIG += xcb xcb-xfixes
DEFINES += QT_VIRTUALKEYBOARD_HAVE_XCB
}
}
-SOURCES += appinputpanel.cpp
-HEADERS += appinputpanel.h
-
-!disable-hunspell {
- exists(3rdparty/hunspell/src/hunspell/hunspell.h) {
- SOURCES += hunspellinputmethod.cpp hunspellinputmethod_p.cpp hunspellworker.cpp
- HEADERS += hunspellinputmethod.h hunspellinputmethod_p.h hunspellworker.h
- DEFINES += HAVE_HUNSPELL
- QMAKE_USE += hunspell
- exists(3rdparty/hunspell/data) {
- hunspell_data.files = 3rdparty/hunspell/data/*.dic 3rdparty/hunspell/data/*.aff
- hunspell_data.path = $$DATAPATH/hunspell
- INSTALLS += hunspell_data
- !prefix_build: COPIES += hunspell_data
- } else {
- error("Hunspell dictionaries are missing! Please copy .dic and .aff" \
- "files to src/virtualkeyboard/3rdparty/hunspell/data directory.")
- }
- } else:!no-pkg-config:packagesExist(hunspell) {
- SOURCES += hunspellinputmethod.cpp hunspellinputmethod_p.cpp hunspellworker.cpp
- HEADERS += hunspellinputmethod.h hunspellinputmethod_p.h hunspellworker.h
- DEFINES += HAVE_HUNSPELL
- PKGCONFIG += hunspell
- } else {
- message("Hunspell not found! Spell correction will not be available.")
- }
-}
-
-pinyin {
- SOURCES += \
- pinyininputmethod.cpp \
- pinyindecoderservice.cpp
- HEADERS += \
- pinyininputmethod.h \
- pinyindecoderservice.h
- DEFINES += HAVE_PINYIN
- QMAKE_USE += pinyin
- pinyin_data.files = $$PWD/3rdparty/pinyin/data/dict_pinyin.dat
- pinyin_data.path = $$DATAPATH/pinyin
- INSTALLS += pinyin_data
- !prefix_build: COPIES += pinyin_data
-}
-
-tcime {
- SOURCES += \
- tcinputmethod.cpp
- HEADERS += \
- tcinputmethod.h
- DEFINES += HAVE_TCIME
- cangjie: DEFINES += HAVE_TCIME_CANGJIE
- zhuyin: DEFINES += HAVE_TCIME_ZHUYIN
- QMAKE_USE += tcime
- tcime_data.files = \
- $$PWD/3rdparty/tcime/data/qt/dict_phrases.dat
- cangjie: tcime_data.files += \
- $$PWD/3rdparty/tcime/data/qt/dict_cangjie.dat
- zhuyin: tcime_data.files += \
- $$PWD/3rdparty/tcime/data/qt/dict_zhuyin.dat
- tcime_data.path = $$DATAPATH/tcime
- INSTALLS += tcime_data
- !prefix_build: COPIES += tcime_data
-}
-
-hangul {
- SOURCES += \
- hangulinputmethod.cpp \
- hangul.cpp
- HEADERS += \
- hangulinputmethod.h \
- hangul.h
- DEFINES += HAVE_HANGUL
-}
-
-openwnn {
- SOURCES += openwnninputmethod.cpp
- HEADERS += openwnninputmethod.h
- DEFINES += HAVE_OPENWNN
- QMAKE_USE += openwnn
-}
-
-lipi-toolkit:t9write: \
- error("Conflicting configuration flags: lipi-toolkit and t9write." \
- "Please use either one, but not both at the same time.")
-
-lipi-toolkit {
- CONFIG += exceptions
- SOURCES += \
- lipiinputmethod.cpp \
- lipisharedrecognizer.cpp \
- lipiworker.cpp
- HEADERS += \
- lipiinputmethod.h \
- lipisharedrecognizer.h \
- lipiworker.h
- DEFINES += HAVE_LIPI_TOOLKIT
- 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 = $$[QT_INSTALL_DATA]/qtvirtualkeyboard/lipi_toolkit
- INSTALLS += ltk_projects
- !prefix_build: COPIES += ltk_projects
-}
-
-t9write {
- include(3rdparty/t9write/t9write-build.pri)
- equals(T9WRITE_FOUND, 0): \
- error("T9Write SDK could not be found. For more information, see" \
- "the documentation in Building Qt Virtual Keyboard")
- SOURCES += \
- t9writeinputmethod.cpp \
- t9writeworker.cpp \
- t9writedictionary.cpp
- HEADERS += \
- t9writeinputmethod.h \
- t9writeworker.h \
- t9writedictionary.h \
- t9write.h
- DEFINES += HAVE_T9WRITE
- QMAKE_USE += t9write_db
- INCLUDEPATH += $$T9WRITE_INCLUDE_DIRS
- 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
- }
- }
- 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
- }
- }
- DEFINES += QT_VIRTUALKEYBOARD_DEBUG
-}
record-trace-input {
SOURCES += unipentrace.cpp
- HEADERS += unipentrace.h
- DEFINES += QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ HEADERS += unipentrace_p.h
+ MODULE_DEFINES += QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
}
arrow-key-navigation: DEFINES += QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
-include(generateresource.pri)
-
!disable-layouts {
- RESOURCES += $$generate_resource(layouts.qrc, $$LAYOUT_FILES, /QtQuick/VirtualKeyboard)
+ virtualkeyboard_layouts.files = $$LAYOUT_FILES
+ virtualkeyboard_layouts.prefix = $$LAYOUTS_PREFIX
+ RESOURCES += virtualkeyboard_layouts
DEFINES += HAVE_LAYOUTS
}
-PLUGIN_TYPE = platforminputcontexts
-PLUGIN_EXTENDS = -
-PLUGIN_CLASS_NAME = QVirtualKeyboardPlugin
-load(qt_plugin)
+load(qt_module)
diff --git a/src/virtualkeyboard/virtualkeyboarddebug.h b/src/virtualkeyboard/virtualkeyboarddebug.h
deleted file mode 100644
index 17e53bdf..00000000
--- a/src/virtualkeyboard/virtualkeyboarddebug.h
+++ /dev/null
@@ -1,40 +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 VIRTUALKEYBOARDDEBUG_H
-#define VIRTUALKEYBOARDDEBUG_H
-
-#include <QDebug>
-#include <QLoggingCategory>
-
-Q_DECLARE_LOGGING_CATEGORY(qlcVirtualKeyboard)
-
-#define VIRTUALKEYBOARD_DEBUG() qCDebug(qlcVirtualKeyboard)
-
-#endif // VIRTUALKEYBOARDDEBUG_H
diff --git a/src/virtualkeyboard/virtualkeyboarddebug_p.h b/src/virtualkeyboard/virtualkeyboarddebug_p.h
new file mode 100644
index 00000000..fe679b4c
--- /dev/null
+++ b/src/virtualkeyboard/virtualkeyboarddebug_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** 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 VIRTUALKEYBOARDDEBUG_H
+#define VIRTUALKEYBOARDDEBUG_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 <QDebug>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_DECLARE_LOGGING_CATEGORY(qlcVirtualKeyboard)
+
+#define VIRTUALKEYBOARD_DEBUG() qCDebug(qlcVirtualKeyboard)
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // VIRTUALKEYBOARDDEBUG_H
diff --git a/src/virtualkeyboard/virtualkeyboardsettings.cpp b/src/virtualkeyboard/virtualkeyboardsettings.cpp
index 74487ef4..5f9e82f0 100644
--- a/src/virtualkeyboard/virtualkeyboardsettings.cpp
+++ b/src/virtualkeyboard/virtualkeyboardsettings.cpp
@@ -27,15 +27,16 @@
**
****************************************************************************/
-#include "virtualkeyboardsettings.h"
-#include "settings.h"
-#include "virtualkeyboarddebug.h"
+#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
@@ -48,8 +49,8 @@ public:
QString buildStyleImportPath(const QString &path, const QString &name) const
{
- QString importPath(path + name + "/style.qml");
- if (!importPath.startsWith("qrc:")) {
+ QString importPath(path + name + QLatin1String("/style.qml"));
+ if (!importPath.startsWith(QLatin1String("qrc:"))) {
QUrl url = QUrl::fromLocalFile(importPath);
importPath = url.toString();
}
@@ -59,20 +60,23 @@ public:
QString buildStyleFilePath(const QString &path, const QString &name) const
{
QString filePath(path);
- if (filePath.startsWith("qrc:"))
+ if (filePath.startsWith(QLatin1String("qrc:")))
filePath.remove(0, 3);
- return filePath + name + "/style.qml";
+ return filePath + name + QLatin1String("/style.qml");
}
QString styleImportPath(const QString &name) const
{
+ if (name.isEmpty())
+ return QString();
+
QStringList styleImportPathList;
- styleImportPathList << "qrc:/QtQuick/VirtualKeyboard/content/styles/";
+ 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)
- + QStringLiteral("/QtQuick/VirtualKeyboard/Styles/");
+ + QLatin1String("/QtQuick/VirtualKeyboard/Styles/");
styleImportPathList += stylesPath;
}
@@ -222,7 +226,7 @@ void VirtualKeyboardSettings::setLayoutPath(const QUrl &layoutPath)
void VirtualKeyboardSettings::resetLayoutPath()
{
Settings *settings = Settings::instance();
- QUrl layoutPath(QT_VIRTUALKEYBOARD_DEFAULT_LAYOUTS_DIR);
+ QUrl layoutPath(QLatin1String(QT_VIRTUALKEYBOARD_DEFAULT_LAYOUTS_DIR));
const QString customLayoutPath(QDir::fromNativeSeparators(qEnvironmentVariable("QT_VIRTUALKEYBOARD_LAYOUT_PATH")));
if (!customLayoutPath.isEmpty()) {
bool found = false;
@@ -289,12 +293,12 @@ void VirtualKeyboardSettings::resetStyle()
{
Q_D(VirtualKeyboardSettings);
Settings *settings = Settings::instance();
- QString styleName = QT_VIRTUALKEYBOARD_DEFAULT_STYLE;
+ QString styleName = QLatin1String(QT_VIRTUALKEYBOARD_DEFAULT_STYLE);
QString style = d->styleImportPath(styleName);
- QString customStyleName = qgetenv("QT_VIRTUALKEYBOARD_STYLE");
+ QString customStyleName = QString::fromLatin1(qgetenv("QT_VIRTUALKEYBOARD_STYLE"));
if (!customStyleName.isEmpty()) {
bool found = false;
- QRegularExpression styleNameValidator("\\A(?:\\w+)\\z");
+ QRegularExpression styleNameValidator(QLatin1String("\\A(?:\\w+)\\z"));
QRegularExpressionMatch match = styleNameValidator.match(customStyleName);
if (match.hasMatch()) {
QString customStyle = d->styleImportPath(customStyleName);
@@ -464,3 +468,4 @@ void WordCandidateListSettings::setAutoCommitWord(bool autoCommitWord)
}
} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/virtualkeyboardsettings.h b/src/virtualkeyboard/virtualkeyboardsettings.h
deleted file mode 100644
index ca61db2a..00000000
--- a/src/virtualkeyboard/virtualkeyboardsettings.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef VIRTUALKEYBOARDSETTINGS_H
-#define VIRTUALKEYBOARDSETTINGS_H
-
-#include <qqml.h>
-
-namespace QtVirtualKeyboard {
-
-class WordCandidateListSettings;
-class VirtualKeyboardSettingsPrivate;
-
-class 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 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 = 0);
- 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();
-};
-
-}
-
-#endif // VIRTUALKEYBOARDSETTINGS_H
diff --git a/src/virtualkeyboard/virtualkeyboardsettings_p.h b/src/virtualkeyboard/virtualkeyboardsettings_p.h
new file mode 100644
index 00000000..7acb8268
--- /dev/null
+++ b/src/virtualkeyboard/virtualkeyboardsettings_p.h
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** 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
index dfc1d5d6..476934c8 100644
--- a/sync.profile
+++ b/sync.profile
@@ -1,4 +1,6 @@
%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/auto/auto.pro b/tests/auto/auto.pro
index 6b71c159..15685d5f 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -5,4 +5,4 @@ SUBDIRS += \
styles \
layoutfilesystem \
layoutresources \
-
+ cmake \
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
new file mode 100644
index 00000000..3d77b9e5
--- /dev/null
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -0,0 +1,12 @@
+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
new file mode 100644
index 00000000..f8635657
--- /dev/null
+++ b/tests/auto/cmake/cmake.pro
@@ -0,0 +1,6 @@
+# Cause make to do nothing.
+TEMPLATE = subdirs
+
+CMAKE_QT_MODULES_UNDER_TEST = virtualkeyboard
+
+CONFIG += ctest_testcase
diff --git a/tests/auto/inputpanel/BLACKLIST b/tests/auto/inputpanel/BLACKLIST
deleted file mode 100644
index 462882f7..00000000
--- a/tests/auto/inputpanel/BLACKLIST
+++ /dev/null
@@ -1,14 +0,0 @@
-# QTBUG-61279
-# Test fails if hunspell support is enabled in qtvirtualkeyboard
-# and hunspell-en-gb is installed to the system
-[tst_plugin::test_wclAutoCommitWordSetting:row 0]
-b2qt
-
-# QTBUG-65507
-[tst_plugin::test_inputMethodHints:row 8]
-b2qt
-
-# QTBUG-65507
-[tst_plugin::test_shiftCapsLock:row 1]
-b2qt
-
diff --git a/tests/auto/inputpanel/data/inputpanel/handwriting.js b/tests/auto/inputpanel/data/inputpanel/handwriting.js
index a4c4ec1a..0721f141 100644
--- a/tests/auto/inputpanel/data/inputpanel/handwriting.js
+++ b/tests/auto/inputpanel/data/inputpanel/handwriting.js
@@ -38,14 +38,17 @@
.import "unipen_data_cyrillic.js" as UnipenDataCyrillic
.import "unipen_data_arabic.js" as UnipenDataArabic
.import "unipen_data_hebrew.js" as UnipenDataHebrew
+.import "unipen_data_vietnamese.js" as UnipenDataVietnamese
-function emulate(testcase, hwrInputArea, ch, instant) {
+function emulate(testcase, hwrInputArea, ch, instant, locale) {
var chKey = (((typeof ch == "number") ? ch : ch.charCodeAt(0)) + 0x100000000).toString(16).substr(1)
while (chKey.length > 4 && chKey[0] === '0')
chKey = chKey.substring(1)
chKey = "0x" + chKey
var unipenData
- if (UnipenData.unipenData.hasOwnProperty(chKey))
+ if (locale === "vi_VN" && UnipenDataVietnamese.unipenData.hasOwnProperty(chKey))
+ unipenData = UnipenDataVietnamese
+ else if (UnipenData.unipenData.hasOwnProperty(chKey))
unipenData = UnipenData
else if (UnipenDataSimpChinese.unipenData.hasOwnProperty(chKey))
unipenData = UnipenDataSimpChinese
diff --git a/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml b/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
index 692116d0..aa7ae714 100644
--- a/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
@@ -38,6 +38,7 @@ HandwritingInputPanel {
z: 99
property var testcase
+ readonly property var inputMethod: InputContext.inputEngine.inputMethod
readonly property var wordCandidatePopupList: Utils.findChildByProperty(handwritingInputPanel, "objectName", "wordCandidatePopupList", null)
anchors.fill: parent
@@ -129,7 +130,15 @@ HandwritingInputPanel {
console.warn("Cannot produce the symbol '%1' in full screen handwriting mode".arg(ch))
return false
}
+ if (isSuperimposedHandwriting())
+ return true;
inputMethodResultSpy.wait(3000)
return inputMethodResultSpy.count > 0
}
+
+ function isSuperimposedHandwriting() {
+ if (!available)
+ return false
+ return inputMethod != null && inputMethod.hasOwnProperty("superimposed") && inputMethod.superimposed;
+ }
}
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
index 18ca94b4..79526c91 100644
--- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
@@ -47,8 +47,8 @@ InputPanel {
readonly property int cursorPosition: InputContext.cursorPosition
readonly property string preeditText: InputContext.preeditText
readonly property string surroundingText: InputContext.surroundingText
- readonly property bool autoCapitalizationEnabled: InputContext.shiftHandler.autoCapitalizationEnabled
- readonly property bool toggleShiftEnabled: InputContext.shiftHandler.toggleShiftEnabled
+ readonly property bool autoCapitalizationEnabled: InputContext.priv.shiftHandler.autoCapitalizationEnabled
+ readonly property bool toggleShiftEnabled: InputContext.priv.shiftHandler.toggleShiftEnabled
readonly property string locale: keyboard.locale
readonly property string defaultLocale: VirtualKeyboardSettings.locale
readonly property var availableLocales: VirtualKeyboardSettings.availableLocales
@@ -67,6 +67,7 @@ InputPanel {
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)
@@ -96,6 +97,8 @@ InputPanel {
signal inputMethodResult(var text)
+ LayoutMirroring.childrenInherit: true
+
Connections {
target: InputContext
onPreeditTextChanged: if (InputContext.preeditText.length > 0) inputMethodResult(InputContext.preeditText)
@@ -185,9 +188,15 @@ InputPanel {
}
SignalSpy {
+ id: wordCandidateContextMenuActiveSpy
+ target: wordCandidateContextMenu
+ signalName: "onActiveChanged"
+ }
+
+ SignalSpy {
id: shiftStateSpy
target: InputContext
- signalName: "onShiftChanged"
+ signalName: "onShiftActiveChanged"
}
SignalSpy {
@@ -258,39 +267,39 @@ InputPanel {
function mapInputMode(inputModeName) {
if (inputModeName === "Latin")
- return InputEngine.Latin
+ return InputEngine.InputMode.Latin
else if (inputModeName === "Numeric")
- return InputEngine.Numeric
+ return InputEngine.InputMode.Numeric
else if (inputModeName === "Dialable")
- return InputEngine.Dialable
+ return InputEngine.InputMode.Dialable
else if (inputModeName === "Pinyin")
- return InputEngine.Pinyin
+ return InputEngine.InputMode.Pinyin
else if (inputModeName === "Cangjie")
- return InputEngine.Cangjie
+ return InputEngine.InputMode.Cangjie
else if (inputModeName === "Zhuyin")
- return InputEngine.Zhuyin
+ return InputEngine.InputMode.Zhuyin
else if (inputModeName === "Hangul")
- return InputEngine.Hangul
+ return InputEngine.InputMode.Hangul
else if (inputModeName === "Hiragana")
- return InputEngine.Hiragana
+ return InputEngine.InputMode.Hiragana
else if (inputModeName === "Katakana")
- return InputEngine.Katakana
+ return InputEngine.InputMode.Katakana
else if (inputModeName === "FullwidthLatin")
- return InputEngine.FullwidthLatin
+ return InputEngine.InputMode.FullwidthLatin
else if (inputModeName === "Greek")
- return InputEngine.Greek
+ return InputEngine.InputMode.Greek
else if (inputModeName === "Cyrillic")
- return InputEngine.Cyrillic
+ return InputEngine.InputMode.Cyrillic
else if (inputModeName === "Arabic")
- return InputEngine.Arabic
+ return InputEngine.InputMode.Arabic
else if (inputModeName === "Hebrew")
- return InputEngine.Hebrew
+ return InputEngine.InputMode.Hebrew
else if (inputModeName === "ChineseHandwriting")
- return InputEngine.ChineseHandwriting
+ return InputEngine.InputMode.ChineseHandwriting
else if (inputModeName === "JapaneseHandwriting")
- return InputEngine.JapaneseHandwriting
+ return InputEngine.InputMode.JapaneseHandwriting
else if (inputModeName === "KoreanHandwriting")
- return InputEngine.KoreanHandwriting
+ return InputEngine.InputMode.KoreanHandwriting
else
return -1
}
@@ -307,10 +316,83 @@ InputPanel {
return true
}
+ function testPublicEnums() {
+ // Scoped
+ testcase.verify(InputEngine.TextCase.Lower !== undefined)
+ testcase.verify(InputEngine.TextCase.Upper !== undefined)
+ testcase.verify(InputEngine.InputMode.Latin !== undefined)
+ testcase.verify(InputEngine.InputMode.Numeric !== undefined)
+ testcase.verify(InputEngine.InputMode.Dialable !== undefined)
+ testcase.verify(InputEngine.InputMode.Pinyin !== undefined)
+ testcase.verify(InputEngine.InputMode.Cangjie !== undefined)
+ testcase.verify(InputEngine.InputMode.Zhuyin !== undefined)
+ testcase.verify(InputEngine.InputMode.Hangul !== undefined)
+ testcase.verify(InputEngine.InputMode.Hiragana !== undefined)
+ testcase.verify(InputEngine.InputMode.Katakana !== undefined)
+ testcase.verify(InputEngine.InputMode.FullwidthLatin !== undefined)
+ testcase.verify(InputEngine.InputMode.Greek !== undefined)
+ testcase.verify(InputEngine.InputMode.Cyrillic !== undefined)
+ testcase.verify(InputEngine.InputMode.Arabic !== undefined)
+ testcase.verify(InputEngine.InputMode.Hebrew !== undefined)
+ testcase.verify(InputEngine.InputMode.ChineseHandwriting !== undefined)
+ testcase.verify(InputEngine.InputMode.JapaneseHandwriting !== undefined)
+ testcase.verify(InputEngine.InputMode.KoreanHandwriting !== undefined)
+ testcase.verify(InputEngine.PatternRecognitionMode.None !== undefined)
+ testcase.verify(InputEngine.PatternRecognitionMode.PatternRecognitionDisabled !== undefined)
+ testcase.verify(InputEngine.PatternRecognitionMode.Handwriting !== undefined)
+ testcase.verify(InputEngine.PatternRecognitionMode.HandwritingRecoginition !== undefined)
+ testcase.verify(InputEngine.ReselectFlag.WordBeforeCursor !== undefined)
+ testcase.verify(InputEngine.ReselectFlag.WordAfterCursor !== undefined)
+ testcase.verify(InputEngine.ReselectFlag.WordAtCursor !== undefined)
+ testcase.verify(SelectionListModel.Type.WordCandidateList !== undefined)
+ testcase.verify(SelectionListModel.Role.Display !== undefined)
+ testcase.verify(SelectionListModel.Role.WordCompletionLength !== undefined)
+ 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.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) {
externalLanguageSwitchEnabled = enabled
}
+ function setLayoutMirroring(enabled) {
+ LayoutMirroring.enabled = enabled
+ }
+
function findVirtualKey(key) {
return Utils.findChild(keyboardLayoutLoader, key, function(obj, param) {
if (!obj.hasOwnProperty("key") || !obj.hasOwnProperty("text"))
@@ -351,7 +433,7 @@ InputPanel {
testcase.wait(20)
if (alternativeKey) {
alternativeKeysSpy.wait()
- var keyIndex = keyObj.effectiveAlternativeKeys.indexOf(key)
+ 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)
@@ -383,12 +465,15 @@ InputPanel {
}
} else if (typeof key != "number" || key !== Qt.Key_Shift) {
// Some layouts (such as Arabic, Hindi) may have a second layout
- virtualKeyPress(Qt.Key_Shift)
- InputContext.shiftHandler.clearToggleShiftTimer()
+ virtualKeyClick(Qt.Key_Shift)
+ InputContext.priv.shiftHandler.clearToggleShiftTimer()
testcase.waitForRendering(inputPanel)
success = keyActionOnCurrentLayoutCb(key)
- virtualKeyPress(Qt.Key_Shift)
- InputContext.shiftHandler.clearToggleShiftTimer()
+ if (!success) {
+ virtualKeyClick(Qt.Key_Shift)
+ InputContext.priv.shiftHandler.clearToggleShiftTimer()
+ testcase.waitForRendering(inputPanel)
+ }
}
if (success)
break
@@ -521,6 +606,8 @@ 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)
@@ -531,7 +618,15 @@ InputPanel {
}
function toggleShift() {
- InputContext.shiftHandler.toggleShift()
+ InputContext.priv.shiftHandler.toggleShift()
+ }
+
+ function setShiftActive(shiftActive) {
+ InputContext.priv.shiftHandler.shiftActive = shiftActive
+ }
+
+ function setCapsLockActive(capsLockActive) {
+ InputContext.priv.shiftHandler.capsLockActive = capsLockActive
}
function style() {
@@ -598,6 +693,48 @@ InputPanel {
return true
}
+ function selectionListCurrentIndex() {
+ return inputPanel.wordCandidateView.currentIndex
+ }
+
+ function selectionListSuggestionIsFromUserDictionary() {
+ if (!inputPanel.wordCandidateView.currentItem)
+ return false
+ var dictionaryType = inputPanel.wordCandidateView.model.dataAt(inputPanel.wordCandidateView.currentIndex, SelectionListModel.Role.Dictionary)
+ return dictionaryType !== undefined && dictionaryType === SelectionListModel.DictionaryType.User
+ }
+
+ function openWordCandidateContextMenu() {
+ if (!inputPanel.wordCandidateView.currentItem)
+ return false
+ testcase.wait(200)
+ wordCandidateContextMenuActiveSpy.clear()
+ testcase.mousePress(inputPanel.wordCandidateView.currentItem)
+ wordCandidateContextMenuActiveSpy.wait()
+ testcase.mouseRelease(inputPanel.wordCandidateView.currentItem)
+ return wordCandidateContextMenu.active
+ }
+
+ function selectItemFromWordCandidateContextMenu(index) {
+ if (!inputPanel.wordCandidateView.currentItem)
+ return false
+ if (!wordCandidateContextMenu.active)
+ return false
+ var wordCandidateContextMenuList = Utils.findChildByProperty(keyboard, "objectName", "wordCandidateContextMenuList", null)
+ if (wordCandidateContextMenuList.currentIndex !== index) {
+ wordCandidateContextMenuList.currentIndex = index
+ testcase.waitForRendering(inputPanel)
+ }
+ if (!wordCandidateContextMenuList.currentItem)
+ return false
+ var itemPos = inputPanel.mapFromItem(wordCandidateContextMenuList.currentItem,
+ 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 setHandwritingMode(enabled) {
if (inputPanel.keyboard.handwritingMode !== enabled) {
if (!enabled || inputPanel.keyboard.isHandwritingAvailable())
@@ -611,13 +748,22 @@ InputPanel {
return false
var hwrInputArea = Utils.findChildByProperty(keyboard, "objectName", "hwrInputArea", null)
inputMethodResultSpy.clear()
- if (!Handwriting.emulate(testcase, hwrInputArea, ch, instant)) {
+ if (!Handwriting.emulate(testcase, hwrInputArea, ch, instant,
+ VirtualKeyboardSettings.locale)) {
if (virtualKeyClick(ch))
return true
console.warn("Cannot produce the symbol '%1' in handwriting mode".arg(ch))
return false
}
+ if (isSuperimposedHandwriting())
+ return true
inputMethodResultSpy.wait(3000)
return inputMethodResultSpy.count > 0
}
+
+ function isSuperimposedHandwriting() {
+ if (!inputPanel.keyboard.handwritingMode)
+ return false
+ return inputMethod != null && inputMethod.hasOwnProperty("superimposed") && inputMethod.superimposed
+ }
}
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
index 1b487c49..db30adda 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** 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.
@@ -38,528 +38,528 @@ var unipenData = {
".PEN": [
[
[
- 379,
+ 344,
53,
0
],
[
- 380,
+ 345,
53,
155
],
[
- 382,
+ 347,
53,
177
],
[
- 385,
+ 350,
53,
179
],
[
- 391,
+ 356,
53,
243
],
[
- 400,
+ 365,
53,
244
],
[
- 421,
+ 386,
55,
311
],
[
- 437,
+ 402,
55,
313
],
[
- 441,
+ 406,
55,
315
],
[
- 448,
+ 413,
55,
365
],
[
- 454,
+ 419,
55,
366
],
[
- 461,
+ 426,
55,
370
],
[
- 467,
+ 432,
54,
426
],
[
- 472,
+ 437,
54,
427
],
[
- 475,
+ 440,
54,
486
],
[
- 477,
+ 442,
54,
487
],
[
- 478,
+ 443,
54,
490
],
[
- 479,
+ 444,
54,
548
],
[
- 480,
+ 445,
54,
549
],
[
- 482,
+ 447,
54,
610
],
[
- 485,
+ 450,
54,
610
],
[
- 488,
+ 453,
54,
670
],
[
- 489,
+ 454,
54,
731
],
[
- 489,
+ 454,
55,
939
],
[
- 489,
+ 454,
56,
1003
],
[
- 489,
+ 454,
60,
1004
],
[
- 489,
+ 454,
64,
1064
],
[
- 489,
+ 454,
66,
1065
],
[
- 489,
+ 454,
72,
1124
],
[
- 489,
+ 454,
75,
1125
],
[
- 489,
+ 454,
79,
1131
],
[
- 489,
+ 454,
81,
1184
],
[
- 489,
+ 454,
86,
1185
],
[
- 489,
+ 454,
91,
1245
],
[
- 489,
+ 454,
92,
1246
],
[
- 489,
+ 454,
97,
1306
],
[
- 489,
+ 454,
99,
1307
],
[
- 489,
+ 454,
101,
1366
],
[
- 489,
+ 454,
102,
1367
],
[
- 489,
+ 454,
103,
1427
],
[
- 489,
+ 454,
105,
1429
],
[
- 489,
+ 454,
106,
1500
],
[
- 489,
+ 454,
107,
1549
],
[
- 489,
+ 454,
108,
1550
],
[
- 489,
+ 454,
109,
1614
]
],
[
[
- 383,
+ 348,
113,
2999
],
[
- 384,
+ 349,
113,
3259
],
[
- 385,
+ 350,
112,
3291
],
[
- 386,
+ 351,
112,
3360
],
[
- 399,
+ 364,
112,
3361
],
[
- 412,
+ 377,
112,
3389
],
[
- 434,
+ 399,
112,
3449
],
[
- 440,
+ 405,
112,
3450
],
[
- 451,
+ 416,
112,
3451
],
[
- 455,
+ 420,
112,
3510
],
[
- 479,
+ 444,
111,
3511
],
[
- 493,
+ 458,
110,
3574
],
[
- 506,
+ 471,
109,
3576
],
[
- 513,
+ 478,
109,
3632
],
[
- 515,
+ 480,
109,
3633
],
[
- 516,
+ 481,
109,
3636
]
],
[
[
- 430,
+ 395,
115,
5767
],
[
- 430,
+ 395,
116,
5851
],
[
- 432,
+ 397,
120,
5884
],
[
- 433,
+ 398,
123,
5937
],
[
- 433,
+ 398,
127,
5938
],
[
- 434,
+ 399,
130,
6000
],
[
- 434,
+ 399,
133,
6002
],
[
- 435,
+ 400,
139,
6058
],
[
- 435,
+ 400,
141,
6059
],
[
- 435,
+ 400,
142,
6124
],
[
- 435,
+ 400,
143,
6523
]
],
[
[
- 393,
+ 358,
151,
7943
],
[
- 394,
+ 359,
151,
8099
],
[
- 399,
+ 364,
150,
8124
],
[
- 412,
+ 377,
150,
8184
],
[
- 422,
+ 387,
150,
8185
],
[
- 438,
+ 403,
150,
8245
],
[
- 448,
+ 413,
150,
8246
],
[
- 465,
+ 430,
149,
8305
],
[
- 478,
+ 443,
149,
8306
],
[
- 485,
+ 450,
149,
8366
],
[
- 487,
+ 452,
149,
8366
],
[
- 488,
+ 453,
149,
8432
],
[
- 489,
+ 454,
149,
8490
],
[
- 491,
+ 456,
149,
8492
],
[
- 492,
+ 457,
149,
8549
],
[
- 492,
+ 457,
150,
8835
],
[
- 492,
+ 457,
152,
8882
],
[
- 492,
+ 457,
155,
8883
],
[
- 492,
+ 457,
159,
8944
],
[
- 492,
+ 457,
163,
8945
],
[
- 492,
+ 457,
168,
9005
],
[
- 491,
+ 456,
173,
9005
],
[
- 491,
+ 456,
177,
9067
],
[
- 490,
+ 455,
182,
9068
],
[
- 490,
+ 455,
188,
9126
],
[
- 490,
+ 455,
192,
9126
],
[
- 490,
+ 455,
193,
9130
],
[
- 490,
+ 455,
196,
9188
],
[
- 490,
+ 455,
198,
9247
],
[
- 490,
+ 455,
200,
9247
],
[
- 490,
+ 455,
202,
9307
],
[
- 490,
+ 455,
203,
9308
]
@@ -871,108 +871,128 @@ var unipenData = {
],
[
625,
- 120,
- 3236
+ 121,
+ 3096
+ ],
+ [
+ 626,
+ 121,
+ 3155
+ ],
+ [
+ 628,
+ 121,
+ 3199
+ ],
+ [
+ 629,
+ 121,
+ 3254
+ ],
+ [
+ 631,
+ 121,
+ 3310
]
],
[
[
- 614,
+ 626,
42,
3848
],
[
- 614,
+ 626,
45,
3896
],
[
- 614,
+ 626,
47,
3897
],
[
- 614,
+ 626,
54,
3900
],
[
- 615,
+ 627,
63,
3958
],
[
- 617,
+ 629,
76,
3958
],
[
- 619,
+ 631,
92,
4017
],
[
- 620,
+ 632,
100,
4018
],
[
- 620,
+ 632,
115,
4078
],
[
- 620,
+ 632,
133,
4079
],
[
- 618,
+ 630,
141,
4084
],
[
- 616,
+ 628,
153,
4138
],
[
- 616,
+ 628,
157,
4139
],
[
- 615,
+ 627,
169,
4200
],
[
- 614,
+ 626,
176,
4201
],
[
- 614,
+ 626,
178,
4205
],
[
- 613,
+ 625,
184,
4260
],
[
- 613,
+ 625,
188,
4261
],
[
- 613,
+ 625,
190,
4420
],
[
- 613,
+ 625,
191,
4540
]
@@ -996,134 +1016,134 @@ var unipenData = {
".PEN": [
[
[
- 169,
- 59,
+ 224,
+ 27,
0
],
[
- 171,
- 59,
+ 223,
+ 27,
148
],
[
- 175,
- 59,
+ 222,
+ 34,
170
],
[
- 183,
- 59,
+ 222,
+ 39,
228
],
[
- 197,
- 59,
+ 223,
+ 46,
229
],
[
- 210,
- 59,
+ 223,
+ 47,
288
],
[
223,
- 61,
+ 50,
289
],
[
- 233,
- 61,
+ 224,
+ 53,
292
],
[
- 241,
- 61,
+ 224,
+ 56,
350
],
[
- 252,
- 62,
+ 224,
+ 57,
350
],
[
- 260,
- 62,
+ 225,
+ 59,
418
],
[
- 265,
- 62,
+ 225,
+ 61,
419
],
[
- 266,
+ 225,
62,
748
]
],
[
[
- 224,
- 27,
+ 169,
+ 59,
1367
],
[
- 223,
- 27,
+ 171,
+ 59,
1414
],
[
- 222,
- 34,
+ 175,
+ 59,
1444
],
[
- 222,
- 39,
+ 183,
+ 59,
1502
],
[
- 223,
- 46,
+ 197,
+ 59,
1503
],
[
- 223,
- 47,
+ 210,
+ 59,
1508
],
[
223,
- 50,
+ 61,
1566
],
[
- 224,
- 53,
+ 233,
+ 61,
1568
],
[
- 224,
- 56,
+ 241,
+ 61,
1629
],
[
- 224,
- 57,
+ 252,
+ 62,
1630
],
[
- 225,
- 59,
+ 260,
+ 62,
1630
],
[
- 225,
- 61,
+ 265,
+ 62,
1686
],
[
- 225,
+ 266,
62,
1687
]
@@ -1132,568 +1152,568 @@ var unipenData = {
[
244,
82,
- 3184
+ 2184
],
[
243,
81,
- 3259
+ 2259
],
[
242,
81,
- 3285
+ 2285
],
[
238,
80,
- 3349
+ 2349
],
[
225,
80,
- 3350
+ 2350
],
[
210,
80,
- 3412
+ 2412
],
[
198,
82,
- 3414
+ 2414
],
[
192,
84,
- 3474
+ 2474
],
[
186,
88,
- 3476
+ 2476
],
[
184,
90,
- 3478
+ 2478
],
[
180,
95,
- 3532
+ 2532
],
[
178,
100,
- 3533
+ 2533
],
[
178,
109,
- 3595
+ 2595
],
[
178,
117,
- 3598
+ 2598
],
[
181,
125,
- 3657
+ 2657
],
[
186,
130,
- 3658
+ 2658
],
[
194,
136,
- 3716
+ 2716
],
[
197,
137,
- 3717
+ 2717
],
[
199,
137,
- 3775
+ 2775
],
[
202,
137,
- 3776
+ 2776
],
[
204,
137,
- 3780
+ 2780
],
[
206,
137,
- 3835
+ 2835
],
[
223,
135,
- 3836
+ 2836
],
[
234,
133,
- 3897
+ 2897
],
[
240,
130,
- 3898
+ 2898
],
[
242,
129,
- 3900
+ 2900
],
[
244,
128,
- 3958
+ 2958
],
[
251,
120,
- 3959
+ 2959
],
[
253,
117,
- 4017
+ 3017
],
[
253,
114,
- 4020
+ 3020
],
[
253,
110,
- 4081
+ 3081
],
[
251,
104,
- 4083
+ 3083
],
[
249,
99,
- 4140
+ 3140
],
[
247,
95,
- 4141
+ 3141
],
[
243,
89,
- 4205
+ 3205
],
[
242,
86,
- 4206
+ 3206
],
[
242,
85,
- 4212
+ 3212
],
[
241,
84,
- 4284
+ 3284
],
[
240,
84,
- 4324
+ 3324
],
[
239,
84,
- 4596
- ]
- ],
- [
- [
- 177,
- 144,
- 6344
- ],
- [
- 178,
- 144,
- 6573
- ],
- [
- 178,
- 146,
- 6600
- ],
- [
- 179,
- 148,
- 6604
- ],
- [
- 179,
- 150,
- 6657
- ],
- [
- 180,
- 153,
- 6658
- ],
- [
- 181,
- 160,
- 6719
- ],
- [
- 182,
- 167,
- 6720
- ],
- [
- 183,
- 176,
- 6779
- ],
- [
- 184,
- 182,
- 6780
- ],
- [
- 184,
- 185,
- 6840
- ],
- [
- 185,
- 189,
- 6841
- ],
- [
- 186,
- 189,
- 7108
- ],
- [
- 195,
- 189,
- 7174
- ],
- [
- 206,
- 187,
- 7234
- ],
- [
- 213,
- 186,
- 7236
- ],
- [
- 219,
- 186,
- 7294
- ],
- [
- 224,
- 186,
- 7296
- ],
- [
- 233,
- 186,
- 7355
- ],
- [
- 241,
- 185,
- 7355
- ],
- [
- 252,
- 185,
- 7417
- ],
- [
- 262,
- 185,
- 7419
- ],
- [
- 268,
- 186,
- 7421
- ],
- [
- 276,
- 186,
- 7475
- ],
- [
- 281,
- 186,
- 7476
- ],
- [
- 289,
- 186,
- 7536
- ],
- [
- 290,
- 186,
- 7537
- ],
- [
- 291,
- 186,
- 7597
- ],
- [
- 292,
- 186,
- 7660
- ],
- [
- 293,
- 186,
- 7724
- ],
- [
- 294,
- 186,
- 7725
- ],
- [
- 295,
- 186,
- 8172
+ 3596
]
],
[
[
283,
25,
- 9136
+ 4344
],
[
283,
26,
- 9220
+ 4573
],
[
283,
27,
- 9244
+ 4600
],
[
283,
33,
- 9299
+ 4604
],
[
283,
41,
- 9300
+ 4657
],
[
282,
53,
- 9359
+ 4658
],
[
282,
65,
- 9359
+ 4719
],
[
282,
78,
- 9420
+ 4720
],
[
282,
92,
- 9421
+ 4779
],
[
281,
115,
- 9481
+ 4780
],
[
280,
124,
- 9482
+ 4840
],
[
279,
133,
- 9484
+ 4841
],
[
279,
135,
- 9542
+ 5108
],
[
278,
142,
- 9542
+ 5174
],
[
277,
148,
- 9605
+ 5234
],
[
277,
150,
- 9607
+ 5236
],
[
277,
151,
- 9764
+ 5294
],
[
277,
153,
- 9816
+ 5296
],
[
277,
154,
- 9876
+ 5355
],
[
277,
153,
- 10124
+ 5355
],
[
277,
151,
- 10180
+ 5417
]
],
[
[
282,
89,
- 10651
+ 6136
],
[
283,
89,
- 10796
+ 6220
],
[
286,
89,
- 10821
+ 6244
],
[
288,
88,
- 10879
+ 6299
],
[
291,
88,
- 10879
+ 6300
],
[
294,
88,
- 10941
+ 6359
],
[
295,
88,
- 10941
+ 6359
],
[
297,
88,
- 11003
+ 6420
],
[
298,
88,
- 11004
+ 6421
],
[
299,
88,
- 11061
+ 6481
],
[
300,
88,
- 11062
+ 6482
],
[
301,
88,
- 11121
+ 6484
],
[
302,
88,
- 11123
+ 6542
],
[
303,
88,
- 11185
+ 6542
],
[
304,
88,
- 11187
+ 6605
],
[
305,
88,
- 11189
+ 6607
],
[
306,
88,
- 11248
+ 6764
],
[
307,
88,
- 11249
+ 6816
],
[
309,
89,
- 11304
+ 6876
+ ]
+ ],
+ [
+ [
+ 177,
+ 144,
+ 7651
+ ],
+ [
+ 178,
+ 144,
+ 7796
+ ],
+ [
+ 178,
+ 146,
+ 7821
+ ],
+ [
+ 179,
+ 148,
+ 7879
+ ],
+ [
+ 179,
+ 150,
+ 7879
+ ],
+ [
+ 180,
+ 153,
+ 7941
+ ],
+ [
+ 181,
+ 160,
+ 7941
+ ],
+ [
+ 182,
+ 167,
+ 8003
+ ],
+ [
+ 183,
+ 176,
+ 8004
+ ],
+ [
+ 184,
+ 182,
+ 8061
+ ],
+ [
+ 184,
+ 185,
+ 8062
+ ],
+ [
+ 185,
+ 189,
+ 8121
+ ],
+ [
+ 186,
+ 189,
+ 8123
+ ],
+ [
+ 195,
+ 189,
+ 8185
+ ],
+ [
+ 206,
+ 187,
+ 8187
+ ],
+ [
+ 213,
+ 186,
+ 8189
+ ],
+ [
+ 219,
+ 186,
+ 8248
+ ],
+ [
+ 224,
+ 186,
+ 8249
+ ],
+ [
+ 233,
+ 186,
+ 8304
+ ],
+ [
+ 241,
+ 185,
+ 8304
+ ],
+ [
+ 252,
+ 185,
+ 8366
+ ],
+ [
+ 262,
+ 185,
+ 8368
+ ],
+ [
+ 268,
+ 186,
+ 8370
+ ],
+ [
+ 276,
+ 186,
+ 8424
+ ],
+ [
+ 281,
+ 186,
+ 8425
+ ],
+ [
+ 289,
+ 186,
+ 8485
+ ],
+ [
+ 290,
+ 186,
+ 8486
+ ],
+ [
+ 291,
+ 186,
+ 8546
+ ],
+ [
+ 292,
+ 186,
+ 8609
+ ],
+ [
+ 293,
+ 186,
+ 8673
+ ],
+ [
+ 294,
+ 186,
+ 8674
+ ],
+ [
+ 295,
+ 186,
+ 8738
]
]
],
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js
new file mode 100644
index 00000000..09d2fae6
--- /dev/null
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js
@@ -0,0 +1,1930 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+var unipenData = {
+ "0x0067": {
+ ".COORD": [
+ "X",
+ "Y",
+ "T"
+ ],
+ ".HIERARCHY": "CHARACTER",
+ ".PEN": [
+ [
+ [
+ 493,
+ 87,
+ 0
+ ],
+ [
+ 492,
+ 86,
+ 57
+ ],
+ [
+ 488,
+ 84,
+ 87
+ ],
+ [
+ 484,
+ 83,
+ 150
+ ],
+ [
+ 480,
+ 83,
+ 152
+ ],
+ [
+ 473,
+ 83,
+ 212
+ ],
+ [
+ 462,
+ 85,
+ 215
+ ],
+ [
+ 454,
+ 89,
+ 271
+ ],
+ [
+ 452,
+ 92,
+ 273
+ ],
+ [
+ 451,
+ 94,
+ 274
+ ],
+ [
+ 449,
+ 99,
+ 332
+ ],
+ [
+ 445,
+ 109,
+ 333
+ ],
+ [
+ 443,
+ 114,
+ 337
+ ],
+ [
+ 442,
+ 120,
+ 394
+ ],
+ [
+ 442,
+ 132,
+ 395
+ ],
+ [
+ 442,
+ 144,
+ 455
+ ],
+ [
+ 444,
+ 159,
+ 458
+ ],
+ [
+ 446,
+ 167,
+ 522
+ ],
+ [
+ 448,
+ 175,
+ 524
+ ],
+ [
+ 450,
+ 178,
+ 577
+ ],
+ [
+ 450,
+ 179,
+ 578
+ ],
+ [
+ 451,
+ 180,
+ 640
+ ],
+ [
+ 454,
+ 181,
+ 642
+ ],
+ [
+ 455,
+ 182,
+ 699
+ ],
+ [
+ 456,
+ 183,
+ 701
+ ],
+ [
+ 460,
+ 185,
+ 760
+ ],
+ [
+ 463,
+ 185,
+ 762
+ ],
+ [
+ 466,
+ 186,
+ 823
+ ],
+ [
+ 469,
+ 186,
+ 825
+ ],
+ [
+ 474,
+ 183,
+ 883
+ ],
+ [
+ 487,
+ 179,
+ 884
+ ],
+ [
+ 496,
+ 173,
+ 944
+ ],
+ [
+ 502,
+ 162,
+ 945
+ ],
+ [
+ 509,
+ 144,
+ 1011
+ ],
+ [
+ 514,
+ 133,
+ 1013
+ ],
+ [
+ 514,
+ 124,
+ 1069
+ ],
+ [
+ 514,
+ 118,
+ 1070
+ ],
+ [
+ 514,
+ 113,
+ 1073
+ ],
+ [
+ 512,
+ 108,
+ 1125
+ ],
+ [
+ 509,
+ 100,
+ 1125
+ ],
+ [
+ 507,
+ 97,
+ 1185
+ ],
+ [
+ 506,
+ 94,
+ 1186
+ ],
+ [
+ 506,
+ 92,
+ 1247
+ ],
+ [
+ 505,
+ 90,
+ 1248
+ ],
+ [
+ 504,
+ 89,
+ 1310
+ ],
+ [
+ 504,
+ 88,
+ 1312
+ ],
+ [
+ 504,
+ 90,
+ 1571
+ ],
+ [
+ 506,
+ 95,
+ 1616
+ ],
+ [
+ 507,
+ 101,
+ 1618
+ ],
+ [
+ 511,
+ 117,
+ 1675
+ ],
+ [
+ 512,
+ 130,
+ 1676
+ ],
+ [
+ 514,
+ 145,
+ 1738
+ ],
+ [
+ 514,
+ 158,
+ 1740
+ ],
+ [
+ 514,
+ 165,
+ 1797
+ ],
+ [
+ 514,
+ 177,
+ 1799
+ ],
+ [
+ 514,
+ 182,
+ 1802
+ ],
+ [
+ 514,
+ 187,
+ 1860
+ ],
+ [
+ 513,
+ 193,
+ 1862
+ ],
+ [
+ 513,
+ 198,
+ 1922
+ ],
+ [
+ 512,
+ 200,
+ 1924
+ ],
+ [
+ 512,
+ 202,
+ 1981
+ ],
+ [
+ 512,
+ 206,
+ 1983
+ ],
+ [
+ 511,
+ 207,
+ 2043
+ ],
+ [
+ 511,
+ 209,
+ 2044
+ ],
+ [
+ 511,
+ 211,
+ 2045
+ ],
+ [
+ 511,
+ 212,
+ 2050
+ ],
+ [
+ 511,
+ 214,
+ 2106
+ ],
+ [
+ 510,
+ 217,
+ 2167
+ ],
+ [
+ 510,
+ 218,
+ 2169
+ ],
+ [
+ 508,
+ 220,
+ 2170
+ ],
+ [
+ 507,
+ 222,
+ 2228
+ ],
+ [
+ 503,
+ 226,
+ 2230
+ ],
+ [
+ 500,
+ 227,
+ 2234
+ ],
+ [
+ 499,
+ 229,
+ 2290
+ ],
+ [
+ 491,
+ 232,
+ 2293
+ ],
+ [
+ 480,
+ 233,
+ 2349
+ ],
+ [
+ 466,
+ 234,
+ 2350
+ ],
+ [
+ 458,
+ 235,
+ 2411
+ ]
+ ]
+ ],
+ ".POINTS_PER_SECOND": 60,
+ ".SEGMENT": "CHARACTER",
+ ".VERSION": "1.0",
+ ".X_DIM": 1032,
+ ".X_POINTS_PER_INCH": 94,
+ ".Y_DIM": 263,
+ ".Y_POINTS_PER_INCH": 94
+ },
+ "0x0069": {
+ ".COORD": [
+ "X",
+ "Y",
+ "T"
+ ],
+ ".HIERARCHY": "CHARACTER",
+ ".PEN": [
+ [
+ [
+ 538,
+ 83,
+ 0
+ ],
+ [
+ 538,
+ 86,
+ 83
+ ],
+ [
+ 538,
+ 88,
+ 96
+ ],
+ [
+ 538,
+ 92,
+ 147
+ ],
+ [
+ 538,
+ 105,
+ 148
+ ],
+ [
+ 538,
+ 129,
+ 203
+ ],
+ [
+ 537,
+ 141,
+ 204
+ ],
+ [
+ 534,
+ 170,
+ 264
+ ],
+ [
+ 532,
+ 182,
+ 265
+ ],
+ [
+ 532,
+ 191,
+ 327
+ ],
+ [
+ 532,
+ 197,
+ 329
+ ],
+ [
+ 532,
+ 198,
+ 388
+ ],
+ [
+ 532,
+ 200,
+ 390
+ ],
+ [
+ 532,
+ 198,
+ 764
+ ],
+ [
+ 532,
+ 194,
+ 812
+ ]
+ ],
+ [
+ [
+ 533,
+ 58,
+ 1292
+ ]
+ ]
+ ],
+ ".POINTS_PER_SECOND": 60,
+ ".SEGMENT": "CHARACTER",
+ ".VERSION": "1.0",
+ ".X_DIM": 1032,
+ ".X_POINTS_PER_INCH": 94,
+ ".Y_DIM": 263,
+ ".Y_POINTS_PER_INCH": 94
+ },
+ "0x006e": {
+ ".COORD": [
+ "X",
+ "Y",
+ "T"
+ ],
+ ".HIERARCHY": "CHARACTER",
+ ".PEN": [
+ [
+ [
+ 400,
+ 82,
+ 0
+ ],
+ [
+ 400,
+ 83,
+ 85
+ ],
+ [
+ 400,
+ 85,
+ 96
+ ],
+ [
+ 400,
+ 96,
+ 153
+ ],
+ [
+ 401,
+ 103,
+ 156
+ ],
+ [
+ 402,
+ 113,
+ 157
+ ],
+ [
+ 402,
+ 124,
+ 215
+ ],
+ [
+ 402,
+ 147,
+ 217
+ ],
+ [
+ 402,
+ 161,
+ 221
+ ],
+ [
+ 402,
+ 173,
+ 275
+ ],
+ [
+ 402,
+ 188,
+ 278
+ ],
+ [
+ 400,
+ 198,
+ 342
+ ],
+ [
+ 399,
+ 202,
+ 344
+ ],
+ [
+ 399,
+ 204,
+ 345
+ ],
+ [
+ 399,
+ 205,
+ 396
+ ],
+ [
+ 399,
+ 204,
+ 526
+ ],
+ [
+ 399,
+ 200,
+ 580
+ ],
+ [
+ 399,
+ 191,
+ 582
+ ],
+ [
+ 399,
+ 185,
+ 641
+ ],
+ [
+ 401,
+ 170,
+ 643
+ ],
+ [
+ 402,
+ 162,
+ 644
+ ],
+ [
+ 403,
+ 153,
+ 701
+ ],
+ [
+ 404,
+ 132,
+ 703
+ ],
+ [
+ 407,
+ 118,
+ 761
+ ],
+ [
+ 409,
+ 109,
+ 763
+ ],
+ [
+ 411,
+ 104,
+ 764
+ ],
+ [
+ 414,
+ 99,
+ 824
+ ],
+ [
+ 415,
+ 98,
+ 827
+ ],
+ [
+ 417,
+ 95,
+ 884
+ ],
+ [
+ 418,
+ 93,
+ 886
+ ],
+ [
+ 419,
+ 93,
+ 1125
+ ],
+ [
+ 420,
+ 93,
+ 1183
+ ],
+ [
+ 422,
+ 92,
+ 1185
+ ],
+ [
+ 423,
+ 92,
+ 1216
+ ],
+ [
+ 425,
+ 91,
+ 1277
+ ],
+ [
+ 426,
+ 91,
+ 1337
+ ],
+ [
+ 427,
+ 91,
+ 1338
+ ],
+ [
+ 428,
+ 91,
+ 1340
+ ],
+ [
+ 432,
+ 94,
+ 1399
+ ],
+ [
+ 434,
+ 96,
+ 1400
+ ],
+ [
+ 437,
+ 102,
+ 1430
+ ],
+ [
+ 439,
+ 105,
+ 1460
+ ],
+ [
+ 442,
+ 115,
+ 1461
+ ],
+ [
+ 444,
+ 126,
+ 1520
+ ],
+ [
+ 446,
+ 137,
+ 1521
+ ],
+ [
+ 447,
+ 148,
+ 1581
+ ],
+ [
+ 447,
+ 153,
+ 1582
+ ],
+ [
+ 447,
+ 159,
+ 1642
+ ],
+ [
+ 447,
+ 165,
+ 1643
+ ],
+ [
+ 447,
+ 166,
+ 1645
+ ],
+ [
+ 447,
+ 172,
+ 1703
+ ],
+ [
+ 446,
+ 177,
+ 1764
+ ],
+ [
+ 446,
+ 179,
+ 1765
+ ],
+ [
+ 446,
+ 180,
+ 1853
+ ],
+ [
+ 446,
+ 181,
+ 1891
+ ],
+ [
+ 446,
+ 183,
+ 1947
+ ],
+ [
+ 446,
+ 185,
+ 1950
+ ],
+ [
+ 446,
+ 186,
+ 2007
+ ],
+ [
+ 446,
+ 188,
+ 2008
+ ],
+ [
+ 446,
+ 189,
+ 2069
+ ],
+ [
+ 445,
+ 191,
+ 2070
+ ],
+ [
+ 445,
+ 192,
+ 2131
+ ],
+ [
+ 445,
+ 193,
+ 2193
+ ],
+ [
+ 445,
+ 194,
+ 2195
+ ],
+ [
+ 445,
+ 195,
+ 2413
+ ],
+ [
+ 445,
+ 196,
+ 2477
+ ],
+ [
+ 445,
+ 197,
+ 2527
+ ],
+ [
+ 445,
+ 198,
+ 2528
+ ],
+ [
+ 445,
+ 199,
+ 2587
+ ],
+ [
+ 445,
+ 200,
+ 2588
+ ],
+ [
+ 445,
+ 201,
+ 2648
+ ]
+ ]
+ ],
+ ".POINTS_PER_SECOND": 60,
+ ".SEGMENT": "CHARACTER",
+ ".VERSION": "1.0",
+ ".X_DIM": 1032,
+ ".X_POINTS_PER_INCH": 94,
+ ".Y_DIM": 263,
+ ".Y_POINTS_PER_INCH": 94
+ },
+ "0x0074": {
+ ".COORD": [
+ "X",
+ "Y",
+ "T"
+ ],
+ ".HIERARCHY": "CHARACTER",
+ ".PEN": [
+ [
+ [
+ 639,
+ 167,
+ 0
+ ],
+ [
+ 640,
+ 167,
+ 50
+ ],
+ [
+ 640,
+ 164,
+ 76
+ ],
+ [
+ 645,
+ 154,
+ 136
+ ],
+ [
+ 653,
+ 135,
+ 137
+ ],
+ [
+ 662,
+ 108,
+ 203
+ ],
+ [
+ 666,
+ 87,
+ 205
+ ],
+ [
+ 666,
+ 73,
+ 257
+ ],
+ [
+ 666,
+ 67,
+ 259
+ ],
+ [
+ 666,
+ 62,
+ 318
+ ],
+ [
+ 666,
+ 60,
+ 319
+ ],
+ [
+ 666,
+ 58,
+ 380
+ ],
+ [
+ 665,
+ 57,
+ 381
+ ],
+ [
+ 665,
+ 56,
+ 440
+ ],
+ [
+ 664,
+ 57,
+ 505
+ ],
+ [
+ 664,
+ 58,
+ 507
+ ],
+ [
+ 663,
+ 61,
+ 561
+ ],
+ [
+ 663,
+ 66,
+ 562
+ ],
+ [
+ 662,
+ 75,
+ 622
+ ],
+ [
+ 661,
+ 86,
+ 623
+ ],
+ [
+ 660,
+ 98,
+ 688
+ ],
+ [
+ 659,
+ 111,
+ 689
+ ],
+ [
+ 659,
+ 114,
+ 690
+ ],
+ [
+ 659,
+ 121,
+ 745
+ ],
+ [
+ 659,
+ 132,
+ 746
+ ],
+ [
+ 659,
+ 141,
+ 805
+ ],
+ [
+ 659,
+ 149,
+ 806
+ ],
+ [
+ 659,
+ 158,
+ 868
+ ],
+ [
+ 660,
+ 161,
+ 870
+ ],
+ [
+ 661,
+ 164,
+ 929
+ ],
+ [
+ 661,
+ 165,
+ 990
+ ],
+ [
+ 662,
+ 166,
+ 992
+ ],
+ [
+ 663,
+ 167,
+ 1131
+ ],
+ [
+ 663,
+ 165,
+ 1483
+ ],
+ [
+ 663,
+ 159,
+ 1535
+ ],
+ [
+ 664,
+ 156,
+ 1536
+ ],
+ [
+ 664,
+ 151,
+ 1538
+ ],
+ [
+ 665,
+ 146,
+ 1595
+ ],
+ [
+ 666,
+ 136,
+ 1596
+ ],
+ [
+ 666,
+ 127,
+ 1659
+ ],
+ [
+ 666,
+ 116,
+ 1662
+ ],
+ [
+ 665,
+ 111,
+ 1667
+ ],
+ [
+ 663,
+ 105,
+ 1723
+ ],
+ [
+ 656,
+ 96,
+ 1724
+ ],
+ [
+ 652,
+ 93,
+ 1781
+ ],
+ [
+ 648,
+ 92,
+ 1783
+ ],
+ [
+ 643,
+ 90,
+ 1786
+ ],
+ [
+ 639,
+ 89,
+ 1840
+ ],
+ [
+ 633,
+ 88,
+ 1841
+ ],
+ [
+ 632,
+ 87,
+ 1971
+ ],
+ [
+ 632,
+ 86,
+ 2023
+ ],
+ [
+ 636,
+ 85,
+ 2023
+ ],
+ [
+ 641,
+ 84,
+ 2024
+ ],
+ [
+ 647,
+ 82,
+ 2026
+ ],
+ [
+ 655,
+ 81,
+ 2084
+ ],
+ [
+ 668,
+ 79,
+ 2085
+ ],
+ [
+ 682,
+ 77,
+ 2148
+ ],
+ [
+ 686,
+ 77,
+ 2150
+ ],
+ [
+ 688,
+ 77,
+ 2154
+ ],
+ [
+ 689,
+ 77,
+ 2211
+ ],
+ [
+ 690,
+ 77,
+ 2267
+ ]
+ ]
+ ],
+ ".POINTS_PER_SECOND": 60,
+ ".SEGMENT": "CHARACTER",
+ ".VERSION": "1.0",
+ ".X_DIM": 1032,
+ ".X_POINTS_PER_INCH": 94,
+ ".Y_DIM": 263,
+ ".Y_POINTS_PER_INCH": 94
+ },
+ "0x1ebf": {
+ ".COORD": [
+ "X",
+ "Y",
+ "T"
+ ],
+ ".HIERARCHY": "CHARACTER",
+ ".PEN": [
+ [
+ [
+ 294,
+ 112,
+ 0
+ ],
+ [
+ 297,
+ 112,
+ 117
+ ],
+ [
+ 299,
+ 113,
+ 134
+ ],
+ [
+ 305,
+ 114,
+ 141
+ ],
+ [
+ 311,
+ 115,
+ 176
+ ],
+ [
+ 318,
+ 115,
+ 177
+ ],
+ [
+ 325,
+ 116,
+ 237
+ ],
+ [
+ 330,
+ 116,
+ 238
+ ],
+ [
+ 340,
+ 116,
+ 297
+ ],
+ [
+ 350,
+ 116,
+ 299
+ ],
+ [
+ 352,
+ 116,
+ 358
+ ],
+ [
+ 352,
+ 111,
+ 360
+ ],
+ [
+ 353,
+ 104,
+ 419
+ ],
+ [
+ 353,
+ 98,
+ 420
+ ],
+ [
+ 353,
+ 94,
+ 481
+ ],
+ [
+ 347,
+ 87,
+ 483
+ ],
+ [
+ 337,
+ 81,
+ 541
+ ],
+ [
+ 334,
+ 79,
+ 543
+ ],
+ [
+ 330,
+ 78,
+ 572
+ ],
+ [
+ 329,
+ 78,
+ 606
+ ],
+ [
+ 320,
+ 78,
+ 607
+ ],
+ [
+ 314,
+ 78,
+ 662
+ ],
+ [
+ 303,
+ 80,
+ 663
+ ],
+ [
+ 301,
+ 82,
+ 667
+ ],
+ [
+ 299,
+ 84,
+ 723
+ ],
+ [
+ 292,
+ 93,
+ 725
+ ],
+ [
+ 289,
+ 97,
+ 783
+ ],
+ [
+ 284,
+ 108,
+ 786
+ ],
+ [
+ 282,
+ 114,
+ 788
+ ],
+ [
+ 282,
+ 121,
+ 843
+ ],
+ [
+ 282,
+ 134,
+ 845
+ ],
+ [
+ 285,
+ 145,
+ 903
+ ],
+ [
+ 288,
+ 153,
+ 906
+ ],
+ [
+ 292,
+ 159,
+ 966
+ ],
+ [
+ 293,
+ 161,
+ 968
+ ],
+ [
+ 295,
+ 165,
+ 972
+ ],
+ [
+ 296,
+ 165,
+ 1026
+ ],
+ [
+ 299,
+ 168,
+ 1027
+ ],
+ [
+ 304,
+ 170,
+ 1092
+ ],
+ [
+ 311,
+ 173,
+ 1093
+ ],
+ [
+ 314,
+ 173,
+ 1095
+ ],
+ [
+ 323,
+ 174,
+ 1151
+ ],
+ [
+ 331,
+ 175,
+ 1153
+ ],
+ [
+ 343,
+ 176,
+ 1213
+ ],
+ [
+ 353,
+ 176,
+ 1215
+ ],
+ [
+ 357,
+ 175,
+ 1273
+ ],
+ [
+ 359,
+ 172,
+ 1275
+ ],
+ [
+ 359,
+ 171,
+ 1334
+ ],
+ [
+ 360,
+ 171,
+ 2556
+ ]
+ ],
+ [
+ [
+ 306,
+ 67,
+ 3105
+ ],
+ [
+ 306,
+ 64,
+ 3162
+ ],
+ [
+ 307,
+ 63,
+ 3164
+ ],
+ [
+ 309,
+ 62,
+ 3219
+ ],
+ [
+ 314,
+ 56,
+ 3221
+ ],
+ [
+ 320,
+ 47,
+ 3281
+ ],
+ [
+ 323,
+ 43,
+ 3283
+ ],
+ [
+ 325,
+ 40,
+ 3285
+ ],
+ [
+ 326,
+ 40,
+ 3412
+ ],
+ [
+ 327,
+ 41,
+ 3462
+ ],
+ [
+ 327,
+ 43,
+ 3463
+ ],
+ [
+ 328,
+ 47,
+ 3467
+ ],
+ [
+ 329,
+ 51,
+ 3522
+ ],
+ [
+ 330,
+ 59,
+ 3523
+ ],
+ [
+ 330,
+ 62,
+ 3586
+ ],
+ [
+ 331,
+ 62,
+ 4012
+ ]
+ ],
+ [
+ [
+ 338,
+ 62,
+ 4380
+ ],
+ [
+ 340,
+ 62,
+ 4443
+ ],
+ [
+ 343,
+ 59,
+ 4471
+ ],
+ [
+ 348,
+ 56,
+ 4532
+ ],
+ [
+ 352,
+ 51,
+ 4535
+ ],
+ [
+ 355,
+ 47,
+ 4593
+ ],
+ [
+ 356,
+ 45,
+ 4594
+ ],
+ [
+ 357,
+ 44,
+ 4595
+ ]
+ ]
+ ],
+ ".POINTS_PER_SECOND": 60,
+ ".SEGMENT": "CHARACTER",
+ ".VERSION": "1.0",
+ ".X_DIM": 1032,
+ ".X_POINTS_PER_INCH": 94,
+ ".Y_DIM": 263,
+ ".Y_POINTS_PER_INCH": 94
+ },
+ "0x1ec7": {
+ ".COORD": [
+ "X",
+ "Y",
+ "T"
+ ],
+ ".HIERARCHY": "CHARACTER",
+ ".PEN": [
+ [
+ [
+ 561,
+ 107,
+ 0
+ ],
+ [
+ 564,
+ 107,
+ 60
+ ],
+ [
+ 571,
+ 109,
+ 76
+ ],
+ [
+ 583,
+ 109,
+ 128
+ ],
+ [
+ 608,
+ 111,
+ 129
+ ],
+ [
+ 620,
+ 111,
+ 186
+ ],
+ [
+ 632,
+ 109,
+ 187
+ ],
+ [
+ 634,
+ 106,
+ 188
+ ],
+ [
+ 635,
+ 100,
+ 246
+ ],
+ [
+ 632,
+ 93,
+ 246
+ ],
+ [
+ 624,
+ 87,
+ 306
+ ],
+ [
+ 619,
+ 86,
+ 307
+ ],
+ [
+ 614,
+ 85,
+ 308
+ ],
+ [
+ 608,
+ 85,
+ 367
+ ],
+ [
+ 594,
+ 87,
+ 368
+ ],
+ [
+ 587,
+ 90,
+ 371
+ ],
+ [
+ 582,
+ 94,
+ 437
+ ],
+ [
+ 564,
+ 110,
+ 438
+ ],
+ [
+ 559,
+ 117,
+ 489
+ ],
+ [
+ 554,
+ 132,
+ 490
+ ],
+ [
+ 554,
+ 149,
+ 550
+ ],
+ [
+ 559,
+ 161,
+ 551
+ ],
+ [
+ 562,
+ 164,
+ 611
+ ],
+ [
+ 568,
+ 166,
+ 612
+ ],
+ [
+ 576,
+ 167,
+ 672
+ ],
+ [
+ 605,
+ 168,
+ 674
+ ],
+ [
+ 622,
+ 168,
+ 733
+ ],
+ [
+ 625,
+ 167,
+ 794
+ ],
+ [
+ 626,
+ 167,
+ 795
+ ],
+ [
+ 627,
+ 166,
+ 857
+ ],
+ [
+ 628,
+ 166,
+ 1029
+ ]
+ ],
+ [
+ [
+ 583,
+ 57,
+ 4161
+ ],
+ [
+ 584,
+ 57,
+ 4229
+ ],
+ [
+ 588,
+ 53,
+ 4231
+ ],
+ [
+ 592,
+ 49,
+ 4288
+ ],
+ [
+ 595,
+ 45,
+ 4289
+ ],
+ [
+ 599,
+ 42,
+ 4351
+ ],
+ [
+ 600,
+ 42,
+ 4353
+ ],
+ [
+ 601,
+ 41,
+ 4411
+ ],
+ [
+ 602,
+ 40,
+ 4476
+ ],
+ [
+ 603,
+ 39,
+ 4749
+ ],
+ [
+ 604,
+ 38,
+ 4836
+ ],
+ [
+ 605,
+ 38,
+ 4895
+ ],
+ [
+ 606,
+ 38,
+ 4900
+ ],
+ [
+ 607,
+ 38,
+ 5005
+ ],
+ [
+ 608,
+ 38,
+ 5149
+ ],
+ [
+ 609,
+ 38,
+ 5198
+ ],
+ [
+ 609,
+ 39,
+ 5199
+ ],
+ [
+ 613,
+ 51,
+ 5260
+ ],
+ [
+ 615,
+ 59,
+ 5261
+ ],
+ [
+ 616,
+ 65,
+ 5320
+ ],
+ [
+ 617,
+ 68,
+ 5321
+ ],
+ [
+ 617,
+ 69,
+ 5323
+ ],
+ [
+ 617,
+ 70,
+ 5382
+ ],
+ [
+ 618,
+ 71,
+ 5383
+ ]
+ ],
+ [
+ [
+ 594,
+ 188,
+ 6585
+ ]
+ ]
+ ],
+ ".POINTS_PER_SECOND": 60,
+ ".SEGMENT": "CHARACTER",
+ ".VERSION": "1.0",
+ ".X_DIM": 1032,
+ ".X_POINTS_PER_INCH": 94,
+ ".Y_DIM": 263,
+ ".Y_POINTS_PER_INCH": 94
+ }
+}
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml
index 10a9b906..91a6e13f 100644
--- a/tests/auto/inputpanel/data/tst_inputpanel.qml
+++ b/tests/auto/inputpanel/data/tst_inputpanel.qml
@@ -78,12 +78,13 @@ Rectangle {
handwritingInputPanel.destroy()
}
- function prepareTest(data) {
+ function prepareTest(data, skipIfFail) {
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)
var window = container.Window.window
verify(window)
@@ -92,6 +93,7 @@ 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
@@ -103,31 +105,40 @@ Rectangle {
}
textInput.inputMethodHints = data !== undefined && data.hasOwnProperty("initInputMethodHints") ? data.initInputMethodHints : Qt.ImhNone
handwritingInputPanel.available = false
- textInput.forceActiveFocus()
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"
- if (!inputPanel.isLocaleSupported(locale))
+ if (!inputPanel.isLocaleSupported(locale)) {
+ if (skipIfFail)
+ skip("Input locale not available (%1)".arg(locale))
expectFail("", "Input locale not available (%1)".arg(locale))
+ }
var localeChanged = Qt.inputMethod.locale.name !== locale
verify(inputPanel.setLocale(locale))
if (localeChanged && !(textInput.inputMethodHints & Qt.ImhNoPredictiveText))
wait(300)
if (data !== undefined && data.hasOwnProperty("initHwrMode") && data.initHwrMode) {
- if (!inputPanel.setHandwritingMode(true))
+ if (!inputPanel.setHandwritingMode(true)) {
+ if (skipIfFail)
+ skip("Handwriting not enabled")
expectFail("", "Handwriting not enabled")
+ }
verify(inputPanel.handwritingMode === true)
}
if (data !== undefined && data.hasOwnProperty("initInputMode")) {
var inputMode = inputPanel.mapInputMode(data.initInputMode)
- if (!inputPanel.isInputModeSupported(inputMode))
+ if (!inputPanel.isInputModeSupported(inputMode)) {
+ if (skipIfFail)
+ skip("Input mode not available (%1)".arg(data.initInputMode))
expectFail("", "Input mode not available (%1)".arg(data.initInputMode))
+ }
verify(inputPanel.setInputMode(inputMode))
}
- Qt.inputMethod.show()
- waitForRendering(inputPanel)
verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
}
function test_versionCheck_data() {
@@ -216,6 +227,11 @@ Rectangle {
obj.destroy()
}
+ function test_publicEnums() {
+ prepareTest()
+ inputPanel.testPublicEnums()
+ }
+
function test_focusShowKeyboard() {
container.forceActiveFocus()
verify(inputPanel.visible === false)
@@ -329,22 +345,35 @@ Rectangle {
{ initLocale: "de_DE", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hallo", outputText: "Hallo" },
{ initLocale: "el_GR", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "\u03C7\u03B1\u03AF\u03C1\u03B5\u03C4\u03B5", outputText: "\u03A7\u03B1\u03AF\u03C1\u03B5\u03C4\u03B5" },
{ initLocale: "en_GB", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hello", outputText: "Hello" },
+ { initLocale: "en_US", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hello", outputText: "Hello" },
{ initLocale: "es_ES", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hola", outputText: "Hola" },
+ { initLocale: "es_MX", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hola", outputText: "Hola" },
{ initLocale: "et_EE", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "tere", outputText: "Tere" },
{ initLocale: "hi_IN", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "\u0928\u092E\u0938\u094D\u0915\u093E\u0930", outputText: "\u0928\u092E\u0938\u094D\u0915\u093E\u0930" },
{ initLocale: "hr_HR", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "zdravo", outputText: "Zdravo" },
{ initLocale: "hu_HU", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "helló", outputText: "Helló" },
{ initLocale: "fi_FI", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hei", outputText: "Hei" },
+ { initLocale: "fr_CA", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "bonjour", outputText: "Bonjour" },
{ initLocale: "fr_FR", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "bonjour", outputText: "Bonjour" },
+ { initLocale: "id_ID", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "halo", outputText: "Halo" },
{ initLocale: "it_IT", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "ciao", outputText: "Ciao" },
{ initLocale: "ja_JP", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "watashi", outputText: "\u308F\u305F\u3057" },
+ { initLocale: "ms_MY", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hello", outputText: "Hello" },
{ initLocale: "nb_NO", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hallo", outputText: "Hallo" },
{ initLocale: "nl_NL", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hallo", outputText: "Hallo" },
{ initLocale: "pl_PL", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "cze\u015B\u0107", outputText: "Cze\u015B\u0107" },
+ { 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: "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" },
+ { initLocale: "sk_SK", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "ahoj", outputText: "Ahoj" },
+ { initLocale: "sl_SI", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "zdravo", outputText: "Zdravo" },
+ { initLocale: "th_TH", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "สวัสดี", outputText: "สวัสดี" },
+ { initLocale: "tr_TR", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "merhaba", outputText: "Merhaba" },
+ { initLocale: "uk_UA", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "здравствуйте", outputText: "Здравствуйте" },
]
}
@@ -580,6 +609,9 @@ Rectangle {
}
function test_soundEffects() {
+ if (!inputPanel.keyboard.soundEffect.available || !inputPanel.keyboard.soundEffect.enabled)
+ skip("Sound effects not enabled")
+
prepareTest({ initInputMethodHints: Qt.ImhNoPredictiveText })
wait(500)
@@ -587,8 +619,7 @@ Rectangle {
verify(inputPanel.virtualKeyClick(Qt.Key_A))
wait(500)
- if (!inputPanel.keyboard.soundEffect.available || !inputPanel.keyboard.soundEffect.enabled)
- expectFail("", "Sound effects not enabled")
+
compare(inputPanel.soundEffectSpy.count, 2)
}
@@ -604,7 +635,8 @@ Rectangle {
prepareTest(data)
if (!inputPanel.activateNavigationKeyMode())
- expectFail("", "Arrow key navigation not enabled")
+ skip("Arrow key navigation not enabled")
+
verify(inputPanel.naviationHighlight.visible)
for (var inputIndex in data.inputSequence) {
@@ -633,10 +665,10 @@ Rectangle {
}
function test_navigationCursorWrap(data) {
- prepareTest()
+ prepareTest(data)
if (!inputPanel.activateNavigationKeyMode())
- expectFail("", "Arrow key navigation not enabled")
+ skip("Arrow key navigation not enabled")
verify(inputPanel.naviationHighlight.visible)
verify(inputPanel.navigateToKey(data.initialKey))
@@ -659,7 +691,7 @@ Rectangle {
prepareTest()
if (!inputPanel.activateNavigationKeyMode())
- expectFail("", "Arrow key navigation not enabled")
+ skip("Arrow key navigation not enabled")
verify(inputPanel.naviationHighlight.visible)
verify(inputPanel.navigationKeyClick("q"))
@@ -674,6 +706,17 @@ Rectangle {
verify(inputPanel.keyboardInputArea.initialKey === focusKey)
verify(inputPanel.wordCandidateView.currentIndex !== -1)
+ // Select alternative key and check word candidates
+ verify(inputPanel.navigationKeyClick("e"))
+ var focusKeyAlt = inputPanel.keyboardInputArea.initialKey
+ verify(inputPanel.navigationKeyClick("ë"))
+ verify(inputPanel.wordCandidateView.count > 1)
+ verify(inputPanel.keyboardInputArea.initialKey === focusKeyAlt)
+ verify(inputPanel.navigationKeyClick(Qt.Key_Backspace))
+ verify(inputPanel.navigationKeyClick(Qt.Key_Backspace))
+ verify(inputPanel.navigationKeyClick(Qt.Key_Backspace))
+ verify(inputPanel.navigationKeyClick("q"))
+
// Move focus to word candidate list
inputPanel.emulateNavigationKeyClick(Qt.Key_Up)
verify(inputPanel.keyboardInputArea.initialKey === null)
@@ -738,6 +781,43 @@ Rectangle {
verify(textInput.text.length > 0)
}
+ function test_navigationKeyLayoutMirroring_data() {
+ return [
+ { layoutMirroring: false },
+ { layoutMirroring: true },
+ ]
+ }
+
+ function test_navigationKeyLayoutMirroring(data) {
+ prepareTest(data)
+
+ if (!inputPanel.activateNavigationKeyMode())
+ skip("Arrow key navigation not enabled")
+ verify(inputPanel.naviationHighlight.visible)
+
+ verify(inputPanel.navigateToKey("q"))
+ var initialKey = inputPanel.keyboardInputArea.initialKey
+
+ var keysTraversed = []
+ do {
+ verify(keysTraversed.indexOf(inputPanel.keyboardInputArea.initialKey) === -1)
+ var currentKey = inputPanel.keyboardInputArea.initialKey
+ keysTraversed.push(currentKey)
+ inputPanel.emulateNavigationKeyClick(Qt.Key_Right)
+ } while (initialKey !== inputPanel.keyboardInputArea.initialKey)
+
+ inputPanel.setLayoutMirroring(!data.layoutMirroring)
+
+ do {
+ var indexOfKey = keysTraversed.indexOf(inputPanel.keyboardInputArea.initialKey)
+ verify(indexOfKey !== -1)
+ keysTraversed.splice(indexOfKey, 1)
+ inputPanel.emulateNavigationKeyClick(Qt.Key_Left)
+ } while (initialKey !== inputPanel.keyboardInputArea.initialKey)
+
+ compare(keysTraversed.length, 0)
+ }
+
function test_spellCorrectionSuggestions_data() {
return [
{ initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hwllo", unexpectedSuggestion: "Hello", outputText: "Hwllo" },
@@ -792,10 +872,6 @@ Rectangle {
}
function test_spellCorrectionAutomaticSpaceInsertion(data) {
- if (Qt.platform.pluginName === "offscreen") {
- skip("QTBUG-68349");
- }
-
prepareTest(data)
for (var inputIndex in data.inputSequence) {
@@ -843,7 +919,7 @@ Rectangle {
}
function test_pinyinInputMethod(data) {
- prepareTest(data)
+ prepareTest(data, true)
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
@@ -892,7 +968,7 @@ Rectangle {
}
function test_cangjieInputMethod(data) {
- prepareTest(data)
+ prepareTest(data, true)
if (data.hasOwnProperty("initSimplified")) {
if (inputPanel.inputMethod.simplified !== data.initSimplified)
@@ -976,7 +1052,7 @@ Rectangle {
}
function test_zhuyinInputMethod(data) {
- prepareTest(data)
+ prepareTest(data, true)
for (var inputIndex in data.inputSequence) {
if (Array.isArray(data.inputSequence)) {
@@ -1046,7 +1122,7 @@ Rectangle {
}
function test_hangulInputMethod(data) {
- prepareTest(data)
+ prepareTest(data, true)
compare(Qt.inputMethod.locale.name, Qt.locale(data.initLocale).name)
@@ -1098,11 +1174,15 @@ Rectangle {
{ initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o"], outputText: "" },
// Latin only
{ initLocale: "ja_JP", initInputMethodHints: Qt.ImhLatinOnly, inputSequence: "hello", outputText: "Hello" },
+ // Cursor test: 1. Enter hiragana input sequence and move cursor in the middle of input.
+ // 2. Change input mode to Katakana.
+ // 3. The input sequence should be committed leaving the cursor in the middle.
+ { initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o",Qt.Key_Left,Qt.Key_Left,Qt.Key_Left,Qt.Key_Mode_switch], outputText: "\u306B\u307B\u3093\u3054", expectedCursorPosition: 2 },
]
}
function test_japaneseInputModes(data) {
- prepareTest(data)
+ prepareTest(data, true)
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
@@ -1110,6 +1190,9 @@ Rectangle {
waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
+
+ if (data.hasOwnProperty("expectedCursorPosition"))
+ compare(textInput.cursorPosition, data.expectedCursorPosition)
}
function test_baseKeyNoModifier() {
@@ -1124,6 +1207,28 @@ Rectangle {
compare(textInput.selectedText, "")
}
+ function test_vietnameseInputMethod_data() {
+ return [
+ { initLocale: "vi_VN", inputSequence: "Xin chào", outputText: "Xin chào" },
+ { initLocale: "vi_VN", inputSequence: "Ảo", outputText: "Ảo" },
+ { initLocale: "vi_VN", inputSequence: "Cũng", outputText: "Cũng" },
+ { initLocale: "vi_VN", inputSequence: "Chiếc", outputText: "Chiếc" },
+ { initLocale: "vi_VN", inputSequence: "Giọt", outputText: "Giọt" },
+ ]
+ }
+
+ function test_vietnameseInputMethod(data) {
+ prepareTest(data, true)
+
+ for (var inputIndex in data.inputSequence) {
+ verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
+ }
+
+ Qt.inputMethod.commit()
+ waitForRendering(inputPanel)
+ compare(textInput.text, data.outputText)
+ }
+
function test_hwrInputSequence_data() {
return [
{ initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 0, inputSequence: "abcdefghij", outputText: "Abcdefghij" },
@@ -1139,11 +1244,60 @@ Rectangle {
{ initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "ar_AR", initInputMode: "Arabic", inputSequence: "\u0643\u062A\u0627\u0628", outputText: "\u0643\u062A\u0627\u0628" },
{ initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "fa_FA", initInputMode: "Arabic", inputSequence: "\u0686\u0627\u06CC", outputText: "\u0686\u0627\u06CC" },
{ initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "he_IL", initInputMode: "Hebrew", inputSequence: "\u05D0\u05D5\u05D8\u05D5", outputText: "\u05D0\u05D5\u05D8\u05D5" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "vi_VN", inputSequence: "Ti\u1EBFng vi\u1EC7t", outputText: "Ti\u1EBFng vi\u1EC7t" },
]
}
function test_hwrInputSequence(data) {
- prepareTest(data)
+ prepareTest(data, true)
+
+ if (inputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for Superimposed Handwriting")
+
+ for (var i = 0; i < data.toggleShiftCount; i++) {
+ inputPanel.toggleShift()
+ }
+ for (var inputIndex in data.inputSequence) {
+ verify(inputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
+ }
+
+ if (inputPanel.wordCandidateView.count > 0) {
+ if (inputPanel.selectionListSearchSuggestion(data.outputText)) {
+ inputPanel.selectionListSelectCurrentItem()
+ }
+ }
+
+ Qt.inputMethod.commit()
+ waitForRendering(inputPanel)
+ compare(textInput.text, data.outputText)
+ }
+
+ function test_superimposedHwrInputSequence_data() {
+ return [
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "en_GB", inputSequence: "Hellohowareyou?", outputText: "Hello how are you?" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "fr_FR", inputSequence: "Bonjour", outputText: "Bonjour" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "da_DK", inputSequence: "Hej", outputText: "Hej" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "de_DE", inputSequence: "Hallo", outputText: "Hallo" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "es_ES", inputSequence: "Hola", outputText: "Hola" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "et_EE", inputSequence: "Tere", outputText: "Tere" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "hr_HR", inputSequence: "Zdravo", outputText: "Zdravo" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "it_IT", inputSequence: "Ciao", outputText: "Ciao" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "cs_CZ", inputSequence: "Ahoj", outputText: "Ahoj" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "bg_BG", inputSequence: "\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438", outputText: "\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "\u4e2d\u6587", outputText: "\u4e2d\u6587" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "zh_TW", inputSequence: "\u570b", outputText: "\u570b" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "ja_JP", inputSequence: "\u65E5\u672C\u8A9E", outputText: "\u65E5\u672C\u8A9E" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "ko_KR", inputSequence: "\uD55C\uAD6D\uC5B4", outputText: "\uD55C\uAD6D\uC5B4" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "el_GR", inputSequence: "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC", outputText: "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "he_IL", inputSequence: "\u05D0\u05D5\u05D8\u05D5", outputText: "\u05D0\u05D5\u05D8\u05D5" },
+ ]
+ }
+
+ function test_superimposedHwrInputSequence(data) {
+ prepareTest(data, true)
+
+ if (!inputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for non-Superimposed Handwriting")
for (var i = 0; i < data.toggleShiftCount; i++) {
inputPanel.toggleShift()
@@ -1151,6 +1305,7 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
}
+ wait(2000)
if (inputPanel.wordCandidateView.count > 0) {
if (inputPanel.selectionListSearchSuggestion(data.outputText)) {
@@ -1177,7 +1332,10 @@ Rectangle {
}
function test_hwrNumericInputSequence(data) {
- prepareTest(data)
+ prepareTest(data, true)
+
+ if (inputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for Superimposed Handwriting")
for (var inputIndex in data.inputSequence) {
verify(inputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
@@ -1201,25 +1359,20 @@ Rectangle {
function test_hwrSpellCorrectionSuggestions_data() {
return [
- { initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "bello", unexpectedSuggestion: "Hello", outputText: "Bello" },
- { initInputMethodHints: Qt.ImhNone, inputSequence: "bello", expectedSuggestion: "Hello", outputText: "Hello" },
- { initText: "Hello", initInputMethodHints: Qt.ImhNone, inputSequence: "worla", expectedSuggestion: "world", outputText: "Helloworld" },
- { initText: "isn'", initInputMethodHints: Qt.ImhNone, inputSequence: "t", outputText: "isn't" },
- { initInputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase, inputSequence: "www.example.com", expectedSuggestion: "www.example.com", outputText: "www.example.com" },
- { initInputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase, inputSequence: "user.name@example.com", expectedSuggestion: "user.name@example.com", outputText: "user.name@example.com" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "bello", unexpectedSuggestion: "Hello", outputText: "Bello" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, inputSequence: "bello", expectedSuggestion: "Hello", outputText: "Hello" },
+ { initHwrMode: true, initText: "Hello", initInputMethodHints: Qt.ImhNone, inputSequence: "worla", expectedSuggestion: "world", outputText: "Helloworld" },
+ { initHwrMode: true, initText: "isn'", initInputMethodHints: Qt.ImhNone, inputSequence: "t", outputText: "isn't" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase, inputSequence: "www.example.com", expectedSuggestion: "www.example.com", outputText: "www.example.com" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase, inputSequence: "user.name@example.com", expectedSuggestion: "user.name@example.com", outputText: "user.name@example.com" },
]
}
function test_hwrSpellCorrectionSuggestions(data) {
- if (Qt.platform.pluginName === "offscreen") {
- skip("QTBUG-65507");
- }
-
- prepareTest(data)
+ prepareTest(data, true)
- if (!inputPanel.setHandwritingMode(true))
- expectFail("", "Handwriting not enabled")
- verify(inputPanel.handwritingMode === true)
+ if (inputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for Superimposed Handwriting")
for (var inputIndex in data.inputSequence) {
verify(inputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
@@ -1245,27 +1398,73 @@ Rectangle {
function test_hwrFullScreenInputSequence_data() {
return [
- { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 0, inputSequence: "abcdefghij", outputText: "Abcdefghij" },
- { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 1, inputSequence: "klmnopqrst", outputText: "klmnopqrst" },
- { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 3, inputSequence: "uvwxyz", outputText: "UVWXYZ" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 0, inputSequence: "abcdefghij", outputText: "Abcdefghij" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 1, inputSequence: "klmnopqrst", outputText: "klmnopqrst" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 3, inputSequence: "uvwxyz", outputText: "UVWXYZ" },
]
}
function test_hwrFullScreenInputSequence(data) {
- prepareTest(data)
+ prepareTest(data, true)
+
+ handwritingInputPanel.available = true
+ verify(inputPanel.visible === false)
+
+ if (inputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for Superimposed Handwriting")
+
+ for (var i = 0; i < data.toggleShiftCount; i++) {
+ inputPanel.toggleShift()
+ }
+ for (var inputIndex in data.inputSequence) {
+ verify(handwritingInputPanel.emulateHandwriting(data.inputSequence[inputIndex], true))
+ }
+
+ if (handwritingInputPanel.wordCandidatePopupListSearchSuggestion(data.outputText)) {
+ handwritingInputPanel.wordCandidatePopupListSelectCurrentItem()
+ }
+
+ Qt.inputMethod.commit()
+ compare(textInput.text, data.outputText)
+ }
+
+ function test_superimposedHwrFullScreenInputSequence_data() {
+ return [
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "en_GB", inputSequence: "Hellohowareyou", outputText: "Hello how are you" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "fr_FR", inputSequence: "Bonjour", outputText: "Bonjour" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "da_DK", inputSequence: "Hej", outputText: "Hej" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "de_DE", inputSequence: "Hallo", outputText: "Hallo" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "es_ES", inputSequence: "Hola", outputText: "Hola" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "et_EE", inputSequence: "Tere", outputText: "Tere" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "hr_HR", inputSequence: "Zdravo", outputText: "Zdravo" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "it_IT", inputSequence: "Ciao", outputText: "Ciao" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "cs_CZ", inputSequence: "Ahoj", outputText: "Ahoj" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "bg_BG", inputSequence: "\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438", outputText: "\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "\u4e2d\u6587", outputText: "\u4e2d\u6587" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "zh_TW", inputSequence: "\u570b", outputText: "\u570b" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "ja_JP", inputSequence: "\u65E5\u672C\u8A9E", outputText: "\u65E5\u672C\u8A9E" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "ko_KR", inputSequence: "\uD55C\uAD6D\uC5B4", outputText: "\uD55C\uAD6D\uC5B4" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "el_GR", inputSequence: "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC", outputText: "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "he_IL", inputSequence: "\u05D0\u05D5\u05D8\u05D5", outputText: "\u05D0\u05D5\u05D8\u05D5" },
+ ]
+ }
+
+ function test_superimposedHwrFullScreenInputSequence(data) {
+ prepareTest(data, true)
- if (!handwritingInputPanel.enabled)
- expectFail("", "Handwriting not enabled")
- verify(handwritingInputPanel.enabled)
handwritingInputPanel.available = true
verify(inputPanel.visible === false)
+ if (!inputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for non-Superimposed Handwriting")
+
for (var i = 0; i < data.toggleShiftCount; i++) {
inputPanel.toggleShift()
}
for (var inputIndex in data.inputSequence) {
verify(handwritingInputPanel.emulateHandwriting(data.inputSequence[inputIndex], true))
}
+ wait(2000)
if (handwritingInputPanel.wordCandidatePopupListSearchSuggestion(data.outputText)) {
handwritingInputPanel.wordCandidatePopupListSelectCurrentItem()
@@ -1277,22 +1476,22 @@ Rectangle {
function test_hwrFullScreenNumericInputSequence_data() {
return [
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhPreferNumbers, inputSequence: "0123456789", outputText: "0123456789" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDigitsOnly, inputSequence: "1234567890", outputText: "1234567890" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhFormattedNumbersOnly, inputSequence: "1234567890+", outputText: "1234567890+" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDialableCharactersOnly, inputSequence: "1234567890+", outputText: "1234567890+" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhPreferNumbers, inputSequence: "0123456789", outputText: "0123456789" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDigitsOnly, inputSequence: "1234567890", outputText: "1234567890" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhFormattedNumbersOnly, inputSequence: "1234567890+", outputText: "1234567890+" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDialableCharactersOnly, inputSequence: "1234567890+", outputText: "1234567890+" },
]
}
function test_hwrFullScreenNumericInputSequence(data) {
- prepareTest(data)
+ prepareTest(data, true)
- if (!handwritingInputPanel.enabled)
- expectFail("", "Handwriting not enabled")
- verify(handwritingInputPanel.enabled)
handwritingInputPanel.available = true
verify(inputPanel.visible === false)
+ if (handwritingInputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for Superimposed Handwriting")
+
for (var inputIndex in data.inputSequence) {
verify(handwritingInputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
}
@@ -1307,20 +1506,20 @@ Rectangle {
function test_hwrFullScreenGestures_data() {
return [
- { initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: ["a","b","c",Qt.Key_Backspace,Qt.Key_Space,"c"], outputText: "Ab c" },
+ { initHwrMode: true, initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: ["a","b","c",Qt.Key_Backspace,Qt.Key_Space,"c"], outputText: "Ab c" },
{ initHwrMode: true, initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", initInputMode: "ChineseHandwriting", inputSequence: ["\u4e2d", "\u6587", Qt.Key_Backspace], outputText: "\u4e2d" },
]
}
function test_hwrFullScreenGestures(data) {
- prepareTest(data)
+ prepareTest(data, true)
- if (!handwritingInputPanel.enabled)
- expectFail("", "Handwriting not enabled")
- verify(handwritingInputPanel.enabled)
handwritingInputPanel.available = true
verify(inputPanel.visible === false)
+ if (handwritingInputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for Superimposed Handwriting")
+
for (var inputIndex in data.inputSequence) {
verify(handwritingInputPanel.emulateHandwriting(data.inputSequence[inputIndex], true))
}
@@ -1331,23 +1530,23 @@ Rectangle {
function test_hwrFullScreenWordCandidatePopup_data() {
return [
- { inputSequence: "hello", initLinesToBottom: 0, popupFlipped: true },
- { inputSequence: "hello", initLinesToBottom: 2, popupFlipped: true },
- { inputSequence: "hello", initLinesToBottom: 4, popupFlipped: false },
- { inputSequence: "hello", initLinesToBottom: 5, popupFlipped: false },
+ { initHwrMode: true, inputSequence: "hello", initLinesToBottom: 0, popupFlipped: true },
+ { initHwrMode: true, inputSequence: "hello", initLinesToBottom: 2, popupFlipped: true },
+ { initHwrMode: true, inputSequence: "hello", initLinesToBottom: 4, popupFlipped: false },
+ { initHwrMode: true, inputSequence: "hello", initLinesToBottom: 5, popupFlipped: false },
]
}
function test_hwrFullScreenWordCandidatePopup(data) {
- prepareTest(data)
+ prepareTest(data, true)
- if (!handwritingInputPanel.enabled)
- expectFail("", "Handwriting not enabled")
- verify(handwritingInputPanel.enabled)
handwritingInputPanel.available = true
if (!inputPanel.wordCandidateListVisibleHint)
skip("Word candidates not available (spell correction/hwr suggestions)")
+ if (handwritingInputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for Superimposed Handwriting")
+
var numAddedLines = Math.floor(textInput.height / Qt.inputMethod.cursorRectangle.height - data.initLinesToBottom) - 1
for (var i = 0; i < numAddedLines; i++) {
textInput.insert(textInput.length, "\n")
@@ -1456,41 +1655,41 @@ Rectangle {
function test_hwrWordReselection_data() {
return [
- { initText: "hello", clickPositions: [5], expectedPreeditText: "", expectedCursorPosition: 5, expectedText: "hello" },
- { initText: "hello", clickPositions: [4], expectedPreeditText: "hello", expectedCursorPosition: 0, expectedText: "" },
- { initText: "hello", clickPositions: [1], expectedPreeditText: "hello", expectedCursorPosition: 0, expectedText: "" },
- { initText: "hello", clickPositions: [0], expectedPreeditText: "", expectedCursorPosition: 0, expectedText: "hello" },
- { initText: "hello", clickPositions: [4, 3], expectedPreeditText: "hel", expectedCursorPosition: 0, expectedText: "lo" },
+ { initHwrMode: true, initText: "hello", clickPositions: [5], expectedPreeditText: "", expectedCursorPosition: 5, expectedText: "hello" },
+ { initHwrMode: true, initText: "hello", clickPositions: [4], expectedPreeditText: "hello", expectedCursorPosition: 0, expectedText: "" },
+ { initHwrMode: true, initText: "hello", clickPositions: [1], expectedPreeditText: "hello", expectedCursorPosition: 0, expectedText: "" },
+ { initHwrMode: true, initText: "hello", clickPositions: [0], expectedPreeditText: "", expectedCursorPosition: 0, expectedText: "hello" },
+ { initHwrMode: true, initText: "hello", clickPositions: [4, 3], expectedPreeditText: "hel", expectedCursorPosition: 0, expectedText: "lo" },
// 5
- { initText: "hello", clickPositions: [4, 2], expectedPreeditText: "he", expectedCursorPosition: 0, expectedText: "llo" },
- { initText: "hello", clickPositions: [4, 1], expectedPreeditText: "h", expectedCursorPosition: 0, expectedText: "ello" },
- { initText: "hello", clickPositions: [4, 0], expectedPreeditText: "", expectedCursorPosition: 0, expectedText: "hello" },
- { initText: "hello", clickPositions: [1, 2], expectedPreeditText: "he", expectedCursorPosition: 0, expectedText: "llo" },
- { initText: "hello", clickPositions: [1, 2, 2], expectedPreeditText: "", expectedCursorPosition: 2, expectedText: "hello" },
+ { initHwrMode: true, initText: "hello", clickPositions: [4, 2], expectedPreeditText: "he", expectedCursorPosition: 0, expectedText: "llo" },
+ { initHwrMode: true, initText: "hello", clickPositions: [4, 1], expectedPreeditText: "h", expectedCursorPosition: 0, expectedText: "ello" },
+ { initHwrMode: true, initText: "hello", clickPositions: [4, 0], expectedPreeditText: "", expectedCursorPosition: 0, expectedText: "hello" },
+ { initHwrMode: true, initText: "hello", clickPositions: [1, 2], expectedPreeditText: "he", expectedCursorPosition: 0, expectedText: "llo" },
+ { initHwrMode: true, initText: "hello", clickPositions: [1, 2, 2], expectedPreeditText: "", expectedCursorPosition: 2, expectedText: "hello" },
// 10
- { initText: "hello", clickPositions: [1, 5], expectedPreeditText: "", expectedCursorPosition: 5, expectedText: "hello" },
- { initText: "hel-lo", clickPositions: [3], expectedPreeditText: "hel-lo", expectedCursorPosition: 0, expectedText: "" },
- { initText: "hel-lo", clickPositions: [4], expectedPreeditText: "hel-lo", expectedCursorPosition: 0, expectedText: "" },
- { initText: "hel-lo", clickPositions: [4, 4], expectedPreeditText: "", expectedCursorPosition: 4, expectedText: "hel-lo" },
- { initText: "hel-lo", clickPositions: [5], expectedPreeditText: "hel-lo", expectedCursorPosition: 0, expectedText: "" },
+ { initHwrMode: true, initText: "hello", clickPositions: [1, 5], expectedPreeditText: "", expectedCursorPosition: 5, expectedText: "hello" },
+ { initHwrMode: true, initText: "hel-lo", clickPositions: [3], expectedPreeditText: "hel-lo", expectedCursorPosition: 0, expectedText: "" },
+ { initHwrMode: true, initText: "hel-lo", clickPositions: [4], expectedPreeditText: "hel-lo", expectedCursorPosition: 0, expectedText: "" },
+ { initHwrMode: true, initText: "hel-lo", clickPositions: [4, 4], expectedPreeditText: "", expectedCursorPosition: 4, expectedText: "hel-lo" },
+ { initHwrMode: true, initText: "hel-lo", clickPositions: [5], expectedPreeditText: "hel-lo", expectedCursorPosition: 0, expectedText: "" },
// 15
- { initText: "hel-lo", clickPositions: [5], initInputMethodHints: Qt.ImhNoPredictiveText, expectedPreeditText: "", expectedCursorPosition: 5, expectedText: "hel-lo" },
- { initText: "isn'", clickPositions: [2], expectedPreeditText: "isn", expectedCursorPosition: 0, expectedText: "'" },
- { initText: "isn't", clickPositions: [2], expectedPreeditText: "isn't", expectedCursorPosition: 0, expectedText: "" },
- { initText: "-hello", clickPositions: [2], expectedPreeditText: "hello", expectedCursorPosition: 1, expectedText: "-" },
- { initText: "aa http://www.example.com bb", clickPositions: [4], expectedPreeditText: "http", expectedCursorPosition: 3, expectedText: "aa ://www.example.com bb" },
+ { initHwrMode: true, initText: "hel-lo", clickPositions: [5], initInputMethodHints: Qt.ImhNoPredictiveText, expectedPreeditText: "", expectedCursorPosition: 5, expectedText: "hel-lo" },
+ { initHwrMode: true, initText: "isn'", clickPositions: [2], expectedPreeditText: "isn", expectedCursorPosition: 0, expectedText: "'" },
+ { initHwrMode: true, initText: "isn't", clickPositions: [2], expectedPreeditText: "isn't", expectedCursorPosition: 0, expectedText: "" },
+ { initHwrMode: true, initText: "-hello", clickPositions: [2], expectedPreeditText: "hello", expectedCursorPosition: 1, expectedText: "-" },
+ { initHwrMode: true, initText: "aa http://www.example.com bb", clickPositions: [4], expectedPreeditText: "http", expectedCursorPosition: 3, expectedText: "aa ://www.example.com bb" },
// 20
- { 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" },
+ { initHwrMode: true, initText: "aa http://www.example.com bb", initInputMethodHints: Qt.ImhUrlCharactersOnly, clickPositions: [4], expectedPreeditText: "http://www.example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
+ { initHwrMode: true, initText: "aa username@example.com bb", clickPositions: [4], expectedPreeditText: "username", expectedCursorPosition: 3, expectedText: "aa @example.com bb" },
+ { initHwrMode: true, initText: "aa username@example.com bb", initInputMethodHints: Qt.ImhEmailCharactersOnly, clickPositions: [4], expectedPreeditText: "username@example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
]
}
function test_hwrWordReselection(data) {
- prepareTest(data)
+ prepareTest(data, true)
- if (!inputPanel.setHandwritingMode(true))
- skip("Handwriting not enabled")
+ if (inputPanel.isSuperimposedHandwriting())
+ skip("Not valid test for Superimposed Handwriting")
var cursorRects = []
for (var i = 0; i < data.clickPositions.length; i++)
@@ -1878,5 +2077,67 @@ Rectangle {
compare(inputPanel.shadowInput.text, "")
}
+ function test_userDictionary_data() {
+ return [
+ { inputSequence: ['a','s','d','f'], initShift: false },
+ { 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'], 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'], 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"},
+ //
+ { 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 },
+ ]
+ }
+
+ function test_userDictionary(data) {
+ prepareTest(data, true)
+
+ if (!inputPanel.wordCandidateListVisibleHint)
+ skip("Prediction/spell correction not enabled")
+
+ if (data.hasOwnProperty("initShift"))
+ inputPanel.setShiftActive(data.initShift)
+ if (data.hasOwnProperty("initCapsLock"))
+ inputPanel.setCapsLockActive(data.initCapsLock)
+
+ for (var inputIndex in data.inputSequence)
+ inputPanel.virtualKeyClick(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))
+ verify(inputPanel.selectionListCurrentIndex() > 0)
+ if (data.hasOwnProperty("suggestionIsFromUserDictionary"))
+ compare(inputPanel.selectionListSuggestionIsFromUserDictionary(), data.suggestionIsFromUserDictionary)
+ if (data.hasOwnProperty("removeSuggestion") && data.removeSuggestion) {
+ verify(inputPanel.openWordCandidateContextMenu())
+ 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))
+ } 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))
+ compare(inputPanel.selectionListCurrentIndex(), oldIndex)
+ } else {
+ inputPanel.selectionListSelectCurrentItem()
+ }
+
+ Qt.inputMethod.reset()
+ }
}
}
diff --git a/tests/auto/inputpanel/hwr_test_data/korean/44397_100_0.txt b/tests/auto/inputpanel/hwr_test_data/korean/44397_100_0.txt
index cd2eab9b..16f1285e 100644
--- a/tests/auto/inputpanel/hwr_test_data/korean/44397_100_0.txt
+++ b/tests/auto/inputpanel/hwr_test_data/korean/44397_100_0.txt
@@ -8,114 +8,114 @@
.Y_POINTS_PER_INCH 94
.POINTS_PER_SECOND 60
.PEN_DOWN
-379 53 0
-380 53 155
-382 53 177
-385 53 179
-391 53 243
-400 53 244
-421 55 311
-437 55 313
-441 55 315
-448 55 365
-454 55 366
-461 55 370
-467 54 426
-472 54 427
-475 54 486
-477 54 487
-478 54 490
-479 54 548
-480 54 549
-482 54 610
-485 54 610
-488 54 670
-489 54 731
-489 55 939
-489 56 1003
-489 60 1004
-489 64 1064
-489 66 1065
-489 72 1124
-489 75 1125
-489 79 1131
-489 81 1184
-489 86 1185
-489 91 1245
-489 92 1246
-489 97 1306
-489 99 1307
-489 101 1366
-489 102 1367
-489 103 1427
-489 105 1429
-489 106 1500
-489 107 1549
-489 108 1550
-489 109 1614
+344 53 0
+345 53 155
+347 53 177
+350 53 179
+356 53 243
+365 53 244
+386 55 311
+402 55 313
+406 55 315
+413 55 365
+419 55 366
+426 55 370
+432 54 426
+437 54 427
+440 54 486
+442 54 487
+443 54 490
+444 54 548
+445 54 549
+447 54 610
+450 54 610
+453 54 670
+454 54 731
+454 55 939
+454 56 1003
+454 60 1004
+454 64 1064
+454 66 1065
+454 72 1124
+454 75 1125
+454 79 1131
+454 81 1184
+454 86 1185
+454 91 1245
+454 92 1246
+454 97 1306
+454 99 1307
+454 101 1366
+454 102 1367
+454 103 1427
+454 105 1429
+454 106 1500
+454 107 1549
+454 108 1550
+454 109 1614
.PEN_UP
.PEN_DOWN
-383 113 2999
-384 113 3259
-385 112 3291
-386 112 3360
-399 112 3361
-412 112 3389
-434 112 3449
-440 112 3450
-451 112 3451
-455 112 3510
-479 111 3511
-493 110 3574
-506 109 3576
-513 109 3632
-515 109 3633
-516 109 3636
+348 113 2999
+349 113 3259
+350 112 3291
+351 112 3360
+364 112 3361
+377 112 3389
+399 112 3449
+405 112 3450
+416 112 3451
+420 112 3510
+444 111 3511
+458 110 3574
+471 109 3576
+478 109 3632
+480 109 3633
+481 109 3636
.PEN_UP
.PEN_DOWN
-430 115 5767
-430 116 5851
-432 120 5884
-433 123 5937
-433 127 5938
-434 130 6000
-434 133 6002
-435 139 6058
-435 141 6059
-435 142 6124
-435 143 6523
+395 115 5767
+395 116 5851
+397 120 5884
+398 123 5937
+398 127 5938
+399 130 6000
+399 133 6002
+400 139 6058
+400 141 6059
+400 142 6124
+400 143 6523
.PEN_UP
.PEN_DOWN
-393 151 7943
-394 151 8099
-399 150 8124
-412 150 8184
-422 150 8185
-438 150 8245
-448 150 8246
-465 149 8305
-478 149 8306
-485 149 8366
-487 149 8366
-488 149 8432
-489 149 8490
-491 149 8492
-492 149 8549
-492 150 8835
-492 152 8882
-492 155 8883
-492 159 8944
-492 163 8945
-492 168 9005
-491 173 9005
-491 177 9067
-490 182 9068
-490 188 9126
-490 192 9126
-490 193 9130
-490 196 9188
-490 198 9247
-490 200 9247
-490 202 9307
-490 203 9308
+358 151 7943
+359 151 8099
+364 150 8124
+377 150 8184
+387 150 8185
+403 150 8245
+413 150 8246
+430 149 8305
+443 149 8306
+450 149 8366
+452 149 8366
+453 149 8432
+454 149 8490
+456 149 8492
+457 149 8549
+457 150 8835
+457 152 8882
+457 155 8883
+457 159 8944
+457 163 8945
+457 168 9005
+456 173 9005
+456 177 9067
+455 182 9068
+455 188 9126
+455 192 9126
+455 193 9130
+455 196 9188
+455 198 9247
+455 200 9247
+455 202 9307
+455 203 9308
.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/korean/50612_100_0.txt b/tests/auto/inputpanel/hwr_test_data/korean/50612_100_0.txt
index fd22d87d..03a24576 100644
--- a/tests/auto/inputpanel/hwr_test_data/korean/50612_100_0.txt
+++ b/tests/auto/inputpanel/hwr_test_data/korean/50612_100_0.txt
@@ -67,27 +67,31 @@
622 121 2840
623 121 2957
624 121 3045
-625 120 3236
+625 121 3096
+626 121 3155
+628 121 3199
+629 121 3254
+631 121 3310
.PEN_UP
.PEN_DOWN
-614 42 3848
-614 45 3896
-614 47 3897
-614 54 3900
-615 63 3958
-617 76 3958
-619 92 4017
-620 100 4018
-620 115 4078
-620 133 4079
-618 141 4084
-616 153 4138
-616 157 4139
-615 169 4200
-614 176 4201
-614 178 4205
-613 184 4260
-613 188 4261
-613 190 4420
-613 191 4540
+626 42 3848
+626 45 3896
+626 47 3897
+626 54 3900
+627 63 3958
+629 76 3958
+631 92 4017
+632 100 4018
+632 115 4078
+632 133 4079
+630 141 4084
+628 153 4138
+628 157 4139
+627 169 4200
+626 176 4201
+626 178 4205
+625 184 4260
+625 188 4261
+625 190 4420
+625 191 4540
.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/korean/54620_100_0.txt b/tests/auto/inputpanel/hwr_test_data/korean/54620_100_0.txt
index 99f6f912..25488a30 100644
--- a/tests/auto/inputpanel/hwr_test_data/korean/54620_100_0.txt
+++ b/tests/auto/inputpanel/hwr_test_data/korean/54620_100_0.txt
@@ -8,152 +8,152 @@
.Y_POINTS_PER_INCH 94
.POINTS_PER_SECOND 60
.PEN_DOWN
-169 59 0
-171 59 148
-175 59 170
-183 59 228
-197 59 229
-210 59 288
-223 61 289
-233 61 292
-241 61 350
-252 62 350
-260 62 418
-265 62 419
-266 62 748
+224 27 0
+223 27 148
+222 34 170
+222 39 228
+223 46 229
+223 47 288
+223 50 289
+224 53 292
+224 56 350
+224 57 350
+225 59 418
+225 61 419
+225 62 748
.PEN_UP
.PEN_DOWN
-224 27 1367
-223 27 1414
-222 34 1444
-222 39 1502
-223 46 1503
-223 47 1508
-223 50 1566
-224 53 1568
-224 56 1629
-224 57 1630
-225 59 1630
-225 61 1686
-225 62 1687
+169 59 1367
+171 59 1414
+175 59 1444
+183 59 1502
+197 59 1503
+210 59 1508
+223 61 1566
+233 61 1568
+241 61 1629
+252 62 1630
+260 62 1630
+265 62 1686
+266 62 1687
.PEN_UP
.PEN_DOWN
-244 82 3184
-243 81 3259
-242 81 3285
-238 80 3349
-225 80 3350
-210 80 3412
-198 82 3414
-192 84 3474
-186 88 3476
-184 90 3478
-180 95 3532
-178 100 3533
-178 109 3595
-178 117 3598
-181 125 3657
-186 130 3658
-194 136 3716
-197 137 3717
-199 137 3775
-202 137 3776
-204 137 3780
-206 137 3835
-223 135 3836
-234 133 3897
-240 130 3898
-242 129 3900
-244 128 3958
-251 120 3959
-253 117 4017
-253 114 4020
-253 110 4081
-251 104 4083
-249 99 4140
-247 95 4141
-243 89 4205
-242 86 4206
-242 85 4212
-241 84 4284
-240 84 4324
-239 84 4596
+244 82 2184
+243 81 2259
+242 81 2285
+238 80 2349
+225 80 2350
+210 80 2412
+198 82 2414
+192 84 2474
+186 88 2476
+184 90 2478
+180 95 2532
+178 100 2533
+178 109 2595
+178 117 2598
+181 125 2657
+186 130 2658
+194 136 2716
+197 137 2717
+199 137 2775
+202 137 2776
+204 137 2780
+206 137 2835
+223 135 2836
+234 133 2897
+240 130 2898
+242 129 2900
+244 128 2958
+251 120 2959
+253 117 3017
+253 114 3020
+253 110 3081
+251 104 3083
+249 99 3140
+247 95 3141
+243 89 3205
+242 86 3206
+242 85 3212
+241 84 3284
+240 84 3324
+239 84 3596
.PEN_UP
.PEN_DOWN
-177 144 6344
-178 144 6573
-178 146 6600
-179 148 6604
-179 150 6657
-180 153 6658
-181 160 6719
-182 167 6720
-183 176 6779
-184 182 6780
-184 185 6840
-185 189 6841
-186 189 7108
-195 189 7174
-206 187 7234
-213 186 7236
-219 186 7294
-224 186 7296
-233 186 7355
-241 185 7355
-252 185 7417
-262 185 7419
-268 186 7421
-276 186 7475
-281 186 7476
-289 186 7536
-290 186 7537
-291 186 7597
-292 186 7660
-293 186 7724
-294 186 7725
-295 186 8172
+283 25 4344
+283 26 4573
+283 27 4600
+283 33 4604
+283 41 4657
+282 53 4658
+282 65 4719
+282 78 4720
+282 92 4779
+281 115 4780
+280 124 4840
+279 133 4841
+279 135 5108
+278 142 5174
+277 148 5234
+277 150 5236
+277 151 5294
+277 153 5296
+277 154 5355
+277 153 5355
+277 151 5417
.PEN_UP
.PEN_DOWN
-283 25 9136
-283 26 9220
-283 27 9244
-283 33 9299
-283 41 9300
-282 53 9359
-282 65 9359
-282 78 9420
-282 92 9421
-281 115 9481
-280 124 9482
-279 133 9484
-279 135 9542
-278 142 9542
-277 148 9605
-277 150 9607
-277 151 9764
-277 153 9816
-277 154 9876
-277 153 10124
-277 151 10180
+282 89 6136
+283 89 6220
+286 89 6244
+288 88 6299
+291 88 6300
+294 88 6359
+295 88 6359
+297 88 6420
+298 88 6421
+299 88 6481
+300 88 6482
+301 88 6484
+302 88 6542
+303 88 6542
+304 88 6605
+305 88 6607
+306 88 6764
+307 88 6816
+309 89 6876
.PEN_UP
.PEN_DOWN
-282 89 10651
-283 89 10796
-286 89 10821
-288 88 10879
-291 88 10879
-294 88 10941
-295 88 10941
-297 88 11003
-298 88 11004
-299 88 11061
-300 88 11062
-301 88 11121
-302 88 11123
-303 88 11185
-304 88 11187
-305 88 11189
-306 88 11248
-307 88 11249
-309 89 11304
+177 144 7651
+178 144 7796
+178 146 7821
+179 148 7879
+179 150 7879
+180 153 7941
+181 160 7941
+182 167 8003
+183 176 8004
+184 182 8061
+184 185 8062
+185 189 8121
+186 189 8123
+195 189 8185
+206 187 8187
+213 186 8189
+219 186 8248
+224 186 8249
+233 186 8304
+241 185 8304
+252 185 8366
+262 185 8368
+268 186 8370
+276 186 8424
+281 186 8425
+289 186 8485
+290 186 8486
+291 186 8546
+292 186 8609
+293 186 8673
+294 186 8674
+295 186 8738
.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/vietnamese/103_100_0.txt b/tests/auto/inputpanel/hwr_test_data/vietnamese/103_100_0.txt
new file mode 100644
index 00000000..7208d774
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/vietnamese/103_100_0.txt
@@ -0,0 +1,89 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 1032
+.Y_DIM 263
+.X_POINTS_PER_INCH 94
+.Y_POINTS_PER_INCH 94
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+493 87 0
+492 86 57
+488 84 87
+484 83 150
+480 83 152
+473 83 212
+462 85 215
+454 89 271
+452 92 273
+451 94 274
+449 99 332
+445 109 333
+443 114 337
+442 120 394
+442 132 395
+442 144 455
+444 159 458
+446 167 522
+448 175 524
+450 178 577
+450 179 578
+451 180 640
+454 181 642
+455 182 699
+456 183 701
+460 185 760
+463 185 762
+466 186 823
+469 186 825
+474 183 883
+487 179 884
+496 173 944
+502 162 945
+509 144 1011
+514 133 1013
+514 124 1069
+514 118 1070
+514 113 1073
+512 108 1125
+509 100 1125
+507 97 1185
+506 94 1186
+506 92 1247
+505 90 1248
+504 89 1310
+504 88 1312
+504 90 1571
+506 95 1616
+507 101 1618
+511 117 1675
+512 130 1676
+514 145 1738
+514 158 1740
+514 165 1797
+514 177 1799
+514 182 1802
+514 187 1860
+513 193 1862
+513 198 1922
+512 200 1924
+512 202 1981
+512 206 1983
+511 207 2043
+511 209 2044
+511 211 2045
+511 212 2050
+511 214 2106
+510 217 2167
+510 218 2169
+508 220 2170
+507 222 2228
+503 226 2230
+500 227 2234
+499 229 2290
+491 232 2293
+480 233 2349
+466 234 2350
+458 235 2411
+.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/vietnamese/105_100_0.txt b/tests/auto/inputpanel/hwr_test_data/vietnamese/105_100_0.txt
new file mode 100644
index 00000000..f8df0a97
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/vietnamese/105_100_0.txt
@@ -0,0 +1,41 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 1032
+.Y_DIM 263
+.X_POINTS_PER_INCH 94
+.Y_POINTS_PER_INCH 94
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+255 93 0
+255 95 75
+255 97 92
+255 103 123
+255 105 124
+255 111 184
+255 125 185
+255 131 186
+255 138 245
+255 147 247
+256 153 306
+256 154 308
+256 155 366
+256 156 431
+256 158 432
+256 159 489
+256 160 490
+256 161 836
+256 162 885
+256 164 952
+256 165 954
+256 166 1007
+256 167 1143
+256 168 1188
+256 169 1249
+257 170 1309
+257 171 1400
+.PEN_UP
+.PEN_DOWN
+252 71 2545
+.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/vietnamese/105_100_1.txt b/tests/auto/inputpanel/hwr_test_data/vietnamese/105_100_1.txt
new file mode 100644
index 00000000..ce79ff6b
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/vietnamese/105_100_1.txt
@@ -0,0 +1,29 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 1032
+.Y_DIM 263
+.X_POINTS_PER_INCH 94
+.Y_POINTS_PER_INCH 94
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+538 83 0
+538 86 83
+538 88 96
+538 92 147
+538 105 148
+538 129 203
+537 141 204
+534 170 264
+532 182 265
+532 191 327
+532 197 329
+532 198 388
+532 200 390
+532 198 764
+532 194 812
+.PEN_UP
+.PEN_DOWN
+533 58 1292
+.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/vietnamese/110_100_0.txt b/tests/auto/inputpanel/hwr_test_data/vietnamese/110_100_0.txt
new file mode 100644
index 00000000..ead63891
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/vietnamese/110_100_0.txt
@@ -0,0 +1,82 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 1032
+.Y_DIM 263
+.X_POINTS_PER_INCH 94
+.Y_POINTS_PER_INCH 94
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+400 82 0
+400 83 85
+400 85 96
+400 96 153
+401 103 156
+402 113 157
+402 124 215
+402 147 217
+402 161 221
+402 173 275
+402 188 278
+400 198 342
+399 202 344
+399 204 345
+399 205 396
+399 204 526
+399 200 580
+399 191 582
+399 185 641
+401 170 643
+402 162 644
+403 153 701
+404 132 703
+407 118 761
+409 109 763
+411 104 764
+414 99 824
+415 98 827
+417 95 884
+418 93 886
+419 93 1125
+420 93 1183
+422 92 1185
+423 92 1216
+425 91 1277
+426 91 1337
+427 91 1338
+428 91 1340
+432 94 1399
+434 96 1400
+437 102 1430
+439 105 1460
+442 115 1461
+444 126 1520
+446 137 1521
+447 148 1581
+447 153 1582
+447 159 1642
+447 165 1643
+447 166 1645
+447 172 1703
+446 177 1764
+446 179 1765
+446 180 1853
+446 181 1891
+446 183 1947
+446 185 1950
+446 186 2007
+446 188 2008
+446 189 2069
+445 191 2070
+445 192 2131
+445 193 2193
+445 194 2195
+445 195 2413
+445 196 2477
+445 197 2527
+445 198 2528
+445 199 2587
+445 200 2588
+445 201 2648
+.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/vietnamese/116_100_0.txt b/tests/auto/inputpanel/hwr_test_data/vietnamese/116_100_0.txt
new file mode 100644
index 00000000..dc06a8b8
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/vietnamese/116_100_0.txt
@@ -0,0 +1,72 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 1032
+.Y_DIM 263
+.X_POINTS_PER_INCH 94
+.Y_POINTS_PER_INCH 94
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+639 167 0
+640 167 50
+640 164 76
+645 154 136
+653 135 137
+662 108 203
+666 87 205
+666 73 257
+666 67 259
+666 62 318
+666 60 319
+666 58 380
+665 57 381
+665 56 440
+664 57 505
+664 58 507
+663 61 561
+663 66 562
+662 75 622
+661 86 623
+660 98 688
+659 111 689
+659 114 690
+659 121 745
+659 132 746
+659 141 805
+659 149 806
+659 158 868
+660 161 870
+661 164 929
+661 165 990
+662 166 992
+663 167 1131
+663 165 1483
+663 159 1535
+664 156 1536
+664 151 1538
+665 146 1595
+666 136 1596
+666 127 1659
+666 116 1662
+665 111 1667
+663 105 1723
+656 96 1724
+652 93 1781
+648 92 1783
+643 90 1786
+639 89 1840
+633 88 1841
+632 87 1971
+632 86 2023
+636 85 2023
+641 84 2024
+647 82 2026
+655 81 2084
+668 79 2085
+682 77 2148
+686 77 2150
+688 77 2154
+689 77 2211
+690 77 2267
+.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/vietnamese/7871_100_0.txt b/tests/auto/inputpanel/hwr_test_data/vietnamese/7871_100_0.txt
new file mode 100644
index 00000000..70f7d412
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/vietnamese/7871_100_0.txt
@@ -0,0 +1,88 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 1032
+.Y_DIM 263
+.X_POINTS_PER_INCH 94
+.Y_POINTS_PER_INCH 94
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+294 112 0
+297 112 117
+299 113 134
+305 114 141
+311 115 176
+318 115 177
+325 116 237
+330 116 238
+340 116 297
+350 116 299
+352 116 358
+352 111 360
+353 104 419
+353 98 420
+353 94 481
+347 87 483
+337 81 541
+334 79 543
+330 78 572
+329 78 606
+320 78 607
+314 78 662
+303 80 663
+301 82 667
+299 84 723
+292 93 725
+289 97 783
+284 108 786
+282 114 788
+282 121 843
+282 134 845
+285 145 903
+288 153 906
+292 159 966
+293 161 968
+295 165 972
+296 165 1026
+299 168 1027
+304 170 1092
+311 173 1093
+314 173 1095
+323 174 1151
+331 175 1153
+343 176 1213
+353 176 1215
+357 175 1273
+359 172 1275
+359 171 1334
+360 171 2556
+.PEN_UP
+.PEN_DOWN
+306 67 3105
+306 64 3162
+307 63 3164
+309 62 3219
+314 56 3221
+320 47 3281
+323 43 3283
+325 40 3285
+326 40 3412
+327 41 3462
+327 43 3463
+328 47 3467
+329 51 3522
+330 59 3523
+330 62 3586
+331 62 4012
+.PEN_UP
+.PEN_DOWN
+338 62 4380
+340 62 4443
+343 59 4471
+348 56 4532
+352 51 4535
+355 47 4593
+356 45 4594
+357 44 4595
+.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/vietnamese/7879_100_0.txt b/tests/auto/inputpanel/hwr_test_data/vietnamese/7879_100_0.txt
new file mode 100644
index 00000000..c4d988de
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/vietnamese/7879_100_0.txt
@@ -0,0 +1,71 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 1032
+.Y_DIM 263
+.X_POINTS_PER_INCH 94
+.Y_POINTS_PER_INCH 94
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+561 107 0
+564 107 60
+571 109 76
+583 109 128
+608 111 129
+620 111 186
+632 109 187
+634 106 188
+635 100 246
+632 93 246
+624 87 306
+619 86 307
+614 85 308
+608 85 367
+594 87 368
+587 90 371
+582 94 437
+564 110 438
+559 117 489
+554 132 490
+554 149 550
+559 161 551
+562 164 611
+568 166 612
+576 167 672
+605 168 674
+622 168 733
+625 167 794
+626 167 795
+627 166 857
+628 166 1029
+.PEN_UP
+.PEN_DOWN
+583 57 4161
+584 57 4229
+588 53 4231
+592 49 4288
+595 45 4289
+599 42 4351
+600 42 4353
+601 41 4411
+602 40 4476
+603 39 4749
+604 38 4836
+605 38 4895
+606 38 4900
+607 38 5005
+608 38 5149
+609 38 5198
+609 39 5199
+613 51 5260
+615 59 5261
+616 65 5320
+617 68 5321
+617 69 5323
+617 70 5382
+618 71 5383
+.PEN_UP
+.PEN_DOWN
+594 188 6585
+.PEN_UP
diff --git a/tests/auto/inputpanel/tst_inputpanel.cpp b/tests/auto/inputpanel/tst_inputpanel.cpp
index 8b84f67b..409383c7 100644
--- a/tests/auto/inputpanel/tst_inputpanel.cpp
+++ b/tests/auto/inputpanel/tst_inputpanel.cpp
@@ -29,7 +29,22 @@
#include <QtQuickTest/quicktest.h>
#include <QByteArray>
+#include <QStandardPaths>
+#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();
+ }
+ return true;
+}
+static bool s_initStandardPaths = initStandardPaths();
QUICK_TEST_MAIN(inputpanel)
diff --git a/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml b/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
index e44e57b5..e58b8d66 100644
--- a/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
+++ b/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
@@ -32,5 +32,5 @@ import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
objectName: "en_GB"
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
}
diff --git a/tests/auto/layoutresources/data/layouts/en_GB/main.qml b/tests/auto/layoutresources/data/layouts/en_GB/main.qml
index e44e57b5..e58b8d66 100644
--- a/tests/auto/layoutresources/data/layouts/en_GB/main.qml
+++ b/tests/auto/layoutresources/data/layouts/en_GB/main.qml
@@ -32,5 +32,5 @@ import QtQuick.VirtualKeyboard 2.1
KeyboardLayout {
objectName: "en_GB"
- inputMode: InputEngine.Latin
+ inputMode: InputEngine.InputMode.Latin
}