summaryrefslogtreecommitdiff
path: root/src/imports
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-12-11 15:54:33 +0100
committerMilian Wolff <milian.wolff@kdab.com>2013-12-12 13:41:18 +0100
commitfb587a3a996d2e9d2fca34cc053df29f6d23f64e (patch)
tree52020dfe8ad740c5a68a402b0cd37fbd1f43f660 /src/imports
parentacf7f0b1ae956f2fac7182c194e0441cd9c6f4d0 (diff)
downloadqtwebchannel-fb587a3a996d2e9d2fca34cc053df29f6d23f64e.tar.gz
Restructure sources and assimilate to Qt module structure.
This module can hopefully be done in time for 5.3. This commit changes the source structure and QMake files to adapt to typical Qt modules. With this in place, we can now use QT += webchannel in qmake files to link against the pure Qt/C++ QtWebChannel library. The QML plugin is separated from it and can be loaded optionally, if the quick module could be found. Also added is now a qmlplugindump for tooling integration. Note that the Qt.labs namespace is removed. The test file structure is also adapted to how its done in the QtDeclarative module. Note that this setup apparently does not support to run tests without running make install first. Change-Id: I1c15d72e7ab5f525d5a6f651f4e965ef86bc17bd Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/imports.pro3
-rw-r--r--src/imports/webchannel/plugin.cpp69
-rw-r--r--src/imports/webchannel/plugins.qmltypes98
-rw-r--r--src/imports/webchannel/qmldir3
-rw-r--r--src/imports/webchannel/webchannel.pro6
5 files changed, 179 insertions, 0 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
new file mode 100644
index 0000000..657e144
--- /dev/null
+++ b/src/imports/imports.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+
+SUBDIRS += webchannel
diff --git a/src/imports/webchannel/plugin.cpp b/src/imports/webchannel/plugin.cpp
new file mode 100644
index 0000000..a5e9895
--- /dev/null
+++ b/src/imports/webchannel/plugin.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com>
+** Contact: http://www.qt-project.org/legal
+*
+** This file is part of the QtWebChannel module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qqml.h>
+#include <QtQml/QQmlExtensionPlugin>
+
+#include "qwebchannel.h"
+#include "qmetaobjectpublisher.h"
+
+QT_USE_NAMESPACE
+
+class QWebChannelPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ void registerTypes(const char *uri);
+};
+
+void QWebChannelPlugin::registerTypes(const char *uri)
+{
+ int major = 1;
+ int minor = 0;
+ qmlRegisterType<QWebChannel>(uri, major, minor, "WebChannel");
+ qmlRegisterType<QMetaObjectPublisher>(uri, major, minor, "MetaObjectPublisher");
+
+}
+
+#include "plugin.moc"
diff --git a/src/imports/webchannel/plugins.qmltypes b/src/imports/webchannel/plugins.qmltypes
new file mode 100644
index 0000000..6d08f9c
--- /dev/null
+++ b/src/imports/webchannel/plugins.qmltypes
@@ -0,0 +1,98 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -notrelocatable QtWebChannel 5.3'
+
+Module {
+ Component {
+ name: "QMetaObjectPublisher"
+ prototype: "QObject"
+ exports: ["QtWebChannel/MetaObjectPublisher 5.3"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "webChannel"; type: "QWebChannel"; isPointer: true }
+ Property { name: "blockUpdates"; type: "bool" }
+ Signal {
+ name: "webChannelChanged"
+ Parameter { name: "channel"; type: "QWebChannel"; isPointer: true }
+ }
+ Signal {
+ name: "blockUpdatesChanged"
+ Parameter { name: "block"; type: "bool" }
+ }
+ Method {
+ name: "classInfoForObjects"
+ type: "QVariantMap"
+ Parameter { name: "objects"; type: "QVariantMap" }
+ }
+ Method {
+ name: "classInfoForObject"
+ type: "QVariantMap"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "registerObjects"
+ Parameter { name: "objects"; type: "QVariantMap" }
+ }
+ Method {
+ name: "handleRequest"
+ type: "bool"
+ Parameter { name: "message"; type: "QJsonObject" }
+ }
+ Method { name: "bench_ensureUpdatesInitialized" }
+ Method { name: "bench_sendPendingPropertyUpdates" }
+ Method {
+ name: "bench_registerObjects"
+ Parameter { name: "objects"; type: "QVariantMap" }
+ }
+ Method { name: "bench_initializeClients" }
+ Method { name: "test_clientIsIdle"; type: "bool" }
+ }
+ Component {
+ name: "QWebChannel"
+ prototype: "QObject"
+ exports: ["QtWebChannel/WebChannel 5.3"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "baseUrl"; type: "string"; isReadonly: true }
+ Property { name: "useSecret"; type: "bool" }
+ Signal {
+ name: "baseUrlChanged"
+ Parameter { name: "baseUrl"; type: "string" }
+ }
+ Signal {
+ name: "rawMessageReceived"
+ Parameter { name: "rawMessage"; type: "string" }
+ }
+ Signal { name: "pongReceived" }
+ Signal { name: "initialized" }
+ Signal {
+ name: "failed"
+ Parameter { name: "reason"; type: "string" }
+ }
+ Method {
+ name: "sendMessage"
+ Parameter { name: "id"; type: "QJsonValue" }
+ Parameter { name: "data"; type: "QJsonValue" }
+ }
+ Method {
+ name: "sendMessage"
+ Parameter { name: "id"; type: "QJsonValue" }
+ }
+ Method {
+ name: "respond"
+ Parameter { name: "messageId"; type: "QJsonValue" }
+ Parameter { name: "data"; type: "QJsonValue" }
+ }
+ Method {
+ name: "respond"
+ Parameter { name: "messageId"; type: "QJsonValue" }
+ }
+ Method {
+ name: "sendRawMessage"
+ Parameter { name: "rawMessage"; type: "string" }
+ }
+ Method { name: "ping" }
+ }
+}
diff --git a/src/imports/webchannel/qmldir b/src/imports/webchannel/qmldir
new file mode 100644
index 0000000..17184fe
--- /dev/null
+++ b/src/imports/webchannel/qmldir
@@ -0,0 +1,3 @@
+module QtWebChannel
+plugin declarative_webchannel
+typeinfo plugins.qmltypes
diff --git a/src/imports/webchannel/webchannel.pro b/src/imports/webchannel/webchannel.pro
new file mode 100644
index 0000000..1753cee
--- /dev/null
+++ b/src/imports/webchannel/webchannel.pro
@@ -0,0 +1,6 @@
+QT = core quick webchannel
+
+SOURCES += \
+ plugin.cpp
+
+load(qml_plugin)