aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard/plugin.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2014-07-21 12:09:37 +0200
committerGatis Paeglis <gatis.paeglis@digia.com>2014-08-28 17:17:56 +0300
commitee4dcc89b81a3a51ef2a5aa934084ddbe004dc44 (patch)
treea6fea6fc48e37b84d00e23c1aeb7d67edab57031 /src/virtualkeyboard/plugin.cpp
parent30a9a7f249dbe628d27922f72038109a91526489 (diff)
Add support for pre-compiling qml files
Adding the Qt Quick Compiler support requires utilizing Qt Resource System. This is achieved by generating the required resource files during execution of qmake and using qrc URL paths in the vkb plugin when in pre-compiled qml mode. The configure option to enable pre-compiled qml support is: CONFIG+=qtquickcompiler When "CONFIG+=qtquickcompiler" configure option is omitted - vkb plugin deploys all the required files on the file system. When "CONFIG+=qtquickcompiler" is set - vkb does not deploy any of the *.qml files. One limitation when using the pre-compiled qml case is that users can not add new layouts dynamically, this feature can be added in later patches. Change-Id: I7f27ea78f14370ee9082d1723f21b1d6230eef42 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Diffstat (limited to 'src/virtualkeyboard/plugin.cpp')
-rw-r--r--src/virtualkeyboard/plugin.cpp52
1 files changed, 34 insertions, 18 deletions
diff --git a/src/virtualkeyboard/plugin.cpp b/src/virtualkeyboard/plugin.cpp
index 65c1f019..30e59132 100644
--- a/src/virtualkeyboard/plugin.cpp
+++ b/src/virtualkeyboard/plugin.cpp
@@ -16,11 +16,7 @@
**
****************************************************************************/
-#include <QtQml>
-#include <QStringList>
-#include <qpa/qplatforminputcontextplugin_p.h>
-
-#include "platforminputcontext.h"
+#include "plugin.h"
#include "declarativeinputcontext.h"
#include "declarativeinputengine.h"
#include "declarativeshifthandler.h"
@@ -46,16 +42,6 @@ static QObject *createInputContextModule(QQmlEngine *engine, QJSEngine *scriptEn
return new DeclarativeInputContext(platformInputContext);
}
-class PlatformInputContextPlugin : public QPlatformInputContextPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPlatformInputContextFactoryInterface" FILE "qtvirtualkeyboard.json")
-
-public:
- QStringList keys() const;
- QPlatformInputContext *create(const QString&, const QStringList&);
-};
-
QStringList PlatformInputContextPlugin::keys() const
{
return QStringList(QStringLiteral("qtvirtualkeyboard"));
@@ -64,7 +50,15 @@ QStringList PlatformInputContextPlugin::keys() const
QPlatformInputContext *PlatformInputContextPlugin::create(const QString &system, const QStringList &paramList)
{
Q_UNUSED(paramList);
-
+#ifdef COMPILING_QML
+ Q_INIT_RESOURCE(content_qtquickcompiler);
+ Q_INIT_RESOURCE(default_style_qtquickcompiler);
+ Q_INIT_RESOURCE(retro_style_qtquickcompiler);
+#else
+ Q_INIT_RESOURCE(default_style);
+ Q_INIT_RESOURCE(retro_style);
+#endif
+ const QString path(QT_VIRTUALKEYBOARD_IMPORT_PATH);
qmlRegisterSingletonType<DeclarativeInputContext>("QtQuick.Enterprise.VirtualKeyboard", 1, 0, "InputContext", createInputContextModule);
qmlRegisterUncreatableType<DeclarativeInputEngine>("QtQuick.Enterprise.VirtualKeyboard", 1, 0, "InputEngine", "Cannot create input method engine");
qmlRegisterUncreatableType<DeclarativeShiftHandler>("QtQuick.Enterprise.VirtualKeyboard", 1, 0, "ShiftHandler", "Cannot create shift handler");
@@ -82,10 +76,32 @@ QPlatformInputContext *PlatformInputContextPlugin::create(const QString &system,
qmlRegisterType<EnterKeyAction>("QtQuick.Enterprise.VirtualKeyboard", 1, 0, "EnterKeyAction");
qmlRegisterSingletonType<DeclarativeSettings>("QtQuick.Enterprise.VirtualKeyboard.Settings", 1, 0, "VirtualKeyboardSettings", DeclarativeSettings::registerSettingsModule);
+ qmlRegisterType(QUrl(path + "InputPanel.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "InputPanel");
+ const QString componentsPath = path + QLatin1Literal("components/");
+ qmlRegisterType(QUrl(componentsPath + "AlternativeKeys.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "AlternativeKeys");
+ qmlRegisterType(QUrl(componentsPath + "AutoScroller.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "AutoScroller");
+ qmlRegisterType(QUrl(componentsPath + "BackspaceKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "BackspaceKey");
+ qmlRegisterType(QUrl(componentsPath + "BaseKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "BaseKey");
+ qmlRegisterType(QUrl(componentsPath + "ChangeLanguageKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "ChangeLanguageKey");
+ qmlRegisterType(QUrl(componentsPath + "CharacterPreviewBubble.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "CharacterPreviewBubble");
+ qmlRegisterType(QUrl(componentsPath + "EnterKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "EnterKey");
+ qmlRegisterType(QUrl(componentsPath + "FillerKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "FillerKey");
+ qmlRegisterType(QUrl(componentsPath + "HideKeyboardKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "HideKeyboardKey");
+ qmlRegisterType(QUrl(componentsPath + "KeyboardColumn.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "KeyboardColumn");
+ qmlRegisterType(QUrl(componentsPath + "KeyboardLayout.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "KeyboardLayout");
+ qmlRegisterType(QUrl(componentsPath + "KeyboardLayoutLoader.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 1, "KeyboardLayoutLoader");
+ qmlRegisterType(QUrl(componentsPath + "Keyboard.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "Keyboard");
+ qmlRegisterType(QUrl(componentsPath + "KeyboardRow.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "KeyboardRow");
+ qmlRegisterType(QUrl(componentsPath + "Key.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "Key");
+ qmlRegisterType(QUrl(componentsPath + "MultiSoundEffect.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 1, "MultiSoundEffect");
+ qmlRegisterType(QUrl(componentsPath + "MultitapInputMethod.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "MultitapInputMethod");
+ qmlRegisterType(QUrl(componentsPath + "NumberKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "NumberKey");
+ qmlRegisterType(QUrl(componentsPath + "ShiftKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "ShiftKey");
+ qmlRegisterType(QUrl(componentsPath + "SpaceKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "SpaceKey");
+ qmlRegisterType(QUrl(componentsPath + "SymbolModeKey.qml"), "QtQuick.Enterprise.VirtualKeyboard", 1, 0, "SymbolModeKey");
+
if (system.compare(system, QStringLiteral("qtvirtualkeyboard"), Qt::CaseInsensitive) == 0) {
platformInputContext = new PlatformInputContext();
}
return platformInputContext;
}
-
-#include "plugin.moc"