Refactor the QObject QWebChannel and make the API reusable.
authorMilian Wolff <milian.wolff@kdab.com>
Fri, 18 Jan 2013 15:27:42 +0000 (16:27 +0100)
committerMilian Wolff <milian.wolff@kdab.com>
Fri, 18 Jan 2013 15:37:31 +0000 (16:37 +0100)
commit49631b21f898970b834aaee23070f7c68eceb2a6
tree9aadaa149c557575e88946e9f31364f36d3239af
parentfac4cad296cccc92897378cf2de7303dc5f05467
Refactor the QObject QWebChannel and make the API reusable.

It might becme a very common use case of the QWebChannel QML plugin.
Thus it should be as simple as possible for third party consumers to
setup a QWebChannel for QObject publishing.

The new API basically moves the QtMetaObjectPublisher along with
the JavaScript marshalling to the qwebchannl/src folder.

The updated qtobject example shows how this new API can be used.
Furthermore note how it is now trivially possible to register
multiple objects, which was not easily possible before.

Some notes on the applied refactoring:

- qobject.js contains the JavaScript QObject binding and was
  refactored to support multiple objects.
- the MetaObjectPublisher contains a new handleRequest function
  which handles the QML-side of the QObject binding. This is
  implemented in QML, while the other book keeping and esp. the
  classInfoForObject is still handled in C++ via the
  QtMetaObjectPublisher class (which is registered as
  MetaObjectPublisherPrivate and used by MetaObjectPublisher)
20 files changed:
examples/qtobject/main.cpp
examples/qtobject/qml/qtobject/index.html
examples/qtobject/qml/qtobject/main.qml
examples/qtobject/qml/qtobject/qtobject.js [deleted file]
examples/qtobject/qtmetaobjectpublisher.cpp [deleted file]
examples/qtobject/qtmetaobjectpublisher.h [deleted file]
examples/qtobject/qtobject.pro
examples/qtobject/testobject.cpp
examples/qtobject/testobject.h
src/MetaObjectPublisher.qml [new file with mode: 0644]
src/qmldir
src/qobject.js [new file with mode: 0644]
src/qtmetaobjectpublisher.cpp [new file with mode: 0644]
src/qtmetaobjectpublisher.h [new file with mode: 0644]
src/qwebchannel.cpp
src/qwebchannel_plugin.cpp
src/resources.qrc
src/src.pri
src/src.pro
src/webchannel-iframe.html