summaryrefslogtreecommitdiffstats
path: root/src/imports/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/utils')
-rw-r--r--src/imports/utils/plugin.cpp30
-rw-r--r--src/imports/utils/qmldir3
-rw-r--r--src/imports/utils/utils.pro14
3 files changed, 47 insertions, 0 deletions
diff --git a/src/imports/utils/plugin.cpp b/src/imports/utils/plugin.cpp
new file mode 100644
index 0000000..4b3f6e1
--- /dev/null
+++ b/src/imports/utils/plugin.cpp
@@ -0,0 +1,30 @@
+#include <QtDroidUtils/qdroidutils.h>
+#include <QtQml>
+
+static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+ QDroidUtils *api = new QDroidUtils();
+
+ return api;
+}
+
+class QDroidUtilsPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ QDroidUtilsPlugin()
+ {
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "QtDroid.Utils");
+ qmlRegisterSingletonType<QDroidUtils>(uri, 1, 0, "DroidUtils", module_api_factory);
+ }
+};
+
+#include "plugin.moc"
diff --git a/src/imports/utils/qmldir b/src/imports/utils/qmldir
new file mode 100644
index 0000000..6db1b0f
--- /dev/null
+++ b/src/imports/utils/qmldir
@@ -0,0 +1,3 @@
+module QtDroid.Utils
+plugin qtdroidutilsplugin
+typeinfo plugins.qmltypes
diff --git a/src/imports/utils/utils.pro b/src/imports/utils/utils.pro
new file mode 100644
index 0000000..a589b46
--- /dev/null
+++ b/src/imports/utils/utils.pro
@@ -0,0 +1,14 @@
+CXX_MODULE = qml
+TARGET = qtdroidutilsplugin
+TARGETPATH = QtDroid/Utils
+IMPORT_VERSION = 1.0
+
+QT += qml
+
+SOURCES += plugin.cpp
+
+### kludge
+INCLUDEPATH += $$PWD/../../../include
+LIBS += -L$$PWD/../../../lib -lQt5DroidUtils
+
+load(qml_plugin)