summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* The standalone example depends on QtWidgetsSumedha Widyadharma2014-07-241-1/+1
| | | | | | | This fixes builds with Qt built without the widgets module. Change-Id: I280b1443c3333d9d199d0b4fe7ee43bffb9c5e6e Reviewed-by: Simo Fält <simo.falt@digia.com>
* Explicitly distinguish between JavaScript Client and QML Client.Milian Wolff2014-07-182-17/+17
| | | | | | | It worked before, but this patch makes the code more explicit. Change-Id: Id7cf90cb3e2488106e08077e9a8165112734dd88 Reviewed-by: Michael Bruning <michael.bruning@digia.com>
* Adapt to rename to QtWebChannel and rename resource path as well.Milian Wolff2014-07-177-6/+3
| | | | | | | | | | This is a minor cleanup commit. Renaming the .pro file is required for qt.pro to find it. The rename of the resource path makes it more explicit by using the module name. Change-Id: Ib724882d02d2a8aea7468ef984ed573dca1d3e7b Reviewed-by: Michael Bruning <michael.bruning@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Make the QWebChannel QML API publically accessible.Milian Wolff2014-07-1524-134/+316
| | | | | | | | | | This is required for proper QtWebKit/QtWebEngine integration, as otherwise these modules would have to redo a lot of the QtWebChannel QML API. Furthermore, without this, we could not use the WebChannel.id attached property everywhere, independent of the web browser technology. Change-Id: I032a9326841d505c2f77959a240bbfc71e94b6e8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Make the registered objects of a QWebChannel accessible.Milian Wolff2014-07-052-0/+6
| | | | | | | This is useful for integration into QtWebKit. Change-Id: I80d79c0ed8a627d62ee45090d7bceca22fdf56ce Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Do not link against QtNetWork.Milian Wolff2014-07-041-1/+1
| | | | | | | It is not required anymore. Change-Id: Ifb76ed515193591a09a81b73edee12703d16d04c Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
* Only depend optionally on QtWebSockets, and only use it in the example.Milian Wolff2014-07-0410-85/+214
| | | | | | | | | | | | | The utility QWebChannelAbstractTransport implementation based on the QtWebSocket has no big value. Instead, it would pull in the QtWebSocket link-time dependency into QtWebKit/QtWebEngine, which is not desired. Considering that the WebSocket usecase is minor, and only few people will ever use it, we agreed that having the code in the example alone is enough. Change-Id: Ica038329a1d684f33e805fc296e9dff71b1446ba Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com> Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Refactor code to use QWebChannelAbstractTransport and QtWebSockets.Milian Wolff2014-07-0447-1323/+662
| | | | | | | | | | | | | | | | | | | | | | This is a quite big changeset, but necessary to get the roadmap implemented that was discussed at QtCS. With this patchset landed, the QWebChannel does not depend on QtWebKit anymore, not even for the tests. Rather, we will introduce the dependency in the other way (i.e. QtWebKit will optionally use QtWebChannel if available). For the pure Qt/C++ use-case, we ship a utility implementation of a QWebChannelAbstractTransport that uses a QWebSocket for the server-client communication. This way, we can get rid of the custom WebSocket implementation. The tests are refactored to run the qwebchannel.js code directly inside QML. Integration tests for QtWebKit/QtWebEngine as well as examples will be added to these repositories. Change-Id: Icc1c1c5918ec46e31d5070937c14c4ca25a3e2d6 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Do not return a function for property getters on the HTML side.Milian Wolff2014-07-034-21/+10
| | | | | | | | | This simplifies the usage and lets properties be used just like normal JavaScript properties. This is possible since the properties are cached on the HTML side. Change-Id: Ic60076f4596cd8df063567dfbd630e5bd6403119 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Add cmake test, adapt test directory layout and point to dev branches.Milian Wolff2014-07-0327-11/+35
| | | | | | | | | | | The auto tests are now located in tests/auto instead of directly in tests/. This is required to ensure the cmake test is found. Furthermore, the sync.profile is updated to point to refs/heads/dev, as we target Qt 5.4 with this new module. Change-Id: I1e6e99968b7081b5774eaf30319cac1fbaed35c2 Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
* Add .tag file and fix .gitignoreSergio Ahumada2014-07-022-1/+1
| | | | | | | | | | | Do not ignore all .* files by default, if there is any file that should really be ignored then it should be added explicitly in the future. Change-Id: I94a6524d05d87745c8a197e1142a60bf70d17f16 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
* Fix public headers for use with QT_NO_KEYWORDSPierre Rossi2014-06-266-9/+9
| | | | | | | | | QtWebEngineCore has to build that way, so we better make sure the two can play nicely together. Change-Id: Ibab5a2d042b3c8ea230922aeca6768ffec2ca452 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Send response data only to target client.Milian Wolff2014-03-2116-118/+87
| | | | | | | | | | | | | | Before, the response was sent to all clients in a broad-cast and had to be filtered on the client-side. This required additional client identification data to be added to all requests and responses. Now, we keep track of the transport and transport-internal client and only send the response to that client. This is very benefitial for multi-client setups but also reduces traffic for single-client setups and thus their performance. Change-Id: Ia1ef5e031b0058222083d352a8aa28a7d566a6ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use an enum for message types instead of strings.Milian Wolff2014-03-215-45/+100
| | | | | | | | | | | This further reduces the network traffic and thus leads to a small performance boost. Personally, I also think this code is a bit nicer to read and grasp. Change-Id: I943c621142e9982f0e52d24e3a0976428856541b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Refactor QML test code and add a test for multiple websocket clients.Milian Wolff2014-03-215-50/+234
| | | | | | | | | This will allow us to refactor the handling of multiple clients without breaking the functionality. Change-Id: I277eb5d7337d398fdf0694ef539d3b6ab7e5d332 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Merge QWebChannelSocket and QWebSocketTransport.Milian Wolff2014-03-215-162/+116
| | | | | | | | | The former was just the private implementation of the latter. This way, the code structure is more understandable to newcomers and follows existing best-practices. Change-Id: I07cf64370553f4c2de349b5f01e90b31112fee58 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix minor coding style issues.Milian Wolff2014-03-213-8/+8
| | | | | | | | Add space between type name and & or *. Change-Id: I64bfe20510cb43ee0a0b6e08bd433fc657e925a0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Mark some constructor as explicitSergio Ahumada2014-03-193-3/+3
| | | | | | Change-Id: I92c5b00d5bbcc08a241ed0382c13b6bf2676ca6f Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Port code to QtWebSockets.Milian Wolff2014-03-068-618/+68
| | | | | | | | | | | | | This removes the custom WebSocket server implementation and replaces it by a dependency on the QtWebSockets module. Sadly, the QtWebSocket module does not yet support custom protocols. Also, there is quite some boiler plate code required, something which I want to simplify upstream in the QtWebSockets module later. Change-Id: I8066418fb1857d23b8593c443bc9a98ded917a99 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Change destruction order to fix crash on close.Milian Wolff2014-02-061-1/+1
| | | | | | | | The transport interface should outlive the web channel or unregister itself before being destroyed. Change-Id: I77eaa26a4e1985d83cc3f19d07830cf0ca48ee7c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make the underlying transport mechanism of the webchannel pluggable.Milian Wolff2014-02-0638-179/+813
| | | | | | | | | | | | | | | | | | | | | This enables us to optionally use navigator.qt instead of a WebSocket, which is nicer setup-wise and is also slightly faster: navigator.qt: 284.0 msecs per iteration (total: 2,840, iterations: 10) WebSocket: 295.8 msecs per iteration (total: 2,959, iterations: 10) The baseline is ca. 203 msecs, which would mean a performance boost of ca. 12.7%. Furthermore, this sets the fundation to eventually add a WebEngine transport mechanism. The WebViewTransport should also be removed and instead the WebView itself should directly implement the WebChannelTransportInterface. Change-Id: I368bb27e38ffa2f17ffeb7f5ae695690f6f5ad21 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update README and use markdown for nicer display on gitorious.Milian Wolff2014-02-062-60/+90
| | | | | | | This text can then be used in the future for proper qdoc integration. Change-Id: If75b98c0aa1aa131b52542c97a5c2bf382171729 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add license filesMilian Wolff2014-02-064-0/+1660
| | | | | Change-Id: If016bdd88fa26817ae48f77465f111743f62cb1e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix clang warning about struct which was forward-declared as class.Milian Wolff2014-01-311-1/+1
| | | | | Change-Id: I7dc78213bc57cbfd63b021e00823c4aad105aa05 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix compilation when building with namespaced Qt.Milian Wolff2014-01-3116-1/+59
| | | | | | | | Wrap everything in the QtWebChannel module with the Qt namespace or use the Qt namespace where appropriate. Change-Id: I1ef2b2f5eb22ec5e04ca76c034ef8ebf4043b899 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Mark QtWebKit as optional module dependency.Milian Wolff2014-01-313-2/+6
| | | | | | | | | | | | | | The current CI system fails to build the webchannel when QtWebKit is included in sync.profile, so we ignore it for now and adapt the QMake build system to only include the declarative tests when webkit is found. As discussed with tronical, sifalt and sahumada, the qtqa scripts will need to be adapted to cope with optional dependencies of non-qt5 modules. Change-Id: Id89b763ef2697e9e72eb4064c150971b13ebccc3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add QML WebKit example which can be run with qmlscene.Milian Wolff2014-01-313-0/+176
| | | | | | | | | | | | It depends on QtQuickControls for layouting of the QML server side and uses an HTML page similar to the one used by the existing standalone example. The example itself uses the simple raw message passing and simulates a chat app between QML server and HTML client. Change-Id: Ib4ce39ca736febb82a7d56bef4501888b8c06bc7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove examples written by Noam which are under the Nokia license.Milian Wolff2014-01-1617-859/+0
| | | | | | | I'll write new examples from scratch using the proper license. Change-Id: If13e57cf8b19cf45178b6fccace59cb56410d84e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fixup license headers of the files written by me.Milian Wolff2014-01-1626-113/+135
| | | | | | | | | | | | Some tests referenced Nokia in their license even though that was never the case. The tests where written completely by me after Qt Nokia times. What is missing are the examples which are still mostly original work by Noam back then in Nokia times. The rest was (re-)written by me completely since then anyways. Change-Id: Ib423fb3459bcc1f7464a02de4fd82ddfd614d282 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Properly convert JSON data to target type of function parameter.Milian Wolff2014-01-104-44/+64
| | | | | | | | | | | | | | | | | | | This used to work but broke in one of the last few commits apparently. Now we add a proper unit test to ensure it stays working. The issue was that JSON only knows e.g. numeric types stored as double. When we then try to call a method taking an int with the VariantArgument that tries to convert the double to int, we failed and produced an invalid QVariant which then converts to 0. Now we use the appropriate API to convert the JSON data to the correct target type before calling the method. Furthermore, it became clear that we can greatly cleanup the VariantArgument thanks to that. It now is reduced to just a QVariant wrapper class with an implicit cast operator to QGenericArgument. Change-Id: Ieaf60f548ea9584e7d760f9cd935da455787f376 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add declarative object-registration API to QML WebChannel.Milian Wolff2014-01-109-19/+256
| | | | | | | | | | | | The new registeredObjects list property is now preferred over the old imparative registerObject/registerObjects API. Items that are added to the list need an attached WebChannel.id property which holds the identifier under which the object is published to remote clients. Change-Id: I96a8047b9a85e27f3fd48c900180c22ebd20eb35 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix warning about include in public header.Milian Wolff2014-01-091-1/+1
| | | | | | | | | | | QMake reported the following warnings which is fixed by this patch: QtWebChannel: WARNING: .../qwebchannel/src/webchannel/qwebchannel.h includes qwebchannelglobal.h when it should include QtWebChannel/qwebchannelglobal.h Change-Id: Ib6a330e372a9de32d9578aa17ea0d74257a23676 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix regression in handling of var-emitting signals from QML.Milian Wolff2014-01-092-1/+24
| | | | | | | | | | | | Qt 5.3 propagates var-arguments of signals as QJSValue instead of as a QVariant. This then fails to be serialized to QJson, failing our unit tests. Now, QJSValue types are manually casted to QJsonValues which makes the tests pass again. Change-Id: I730c595eee214ebe3d1f83009cd5605f66407f55 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup public API, remove private slot.Milian Wolff2014-01-084-12/+5
| | | | | Change-Id: I73a83380c571ed5a400b16cb255562bb8079eaac Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify usage of QWebChannel on the server side.Milian Wolff2014-01-0819-536/+711
| | | | | | | | | | | This is achieved by hiding the MetaObjectPublisher completely as private API. The QWebChannel is the only publisher API and now handles both the socket as well as the publisher internally. This now allows us to create a proper QML api in the new QmlWebChannel. Change-Id: I3096364af8485353ca9bc19df4a81a8e4552c3d7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make test_property less flaky by skipping idle messages.Milian Wolff2014-01-081-8/+4
| | | | | | | | These messages are somewhat unpredictable in order and as such we skip them instead of relying on their order. Change-Id: I24c082ea1afe6ede1a8058195f01ffba1e6ca8e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fixup and cleanup examples to make them work properly.Milian Wolff2014-01-088-13/+35
| | | | | | | | | This fixes some regressions introduced by previous commits and ensures that the examples work as intended. While at it, the code is cleaned up a bit by using resources instead of referencing files in the source dir. Change-Id: I01da305429dcdebcb96284b7110c59f3090b2201 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify QWebChannel usage by merging webchannel.js and qobject.js.Milian Wolff2014-01-0818-288/+218
| | | | | | | | | | | The code now resides in a single qwebchannel.js file and there is only a single callback-nesting required to setup a MetaObjectPublisher connection. The server-side will be simplified in the next step. Change-Id: Ib5fc77a03c2b281c61af91713411eed571ec6108 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow running of QML tests without needing "make install" first.Milian Wolff2014-01-081-2/+2
| | | | | | | | In addition to these steps, the developer must symlink the qmldir from the source directory to <his build-folder>/qml/QtWebChannel. Change-Id: Ieb1131edc907c98d9ce9134760f14633b07eb080 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimize: Use property-indices instead of names for notifications.Milian Wolff2014-01-084-30/+33
| | | | | | | | | | | | | | | This reduces the traffic as the indices are usually much smaller than the property names. As such, the benchPropertyUpdates gets a speed boost of about 9% (or 10ms vs. 11ms). As we need to transmit the index during initialization that degrades its performance slightly by ca. 4% (13ms vs. 12.5ms). Considering that the initialization only takes place once whereas the property updates potentially often, this is a good tradeoff. Change-Id: If7df3e360f1528b7d7aa26c63ce851363ae9fd6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix assertion at shutdown or on QObject destruction.Milian Wolff2014-01-083-32/+37
| | | | | | | | | | When handling the destroyed signal of a QObject, the QMetaObject of the sender() will point to the global static QObject meta object. Thus, we also cache its signal argument types. This way, we are able to properly handle the destroyed signal with minimum effort. Change-Id: Iba1a3fc94d55adad178302cc847fd4285815e689 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup: The QtQuick2 test does not need Qt += declarative.Milian Wolff2014-01-071-1/+1
| | | | | Change-Id: Ibd9a696a86939530cd08d57a9ef9cbeb3125bbd8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimize client initialization by using QJson directly.Milian Wolff2013-12-274-71/+143
| | | | | | | | | | | Before, we constructed QVariant maps and lists and then converted them to JSON to send the data to the webchannel. By obsoleting the conversion step, benchInitializeClients shows a good performance boost of ca. 19% (11.81ms vs 14.58ms). Change-Id: Ief8e8127207a046f481488a478cd6a18fa0ebffe Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
* Optimize SignalHandler by obsoleting the call to senderSignalIndex.Milian Wolff2013-12-271-17/+16
| | | | | | | | | This method is quite slow, and can be compared to two calls of sender(). We now encode the signal index in the methodId and thus do not have to call it anymore. The performance gain is about 27% (9.2 vs. 12.7ms). Change-Id: Iaa75efa27a54a21e27e62994de25cafd8136159d Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
* Cleanup and optimize code a bit by calling senderSignalIndex less.Milian Wolff2013-12-271-6/+10
| | | | | | | | | | | | | | Profiling shows that sender() and senderSignalIndex(), which again calls sender() internally, are the hotspots in benchPropertyUpdates. To speed things up a bit, call senderSignalIndex only once whenever a signal is emitted. The performance gain is about 27% (16ms vs. 22ms). While at it, also re-use the global s_destroyedSignalIndex static and also call sender() only once even when assertions are enabled. Change-Id: I90cd1a2b453e5c40d0f41276968f4545b42076bc Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
* Port MetaObjectPublisher benchmarks to C++.Milian Wolff2013-12-277-199/+388
| | | | | | | | | | | This allows us to remove the public API for the tests and allows for more tests and benchmarks in the future. To achieve this, we re-use the new qmetaobjectpublisher_p.h, which then also must be exported. Change-Id: I3c33b2f5be6cc674cd3092667151dd8da2263cf5 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
* Add some C++ tests for QWebChannel and QMetaObjectPublisher.Milian Wolff2013-12-274-0/+273
| | | | | | Change-Id: I6a852e1545e7aac0f9f8d83010a3e905524a8069 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add gitattributes and gitignore files.Milian Wolff2013-12-202-0/+6
| | | | | Change-Id: I26d634e9b7293628b41f038827bd6ee12ad8bf44 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
* Add standalone C++/Qt example which opens HTML client in a browser.Milian Wolff2013-12-207-0/+268
| | | | | | | | | | | | | This example shows how to use the (currently quite ugly) raw C++ API to setup a webchannel without using QML at all. The HTML client is then handled by the users default browser. The example itself shows a simple chat between the HTML client and the C++/Qt server, with a line edit for input and a text edit showing the chat history. Change-Id: I8baf14efb9d0c5f5880d99710cf6317fe9b887b9 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
* Restructure sources and assimilate to Qt module structure.Milian Wolff2013-12-1248-404/+534
| | | | | | | | | | | | | | | | | | | | | 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>