Hello community,
here is the log from the commit of package libqt5-qtwebchannel for
openSUSE:Factory checked in at 2015-03-01 15:26:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libqt5-qtwebchannel (Old)
and /work/SRC/openSUSE:Factory/.libqt5-qtwebchannel.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libqt5-qtwebchannel"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libqt5-qtwebchannel/libqt5-qtwebchannel.changes
2015-01-08 23:01:47.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.libqt5-qtwebchannel.new/libqt5-qtwebchannel.changes
2015-03-01 15:26:57.000000000 +0100
@@ -1,0 +2,9 @@
+Tue Feb 24 16:10:33 UTC 2015 - [email protected]
+
+- Update to 5.4.1
+ * For more details please see:
+ http://blog.qt.io/blog/2015/02/24/qt-5-4-1-released/
+- Split the imports into separate package
+- Add minimal requires on libQtQuick5
+
+-------------------------------------------------------------------
Old:
----
qtwebchannel-opensource-src-5.4.0.tar.xz
New:
----
qtwebchannel-opensource-src-5.4.1.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libqt5-qtwebchannel.spec ++++++
--- /var/tmp/diff_new_pack.R5JmNK/_old 2015-03-01 15:26:58.000000000 +0100
+++ /var/tmp/diff_new_pack.R5JmNK/_new 2015-03-01 15:26:58.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package libqt5-qtwebchannel
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,11 +19,11 @@
%define qt5_snapshot 0
%define libname libQt5WebChannel5
%define base_name libqt5
-%define real_version 5.4.0
-%define so_version 5.4.0
+%define real_version 5.4.1
+%define so_version 5.4.1
%define tar_version qtwebchannel-opensource-src-%{real_version}
Name: libqt5-qtwebchannel
-Version: 5.4.0
+Version: 5.4.1
Release: 0
Summary: Qt 5 WebChannel Addon
License: SUSE-LGPL-2.1-with-digia-exception-1.1 or GPL-3.0
@@ -51,10 +51,25 @@
%package -n %{libname}
Summary: Qt 5 WebChannel Addon
Group: Development/Libraries/X11
+%requires_ge libQtQuick5
%description -n %{libname}
Qt is a set of libraries for developing applications.
+%package -n %{libname}-imports
+Summary: Qt 5 WebSockets Library - QML imports
+Group: Development/Libraries/X11
+Supplements: packageand(%{libname}:libQtQuick5)
+# imports splited with 5.4.1
+Conflicts: %{libname} < 5.4.1
+%requires_ge libQtQuick5
+
+%description -n %{libname}-imports
+Qt is a set of libraries for developing applications.
+
+This package contains base tools, like string, xml, and network
+handling.
+
%package devel
Summary: Qt Development Kit
Group: Development/Libraries/X11
@@ -106,6 +121,10 @@
%defattr(-,root,root,755)
%doc LGPL_EXCEPTION.txt LICENSE.*
%{_libqt5_libdir}/libQt5WebChannel.so.*
+
+%files -n %{libname}-imports
+%defattr(-,root,root,755)
+%doc LGPL_EXCEPTION.txt LICENSE.*
%{_libqt5_archdatadir}/qml/QtWebChannel/
%files private-headers-devel
++++++ qtwebchannel-opensource-src-5.4.0.tar.xz ->
qtwebchannel-opensource-src-5.4.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/qtwebchannel-opensource-src-5.4.0/.qmake.conf
new/qtwebchannel-opensource-src-5.4.1/.qmake.conf
--- old/qtwebchannel-opensource-src-5.4.0/.qmake.conf 2014-12-05
17:24:38.000000000 +0100
+++ new/qtwebchannel-opensource-src-5.4.1/.qmake.conf 2015-02-17
05:56:55.000000000 +0100
@@ -1,4 +1,4 @@
load(qt_build_config)
CONFIG += qt_example_installs warning_clean
-MODULE_VERSION = 5.4.0
+MODULE_VERSION = 5.4.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/qtwebchannel-opensource-src-5.4.0/.tag
new/qtwebchannel-opensource-src-5.4.1/.tag
--- old/qtwebchannel-opensource-src-5.4.0/.tag 2014-12-05 17:24:39.000000000
+0100
+++ new/qtwebchannel-opensource-src-5.4.1/.tag 2015-02-17 05:56:55.000000000
+0100
@@ -1 +1 @@
-86d77a900852691267f556fbde98406a12ee4310
+616a5ea6ea99882de7e65c80b362699742448b75
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/qmetaobjectpublisher_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/qmetaobjectpublisher_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/qmetaobjectpublisher_p.h
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/qmetaobjectpublisher_p.h
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-#include "../../../../../src/webchannel/qmetaobjectpublisher_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/qqmlwebchannelattached_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/qqmlwebchannelattached_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/qqmlwebchannelattached_p.h
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/qqmlwebchannelattached_p.h
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-#include "../../../../../src/webchannel/qqmlwebchannelattached_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/qwebchannel_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/qwebchannel_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/qwebchannel_p.h
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/qwebchannel_p.h
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-#include "../../../../../src/webchannel/qwebchannel_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/signalhandler_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/signalhandler_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/signalhandler_p.h
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/signalhandler_p.h
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-#include "../../../../../src/webchannel/signalhandler_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/variantargument_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/variantargument_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.0/QtWebChannel/private/variantargument_p.h
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.0/QtWebChannel/private/variantargument_p.h
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-#include "../../../../../src/webchannel/variantargument_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/qmetaobjectpublisher_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/qmetaobjectpublisher_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/qmetaobjectpublisher_p.h
1970-01-01 01:00:00.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/qmetaobjectpublisher_p.h
2015-02-17 05:56:55.000000000 +0100
@@ -0,0 +1 @@
+#include "../../../../../src/webchannel/qmetaobjectpublisher_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/qqmlwebchannelattached_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/qqmlwebchannelattached_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/qqmlwebchannelattached_p.h
1970-01-01 01:00:00.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/qqmlwebchannelattached_p.h
2015-02-17 05:56:55.000000000 +0100
@@ -0,0 +1 @@
+#include "../../../../../src/webchannel/qqmlwebchannelattached_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/qwebchannel_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/qwebchannel_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/qwebchannel_p.h
1970-01-01 01:00:00.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/qwebchannel_p.h
2015-02-17 05:56:55.000000000 +0100
@@ -0,0 +1 @@
+#include "../../../../../src/webchannel/qwebchannel_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/signalhandler_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/signalhandler_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/signalhandler_p.h
1970-01-01 01:00:00.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/signalhandler_p.h
2015-02-17 05:56:55.000000000 +0100
@@ -0,0 +1 @@
+#include "../../../../../src/webchannel/signalhandler_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/variantargument_p.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/variantargument_p.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/5.4.1/QtWebChannel/private/variantargument_p.h
1970-01-01 01:00:00.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/5.4.1/QtWebChannel/private/variantargument_p.h
2015-02-17 05:56:55.000000000 +0100
@@ -0,0 +1 @@
+#include "../../../../../src/webchannel/variantargument_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/qtwebchannelversion.h
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/qtwebchannelversion.h
---
old/qtwebchannel-opensource-src-5.4.0/include/QtWebChannel/qtwebchannelversion.h
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/include/QtWebChannel/qtwebchannelversion.h
2015-02-17 05:56:55.000000000 +0100
@@ -2,8 +2,8 @@
#ifndef QT_QTWEBCHANNEL_VERSION_H
#define QT_QTWEBCHANNEL_VERSION_H
-#define QTWEBCHANNEL_VERSION_STR "5.4.0"
+#define QTWEBCHANNEL_VERSION_STR "5.4.1"
-#define QTWEBCHANNEL_VERSION 0x050400
+#define QTWEBCHANNEL_VERSION 0x050401
#endif // QT_QTWEBCHANNEL_VERSION_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/src/imports/webchannel/plugins.qmltypes
new/qtwebchannel-opensource-src-5.4.1/src/imports/webchannel/plugins.qmltypes
---
old/qtwebchannel-opensource-src-5.4.0/src/imports/webchannel/plugins.qmltypes
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/src/imports/webchannel/plugins.qmltypes
2015-02-17 05:56:55.000000000 +0100
@@ -4,49 +4,21 @@
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -notrelocatable QtWebChannel 1.0'
+// 'qmlplugindump -nonrelocatable QtWebChannel 1.0'
Module {
Component {
- name: "QWebChannel"
- prototype: "QObject"
- Property { name: "blockUpdates"; type: "bool" }
- Signal {
- name: "blockUpdatesChanged"
- Parameter { name: "block"; type: "bool" }
- }
- Method {
- name: "sendMessage"
- Parameter { name: "id"; type: "QJsonValue" }
- Parameter { name: "data"; type: "QJsonValue" }
- }
- Method {
- name: "sendMessage"
- Parameter { name: "id"; type: "QJsonValue" }
- }
- Method {
- name: "registerObject"
- Parameter { name: "id"; type: "string" }
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "deregisterObject"
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- }
- Component {
- name: "QmlWebChannel"
+ name: "QQmlWebChannel"
prototype: "QWebChannel"
exports: ["QtWebChannel/WebChannel 1.0"]
exportMetaObjectRevisions: [0]
- attachedType: "QmlWebChannelAttached"
+ attachedType: "QQmlWebChannelAttached"
Property { name: "transports"; type: "QObject"; isList: true;
isReadonly: true }
Property { name: "registeredObjects"; type: "QObject"; isList: true;
isReadonly: true }
Method {
name: "registerObjects"
Parameter { name: "objects"; type: "QVariantMap" }
}
- Method { name: "test_clientIsIdle"; type: "bool" }
Method {
name: "connectTo"
Parameter { name: "transport"; type: "QObject"; isPointer: true }
@@ -57,7 +29,7 @@
}
}
Component {
- name: "QmlWebChannelAttached"
+ name: "QQmlWebChannelAttached"
prototype: "QObject"
Property { name: "id"; type: "string" }
Signal {
@@ -65,4 +37,30 @@
Parameter { name: "id"; type: "string" }
}
}
+ Component {
+ name: "QWebChannel"
+ prototype: "QObject"
+ Property { name: "blockUpdates"; type: "bool" }
+ Signal {
+ name: "blockUpdatesChanged"
+ Parameter { name: "block"; type: "bool" }
+ }
+ Method {
+ name: "connectTo"
+ Parameter { name: "transport"; type:
"QWebChannelAbstractTransport"; isPointer: true }
+ }
+ Method {
+ name: "disconnectFrom"
+ Parameter { name: "transport"; type:
"QWebChannelAbstractTransport"; isPointer: true }
+ }
+ Method {
+ name: "registerObject"
+ Parameter { name: "id"; type: "string" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "deregisterObject"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ }
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/src/imports/webchannel/webchannel.pro
new/qtwebchannel-opensource-src-5.4.1/src/imports/webchannel/webchannel.pro
--- old/qtwebchannel-opensource-src-5.4.0/src/imports/webchannel/webchannel.pro
2014-12-05 17:24:39.000000000 +0100
+++ new/qtwebchannel-opensource-src-5.4.1/src/imports/webchannel/webchannel.pro
2015-02-17 05:56:55.000000000 +0100
@@ -3,6 +3,8 @@
INCLUDEPATH += ../../webchannel
VPATH += ../../webchannel
+IMPORT_VERSION = 1.0
+
SOURCES += \
plugin.cpp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/src/webchannel/qmetaobjectpublisher.cpp
new/qtwebchannel-opensource-src-5.4.1/src/webchannel/qmetaobjectpublisher.cpp
---
old/qtwebchannel-opensource-src-5.4.0/src/webchannel/qmetaobjectpublisher.cpp
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/src/webchannel/qmetaobjectpublisher.cpp
2015-02-17 05:56:55.000000000 +0100
@@ -95,15 +95,18 @@
void QMetaObjectPublisher::registerObject(const QString &id, QObject *object)
{
- if (propertyUpdatesInitialized) {
- qWarning("Registered new object after initialization. This does not
work!");
- return;
- }
registeredObjects[id] = object;
registeredObjectIds[object] = id;
+ if (propertyUpdatesInitialized) {
+ if (!webChannel->d_func()->transports.isEmpty()) {
+ qWarning("Registered new object after initialization, existing
clients won't be notified!");
+ // TODO: send a message to clients that an object was added
+ }
+ initializePropertyUpdates(object, classInfoForObject(object));
+ }
}
-QJsonObject QMetaObjectPublisher::classInfoForObject(const QObject *object)
const
+QJsonObject QMetaObjectPublisher::classInfoForObject(const QObject *object)
{
QJsonObject data;
if (!object) {
@@ -151,7 +154,7 @@
prop.name(), object->metaObject()->className());
}
propertyInfo.append(signalInfo);
- propertyInfo.append(QJsonValue::fromVariant(prop.read(object)));
+ propertyInfo.append(wrapResult(prop.read(object)));
qtProperties.append(propertyInfo);
}
for (int i = 0; i < metaObject->methodCount(); ++i) {
@@ -289,7 +292,7 @@
foreach (const int propertyIndex,
objectsSignalToPropertyMap.value(sigIt.key())) {
const QMetaProperty &property =
metaObject->property(propertyIndex);
Q_ASSERT(property.isValid());
- properties[QString::number(propertyIndex)] =
QJsonValue::fromVariant(property.read(object));
+ properties[QString::number(propertyIndex)] =
wrapResult(property.read(object));
}
sigs[QString::number(sigIt.key())] =
QJsonArray::fromVariantList(sigIt.value());
}
@@ -365,6 +368,8 @@
void QMetaObjectPublisher::signalEmitted(const QObject *object, const int
signalIndex, const QVariantList &arguments)
{
if (!webChannel || webChannel->d_func()->transports.isEmpty()) {
+ if (signalIndex == s_destroyedSignalIndex)
+ objectDestroyed(object);
return;
}
if (!signalToPropertyMap.value(object).contains(signalIndex)) {
@@ -374,9 +379,7 @@
message[KEY_OBJECT] = objectName;
message[KEY_SIGNAL] = signalIndex;
if (!arguments.isEmpty()) {
- // TODO: wrap (new) objects on the fly
- QJsonArray args = QJsonArray::fromVariantList(arguments);
- message[KEY_ARGS] = args;
+ message[KEY_ARGS] = wrapList(arguments);
}
message[KEY_TYPE] = TypeSignal;
broadcastMessage(message);
@@ -400,6 +403,7 @@
Q_ASSERT(removed);
Q_UNUSED(removed);
+ signalHandler.remove(object);
signalToPropertyMap.remove(object);
pendingPropertyUpdates.remove(object);
wrappedObjects.remove(object);
@@ -408,33 +412,49 @@
QJsonValue QMetaObjectPublisher::wrapResult(const QVariant &result)
{
if (QObject *object = result.value<QObject *>()) {
- QJsonObject &objectInfo = wrappedObjects[object];
- if (!objectInfo.isEmpty()) {
- // already registered, use cached information
- Q_ASSERT(registeredObjectIds.contains(object));
- return objectInfo;
- } // else the object is not yet wrapped, do it now
-
- const QString &id = QUuid::createUuid().toString();
- Q_ASSERT(!registeredObjectIds.contains(object));
-
- QJsonObject info = classInfoForObject(object);
+ QJsonObject objectInfo;
objectInfo[KEY_QOBJECT] = true;
- objectInfo[KEY_ID] = id;
- objectInfo[KEY_DATA] = info;
-
- registeredObjectIds[object] = id;
- registeredObjects[id] = object;
- wrappedObjects.insert(object, objectInfo);
+ QString id = registeredObjectIds.value(object);
+ if (id.isEmpty()) {
+ // neither registered, nor wrapped, do so now
+ id = QUuid::createUuid().toString();
+
+ registeredObjectIds[object] = id;
+ registeredObjects[id] = object;
+
+ QJsonObject info = classInfoForObject(object);
+ wrappedObjects[object] = info;
+ objectInfo[KEY_DATA] = info;
+ if (propertyUpdatesInitialized) {
+ // if other objects are initialized already, do the same here
+ initializePropertyUpdates(object, info);
+ }
+ } else if (wrappedObjects.contains(object)) {
+ // if this object was wrapped, send the full class info
+ // this is required for proper multi-client support
+ objectInfo[KEY_DATA] = wrappedObjects.value(object);
+ }
- initializePropertyUpdates(object, info);
+ objectInfo[KEY_ID] = id;
return objectInfo;
+ } else if (result.canConvert<QVariantList>()) {
+ // recurse and potentially wrap contents of the array
+ return wrapList(result.toList());
}
// no need to wrap this
return QJsonValue::fromVariant(result);
}
+QJsonArray QMetaObjectPublisher::wrapList(const QVariantList &list)
+{
+ QJsonArray array;
+ foreach (const QVariant &arg, list) {
+ array.append(wrapResult(arg));
+ }
+ return array;
+}
+
void QMetaObjectPublisher::deleteWrappedObject(QObject *object) const
{
if (!wrappedObjects.contains(object)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/src/webchannel/qmetaobjectpublisher_p.h
new/qtwebchannel-opensource-src-5.4.1/src/webchannel/qmetaobjectpublisher_p.h
---
old/qtwebchannel-opensource-src-5.4.0/src/webchannel/qmetaobjectpublisher_p.h
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/src/webchannel/qmetaobjectpublisher_p.h
2015-02-17 05:56:55.000000000 +0100
@@ -94,7 +94,7 @@
/**
* Serialize the QMetaObject of @p object and return it in JSON form.
*/
- QJsonObject classInfoForObject(const QObject *object) const;
+ QJsonObject classInfoForObject(const QObject *object);
/**
* Set the client to idle or busy, based on the value of @p isIdle.
@@ -154,12 +154,17 @@
* return the objects class information.
*
* All other input types are returned as-is.
- *
- * TODO: support wrapping of initially-registered objects
*/
QJsonValue wrapResult(const QVariant &result);
/**
+ * Convert a list of variant values for consumption by the client.
+ *
+ * This properly handles QML values and also wraps the result if required.
+ */
+ QJsonArray wrapList(const QVariantList &list);
+
+ /**
* Invoke delete later on @p object.
*/
void deleteWrappedObject(QObject *object) const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/src/webchannel/qwebchannel.js
new/qtwebchannel-opensource-src-5.4.1/src/webchannel/qwebchannel.js
--- old/qtwebchannel-opensource-src-5.4.0/src/webchannel/qwebchannel.js
2014-12-05 17:24:39.000000000 +0100
+++ new/qtwebchannel-opensource-src-5.4.1/src/webchannel/qwebchannel.js
2015-02-17 05:56:55.000000000 +0100
@@ -161,6 +161,10 @@
var data = message.data[objectName];
var object = new QObject(objectName, data, channel);
}
+ // now unwrap properties, which might reference other registered
objects
+ for (var objectName in channel.objects) {
+ channel.objects[objectName].unwrapProperties();
+ }
if (initCallback) {
initCallback(channel);
}
@@ -190,18 +194,31 @@
// ----------------------------------------------------------------------
- function unwrapQObject( response )
+ this.unwrapQObject = function(response)
{
+ if (response instanceof Array) {
+ // support list of objects
+ var ret = new Array(response.length);
+ for (var i = 0; i < response.length; ++i) {
+ ret[i] = object.unwrapQObject(response[i]);
+ }
+ return ret;
+ }
if (!response
|| !response["__QObject*__"]
- || response["id"] === undefined
- || response["data"] === undefined) {
+ || response["id"] === undefined) {
return response;
}
+
var objectId = response.id;
if (webChannel.objects[objectId])
return webChannel.objects[objectId];
+ if (!response.data) {
+ console.error("Cannot unwrap unknown QObject " + objectId + "
without data.");
+ return;
+ }
+
var qObject = new QObject( objectId, response.data, webChannel );
qObject.destroyed.connect(function() {
if (webChannel.objects[objectId] === qObject) {
@@ -219,9 +236,18 @@
}
}
});
+ // here we are already initialized, and thus must directly unwrap the
properties
+ qObject.unwrapProperties();
return qObject;
}
+ this.unwrapProperties = function()
+ {
+ for (var propertyIdx in object.__propertyCache__) {
+ object.__propertyCache__[propertyIdx] =
object.unwrapQObject(object.__propertyCache__[propertyIdx]);
+ }
+ }
+
function addSignal(signalData, isPropertyNotifySignal)
{
var signalName = signalData[0];
@@ -324,7 +350,7 @@
"args": args
}, function(response) {
if (response !== undefined) {
- var result = unwrapQObject(response);
+ var result = object.unwrapQObject(response);
if (callback) {
(callback)(result);
}
@@ -339,6 +365,8 @@
var propertyName = propertyInfo[1];
var notifySignalData = propertyInfo[2];
// initialize property cache with current value
+ // NOTE: if this is an object, it is not directly unwrapped as it might
+ // reference other QObject that we do not know yet
object.__propertyCache__[propertyIndex] = propertyInfo[3];
if (notifySignalData) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/src/webchannel/signalhandler_p.h
new/qtwebchannel-opensource-src-5.4.1/src/webchannel/signalhandler_p.h
--- old/qtwebchannel-opensource-src-5.4.0/src/webchannel/signalhandler_p.h
2014-12-05 17:24:39.000000000 +0100
+++ new/qtwebchannel-opensource-src-5.4.1/src/webchannel/signalhandler_p.h
2015-02-17 05:56:55.000000000 +0100
@@ -84,6 +84,11 @@
*/
void clear();
+ /**
+ * Fully remove and disconnect an object from handler
+ */
+ void remove(const QObject *object);
+
private:
/**
* Exctract the arguments of a signal call and pass them to the receiver.
@@ -252,15 +257,6 @@
dispatch(object, methodId, args);
- if (methodId == s_destroyedSignalIndex) {
- // disconnect on QObject::destroyed
- ConnectionHash::iterator it = m_connectionsCounter.find(object);
- Q_ASSERT(it != m_connectionsCounter.end());
- foreach (const ConnectionPair &connection, *it) {
- QObject::disconnect(connection.first);
- }
- m_connectionsCounter.erase(it);
- }
return -1;
}
return methodId;
@@ -280,6 +276,17 @@
m_signalArgumentTypes[&QObject::staticMetaObject] = keep;
}
+template<class Receiver>
+void SignalHandler<Receiver>::remove(const QObject *object)
+{
+ Q_ASSERT(m_connectionsCounter.contains(object));
+ const SignalConnectionHash &connections =
m_connectionsCounter.value(object);
+ foreach (const ConnectionPair &connection, connections) {
+ QObject::disconnect(connection.first);
+ }
+ m_connectionsCounter.remove(object);
+}
+
QT_END_NAMESPACE
#endif // SIGNALHANDLER_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/tests/auto/qml/tst_webchannel.qml
new/qtwebchannel-opensource-src-5.4.1/tests/auto/qml/tst_webchannel.qml
--- old/qtwebchannel-opensource-src-5.4.0/tests/auto/qml/tst_webchannel.qml
2014-12-05 17:24:39.000000000 +0100
+++ new/qtwebchannel-opensource-src-5.4.1/tests/auto/qml/tst_webchannel.qml
2015-02-17 05:56:55.000000000 +0100
@@ -66,6 +66,8 @@
property var bar: 1
WebChannel.id: "myOtherObj"
}
+ QtObject{ id: bar; objectName: "bar" }
+ QtObject{ id: baz; objectName: "baz" }
QtObject {
id: myFactory
property var lastObj
@@ -74,9 +76,13 @@
lastObj = component.createObject(myFactory, {objectName: id});
return lastObj;
}
+ property var objectInProperty: QtObject {
+ objectName: "foo"
+ }
+ property var otherObject: myObj
+ property var objects: [ bar, baz ];
WebChannel.id: "myFactory"
}
-
Component {
id: component
QtObject {
@@ -264,6 +270,15 @@
myFactory.lastObj.mySignal("foobar", 42);
+ // property should be wrapped
+ compare(channel.objects.myFactory.objectInProperty.objectName, "foo");
+ // list property as well
+ compare(channel.objects.myFactory.objects.length, 2);
+ compare(channel.objects.myFactory.objects[0].objectName, "bar");
+ compare(channel.objects.myFactory.objects[1].objectName, "baz");
+ // also works with properties that reference other registered objects
+ compare(channel.objects.myFactory.otherObject, channel.objects.myObj);
+
// deleteLater call
msg = client.awaitMessage();
compare(msg.type, JSClient.QWebChannelMessageTypes.invokeMethod);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/tests/auto/webchannel/tst_webchannel.cpp
new/qtwebchannel-opensource-src-5.4.1/tests/auto/webchannel/tst_webchannel.cpp
---
old/qtwebchannel-opensource-src-5.4.0/tests/auto/webchannel/tst_webchannel.cpp
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/tests/auto/webchannel/tst_webchannel.cpp
2015-02-17 05:56:55.000000000 +0100
@@ -83,6 +83,30 @@
channel.registerObjects(objects);
}
+void TestWebChannel::testDeregisterObjects()
+{
+ QWebChannel channel;
+ TestObject testObject;
+ testObject.setObjectName("myTestObject");
+
+
+ channel.registerObject(testObject.objectName(), &testObject);
+
+ channel.connectTo(m_dummyTransport);
+ channel.d_func()->publisher->initializeClients();
+
+ QJsonObject connectMessage =
+ QJsonDocument::fromJson(("{\"type\": 7,"
+ "\"object\": \"myTestObject\","
+ "\"signal\": " +
QString::number(testObject.metaObject()->indexOfSignal("sig1()"))
+ + "}").toLatin1()).object();
+ channel.d_func()->publisher->handleMessage(connectMessage,
m_dummyTransport);
+
+ emit testObject.sig1();
+ channel.deregisterObject(&testObject);
+ emit testObject.sig1();
+}
+
void TestWebChannel::testInfoForObject()
{
TestObject obj;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/qtwebchannel-opensource-src-5.4.0/tests/auto/webchannel/tst_webchannel.h
new/qtwebchannel-opensource-src-5.4.1/tests/auto/webchannel/tst_webchannel.h
---
old/qtwebchannel-opensource-src-5.4.0/tests/auto/webchannel/tst_webchannel.h
2014-12-05 17:24:39.000000000 +0100
+++
new/qtwebchannel-opensource-src-5.4.1/tests/auto/webchannel/tst_webchannel.h
2015-02-17 05:56:55.000000000 +0100
@@ -214,6 +214,7 @@
private slots:
void testRegisterObjects();
+ void testDeregisterObjects();
void testInfoForObject();
void testInvokeMethodConversion();
void testDisconnect();
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]