aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard/hangulinputmethod.cpp
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2018-05-27 12:12:06 +0300
committerMitch Curtis <mitch.curtis@qt.io>2018-08-06 08:20:01 +0000
commit59208edaaf40be982904a6c8cad4eab2d14f938e (patch)
treea613276e1f785e6cd82d019f01dbe478c7cebc5d /src/virtualkeyboard/hangulinputmethod.cpp
parent263a16009e8d08004a546954cd7b2671c26fab9e (diff)
Modularize virtual keyboard and add an extension interface
With the extension interface it is possible to add new input method and/or languages without recompiling the Qt Virtual Keyboard plugin itself. The existing input methods are now isolated into plugins. So installing a new input method is a matter of copying the corresponding extension plugin to the plugins/virtualkeyboard directory (and any collateral required by the extension plugin itself). This change also renames the HunspellInputMethod to DefaultInputMethod. This change is necessary because some other extension plugin may want to provide the default input method instead. Implementation plan =================== [x] Create virtualkeyboard-private module [x] Create plugin library [x] Define interface for input method plugin [x] Define interface for keyboard layouts [x] Move existing input methods and layouts to plugins [x] HangulInputMethod [x] HunspellInputMethod [x] Maybe create a private library for sharing between HunspellInputMethod and LipiInputMethod [x] LipiInputMethod [x] OpenWnnInputMethod [x] PinyinInputMethod [x] T9WriteInputMethod [x] TCInputMethod [o] Rename some C++ classes (too generic name?) [x] Think again replacing the QtVirtualKeyboard namespace [x] Update documentation [x] General instructions for creating a plugin [x] For the C++ interfaces too (previously removed) [ChangeLog][Important Behavior Changes] Introduce an extension interface for the virtual keyboard. All the current input methods and some special keyboard layouts (e.g. Hunspell, OpenWnn, etc.) have been moved to extensions. The extension interface allows third party to create a new input method without having to modify or rebuild the virtual keyboard. In addition, this change makes it possible to add features and languages independently by copying the desired extension to the system. [ChangeLog][Important Behavior Changes] Introduce a virtualkeyboard module, which can be linked against an extension plugin. This module provides the C++ API necessary for creating an input method. [ChangeLog][Important Behavior Changes] Wrap the entire virtual keyboard API into Qt namespace (e.g. QT_BEGIN_NAMESPACE/QT_END_NAMESPACE). Task-number: QTBUG-57602 Change-Id: I449f4429109f596a7a1df7517c81f97d4aada27c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/virtualkeyboard/hangulinputmethod.cpp')
-rw-r--r--src/virtualkeyboard/hangulinputmethod.cpp101
1 files changed, 0 insertions, 101 deletions
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