diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2017-08-20 21:24:02 +0300 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2017-08-21 12:48:05 +0000 |
commit | d80646f8f11283ad4bd9996d5a59a1154e7f651d (patch) | |
tree | 22c2d8c8eeb72d1b186e122a67a1738bb49ed342 /src | |
parent | 4bd38e1de5a893a1cf6ba04686b2ff73077d61cb (diff) |
Add Farsi handwriting
[ChangeLog] Added Farsi handwriting.
Change-Id: I1bf25cbc7f36cf8ca3f0a44b7e217a55ed3aa13a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml | 116 | ||||
-rw-r--r-- | src/virtualkeyboard/content/layouts/fa_FA/main.qml | 10 | ||||
-rw-r--r-- | src/virtualkeyboard/content/styles/default/style.qml | 2 | ||||
-rw-r--r-- | src/virtualkeyboard/content/styles/retro/style.qml | 2 | ||||
-rw-r--r-- | src/virtualkeyboard/t9writeinputmethod.cpp | 4 | ||||
-rw-r--r-- | src/virtualkeyboard/virtualkeyboard.pro | 2 |
6 files changed, 132 insertions, 4 deletions
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml b/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml new file mode 100644 index 00000000..006df195 --- /dev/null +++ b/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml @@ -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$ +** +****************************************************************************/ + +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.Arabic + readonly property bool alphabeticInputMode: [InputEngine.Latin, InputEngine.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1 + + KeyboardRow { + Layout.preferredHeight: 3 + KeyboardColumn { + Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width + KeyboardRow { + TraceInputKey { + objectName: "hwrInputArea" + patternRecognitionMode: InputEngine.HandwritingRecoginition + horizontalRulers: + alphabeticInputMode ? [] : + [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3] + } + } + } + KeyboardColumn { + Layout.preferredWidth: hideKeyboardKey.width + KeyboardRow { + BackspaceKey {} + } + KeyboardRow { + EnterKey {} + } + KeyboardRow { + ShiftKey { } + } + } + } + KeyboardRow { + id: bottomRow + Layout.preferredHeight: 1 + keyWeight: 154 + InputModeKey { + weight: 217 + inputModeNameList: [ + "ABC", // InputEngine.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 + ] + } + ChangeLanguageKey { + weight: 154 + customLayoutsOnly: true + } + HandwritingModeKey { + weight: 154 + } + SpaceKey { + weight: 864 + } + Key { + key: alphabeticInputMode ? Qt.Key_Apostrophe : 0x060C + text: alphabeticInputMode ? "'" : "\u060C" + alternativeKeys: alphabeticInputMode ? "<>()#%&*/\\\"'=+-_" : "\"\u060C\u066B\u066C\u066D" + } + Key { + key: Qt.Key_Period + text: "." + alternativeKeys: alphabeticInputMode ? ":;,.?!" : ":\u061B.\u061F!" + } + HideKeyboardKey { + id: hideKeyboardKey + weight: 204 + } + } +} diff --git a/src/virtualkeyboard/content/layouts/fa_FA/main.qml b/src/virtualkeyboard/content/layouts/fa_FA/main.qml index 3681dd2b..e73665a8 100644 --- a/src/virtualkeyboard/content/layouts/fa_FA/main.qml +++ b/src/virtualkeyboard/content/layouts/fa_FA/main.qml @@ -28,10 +28,10 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.VirtualKeyboard 2.1 +import QtQuick.VirtualKeyboard 2.3 KeyboardLayoutLoader { - inputMode: InputEngine.Latin + inputMode: InputEngine.Arabic sourceComponent: InputContext.shift ? page2 : page1 Component { id: page1 @@ -166,6 +166,9 @@ KeyboardLayoutLoader { ChangeLanguageKey { weight: 154 } + HandwritingModeKey { + weight: 154 + } SpaceKey { weight: 864 } @@ -317,6 +320,9 @@ KeyboardLayoutLoader { ChangeLanguageKey { weight: 154 } + HandwritingModeKey { + weight: 154 + } SpaceKey { weight: 864 } diff --git a/src/virtualkeyboard/content/styles/default/style.qml b/src/virtualkeyboard/content/styles/default/style.qml index 595c7b79..a30bcb51 100644 --- a/src/virtualkeyboard/content/styles/default/style.qml +++ b/src/virtualkeyboard/content/styles/default/style.qml @@ -770,6 +770,8 @@ KeyboardStyle { case InputEngine.Cyrillic: return "АБВ" case InputEngine.Arabic: + if (InputContext.locale.substring(0, 2) === "fa") + return "\u0627\u200C\u0628\u200C\u067E" return "\u0623\u200C\u0628\u200C\u062C" case InputEngine.ChineseHandwriting: return "中文" diff --git a/src/virtualkeyboard/content/styles/retro/style.qml b/src/virtualkeyboard/content/styles/retro/style.qml index 888f4b50..16dfe7fc 100644 --- a/src/virtualkeyboard/content/styles/retro/style.qml +++ b/src/virtualkeyboard/content/styles/retro/style.qml @@ -884,6 +884,8 @@ KeyboardStyle { case InputEngine.Cyrillic: return "АБВ" case InputEngine.Arabic: + if (InputContext.locale.substring(0, 2) === "fa") + return "\u0627\u200C\u0628\u200C\u067E" return "\u0623\u200C\u0628\u200C\u062C" case InputEngine.ChineseHandwriting: return "中文" diff --git a/src/virtualkeyboard/t9writeinputmethod.cpp b/src/virtualkeyboard/t9writeinputmethod.cpp index 8479ae5a..baecbf47 100644 --- a/src/virtualkeyboard/t9writeinputmethod.cpp +++ b/src/virtualkeyboard/t9writeinputmethod.cpp @@ -639,7 +639,7 @@ public: } else if (language == DECUMA_LANG_SRCY) { if (inputMode != InputEngine::Cyrillic) language = DECUMA_LANG_SRLA; - } else if (language == DECUMA_LANG_AR) { + } else if (language == DECUMA_LANG_AR || language == DECUMA_LANG_FA) { if (inputMode != InputEngine::Arabic && inputMode != InputEngine::Numeric) language = DECUMA_LANG_EN; } @@ -703,7 +703,7 @@ public: break; case InputEngine::Numeric: - if (language == DECUMA_LANG_AR) { + if (language == DECUMA_LANG_AR || language == DECUMA_LANG_FA) { symbolCategories.append(DECUMA_CATEGORY_ARABIC_NUM_MODE); symbolCategories.append(DECUMA_CATEGORY_ARABIC_GESTURES); leftToRightGestures = false; diff --git a/src/virtualkeyboard/virtualkeyboard.pro b/src/virtualkeyboard/virtualkeyboard.pro index 83d0b408..deac2944 100644 --- a/src/virtualkeyboard/virtualkeyboard.pro +++ b/src/virtualkeyboard/virtualkeyboard.pro @@ -142,6 +142,8 @@ contains(CONFIG, lang-fa.*) { 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 += \ |