aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/openwnn
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/openwnn')
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt3
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/openwnn.pro63
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp4
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp30
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp12
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp12
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp8
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp2
-rw-r--r--src/plugins/openwnn/CMakeLists.txt50
-rw-r--r--src/plugins/openwnn/openwnn.pro9
-rw-r--r--src/plugins/openwnn/openwnninputmethod.cpp (renamed from src/plugins/openwnn/plugin/openwnninputmethod.cpp)53
-rw-r--r--src/plugins/openwnn/openwnninputmethod_p.h (renamed from src/plugins/openwnn/plugin/openwnninputmethod_p.h)32
-rw-r--r--src/plugins/openwnn/plugin/.prev_CMakeLists.txt53
-rw-r--r--src/plugins/openwnn/plugin/CMakeLists.txt54
-rw-r--r--src/plugins/openwnn/plugin/openwnn.json6
-rw-r--r--src/plugins/openwnn/plugin/openwnnplugin.cpp44
-rw-r--r--src/plugins/openwnn/plugin/openwnnplugin.h49
-rw-r--r--src/plugins/openwnn/plugin/plugin.pro45
18 files changed, 104 insertions, 425 deletions
diff --git a/src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt b/src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt
index 3cab39b9..d235785f 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt
+++ b/src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt
@@ -4,7 +4,8 @@
## BundledOpenwnn Generic Library:
#####################################################################
-qt_add_3rdparty_library(BundledOpenwnn
+qt_internal_add_3rdparty_library(BundledOpenwnn
+ QMAKE_LIB_NAME openwnn
STATIC
SOURCES
wnnDictionary/engine/ndapi.c
diff --git a/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro b/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro
deleted file mode 100644
index 150ed169..00000000
--- a/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro
+++ /dev/null
@@ -1,63 +0,0 @@
-TARGET = qtopenwnn
-
-VERSION = 1.3.6
-CONFIG += static
-CONFIG += warn_off
-
-MODULE_INCLUDEPATH = $$PWD/wnnEngine/include
-MODULE_DEFINES = HAVE_OPENWNN
-INCLUDEPATH += wnnDictionary/include
-
-SOURCES += \
- wnnDictionary/engine/ndapi.c \
- wnnDictionary/engine/ndbdic.c \
- wnnDictionary/engine/ndcommon.c \
- wnnDictionary/engine/ndfdic.c \
- wnnDictionary/engine/ndldic.c \
- wnnDictionary/engine/ndrdic.c \
- wnnDictionary/engine/neapi.c \
- wnnDictionary/engine/necode.c \
- wnnDictionary/engine/nj_str.c \
- wnnEngine/WnnJpnDic.c \
- wnnEngine/openwnndictionary.cpp \
- wnnEngine/openwnnenginejajp.cpp \
- wnnEngine/openwnnclauseconverterjajp.cpp \
- wnnEngine/kanaconverter.cpp \
- wnnEngine/composingtext.cpp \
- wnnEngine/letterconverter.cpp \
- wnnEngine/romkan.cpp \
- wnnEngine/romkanfullkatakana.cpp \
- wnnEngine/romkanhalfkatakana.cpp \
- wnnEngine/wnnlookuptable.cpp
-
-HEADERS += \
- wnnDictionary/include/nj_dic.h \
- wnnDictionary/include/nj_err.h \
- wnnDictionary/include/nj_ext.h \
- wnnDictionary/include/nj_lib.h \
- wnnDictionary/include/njd.h \
- wnnDictionary/include/njx_lib.h \
- wnnEngine/predef_table.h \
- wnnEngine/include/openwnndictionary.h \
- wnnEngine/include/openwnnenginejajp.h \
- wnnEngine/include/openwnnclauseconverterjajp.h \
- wnnEngine/include/wnnword.h \
- wnnEngine/include/kanaconverter.h \
- wnnEngine/include/composingtext.h \
- wnnEngine/include/strsegment.h \
- wnnEngine/include/letterconverter.h \
- wnnEngine/include/romkan.h \
- wnnEngine/include/romkanfullkatakana.h \
- wnnEngine/include/romkanhalfkatakana.h \
- wnnEngine/include/wnnlookuptable.h
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-load(qt_helper_lib)
-
-CONFIG += qt
-QT = core-private
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
index 2b200b9e..f29efe94 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
@@ -50,7 +50,7 @@ public:
static bool createCandidateString(const QString &input, const WnnLookupTable &map, QString &outBuf)
{
outBuf.clear();
- for (int index = 0, length = input.length(); index < length; index++) {
+ for (int index = 0, length = input.size(); index < length; index++) {
QString out = map.value(input.mid(index, 1));
if (out.isEmpty())
return false;
@@ -167,7 +167,7 @@ QList<WnnWord> KanaConverter::createPseudoCandidateList(const QString &inputHira
Q_D(KanaConverter);
QList<WnnWord> list;
- if (inputHiragana.length() == 0) {
+ if (inputHiragana.size() == 0) {
return list;
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
index e948456f..21db663a 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
@@ -22,7 +22,9 @@
#include "openwnnclauseconverterjajp.h"
#include "openwnndictionary.h"
#include "wnnword.h"
+
#include <QtCore/private/qobject_p.h>
+#include <QtCore/qpointer.h>
class OpenWnnClauseConverterJAJPPrivate : public QObjectPrivate
{
@@ -49,7 +51,7 @@ public:
/* get clauses with ancillary word */
int max = CLAUSE_COST * 2;
- for (int split = 1; split < input.length(); split++) {
+ for (int split = 1; split < input.size(); split++) {
/* get ancillary patterns */
QString str = input.mid(split);
QList<WnnWord> fzks = getAncillaryPattern(str);
@@ -147,7 +149,7 @@ public:
QList<WnnWord> getAncillaryPattern(const QString &input)
{
- if (input.length() == 0) {
+ if (input.size() == 0) {
return QList<WnnWord>();
}
@@ -161,7 +163,7 @@ public:
dict->clearApproxPattern();
dict->setDictionary(6, 400, 500);
- for (int start = input.length() - 1; start >= 0; start--) {
+ for (int start = input.size() - 1; start >= 0; start--) {
QString key = input.mid(start);
if (mFzkPatterns.contains(key)) {
@@ -178,7 +180,7 @@ public:
}
/* concatenate sequence of ancillary words */
- for (int end = input.length() - 1; end > start; end--) {
+ for (int end = input.size() - 1; end > start; end--) {
QString followKey = input.mid(end);
if (!mFzkPatterns.contains(followKey))
continue;
@@ -204,7 +206,7 @@ public:
QList<WnnWord> getIndependentWords(const QString &input, bool all)
{
- if (input.length() == 0)
+ if (input.size() == 0)
return QList<WnnWord>();
QMap<QString, QList<WnnWord> > &wordBag = all ? mAllIndepWordBag : mIndepWordBag;
@@ -261,12 +263,12 @@ public:
void addAutoGeneratedCandidates(const QString &input, QList<WnnWord> &wordList, bool all)
{
Q_UNUSED(all);
- wordList.append(WnnWord(input, input, mPosDefault, (CLAUSE_COST - 1) * input.length()));
+ wordList.append(WnnWord(input, input, mPosDefault, (CLAUSE_COST - 1) * input.size()));
}
WnnClause defaultClause(const QString &input)
{
- return WnnClause(input, input, mPosDefault, (CLAUSE_COST - 1) * input.length());
+ return WnnClause(input, input, mPosDefault, (CLAUSE_COST - 1) * input.size());
}
/** Score(frequency value) of word in the learning dictionary */
@@ -351,7 +353,7 @@ QList<WnnClause> OpenWnnClauseConverterJAJP::convert(const QString &input)
return convertResult;
/* do nothing if the length of input exceeds the limit */
- if (input.length() > OpenWnnClauseConverterJAJPPrivate::MAX_INPUT_LENGTH)
+ if (input.size() > OpenWnnClauseConverterJAJPPrivate::MAX_INPUT_LENGTH)
return convertResult;
/* try single clause conversion */
@@ -367,18 +369,18 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
/* clear the cache which is not matched */
QList<QSharedPointer<WnnSentence> > sentence;
- for (int i = 0; i < input.length(); i++) {
+ for (int i = 0; i < input.size(); i++) {
sentence.append(QSharedPointer<WnnSentence>());
}
/* consecutive clause conversion */
- for (int start = 0; start < input.length(); start++) {
+ for (int start = 0; start < input.size(); start++) {
if (start != 0 && sentence[start - 1] == NULL) {
continue;
}
/* limit the length of a clause */
- int end = input.length();
+ int end = input.size();
if (end > start + 20) {
end = start + 20;
}
@@ -403,7 +405,7 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
QString key = input.mid(start, end - start);
clauses.clear();
- if (end == input.length()) {
+ if (end == input.size()) {
/* get the clause which can be the end of the sentence */
d->singleClauseConvert(clauses, key, d->mPosEndOfClause1, false);
} else {
@@ -424,8 +426,8 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
}
/* return the result of the consecutive clause conversion */
- if (sentence[input.length() - 1] != NULL) {
- return sentence[input.length() - 1];
+ if (sentence[input.size() - 1] != NULL) {
+ return sentence[input.size() - 1];
}
return QSharedPointer<WnnSentence>();
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
index abcf060c..871a58f4 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
@@ -340,7 +340,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SEARCH_WORD, NJ_ERR_INVALID_PARAM);
}
- if (keyString.length() > NJ_MAX_LEN) {
+ if (keyString.size() > NJ_MAX_LEN) {
/* If too long key string was specified, return "No result is found" */
work.flag &= ~NJ_JNI_FLAG_ENABLE_CURSOR;
work.flag &= ~NJ_JNI_FLAG_ENABLE_RESULT;
@@ -468,8 +468,8 @@ public:
int setApproxPattern(const QString &src, const QString &dst)
{
- if (src.isEmpty() || src.length() > 1 ||
- dst.isEmpty() || dst.length() > 3) {
+ if (src.isEmpty() || src.size() > 1 ||
+ dst.isEmpty() || dst.size() > 3) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_APPROX_PATTERN, NJ_ERR_INVALID_PARAM);
}
@@ -543,7 +543,7 @@ public:
QStringList getApproxPattern(const QString &src)
{
- if (src.isEmpty() || src.length() > 1)
+ if (src.isEmpty() || src.size() > 1)
return QStringList();
NJ_CHAR from[NJ_MAX_CHARSET_FROM_LEN + NJ_TERM_LEN];
@@ -614,7 +614,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SET_STROKE, NJ_ERR_INVALID_PARAM);
}
- if (stroke.length() > NJ_MAX_LEN) {
+ if (stroke.size() > NJ_MAX_LEN) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_STROKE, NJ_ERR_YOMI_TOO_LONG);
}
@@ -632,7 +632,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SET_CANDIDATE, NJ_ERR_INVALID_PARAM);
}
- if (candidate.length() > NJ_MAX_RESULT_LEN) {
+ if (candidate.size() > NJ_MAX_RESULT_LEN) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_CANDIDATE, NJ_ERR_CANDIDATE_TOO_LONG);
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
index f66d4942..1a13f72d 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
@@ -143,7 +143,7 @@ public:
bool addCandidate(QSharedPointer<WnnWord> word)
{
if (word.isNull() || word->candidate.isEmpty() || mCandTable.contains(word->candidate)
- || word->candidate.length() > OpenWnnEngineJAJP::MAX_OUTPUT_LENGTH) {
+ || word->candidate.size() > OpenWnnEngineJAJP::MAX_OUTPUT_LENGTH) {
return false;
}
/*
@@ -170,14 +170,14 @@ public:
int setSearchKey(const ComposingText &text, int maxLen)
{
QString input = text.toString(ComposingText::LAYER1);
- if (0 <= maxLen && maxLen <= input.length()) {
+ if (0 <= maxLen && maxLen <= input.size()) {
input = input.mid(0, maxLen);
mExactMatchMode = true;
} else {
mExactMatchMode = false;
}
- if (input.length() == 0) {
+ if (input.size() == 0) {
mInputHiragana.clear();
mInputRomaji.clear();
return 0;
@@ -186,7 +186,7 @@ public:
mInputHiragana = input;
mInputRomaji = text.toString(ComposingText::LAYER0);
- return input.length();
+ return input.size();
}
void clearPreviousWord()
@@ -292,7 +292,7 @@ int OpenWnnEngineJAJP::convert(ComposingText &text)
}
QSharedPointer<WnnSentence> sentence;
- if (input.length() != 0) {
+ if (input.size() != 0) {
sentence = d->mClauseConverter.consecutiveClauseConvert(input);
}
if (!head.isNull()) {
@@ -307,7 +307,7 @@ int OpenWnnEngineJAJP::convert(ComposingText &text)
for (QList<WnnClause>::ConstIterator it = sentence->elements.constBegin();
it != sentence->elements.constEnd(); it++) {
const WnnClause &clause = *it;
- int len = clause.stroke.length();
+ int len = clause.stroke.size();
ss.append(StrSegment(clause, pos, pos + len - 1));
pos += len;
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
index 3a555e2b..f3be31d6 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
@@ -126,20 +126,20 @@ bool Romkan::convertImpl(ComposingText &text, const WnnLookupTable &table) const
for (int i = start; i < RomkanPrivate::MAX_LENGTH; i++) {
key.append(str[i].string);
}
- bool upper = key.at(key.length() - 1).isUpper();
+ bool upper = key.at(key.size() - 1).isUpper();
QString match = table[key.toLower()];
if (!match.isEmpty()) {
if (upper) {
match = match.toUpper();
}
QList<StrSegment> out;
- if (match.length() == 1) {
+ if (match.size() == 1) {
out.append(StrSegment(match, str[start].from, str[RomkanPrivate::MAX_LENGTH - 1].to));
text.replaceStrSegment(ComposingText::LAYER1, out, RomkanPrivate::MAX_LENGTH - start);
} else {
- out.append(StrSegment(match.left(match.length() - 1),
+ out.append(StrSegment(match.left(match.size() - 1),
str[start].from, str[RomkanPrivate::MAX_LENGTH - 1].to - 1));
- out.append(StrSegment(match.mid(match.length() - 1),
+ out.append(StrSegment(match.mid(match.size() - 1),
str[RomkanPrivate::MAX_LENGTH - 1].to, str[RomkanPrivate::MAX_LENGTH - 1].to));
text.replaceStrSegment(ComposingText::LAYER1, out, RomkanPrivate::MAX_LENGTH - start);
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
index a9dc5dda..cd094295 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
@@ -54,7 +54,7 @@ void WnnLookupTable::create(const QMap<QString, QString> &map, const QString &ta
std::sort(keys.begin(), keys.end(), [] (const QString &lhs, const QString &rhs) {
return strcmp(lhs.toUtf8().constData(), rhs.toUtf8().constData()) < 0;
});
- file.write(QString("static const int %1Length = %2;\n").arg(tablePrefix).arg(keys.count()).toUtf8().constData());
+ file.write(QString("static const int %1Length = %2;\n").arg(tablePrefix).arg(keys.size()).toUtf8().constData());
file.write(QString("static const char *%1Key[%1Length];\n").arg(tablePrefix).toUtf8().constData());
file.write(QString("static const char *%1Value[%1Length];\n").arg(tablePrefix).toUtf8().constData());
file.write(QString("const char *%1Key[] = {\n").arg(tablePrefix).toUtf8().constData());
diff --git a/src/plugins/openwnn/CMakeLists.txt b/src/plugins/openwnn/CMakeLists.txt
index f3f86808..eb65f4fb 100644
--- a/src/plugins/openwnn/CMakeLists.txt
+++ b/src/plugins/openwnn/CMakeLists.txt
@@ -1,4 +1,50 @@
-# Generated from openwnn.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(3rdparty/openwnn)
-add_subdirectory(plugin)
+
+#####################################################################
+## QtVirtualKeyboardOpenWnnPlugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(qtvkbopenwnnplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.OpenWNN"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbopenwnnplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ openwnninputmethod.cpp openwnninputmethod_p.h
+ DEFINES
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::VirtualKeyboard
+ Qt::BundledOpenwnn
+ NO_GENERATE_CPP_EXPORTS
+)
+
+# Resources:
+set(qmake_virtualkeyboard_openwnn_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ja_JP/dialpad.fallback"
+ "${VKB_LAYOUTS_BASE}/ja_JP/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/ja_JP/main.qml"
+ "${VKB_LAYOUTS_BASE}/ja_JP/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/ja_JP/symbols.qml"
+)
+
+qt_internal_add_resource(qtvkbopenwnnplugin "qmake_virtualkeyboard_openwnn_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${VKB_LAYOUTS_BASE}"
+ FILES
+ ${qmake_virtualkeyboard_openwnn_layouts_resource_files}
+)
diff --git a/src/plugins/openwnn/openwnn.pro b/src/plugins/openwnn/openwnn.pro
deleted file mode 100644
index bb639c86..00000000
--- a/src/plugins/openwnn/openwnn.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-TEMPLATE = subdirs
-
-include(../../../shared.pri)
-
-SUBDIRS += \
- 3rdparty/openwnn \
- plugin
-
-plugin.depends += 3rdparty/openwnn
diff --git a/src/plugins/openwnn/plugin/openwnninputmethod.cpp b/src/plugins/openwnn/openwnninputmethod.cpp
index 81e933fc..745edd14 100644
--- a/src/plugins/openwnn/plugin/openwnninputmethod.cpp
+++ b/src/plugins/openwnn/openwnninputmethod.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "openwnninputmethod_p.h"
#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
@@ -229,7 +203,7 @@ public:
} else if (layer == ComposingText::LAYER2) {
- highlightEnd = composingText.toString(layer, 0, 0).length();
+ highlightEnd = composingText.toString(layer, 0, 0).size();
/* highlights the first segment */
QTextCharFormat textFormat;
@@ -238,20 +212,20 @@ public:
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, highlightEnd, textFormat));
}
- if (highlightEnd != 0 && highlightEnd < displayText.length()) {
+ if (highlightEnd != 0 && highlightEnd < displayText.size()) {
/* highlights remaining text */
QTextCharFormat textFormat;
textFormat.setBackground(QBrush(QColor(0xF0, 0xFF, 0xFF)));
textFormat.setForeground(QBrush(Qt::black));
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, highlightEnd, displayText.length() - highlightEnd, textFormat));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, highlightEnd, displayText.size() - highlightEnd, textFormat));
}
}
QTextCharFormat textFormat;
textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, displayText.length(), textFormat));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, displayText.size(), textFormat));
- int displayCursor = composingText.toString(layer, 0, cursor - 1).length();
+ int displayCursor = composingText.toString(layer, 0, cursor - 1).size();
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, displayCursor, 1, QVariant()));
Q_Q(OpenWnnInputMethod);
@@ -277,7 +251,7 @@ public:
displayCandidates();
} else {
composingText.setCursor(ComposingText::LAYER1,
- composingText.toString(ComposingText::LAYER1).length());
+ composingText.toString(ComposingText::LAYER1).size());
clearCandidates();
}
break;
@@ -505,7 +479,7 @@ public:
{
if (str.isEmpty())
return false;
- ushort ch = str.at(str.length() - 1).unicode();
+ ushort ch = str.at(str.size() - 1).unicode();
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
@@ -687,7 +661,7 @@ bool OpenWnnInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::Keyboard
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->composingText.toString(ComposingText::LAYER1).size());
d->exactMatchMode = false;
d->clearFocusCandidate();
} else {
@@ -805,6 +779,7 @@ void OpenWnnInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionList
{
Q_UNUSED(type);
Q_D(OpenWnnInputMethod);
+ d->activeWordIndex = index;
// Set selected text as preeditText to place cursor at the end of selected text
inputContext()->setPreeditText(d->candidateList.at(index)->candidate);
d->commitText(*d->candidateList.at(index));
@@ -813,7 +788,7 @@ void OpenWnnInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionList
void OpenWnnInputMethod::reset()
{
Q_D(OpenWnnInputMethod);
- d->commitAll();
+ d->composingText.clear();
d->initializeScreen();
d->fitInputType();
}
@@ -821,8 +796,10 @@ void OpenWnnInputMethod::reset()
void OpenWnnInputMethod::update()
{
Q_D(OpenWnnInputMethod);
- if (!d->disableUpdate)
+ if (!d->disableUpdate) {
+ d->commitAll();
reset();
+ }
}
} // namespace QtVirtualKeyboard
diff --git a/src/plugins/openwnn/plugin/openwnninputmethod_p.h b/src/plugins/openwnn/openwnninputmethod_p.h
index f2e9c6a9..439cd0d3 100644
--- a/src/plugins/openwnn/plugin/openwnninputmethod_p.h
+++ b/src/plugins/openwnn/openwnninputmethod_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef OPENWNNINPUTMETHOD_P_H
#define OPENWNNINPUTMETHOD_P_H
@@ -52,6 +26,8 @@ class OpenWnnInputMethod : public QVirtualKeyboardAbstractInputMethod
{
Q_OBJECT
Q_DECLARE_PRIVATE(OpenWnnInputMethod)
+ QML_NAMED_ELEMENT(JapaneseInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
public:
explicit OpenWnnInputMethod(QObject *parent = nullptr);
diff --git a/src/plugins/openwnn/plugin/.prev_CMakeLists.txt b/src/plugins/openwnn/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index 7f2117fc..00000000
--- a/src/plugins/openwnn/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardOpenWnnPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardOpenWnnPlugin
- OUTPUT_NAME qtvirtualkeyboard_openwnn
- TYPE virtualkeyboard
- SOURCES
- openwnninputmethod.cpp openwnninputmethod_p.h
- openwnnplugin.cpp openwnnplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
- openwnn
-)
-
-# Resources:
-set(qmake_virtualkeyboard_openwnn_layouts_resource_files
- "virtualkeyboard/content/layouts/ja_JP/dialpad.fallback"
- "virtualkeyboard/content/layouts/ja_JP/digits.fallback"
- "virtualkeyboard/content/layouts/ja_JP/main.qml"
- "virtualkeyboard/content/layouts/ja_JP/numbers.fallback"
- "virtualkeyboard/content/layouts/ja_JP/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardOpenWnnPlugin "qmake_virtualkeyboard_openwnn_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_openwnn_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "openwnn.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard OpenWNN (Qt $$QT_VERSION)"
diff --git a/src/plugins/openwnn/plugin/CMakeLists.txt b/src/plugins/openwnn/plugin/CMakeLists.txt
deleted file mode 100644
index 2bea3b1c..00000000
--- a/src/plugins/openwnn/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardOpenWnnPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardOpenWnnPlugin
- OUTPUT_NAME qtvirtualkeyboard_openwnn
- TYPE virtualkeyboard
- SOURCES
- openwnninputmethod.cpp openwnninputmethod_p.h
- openwnnplugin.cpp openwnnplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
- LIBRARIES # special case
- BundledOpenwnn
-)
-
-# Resources:
-set(qmake_virtualkeyboard_openwnn_layouts_resource_files
- "virtualkeyboard/content/layouts/ja_JP/dialpad.fallback"
- "virtualkeyboard/content/layouts/ja_JP/digits.fallback"
- "virtualkeyboard/content/layouts/ja_JP/main.qml"
- "virtualkeyboard/content/layouts/ja_JP/numbers.fallback"
- "virtualkeyboard/content/layouts/ja_JP/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardOpenWnnPlugin "qmake_virtualkeyboard_openwnn_layouts"
- PREFIX
- "${VKB_LAYOUTS_PREFIX}" #special case
- BASE
- "${VKB_LAYOUTS_BASE}" #special case
- FILES
- ${qmake_virtualkeyboard_openwnn_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "openwnn.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard OpenWNN (Qt $$QT_VERSION)"
diff --git a/src/plugins/openwnn/plugin/openwnn.json b/src/plugins/openwnn/plugin/openwnn.json
deleted file mode 100644
index 053875f0..00000000
--- a/src/plugins/openwnn/plugin/openwnn.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "japanese",
- "Provider": "Qt OpenWNN Extension",
- "InputMethod": "JapaneseInputMethod",
- "Version": 100
-}
diff --git a/src/plugins/openwnn/plugin/openwnnplugin.cpp b/src/plugins/openwnn/plugin/openwnnplugin.cpp
deleted file mode 100644
index a8490960..00000000
--- a/src/plugins/openwnn/plugin/openwnnplugin.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "openwnnplugin.h"
-#include "openwnninputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardOpenWnnPlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<OpenWnnInputMethod>(uri, 1, 3, "JapaneseInputMethod");
- qmlRegisterType<OpenWnnInputMethod>(uri, 2, 0, "JapaneseInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/openwnn/plugin/openwnnplugin.h b/src/plugins/openwnn/plugin/openwnnplugin.h
deleted file mode 100644
index b11132b5..00000000
--- a/src/plugins/openwnn/plugin/openwnnplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef OPENWNNPLUGIN_H
-#define OPENWNNPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardOpenWnnPlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "openwnn.json")
-public:
- void registerTypes(const char *uri) const override;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/openwnn/plugin/plugin.pro b/src/plugins/openwnn/plugin/plugin.pro
deleted file mode 100644
index 51a4a2b7..00000000
--- a/src/plugins/openwnn/plugin/plugin.pro
+++ /dev/null
@@ -1,45 +0,0 @@
-TARGET = qtvirtualkeyboard_openwnn
-QT += qml virtualkeyboard
-
-include(../../../shared.pri)
-
-HEADERS += \
- openwnnplugin.h \
- openwnninputmethod_p.h
-SOURCES += \
- openwnnplugin.cpp \
- openwnninputmethod.cpp
-OTHER_FILES += \
- openwnn.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-LAYOUT_FILES += \
- $$LAYOUTS_BASE/content/layouts/ja_JP/dialpad.fallback \
- $$LAYOUTS_BASE/content/layouts/ja_JP/digits.fallback \
- $$LAYOUTS_BASE/content/layouts/ja_JP/main.qml \
- $$LAYOUTS_BASE/content/layouts/ja_JP/numbers.fallback \
- $$LAYOUTS_BASE/content/layouts/ja_JP/symbols.qml
-
-OTHER_FILES += \
- $$LAYOUT_FILES
-
-virtualkeyboard_openwnn_layouts.files = $$LAYOUT_FILES
-virtualkeyboard_openwnn_layouts.base = $$LAYOUTS_BASE
-virtualkeyboard_openwnn_layouts.prefix = $$LAYOUTS_PREFIX
-RESOURCES += virtualkeyboard_openwnn_layouts
-
-QMAKE_USE += openwnn
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard OpenWNN (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardOpenWnnPlugin
-load(qt_plugin)