The standalone example depends on QtWidgets

This fixes builds with Qt built without the widgets module.

Change-Id: I280b1443c3333d9d199d0b4fe7ee43bffb9c5e6e
Reviewed-by: Simo Fält <simo.falt@digia.com>
Use defineProperty instead of __define[SG]etter__

__define[SG]etter__ are non-standard.
Object.defineProperty is the standard way to do this.

See also: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__

Change-Id: If58e420fe84ef2fbb005838955fabf9d96f225b0
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Fix wrong include of qwebchannelglobal.h.

Change-Id: I700f1e1d6508dd4d861bec4f5aa15b666d6eecc0
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Align .qmake.conf with other Qt modules.

This module will be shipped with Qt 5.4.0, so set the version
accordingly. Furthermore, the warning_clean flag is added to CONFIG.

Change-Id: Id8936dc496bf585f838842bcc29fff238523927b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Fix compile warning with clang.

QWebChannelPrivate was declared as struct, even though it is defined as
class later on. Clang emits a warning in such cases.

Change-Id: Ia5988d229d41f02493035e2502955e92079f2baf
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
added module.export for use with nodejs

The module.export allows qwebchannel.js being included and used from
within a nodejs environment.

Change-Id: I3db6ba85e8d3406031c0262815e50aca0f214ace
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Refactor and streamline API and IPC protocol.

This patch removes the obsolete API support to send raw messages using
a QWebChannel. Instead, it is encouraged to directly use WebSockets or
navigator.qt.

By doing so, we can cleanup the code considerably. While at it, the
transport API is adapted to work on QJsonObject messages, instead of
QStrings. This will allow us to use more efficient formats in e.g.
QtWebKit or QtWebEngine. One could also implement a JSONRPC interface
using a custom transport then.

Change-Id: Ia8c125a5558507b3cbecf128a46b19fdb013f47b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Refactor JavaScript QWebChannel to take an external transport object.

This assimilates the JavaScript side to the QML/C++ side. We get rid
of the automagic WebSocket code. Instead, users pass in the WebSocket
from the outside, if they want to use that for communication. In the
QtWebKit/QtWebEngine cases, we will pass in our custom IPC objects.

Change-Id: I15e15b5130f99dc8b39dfbfa8cd3d8b2d34dbbc0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Lutz Schönemann <lutz.schoenemann@basyskom.com>
Add documentation for the QtWebChannel module.

Please proof-read it and tell me what needs to be improved. I assume
most people will probably not use the QWebChannel directly. Rather, they
will only consume its features indirectly through the integration in
QtWebKit/QtWebEngine. Thus the documentation here is for QWebChannel as
a library. User-end documentation should be added to QtWebKit, I think.

Change-Id: I259c204e24331271b8dc74ea11695988234a79d3
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Install missing index.html for standalone example

Change-Id: I908f06bdcea1dfa422cf70817df48cdb1d290690
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Properly disconnect a transport from the QtMetaObjectPublisher.

This fixes a bug, where messages from the transport would still be
send to the QtMetaObjectPublisher even though it was previously
disconnected.

I'll refactor this code eventually to get rid of QtMetaObjectPublisher
alltogether and merge its code into QWebChannelPrivate where
appropriate.

Change-Id: Ie0c35bd81a5e633bdcb6be55b64f947d4a545a59
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: Lutz Schönemann <lutz.schoenemann@basyskom.com>
Fix js src path in HTML chat client

Change-Id: I0a0e05cf1a6e36a7c9b26dfbe5fc083cd5d0ad2b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Enable the QML tests even when QtWebKit is not available.

The tests don't depend on QtWebKit anymore, so they should be run even
without QtWebKit installed.

Change-Id: Id60ebec861b29b73522fba670b1a0c19375cb826
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Use UUIDs to identify wrapped objects

Instead of using stringified pointers to identify
objects this patch creates UUIDs (version 4) for
every object that get's wrapped by QMetaObjectPublisher

Especially when using QtWebChannel to publish an
interface to the network it comes to the point
that you don't want to publish internal memory
addresses

Change-Id: I7e3fec7497d63572cfba72a5dacc10542aef415c
Reviewed-by: Sumedha Widyadharma <sumedha.widyadharma@basyskom.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Fixup documentation issues.

These issues were raised by Sze Howe Koh in code review 89965 of
change I259c204e. This change set does not yet include any comparison
to the old Qt WebKit bridging functionality. I'll hand this in later.

Change-Id: Idc7df0e02bfcda3c3fcf1a4e147c1dfac4f18a64
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Fix namespace build of test

Change-Id: I66b102f0076d8ab39f871ce2be300a1e33228eac
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Make standalone example mostly self-contained.

Install qwebchannel.js file and also copy it to the build dir.

This makes the examples subdirectory self-contained and useable when
compiling it from the install directory. Making individual examples
self-contained would cause too much code duplication, so it was not
done.

Change-Id: Ifeb5eac7d05b92779d24cb4da413f3fb173f992d
Reviewed-by: Sumedha Widyadharma <sumedha.widyadharma@basyskom.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Added a nodeJS example

This is a small sample of a command line chat client which
shows how to use QWebChannel with NodeJS.
See included readme for instructions on how to execute it.
A known port has been introduced to make this work.

Change-Id: If430703f8c2267df758df9d5978509675c8aea9d
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Call unwrapQObject for every response we get

The JS lib will miss to add QObjects to the local
object descriptions when receiving a new description
and the user has not registered a callback function.

This patch makes the lib execute unwrapQObject for
all responses received from a function call.

Change-Id: I72d872d65a7e7bec1d7e6ffb1eea674d0f6e50d7
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Bump version

Change-Id: I1d56bb01e6c9997eb7eba45e9d804109a3cb6384