diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2014-06-04 13:01:40 +0300 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2014-06-19 14:01:48 +0300 |
commit | 4a66c5293fd560daed88e817ad14241adfb7acd6 (patch) | |
tree | db3ab601ff11b09bce05902150309d4cec42b7a8 /src/virtualkeyboard/content/styles | |
parent | 16d6563f54f4dad947a645c23048eea8ddef3b35 (diff) |
Add PinyinInputMethod
Added new PinyinInputMethod which is using the PinyinIME engine as
backend. The PinyinIME is Apache 2.0 licensed.
https://android.googlesource.com/platform/packages/inputmethods/PinyinIME/
The pinyin input method is enabled by using CONFIG+=pinyin
configuration flag on the qmake command line.
Dictionaries
============
The pinyin engine uses two kinds of dictionaries: sys_dict and usr_dict.
The sys_dict is a pre-built dictionary containing a search model for
Chinese words. The sys_dict is built using the dictionary tool included
in the source tree.
The sys_dict is deployed in to the
$$[QT_INSTALL_DATA]/qtvirtualkeyboard/pinyin directory on the target
system. This path will become the default location where the dictionary
is searched in. The default location can be overridden by specifying
an alternative path to the dictionary file in an environment variable
QT_VIRTUALKEYBOARD_PINYIN_DICTIONARY.
The usr_dict contains custom lemmas which the user is most frequently
using. Initially, the usr_dict may not exist, in which case it is
automatically created.
The usr_dict is located at subdirectory qtvirtualkeyboard/pinyin
under the location returned by
QStandardPaths::writableLocation(QStandardPaths::ConfigLocation).
Usage
=====
The pinyin input mode is activated by changing the input locale to
zh_CN.
Chinese words are entered by typing the phonetic form of the Chinese
words and then selecting words from the selection list.
The first item in the selection list always contains the complete
phrase. By selecting the first item, the pinyin completes the entire
phrase and ends the current input. The user can also select the
entire phrase by pressing the space key.
The subsequent items in the selection list are the segments comprising
one or more Chinese words. By selecting segments of previously unknown
lemma, the input method learns this by adding a new entry to the
usr_dict. Once the user enters the same pinyin sequence again, the
input method can suggest the same phrase as the first or the second
item in the selection list.
The characters sequences, which are not valid pinyin spellings,
are displayed in lower case letters. The user can either delete
these characters by pressing the backspace key, or select and accept
them as input from the selection list.
After the user completes the phrase, or moves the cursor in the
text, the pinyin input can predict words by looking at text up to
3 characters in history. In prediction mode the user is not
required to select any items from the prediction list.
The user can enter plain latin characters by accepting the input
sequence with the return key.
Change-Id: I46bfc0df112a4d9c892222916cb7455132dd5059
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'src/virtualkeyboard/content/styles')
-rw-r--r-- | src/virtualkeyboard/content/styles/default/style.qml | 3 | ||||
-rw-r--r-- | src/virtualkeyboard/content/styles/retro/style.qml | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/virtualkeyboard/content/styles/default/style.qml b/src/virtualkeyboard/content/styles/default/style.qml index 51d2c1df..6b3e058b 100644 --- a/src/virtualkeyboard/content/styles/default/style.qml +++ b/src/virtualkeyboard/content/styles/default/style.qml @@ -21,6 +21,7 @@ import QtQuick.Enterprise.VirtualKeyboard 1.0 import QtQuick.Enterprise.VirtualKeyboard.Styles 1.0 KeyboardStyle { + readonly property bool pinyinMode: InputContext.inputEngine.inputMode === InputEngine.Pinyin readonly property string fontFamily: "Sans" readonly property real keyBackgroundMargin: Math.round(13 * scaleHint) readonly property real keyContentMargin: Math.round(45 * scaleHint) @@ -517,7 +518,7 @@ KeyboardStyle { Text { id: selectionListLabel anchors.left: parent.left - anchors.leftMargin: Math.round(140 * scaleHint) + anchors.leftMargin: Math.round((pinyinMode ? 50 : 140) * scaleHint) anchors.verticalCenter: parent.verticalCenter text: decorateText(display, wordCompletionLength) color: "#80c342" diff --git a/src/virtualkeyboard/content/styles/retro/style.qml b/src/virtualkeyboard/content/styles/retro/style.qml index 9b06d2d3..d8b7c586 100644 --- a/src/virtualkeyboard/content/styles/retro/style.qml +++ b/src/virtualkeyboard/content/styles/retro/style.qml @@ -21,6 +21,7 @@ import QtQuick.Enterprise.VirtualKeyboard 1.0 import QtQuick.Enterprise.VirtualKeyboard.Styles 1.0 KeyboardStyle { + readonly property bool pinyinMode: InputContext.inputEngine.inputMode === InputEngine.Pinyin readonly property string fontFamily: "Courier" readonly property real keyBackgroundMargin: Math.round(9 * scaleHint) readonly property real keyContentMargin: Math.round(50 * scaleHint) @@ -634,7 +635,7 @@ KeyboardStyle { Text { id: selectionListLabel anchors.left: parent.left - anchors.leftMargin: Math.round(140 * scaleHint) + anchors.leftMargin: Math.round((pinyinMode ? 50 : 140) * scaleHint) anchors.verticalCenter: parent.verticalCenter text: decorateText(display, wordCompletionLength) color: "white" |