diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2013-12-11 15:54:33 +0100 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2013-12-12 13:41:18 +0100 |
commit | fb587a3a996d2e9d2fca34cc053df29f6d23f64e (patch) | |
tree | 52020dfe8ad740c5a68a402b0cd37fbd1f43f660 | |
parent | acf7f0b1ae956f2fac7182c194e0441cd9c6f4d0 (diff) | |
download | qtwebchannel-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>
-rw-r--r-- | .qmake.conf | 4 | ||||
-rw-r--r-- | examples/examples.pro | 8 | ||||
-rw-r--r-- | examples/hybridshell/main.qml | 3 | ||||
-rw-r--r-- | examples/qmlapp/qmlapp.qml | 2 | ||||
-rw-r--r-- | examples/qtobject/main.qml | 3 | ||||
-rw-r--r-- | qwebchannel.pro | 10 | ||||
-rw-r--r-- | src/imports/imports.pro | 3 | ||||
-rw-r--r-- | src/imports/webchannel/plugin.cpp | 69 | ||||
-rw-r--r-- | src/imports/webchannel/plugins.qmltypes | 98 | ||||
-rw-r--r-- | src/imports/webchannel/qmldir | 3 | ||||
-rw-r--r-- | src/imports/webchannel/webchannel.pro | 6 | ||||
-rw-r--r-- | src/plugin.json | 3 | ||||
-rw-r--r-- | src/qmldir | 2 | ||||
-rw-r--r-- | src/qwebchannel_plugin.cpp | 54 | ||||
-rw-r--r-- | src/qwebchannel_plugin.h | 56 | ||||
-rw-r--r-- | src/src.pri | 11 | ||||
-rw-r--r-- | src/src.pro | 42 | ||||
-rw-r--r-- | src/webchannel/qmetaobjectpublisher.cpp (renamed from src/qtmetaobjectpublisher.cpp) | 111 | ||||
-rw-r--r-- | src/webchannel/qmetaobjectpublisher.h (renamed from src/qtmetaobjectpublisher.h) | 58 | ||||
-rw-r--r-- | src/webchannel/qobject.js (renamed from src/qobject.js) | 40 | ||||
-rw-r--r-- | src/webchannel/qwebchannel.cpp (renamed from src/qwebchannel.cpp) | 46 | ||||
-rw-r--r-- | src/webchannel/qwebchannel.h (renamed from src/qwebchannel.h) | 44 | ||||
-rw-r--r-- | src/webchannel/qwebchannelglobal.h | 62 | ||||
-rw-r--r-- | src/webchannel/qwebsocketserver.cpp (renamed from src/qwebsocketserver.cpp) | 38 | ||||
-rw-r--r-- | src/webchannel/qwebsocketserver_p.h (renamed from src/qwebsocketserver.h) | 36 | ||||
-rw-r--r-- | src/webchannel/resources.qrc (renamed from src/resources.qrc) | 0 | ||||
-rw-r--r-- | src/webchannel/signalhandler_p.h (renamed from src/signalhandler.h) | 2 | ||||
-rw-r--r-- | src/webchannel/variantargument_p.h (renamed from src/variantargument.h) | 2 | ||||
-rw-r--r-- | src/webchannel/webchannel.js (renamed from src/webchannel.js) | 40 | ||||
-rw-r--r-- | src/webchannel/webchannel.pro | 28 | ||||
-rw-r--r-- | sync.profile | 16 | ||||
-rw-r--r-- | tests/qml/WebChannelTest.qml | 6 | ||||
-rw-r--r-- | tests/qml/data/bench_init.html (renamed from tests/qml/bench_init.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/disconnect.html (renamed from tests/qml/disconnect.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/grouping.html (renamed from tests/qml/grouping.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/method.html (renamed from tests/qml/method.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/property.html (renamed from tests/qml/property.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/receiveRaw.html (renamed from tests/qml/receiveRaw.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/respond.html (renamed from tests/qml/respond.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/send.html (renamed from tests/qml/send.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/signal.html (renamed from tests/qml/signal.html) | 0 | ||||
-rw-r--r-- | tests/qml/data/wrapper.html (renamed from tests/qml/wrapper.html) | 0 | ||||
-rw-r--r-- | tests/qml/qml.cpp | 2 | ||||
-rw-r--r-- | tests/qml/qml.pro | 15 | ||||
-rw-r--r-- | tests/qml/tst_bench.qml | 4 | ||||
-rw-r--r-- | tests/qml/tst_metaobjectpublisher.qml | 4 | ||||
-rw-r--r-- | tests/qml/tst_webchannel.qml | 2 | ||||
-rw-r--r-- | tests/tests.pro | 5 |
48 files changed, 534 insertions, 404 deletions
diff --git a/.qmake.conf b/.qmake.conf new file mode 100644 index 0000000..efd0e68 --- /dev/null +++ b/.qmake.conf @@ -0,0 +1,4 @@ +load(qt_build_config) +CONFIG += qt_example_installs + +MODULE_VERSION = 5.3.0 diff --git a/examples/examples.pro b/examples/examples.pro index 532c07e..decf465 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,5 +1,7 @@ TEMPLATE = subdirs -SUBDIRS = \ - hybridshell \ - qtobject +qtHaveModule(quick) { + SUBDIRS += \ + hybridshell \ + qtobject +} diff --git a/examples/hybridshell/main.qml b/examples/hybridshell/main.qml index d6d598d..0dedb74 100644 --- a/examples/hybridshell/main.qml +++ b/examples/hybridshell/main.qml @@ -41,8 +41,7 @@ import QtQuick 2.0 -import Qt.labs 1.0 -import Qt.labs.WebChannel 1.0 +import QtWebChannel 1.0 import QtWebKit 3.0 import QtWebKit.experimental 1.0 diff --git a/examples/qmlapp/qmlapp.qml b/examples/qmlapp/qmlapp.qml index 6599bf1..35bce57 100644 --- a/examples/qmlapp/qmlapp.qml +++ b/examples/qmlapp/qmlapp.qml @@ -41,7 +41,7 @@ import QtQuick 2.0 -import Qt.labs.WebChannel 1.0 +import QtWebChannel 1.0 import QtWebKit 3.0 import QtWebKit.experimental 1.0 diff --git a/examples/qtobject/main.qml b/examples/qtobject/main.qml index bb67663..6dd82fa 100644 --- a/examples/qtobject/main.qml +++ b/examples/qtobject/main.qml @@ -41,8 +41,7 @@ import QtQuick 2.0 -import Qt.labs 1.0 -import Qt.labs.WebChannel 1.0 +import QtWebChannel 1.0 import QtWebKit 3.0 import QtWebKit.experimental 1.0 diff --git a/qwebchannel.pro b/qwebchannel.pro index bbb213a..58c33f2 100644 --- a/qwebchannel.pro +++ b/qwebchannel.pro @@ -1,9 +1 @@ -TEMPLATE = subdirs - -SUBDIRS = \ - src \ - examples \ - tests - -examples.depends = src -tests.depends = src +load(qt_parts) 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) diff --git a/src/plugin.json b/src/plugin.json deleted file mode 100644 index 39c1553..0000000 --- a/src/plugin.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Keys": [ "QWebChannel" ] -} diff --git a/src/qmldir b/src/qmldir deleted file mode 100644 index ebd912a..0000000 --- a/src/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module Qt.labs.WebChannel -plugin qwebchannel diff --git a/src/qwebchannel_plugin.cpp b/src/qwebchannel_plugin.cpp deleted file mode 100644 index 13a38a5..0000000 --- a/src/qwebchannel_plugin.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qqml.h> - -#include "qwebchannel.h" -#include "qtmetaobjectpublisher.h" - -#include "qwebchannel_plugin.h" - -void QWebChannelPlugin::registerTypes(const char *uri) -{ - qmlRegisterType<QWebChannel>(uri, 1, 0, "WebChannel"); - qmlRegisterType<QtMetaObjectPublisher>(uri, 1, 0, "MetaObjectPublisher"); -} - diff --git a/src/qwebchannel_plugin.h b/src/qwebchannel_plugin.h deleted file mode 100644 index a5b712d..0000000 --- a/src/qwebchannel_plugin.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWEBCHANNEL_PLUGIN_H -#define QWEBCHANNEL_PLUGIN_H - -#include <QtQml/QQmlExtensionPlugin> - -class QWebChannelPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") -public: - void registerTypes(const char *uri); -}; - -#endif // QWEBCHANNEL_PLUGIN_H - diff --git a/src/src.pri b/src/src.pri deleted file mode 100644 index 5ae01f3..0000000 --- a/src/src.pri +++ /dev/null @@ -1,11 +0,0 @@ -QT += network -SOURCES += \ - $$PWD/qwebchannel.cpp \ - $$PWD/qtmetaobjectpublisher.cpp \ - $$PWD/qwebsocketserver.cpp -HEADERS += \ - $$PWD/qwebchannel.h \ - $$PWD/qtmetaobjectpublisher.h \ - $$PWD/qwebsocketserver.h \ - $$PWD/variantargument.h \ - $$PWD/signalhandler.h diff --git a/src/src.pro b/src/src.pro index bd2e3c7..900a924 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,40 +1,8 @@ -include(src.pri) +TEMPLATE = subdirs -TEMPLATE = lib -TARGET = qwebchannel -TARGETPATH = Qt/labs/WebChannel -QT += qml quick -CONFIG += qt plugin +SUBDIRS += webchannel -TARGET = $$qtLibraryTarget($$TARGET) - -# Input -SOURCES += $$PWD/qwebchannel_plugin.cpp -HEADERS += $$PWD/qwebchannel_plugin.h - -RESOURCES += \ - resources.qrc - -OTHER_FILES = qmldir \ - webchannel.js \ - qobject.js - -target.path = $$[QT_INSTALL_QML]/$$TARGETPATH - -# extra files that need to be deployed to $$TARGETPATH -DEPLOY_FILES = \ - qmldir - -for(FILE, DEPLOY_FILES): qmldir.files += $$PWD/$$FILE -qmldir.path += $$[QT_INSTALL_QML]/$$TARGETPATH - -INSTALLS += target qmldir - -# ensure that plugin is put into the correct folder structure -DESTDIR = $$TARGETPATH - -# copy files in order to run tests without calling make install first -for(FILE, DEPLOY_FILES) { - PRE_TARGETDEPS += $$PWD/$$FILE - QMAKE_POST_LINK += $$quote($$QMAKE_COPY \"$$PWD/$$FILE\" $$OUT_PWD/$$TARGETPATH$$escape_expand(\n\t)) +qtHaveModule(quick) { + SUBDIRS += imports + imports.depends = webchannel } diff --git a/src/qtmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp index 9ca0d93..c141fb2 100644 --- a/src/qtmetaobjectpublisher.cpp +++ b/src/webchannel/qmetaobjectpublisher.cpp @@ -1,20 +1,19 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** +** 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 QWebChannel module on Qt labs. +* +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** 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 @@ -24,28 +23,28 @@ ** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** 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. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** 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 "qtmetaobjectpublisher.h" +#include "qmetaobjectpublisher.h" #include "qwebchannel.h" -#include "variantargument.h" -#include "signalhandler.h" + +#include "variantargument_p.h" +#include "signalhandler_p.h" #include <QStringList> #include <QMetaObject> @@ -95,9 +94,9 @@ const int s_destroyedSignalIndex = QObject::staticMetaObject.indexOfMethod("dest const int PROPERTY_UPDATE_INTERVAL = 50; } -struct QtMetaObjectPublisherPrivate +struct QMetaObjectPublisherPrivate { - QtMetaObjectPublisherPrivate(QtMetaObjectPublisher *q) + QMetaObjectPublisherPrivate(QMetaObjectPublisher *q) : q(q) , signalHandler(this) , clientIsIdle(false) @@ -175,9 +174,9 @@ struct QtMetaObjectPublisherPrivate */ void deleteWrappedObject(QObject *object) const; - QtMetaObjectPublisher *q; + QMetaObjectPublisher *q; QPointer<QWebChannel> webChannel; - SignalHandler<QtMetaObjectPublisherPrivate> signalHandler; + SignalHandler<QMetaObjectPublisherPrivate> signalHandler; // true when the client is idle, false otherwise bool clientIsIdle; @@ -220,7 +219,7 @@ struct QtMetaObjectPublisherPrivate QBasicTimer timer; }; -void QtMetaObjectPublisherPrivate::setClientIsIdle(bool isIdle) +void QMetaObjectPublisherPrivate::setClientIsIdle(bool isIdle) { if (clientIsIdle == isIdle) { return; @@ -233,7 +232,7 @@ void QtMetaObjectPublisherPrivate::setClientIsIdle(bool isIdle) } } -void QtMetaObjectPublisherPrivate::initializeClients() +void QMetaObjectPublisherPrivate::initializeClients() { QJsonObject objectInfos; { @@ -251,7 +250,7 @@ void QtMetaObjectPublisherPrivate::initializeClients() pendingInit = false; } -void QtMetaObjectPublisherPrivate::initializePropertyUpdates(const QObject *const object, const QVariantMap &objectInfo) +void QMetaObjectPublisherPrivate::initializePropertyUpdates(const QObject *const object, const QVariantMap &objectInfo) { foreach (const QVariant &propertyInfoVar, objectInfo[KEY_PROPERTIES].toList()) { const QVariantList &propertyInfo = propertyInfoVar.toList(); @@ -283,7 +282,7 @@ void QtMetaObjectPublisherPrivate::initializePropertyUpdates(const QObject *cons signalHandler.connectTo(object, s_destroyedSignalIndex); } -void QtMetaObjectPublisherPrivate::sendPendingPropertyUpdates() +void QMetaObjectPublisherPrivate::sendPendingPropertyUpdates() { if (blockUpdates || !clientIsIdle || pendingPropertyUpdates.isEmpty()) { return; @@ -328,7 +327,7 @@ void QtMetaObjectPublisherPrivate::sendPendingPropertyUpdates() setClientIsIdle(false); } -bool QtMetaObjectPublisherPrivate::invokeMethod(QObject *const object, const int methodIndex, +bool QMetaObjectPublisherPrivate::invokeMethod(QObject *const object, const int methodIndex, const QJsonArray &args, const QJsonValue &id) { const QMetaMethod &method = object->metaObject()->method(methodIndex); @@ -381,7 +380,7 @@ bool QtMetaObjectPublisherPrivate::invokeMethod(QObject *const object, const int return true; } -void QtMetaObjectPublisherPrivate::signalEmitted(const QObject *object, const int signalIndex, const QVariantList &arguments) +void QMetaObjectPublisherPrivate::signalEmitted(const QObject *object, const int signalIndex, const QVariantList &arguments) { if (!webChannel) { return; @@ -409,7 +408,7 @@ void QtMetaObjectPublisherPrivate::signalEmitted(const QObject *object, const in } } -void QtMetaObjectPublisherPrivate::objectDestroyed(const QObject *object) +void QMetaObjectPublisherPrivate::objectDestroyed(const QObject *object) { const QString &id = registeredObjectIds.take(object); Q_ASSERT(!id.isEmpty()); @@ -422,7 +421,7 @@ void QtMetaObjectPublisherPrivate::objectDestroyed(const QObject *object) wrappedObjects.remove(object); } -QVariant QtMetaObjectPublisherPrivate::wrapResult(const QVariant &result) +QVariant QMetaObjectPublisherPrivate::wrapResult(const QVariant &result) { if (QObject *object = result.value<QObject *>()) { QVariantMap &objectInfo = wrappedObjects[object]; @@ -452,7 +451,7 @@ QVariant QtMetaObjectPublisherPrivate::wrapResult(const QVariant &result) return result; } -void QtMetaObjectPublisherPrivate::deleteWrappedObject(QObject *object) const +void QMetaObjectPublisherPrivate::deleteWrappedObject(QObject *object) const { if (!wrappedObjects.contains(object)) { qWarning() << "Not deleting non-wrapped object" << object; @@ -461,18 +460,18 @@ void QtMetaObjectPublisherPrivate::deleteWrappedObject(QObject *object) const object->deleteLater(); } -QtMetaObjectPublisher::QtMetaObjectPublisher(QObject *parent) +QMetaObjectPublisher::QMetaObjectPublisher(QObject *parent) : QObject(parent) - , d(new QtMetaObjectPublisherPrivate(this)) + , d(new QMetaObjectPublisherPrivate(this)) { } -QtMetaObjectPublisher::~QtMetaObjectPublisher() +QMetaObjectPublisher::~QMetaObjectPublisher() { } -QVariantMap QtMetaObjectPublisher::classInfoForObjects(const QVariantMap &objectMap) const +QVariantMap QMetaObjectPublisher::classInfoForObjects(const QVariantMap &objectMap) const { QVariantMap ret; QMap<QString, QVariant>::const_iterator it = objectMap.constBegin(); @@ -489,7 +488,7 @@ QVariantMap QtMetaObjectPublisher::classInfoForObjects(const QVariantMap &object return ret; } -QVariantMap QtMetaObjectPublisher::classInfoForObject(QObject *object) const +QVariantMap QMetaObjectPublisher::classInfoForObject(QObject *object) const { QVariantMap data; if (!object) { @@ -562,9 +561,9 @@ QVariantMap QtMetaObjectPublisher::classInfoForObject(QObject *object) const QMetaEnum enumerator = metaObject->enumerator(i); QVariantMap values; for (int k = 0; k < enumerator.keyCount(); ++k) { - values[enumerator.key(k)] = enumerator.value(k); + values[QString::fromLatin1(enumerator.key(k))] = enumerator.value(k); } - qtEnums[enumerator.name()] = values; + qtEnums[QString::fromLatin1(enumerator.name())] = values; } data[KEY_SIGNALS] = qtSignals; data[KEY_METHODS] = qtMethods; @@ -573,7 +572,7 @@ QVariantMap QtMetaObjectPublisher::classInfoForObject(QObject *object) const return data; } -void QtMetaObjectPublisher::registerObjects(const QVariantMap &objects) +void QMetaObjectPublisher::registerObjects(const QVariantMap &objects) { if (d->propertyUpdatesInitialized) { qWarning("Registered new object after initialization. This does not work!"); @@ -591,7 +590,7 @@ void QtMetaObjectPublisher::registerObjects(const QVariantMap &objects) } } -bool QtMetaObjectPublisher::handleRequest(const QJsonObject &message) +bool QMetaObjectPublisher::handleRequest(const QJsonObject &message) { if (!message.contains(KEY_DATA)) { return false; @@ -648,12 +647,12 @@ bool QtMetaObjectPublisher::handleRequest(const QJsonObject &message) return false; } -QWebChannel *QtMetaObjectPublisher::webChannel() const +QWebChannel *QMetaObjectPublisher::webChannel() const { return d->webChannel; } -void QtMetaObjectPublisher::setWebChannel(QWebChannel *webChannel) +void QMetaObjectPublisher::setWebChannel(QWebChannel *webChannel) { if (d->webChannel == webChannel) { return; @@ -664,12 +663,12 @@ void QtMetaObjectPublisher::setWebChannel(QWebChannel *webChannel) emit webChannelChanged(webChannel); } -bool QtMetaObjectPublisher::blockUpdates() const +bool QMetaObjectPublisher::blockUpdates() const { return d->blockUpdates; } -void QtMetaObjectPublisher::setBlockUpdates(bool block) +void QMetaObjectPublisher::setBlockUpdates(bool block) { if (d->blockUpdates == block) { return; @@ -689,20 +688,20 @@ void QtMetaObjectPublisher::setBlockUpdates(bool block) emit blockUpdatesChanged(block); } -void QtMetaObjectPublisher::bench_ensureUpdatesInitialized() +void QMetaObjectPublisher::bench_ensureUpdatesInitialized() { if (!d->propertyUpdatesInitialized) { d->initializeClients(); } } -void QtMetaObjectPublisher::bench_sendPendingPropertyUpdates() +void QMetaObjectPublisher::bench_sendPendingPropertyUpdates() { d->clientIsIdle = true; d->sendPendingPropertyUpdates(); } -void QtMetaObjectPublisher::bench_initializeClients() +void QMetaObjectPublisher::bench_initializeClients() { d->propertyUpdatesInitialized = false; d->signalToPropertyMap.clear(); @@ -710,18 +709,18 @@ void QtMetaObjectPublisher::bench_initializeClients() d->initializeClients(); } -void QtMetaObjectPublisher::bench_registerObjects(const QVariantMap &objects) +void QMetaObjectPublisher::bench_registerObjects(const QVariantMap &objects) { d->propertyUpdatesInitialized = false; registerObjects(objects); } -bool QtMetaObjectPublisher::test_clientIsIdle() const +bool QMetaObjectPublisher::test_clientIsIdle() const { return d->clientIsIdle; } -void QtMetaObjectPublisher::timerEvent(QTimerEvent *event) +void QMetaObjectPublisher::timerEvent(QTimerEvent *event) { if (event->timerId() == d->timer.timerId()) { d->sendPendingPropertyUpdates(); diff --git a/src/qtmetaobjectpublisher.h b/src/webchannel/qmetaobjectpublisher.h index 88a54c4..da733b2 100644 --- a/src/qtmetaobjectpublisher.h +++ b/src/webchannel/qmetaobjectpublisher.h @@ -1,20 +1,19 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** +** 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 QWebChannel module on Qt labs. +* +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** 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 @@ -24,18 +23,17 @@ ** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** 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. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** 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$ @@ -48,19 +46,21 @@ #include <QObject> #include <QVariant> +#include "qwebchannelglobal.h" + class QWebChannel; -struct QtMetaObjectPublisherPrivate; +struct QMetaObjectPublisherPrivate; -class QtMetaObjectPublisher : public QObject +class Q_WEBCHANNEL_EXPORT QMetaObjectPublisher : public QObject { Q_OBJECT Q_PROPERTY(QWebChannel *webChannel READ webChannel WRITE setWebChannel NOTIFY webChannelChanged); Q_PROPERTY(bool blockUpdates READ blockUpdates WRITE setBlockUpdates NOTIFY blockUpdatesChanged); public: - explicit QtMetaObjectPublisher(QObject *parent = 0); - virtual ~QtMetaObjectPublisher(); + explicit QMetaObjectPublisher(QObject *parent = 0); + virtual ~QMetaObjectPublisher(); Q_INVOKABLE QVariantMap classInfoForObjects(const QVariantMap &objects) const; Q_INVOKABLE QVariantMap classInfoForObject(QObject *object) const; @@ -104,11 +104,11 @@ signals: void blockUpdatesChanged(bool block); protected: - virtual void timerEvent(QTimerEvent *); + void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; private: - QScopedPointer<QtMetaObjectPublisherPrivate> d; - friend struct QtMetaObjectPublisherPrivate; + QScopedPointer<QMetaObjectPublisherPrivate> d; + friend struct QMetaObjectPublisherPrivate; }; -#endif // QTMETAOBJECTPUBLISHER_H +#endif // QMETAOBJECTPUBLISHER_H diff --git a/src/qobject.js b/src/webchannel/qobject.js index b783a5b..da8b3de 100644 --- a/src/qobject.js +++ b/src/webchannel/qobject.js @@ -1,20 +1,19 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** +** 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 QWebChannel module on Qt labs. +* +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** 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 @@ -24,18 +23,17 @@ ** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** 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. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** 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$ diff --git a/src/qwebchannel.cpp b/src/webchannel/qwebchannel.cpp index ac5f8f9..8dc7e5e 100644 --- a/src/qwebchannel.cpp +++ b/src/webchannel/qwebchannel.cpp @@ -1,20 +1,19 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** +** 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 QWebChannel module on Qt labs. +* +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** 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 @@ -24,18 +23,17 @@ ** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** 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. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** 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$ @@ -50,7 +48,7 @@ #include <QJsonDocument> #include <QJsonObject> -#include "qwebsocketserver.h" +#include "qwebsocketserver_p.h" class QWebChannelPrivate : public QWebSocketServer { @@ -86,7 +84,7 @@ signals: void initialized(); protected: - virtual bool isValid(const HeaderData& connection); + bool isValid(const HeaderData& connection) Q_DECL_OVERRIDE; private slots: void init(); @@ -206,4 +204,4 @@ void QWebChannel::ping() const d->ping(); } -#include <qwebchannel.moc> +#include "qwebchannel.moc" diff --git a/src/qwebchannel.h b/src/webchannel/qwebchannel.h index 7f3ff13..321706e 100644 --- a/src/qwebchannel.h +++ b/src/webchannel/qwebchannel.h @@ -1,20 +1,19 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** +** 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 QWebChannel module on Qt labs. +* +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** 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 @@ -24,18 +23,17 @@ ** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** 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. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** 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$ @@ -48,9 +46,11 @@ #include <QObject> #include <QJsonValue> +#include "qwebchannelglobal.h" + class QWebChannelPrivate; -class QWebChannel : public QObject +class Q_WEBCHANNEL_EXPORT QWebChannel : public QObject { Q_OBJECT Q_DISABLE_COPY(QWebChannel) diff --git a/src/webchannel/qwebchannelglobal.h b/src/webchannel/qwebchannelglobal.h new file mode 100644 index 0000000..f33ada6 --- /dev/null +++ b/src/webchannel/qwebchannelglobal.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QTWEBCHANNEL_H +#define QTWEBCHANNEL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#ifndef QT_STATIC +# if defined(QT_BUILD_WEBCHANNEL_LIB) +# define Q_WEBCHANNEL_EXPORT Q_DECL_EXPORT +# else +# define Q_WEBCHANNEL_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_WEBCHANNEL_EXPORT +#endif + +QT_END_NAMESPACE + +#endif // QTWEBCHANNEL_H diff --git a/src/qwebsocketserver.cpp b/src/webchannel/qwebsocketserver.cpp index 6e9858b..4bc56c8 100644 --- a/src/qwebsocketserver.cpp +++ b/src/webchannel/qwebsocketserver.cpp @@ -1,16 +1,19 @@ /**************************************************************************** ** +** 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 QWebChannel module on Qt labs. +* +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** 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 @@ -20,25 +23,24 @@ ** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** 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. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** 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 "qwebsocketserver.h" +#include "qwebsocketserver_p.h" #include <QTcpServer> #include <QTcpSocket> diff --git a/src/qwebsocketserver.h b/src/webchannel/qwebsocketserver_p.h index 3a57d2e..4651d17 100644 --- a/src/qwebsocketserver.h +++ b/src/webchannel/qwebsocketserver_p.h @@ -1,16 +1,19 @@ /**************************************************************************** ** +** 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 QWebChannel module on Qt labs. +* +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** 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 @@ -20,18 +23,17 @@ ** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** 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. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** 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$ diff --git a/src/resources.qrc b/src/webchannel/resources.qrc index 821e911..821e911 100644 --- a/src/resources.qrc +++ b/src/webchannel/resources.qrc diff --git a/src/signalhandler.h b/src/webchannel/signalhandler_p.h index 0db6085..2613f92 100644 --- a/src/signalhandler.h +++ b/src/webchannel/signalhandler_p.h @@ -4,7 +4,7 @@ ** 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 QtCore module of the Qt Toolkit. +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/src/variantargument.h b/src/webchannel/variantargument_p.h index d5382bd..ee625fc 100644 --- a/src/variantargument.h +++ b/src/webchannel/variantargument_p.h @@ -4,7 +4,7 @@ ** 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 QtCore module of the Qt Toolkit. +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/src/webchannel.js b/src/webchannel/webchannel.js index f29bafc..8827cbf 100644 --- a/src/webchannel.js +++ b/src/webchannel/webchannel.js @@ -1,20 +1,19 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** +** 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 QWebChannel module on Qt labs. +* +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** 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 @@ -24,18 +23,17 @@ ** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** 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. ** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** 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$ diff --git a/src/webchannel/webchannel.pro b/src/webchannel/webchannel.pro new file mode 100644 index 0000000..a0041bf --- /dev/null +++ b/src/webchannel/webchannel.pro @@ -0,0 +1,28 @@ +TARGET = QtWebChannel +QT = core network +CONFIG += warn_on strict_flags + +load(qt_module) + +RESOURCES += \ + resources.qrc + +OTHER_FILES = \ + webchannel.js \ + qobject.js + +PUBLIC_HEADERS += \ + qwebchannel.h \ + qmetaobjectpublisher.h + +PRIVATE_HEADERS += \ + qwebsocketserver_p.h \ + variantargument_p.h \ + signalhandler_p.h + +SOURCES += \ + qwebchannel.cpp \ + qmetaobjectpublisher.cpp \ + qwebsocketserver.cpp + +HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS diff --git a/sync.profile b/sync.profile new file mode 100644 index 0000000..c616ae8 --- /dev/null +++ b/sync.profile @@ -0,0 +1,16 @@ +%modules = ( # path to module name map + "QtWebChannel" => "$basedir/src/webchannel", +); +%moduleheaders = ( # restrict the module headers to those found in relative path +); +# Module dependencies. +# Every module that is required to build this module should have one entry. +# Each of the module version specifiers can take one of the following values: +# - A specific Git revision. +# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) +# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) +# +%dependencies = ( + "qtbase" => "", + "qtdeclarative" => "", +); diff --git a/tests/qml/WebChannelTest.qml b/tests/qml/WebChannelTest.qml index ca2996d..ee6cadd 100644 --- a/tests/qml/WebChannelTest.qml +++ b/tests/qml/WebChannelTest.qml @@ -3,7 +3,7 @@ ** 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 QWebChannel module on Qt labs. +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ import QtQuick 2.0 import QtTest 1.0 -import Qt.labs.WebChannel 1.0 +import QtWebChannel 1.0 import QtWebKit 3.0 import QtWebKit.experimental 1.0 @@ -86,7 +86,7 @@ TestCase { function loadUrl(url) { verify(webChannel.baseUrl != "", "webChannel.baseUrl is empty"); - view.url = url + "?webChannelBaseUrl=" + webChannel.baseUrl; + view.url = "data/" + url + "?webChannelBaseUrl=" + webChannel.baseUrl; // now wait for page to finish loading do { loadingSpy.wait(500); diff --git a/tests/qml/bench_init.html b/tests/qml/data/bench_init.html index ef18650..ef18650 100644 --- a/tests/qml/bench_init.html +++ b/tests/qml/data/bench_init.html diff --git a/tests/qml/disconnect.html b/tests/qml/data/disconnect.html index f4cbb0a..f4cbb0a 100644 --- a/tests/qml/disconnect.html +++ b/tests/qml/data/disconnect.html diff --git a/tests/qml/grouping.html b/tests/qml/data/grouping.html index bb804f4..bb804f4 100644 --- a/tests/qml/grouping.html +++ b/tests/qml/data/grouping.html diff --git a/tests/qml/method.html b/tests/qml/data/method.html index 618550f..618550f 100644 --- a/tests/qml/method.html +++ b/tests/qml/data/method.html diff --git a/tests/qml/property.html b/tests/qml/data/property.html index 1a8360a..1a8360a 100644 --- a/tests/qml/property.html +++ b/tests/qml/data/property.html diff --git a/tests/qml/receiveRaw.html b/tests/qml/data/receiveRaw.html index cfe685e..cfe685e 100644 --- a/tests/qml/receiveRaw.html +++ b/tests/qml/data/receiveRaw.html diff --git a/tests/qml/respond.html b/tests/qml/data/respond.html index 29e47b8..29e47b8 100644 --- a/tests/qml/respond.html +++ b/tests/qml/data/respond.html diff --git a/tests/qml/send.html b/tests/qml/data/send.html index f30e9c8..f30e9c8 100644 --- a/tests/qml/send.html +++ b/tests/qml/data/send.html diff --git a/tests/qml/signal.html b/tests/qml/data/signal.html index e3815cb..e3815cb 100644 --- a/tests/qml/signal.html +++ b/tests/qml/data/signal.html diff --git a/tests/qml/wrapper.html b/tests/qml/data/wrapper.html index 54f456b..54f456b 100644 --- a/tests/qml/wrapper.html +++ b/tests/qml/data/wrapper.html diff --git a/tests/qml/qml.cpp b/tests/qml/qml.cpp index 242a2b6..9dfd7e6 100644 --- a/tests/qml/qml.cpp +++ b/tests/qml/qml.cpp @@ -3,7 +3,7 @@ ** 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 QWebChannel module on Qt labs. +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/qml/qml.pro b/tests/qml/qml.pro index c969291..a2b6933 100644 --- a/tests/qml/qml.pro +++ b/tests/qml/qml.pro @@ -1,10 +1,19 @@ -QT += testlib - +QT += testlib declarative +TEMPLATE = app TARGET = qml CONFIG += warn_on qmltestcase -IMPORTPATH += $$OUT_PWD/../../src $$PWD +# TODO: running tests without requiring make install +IMPORTPATH += $$PWD SOURCES += \ qml.cpp + +OTHER_FILES += \ + WebChannelTest.qml \ + tst_webchannel.qml \ + tst_metaobjectpublisher.qml \ + tst_bench.qml + +TESTDATA = data/* diff --git a/tests/qml/tst_bench.qml b/tests/qml/tst_bench.qml index c7c7c7c..6893a00 100644 --- a/tests/qml/tst_bench.qml +++ b/tests/qml/tst_bench.qml @@ -3,7 +3,7 @@ ** 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 QWebChannel module on Qt labs. +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -33,7 +33,7 @@ import QtQuick 2.0 -import Qt.labs.WebChannel 1.0 +import QtWebChannel 1.0 WebChannelTest { name: "Bench" diff --git a/tests/qml/tst_metaobjectpublisher.qml b/tests/qml/tst_metaobjectpublisher.qml index 6cb01e6..c99cb47 100644 --- a/tests/qml/tst_metaobjectpublisher.qml +++ b/tests/qml/tst_metaobjectpublisher.qml @@ -3,7 +3,7 @@ ** 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 QWebChannel module on Qt labs. +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -33,7 +33,7 @@ import QtQuick 2.0 -import Qt.labs.WebChannel 1.0 +import QtWebChannel 1.0 WebChannelTest { name: "MetaObjectPublisher" diff --git a/tests/qml/tst_webchannel.qml b/tests/qml/tst_webchannel.qml index a915ea3..2cc6153 100644 --- a/tests/qml/tst_webchannel.qml +++ b/tests/qml/tst_webchannel.qml @@ -3,7 +3,7 @@ ** 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 QWebChannel module on Qt labs. +** This file is part of the QtWebChannel module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/tests.pro b/tests/tests.pro index 3f166e8..a839495 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = \ - qml +qtHaveModule(quick) { + SUBDIRS += qml +} |