• Jarkko Koivikko's avatar
    Add support for full screen handwriting input · 30b0b04d
    Jarkko Koivikko authored
    
    This change adds support for the full screen handwriting input.
    
    In full screen handwriting input, the user is able to use the
    whole application screen as a container for handwriting input.
    
    This feature is available to those application integrations,
    which integrate the new HandwritingInputPanel type to the
    application QML. The HandwritingInputPanel works as an add-on
    to the existing InputPanel, so it cannot be used exclusively
    without the InputPanel.
    
    Change-Id: I11530b9ccbc66aa59b210bec94d7bb87f0826370
    Reviewed-by: default avatarMitch Curtis <mitch.curtis@theqtcompany.com>
    30b0b04d
plugin.cpp 12.22 KiB
/******************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd
** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://qt.io
**
** This file is part of the Qt Virtual Keyboard module.
**
** Licensees holding valid commercial license for Qt may use this file in
** accordance with the Qt License Agreement provided with the Software
** or, alternatively, in accordance with the terms contained in a written
** agreement between you and The Qt Company.
** If you have questions regarding the use of this file, please use
** contact form at http://qt.io
******************************************************************************/
#include "plugin.h"
#include "declarativeinputcontext.h"
#include "declarativeinputengine.h"
#include "declarativeshifthandler.h"
#include "plaininputmethod.h"
#ifdef HAVE_HUNSPELL
#include "hunspellinputmethod.h"
#endif
#ifdef HAVE_PINYIN
#include "pinyininputmethod.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 "declarativeinputmethod.h"
#include "declarativeselectionlistmodel.h"
#include "enterkeyaction.h"
#include "enterkeyactionattachedtype.h"
#include "declarativesettings.h"
#include "declarativetrace.h"
static const char pluginName[] = "qtvirtualkeyboard";
static const char inputMethodEnvVarName[] = "QT_IM_MODULE";
static const char pluginUri[] = "QtQuick.Enterprise.VirtualKeyboard";
static const char pluginSettingsUri[] = "QtQuick.Enterprise.VirtualKeyboard.Settings";
static QPointer<PlatformInputContext> platformInputContext;
static QObject *createInputContextModule(QQmlEngine *engine, QJSEngine *scriptEngine)
    Q_UNUSED(engine);
    Q_UNUSED(scriptEngine);
    QQmlContext *rootContext = engine->rootContext();
    QStringList inputMethodList = QStringList()
            << QLatin1String("PlainInputMethod")
            << QLatin1String("HunspellInputMethod")
#ifdef HAVE_PINYIN
            << QLatin1String("PinyinInputMethod")
#endif
#ifdef HAVE_HANGUL
            << QLatin1String("HangulInputMethod")
#endif
#ifdef HAVE_OPENWNN
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
<< QLatin1String("JapaneseInputMethod") #endif #if defined(HAVE_LIPI_TOOLKIT) || defined(HAVE_T9WRITE) << QLatin1String("HandwritingInputMethod") #endif ; rootContext->setContextProperty(QStringLiteral("VirtualKeyboardInputMethods"), inputMethodList); return new DeclarativeInputContext(platformInputContext); } QStringList PlatformInputContextPlugin::keys() const { return QStringList(QLatin1String(pluginName)); } QPlatformInputContext *PlatformInputContextPlugin::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 if (!qEnvironmentVariableIsSet(inputMethodEnvVarName) || qgetenv(inputMethodEnvVarName) != pluginName) return Q_NULLPTR; qmlRegisterSingletonType<DeclarativeInputContext>(pluginUri, 1, 0, "InputContext", createInputContextModule); qmlRegisterSingletonType<DeclarativeInputContext>(pluginUri, 2, 0, "InputContext", createInputContextModule); qmlRegisterUncreatableType<DeclarativeInputEngine>(pluginUri, 1, 0, "InputEngine", QLatin1String("Cannot create input method engine")); qmlRegisterUncreatableType<DeclarativeInputEngine>(pluginUri, 2, 0, "InputEngine", QLatin1String("Cannot create input method engine")); qmlRegisterUncreatableType<DeclarativeShiftHandler>(pluginUri, 1, 0, "ShiftHandler", QLatin1String("Cannot create shift handler")); qmlRegisterUncreatableType<DeclarativeShiftHandler>(pluginUri, 2, 0, "ShiftHandler", QLatin1String("Cannot create shift handler")); qmlRegisterUncreatableType<DeclarativeSelectionListModel>(pluginUri, 1, 0, "SelectionListModel", QLatin1String("Cannot create selection list model")); qmlRegisterUncreatableType<DeclarativeSelectionListModel>(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<DeclarativeInputMethod>(pluginUri, 1, 0, "InputMethod"); qmlRegisterType<DeclarativeInputMethod>(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_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<DeclarativeTrace>(pluginUri, 2, 0, "Trace"); qmlRegisterSingletonType<DeclarativeSettings>(pluginSettingsUri, 1, 0, "VirtualKeyboardSettings", DeclarativeSettings::registerSettingsModule); qmlRegisterSingletonType<DeclarativeSettings>(pluginSettingsUri, 1, 1, "VirtualKeyboardSettings", DeclarativeSettings::registerSettingsModule);
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
qmlRegisterSingletonType<DeclarativeSettings>(pluginSettingsUri, 1, 2, "VirtualKeyboardSettings", DeclarativeSettings::registerSettingsModule); const QString path(QStringLiteral("qrc:///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("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("AutoScroller.qml")), pluginUri, 1, 0, "AutoScroller"); qmlRegisterType(QUrl(componentsPath + QLatin1String("AutoScroller.qml")), pluginUri, 2, 0, "AutoScroller"); 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("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"); if (system.compare(system, QLatin1String(pluginName), Qt::CaseInsensitive) == 0) { platformInputContext = new PlatformInputContext(); } return platformInputContext; }