summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Fix class name in standalone documentationKai Koehne2017-09-121-3/+3
| | | | | | | This amends change 13294ce605751babad0687e63c033436d129e3d2 Change-Id: I1e819a5d952329985741a558aef47e50a4bd5e7e Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Make chatclient-qml designer-friendlyKai Koehne2017-09-124-69/+209
| | | | | Change-Id: Ibebe78a8bf2ec0147ece31c5895a78415f12c855 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* chatclient-qml: Show errors in a dialogKai Koehne2017-09-121-6/+21
| | | | | | | | | If the socket is closed the error was so far written to a non-existing element. Show a modal dialog then, instead. Also, do not make the login window visible until we have established a connection. Change-Id: I5045f8583a396f22b751e65b8bb73c609b51c9be Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Give example a meaningful window titleKai Koehne2017-09-121-1/+1
| | | | | Change-Id: Id4e4cabe429f00360d1f357183cfbe0ac1ebb5ef Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Chatclient-qml: Use QtQuick.Controls 2Kai Koehne2017-09-121-1/+1
| | | | | | | Let's promote the newer version also in the examples. Change-Id: I903e2aab0bff6fa397c5d35d44b88ee947851f58 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Beautify code of qmlchatclient exampleKai Koehne2017-09-121-50/+68
| | | | | | | | | Follow http://doc.qt.io/qt-5/qml-codingconventions.html This does not change behavior. Change-Id: Ic0e9aa20e9954cd459c4e0b59b67eadcaebd4e47 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: beautify JavaScript snippetsKai Koehne2017-09-085-65/+69
| | | | | Change-Id: I3499bfa49e79ed3664d020f7de0e691afeb15a86 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Split up classes in standalone exampleKai Koehne2017-09-086-71/+267
| | | | | Change-Id: Ie58e8914415f42b0b4d52106b343e152ba9e7565 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use canonical include style and sort #includeKai Koehne2017-09-066-19/+15
| | | | | | | See also https://wiki.qt.io/Writing_Qt_Examples Change-Id: Ife2300b9f1a074e9dc418d53f8c47138129b0cc7 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Allow examples to be built without module sourcesKai Koehne2017-09-062-9/+432
| | | | | | | | | | | | | | | | | | | | | | qwebchannel.js is used by examples, which so far tried to copy it directly from the library source directory. However, in the case of an installed prefix build of Qt, the library sources are not available. This patches therefore moves the qwebchannel.js file to the examples directory, which is installed including sources. The obvious alternative would be copying the file inside the source tree, but that causes code duplication and a maintenance burden that we want to avoid. Another alternative would have been to install qwebchannel.js into QT_INSTALL_DATA, or extract the file at build time from the Qt library. However, this requires bigger changes, and is also dubious because the use case are in particular applications _not_ using Qt. Task-number: QTBUG-57654 Change-Id: I96bc93b6e3d248e4b4facdd582d9fa53ae562924 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Fix coding style issuesKai Koehne2017-08-293-11/+11
| | | | | Change-Id: Ifdd0a9117bc354c342728949e45d1ac431495ef4 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use Qt 5 connectKai Koehne2017-08-292-3/+3
| | | | | Change-Id: I33aa6f8244770bf19b45f69cfc62a5469168418d Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use override keywordKai Koehne2017-08-291-1/+1
| | | | | | | Every C++11 compliant compiler has to support it. Change-Id: I143647aaeba6d49f9ab48abaffad0d77a8abbffd Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use signals and slots keywordsKai Koehne2017-08-292-3/+3
| | | | | | | Examples are not compiled with QT_NO_KEYWORDS. Change-Id: I6bff2b4cc46bd53ef2f1879951e59089734a3864 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use nullptrKai Koehne2017-08-293-3/+3
| | | | | Change-Id: I93688ed891e1cdd6815af0ea22507190c34c0bba Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use canonical include guardsKai Koehne2017-08-292-6/+6
| | | | | Change-Id: I0806cb50a46da19e3538855b348cbdaa2c4f96e1 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Do not put example code in Qt namespaceKai Koehne2017-08-296-22/+6
| | | | | | | | Instead just wrap forward-declared Qt classes. See also https://wiki.qt.io/Writing_Qt_Examples Change-Id: I3707bb6ee5577e49a6b860e8f1c21b6aaf6405c2 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-07-217-46/+67
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/webchannel/doc/src/index.qdoc src/webchannel/qwebchannelabstracttransport.cpp Overlapping changes to documentation; constructed hybrid. src/webchannel/qmetaobjectpublisher.cpp tests/auto/webchannel/tst_webchannel.cpp tests/auto/webchannel/tst_webchannel.h Both sides made additions; in the same place. Change-Id: Iff12970978b70946dc3e1290841aca2d35c9c1d0
| * Doc: Edit example documentationLeena Miettinen2016-06-027-46/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add images to the examples. - Add instructions for running the examples - Edit for grammar and style - Add dependencies to Qt WebEngine and Qt WebSockets modules - Add a workaround for preventing autolinking of WebChannel, WebEngine and WebSockets to the wrong targets - Use explicit linking where necessary Change-Id: Ia4025284063fa09c9e2a0b2c347ee682bba8a615 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com> (cherry picked from commit 01ea92c7c8d77d3d3c10ab1cc4bf4f214aa07126)
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-248-17/+18
|\ \ | |/ | | | | Change-Id: Ica9ff8d7142c5bd5328d44505beb8c22b4c21766
| * Merge remote-tracking branch 'origin/5.6' into 5.7v5.7.0-rc1Liang Qi2016-05-198-17/+18
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I52dc7e8ad7a9ce6fa36ad2d6ce5d8ea29b77b400
| | * make use of COPIESOswald Buddenhagen2016-04-281-12/+4
| | | | | | | | | | | | | | | Change-Id: Ic3979ec70b7ddf7d01d0873c00b7739c5f0ef3c9 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
| | * fix example installsOswald Buddenhagen2016-04-287-5/+14
| | | | | | | | | | | | | | | Change-Id: Iccf9f6e0e9358ba42576fb67a0b356c7414d911e Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Add QStringLiteralFrank Meerkoetter2016-04-131-1/+1
| | | | | | | | | | | | | | | Change-Id: I38ddf1dd4af4e350a11288eebdfd3c3ee1dc5fe9 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Fix include orderFrank Meerkoetter2016-04-132-9/+4
| | | | | | | | | | | | | | | | | | | | | Includes go from most specific to least specific Change-Id: I86aa972dbb09a31142c443dd88f1930e91bf2803 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Fix code styleFrank Meerkoetter2016-04-131-3/+6
| | | | | | | | | | | | | | | | | | Change-Id: I3c3a971c56a5622d24ac8f583bef2039097e244e Reviewed-by: Sérgio Martins <iamsergio@gmail.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Fix typoFrank Meerkoetter2016-04-131-1/+1
|/ / | | | | | | | | Change-Id: I434c84d04d8e8d427bec4fd9f0f9ee20c54e7fc5 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7v5.7.0-alpha1Liang Qi2016-02-152-4/+12
|\ \ | |/ | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I42bfb38e5a9bf03b43636309fe9e29e8d772bb06
| * Example: Add code to copy the JS file from the resource systemVenugopal Shivashankar2016-01-142-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The JS file lives in the src/webchannel directory, and there is a QMake magic in place to copy it to the build directory. But this mechanism fails when the example is run from the Qt binary pkg, which does not include the sources. The JS file must be copied to the build directory either manually or programmatically to run the example. Change-Id: Ib56d9348a8bf1a599e2db5235e0545cd7a8f3bb1 Task-number: QTBUG-46541 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
| * Example: Modify JavaScript part of the HTMLVenugopal Shivashankar2016-01-042-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The baseUrl that is used to connect to a WebSocket server is derived from the query parameters set to the URL. These parameters are ignored by the QDesktopServices::openUrl implementations specific to Windows and OS X. Ubuntu uses the default implementation that retains the query parameters. This means the browser instance will fail to open the local file URL on Ubuntu because it includes the query parameters, so query parameters should never be set. Moreover, the example creates a QWebSocketServer instance, which is available at ws://localhost:12345, so the it is safe to hardcode the address in the JavaScript. The cleaner approach would be to use a URLHandler as described in http://doc.qt.io/qt-5/qdesktopservices.html#url-handlers, but that complicates the example. Change-Id: I5b5df2b7b816ce0bbfb16a85c036ed379616f04a Task-number: QTBUG-46541 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Updated license headersAntti Kokko2016-01-2015-253/+508
|/ | | | | | | | | | From Qt 5.7 -> examples are lisenced under BSD license, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new BSD header instead of LGPL21 one (in those files which will be under BSD) Change-Id: I67629f4d4480e9ba566d7539d62c7cd4e89342e3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Remove transports when the underlying socket gets disconnectFrank Meerkoetter2015-08-191-0/+2
| | | | | | | | | This will cause the transport to be removed from the "transports" member of the QQmlWebChannel. Otherwise it would linger around eating resources. Thanks to Jannis Voelker for pointing it out. Change-Id: I5aca499dfd0bdefc075fa5717436ab0919ec6ab1 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Fix resource leakFrank Meerkoetter2015-08-191-1/+1
| | | | | | | | The transport owns the socket and should therefore delete it. Kudos to Jannis Voelker for pointing it out. Change-Id: Ie6df93c92e00ac64bc4c329b68cbc9c6598257ab Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Update copyright headersv5.5.0-alpha1Antti Kokko2015-02-1715-107/+99
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: Iebed549451f58a9fbdd86adf5d0340412d7766d7 Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-2018-10/+824
|\ | | | | | | | | | | | | Conflicts: examples/webchannel/webchannel.pro Change-Id: Ia768202d177a24ae90358b5d88621a5fa88f9002
| * Added some more examplesBernd Lamecker2014-10-1618-10/+823
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented a C++ Server, providing a chatservice through a simple QObject using QWebChannel and also both a QML and HTML Client to interact with the server. The examples show how to use properties, signals and methods, separated in server and clients. This reverts commit e8c280a15f7822fa5a563388615313858fd90848. The integration issues w.r.t. unconditional usage of the websockets module have been resolved. Change-Id: I4a07646dcd5e6050d3bd6b9bd1c5b07dbc7d7d69 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
| * Revert "Added some more examples"Jani Heikkinen2014-10-1315-634/+8
| | | | | | | | | | | | | | This reverts commit e9ec067e628564e0b065c625dcd7e695857706ac which breaks qt5.git integration Change-Id: I92f23d1c0891ed0e52348ab36b73541027095146 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
| * Added some more examplesBernd Lamecker2014-10-1015-8/+634
| | | | | | | | | | | | | | | | | | | | | | Implemented a C++ Server, providing a chatservice through a simple QObject using QWebChannel and also both a QML and HTML Client to interact with the server. The examples show how to use properties, signals and methods, separated in server and clients. Change-Id: I20c84c2104d0bb599ead1771aad499e59657f83e Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Added a generic node.js debug client as an exampleSumedha Widyadharma2014-09-195-1/+176
|/ | | | | | | | | qwclient can connect to any qwebchannel server using a websocket transport. The service can then be used through a REPL. It can, for instance, be used with the standalone example server. Change-Id: Ie73d19b0376caf2fcf6ae02ec19a56e27bddfd33 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Update license headers and add new licensesJani Heikkinen2014-08-267-126/+70
| | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Furthermore we need to update the sync.profile to not point to the dev branch in order to integrate this patch in the CI. Change-Id: I06b5496b5d865e2da4808532362616429c969658 Reviewed-by: Sergio Ahumada <sahumada@blackberry.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Doc: Edited links JavaScript API page and other documentation fixes.Jerome Pasion2014-08-231-2/+4
| | | | | | | | | The JavaScript API page is important to the rest of the documentation but there was no link to it. Task-number: QTBUG-40756 Change-Id: Id741a67ac2b57e21da548c2961c622c7516ac8cf Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Doc: Add extensions used by example files to .qdocconfTopi Reinio2014-08-211-2/+2
| | | | | | | | | | | As the examples include files with extension that are not included in the global Qt documentation config, add them to the module's .qdocconf to get the files listed in the example documentation pages. Change-Id: Ifc3bf473b67d6acc795ce3f951f0c5269d69b69c Task-number: QTBUG-40831 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Doc: Fix example documentation and pathsTopi Reinio2014-08-1318-53/+8
| | | | | | | | | | | | | | | To fix issues related to example documentation and to follow Qt convention, do the following changes: - Rename examples/qwebchannel to examples/webchannel - Move example-specific documentation to correct location(s) - Include generic 'Running the Example' instructions - Add the module name to example title, fix links This ensures that example docs are built and the example manifest file generated correctly. Change-Id: I284e0b13db95a6738d72258735018b59156cc7da Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Added a nodeJS exampleOswald Buddenhagen2014-08-076-1/+167
| | | | | | | | | | 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>
* Make standalone example mostly self-contained.Milian Wolff2014-08-074-4/+38
| | | | | | | | | | | | | 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>
* Fix js src path in HTML chat clientSumedha Widyadharma2014-08-011-1/+1
| | | | | | Change-Id: I0a0e05cf1a6e36a7c9b26dfbe5fc083cd5d0ad2b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Install missing index.html for standalone exampleSumedha Widyadharma2014-08-011-0/+2
| | | | | Change-Id: I908f06bdcea1dfa422cf70817df48cdb1d290690 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Add documentation for the QtWebChannel module.Milian Wolff2014-08-0113-5/+161
| | | | | | | | | | | 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>
* Refactor JavaScript QWebChannel to take an external transport object.Milian Wolff2014-07-301-20/+37
| | | | | | | | | | | 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>
* Refactor and streamline API and IPC protocol.Milian Wolff2014-07-292-3/+26
| | | | | | | | | | | | | | | 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>