From 97577a0f27a1f427948871ae535645a2e0788bf7 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 13 Oct 2015 12:53:22 +0200 Subject: Doc: Update examplesinstallpath to include the repository name The examplesinstallpath variable in .qdocconf files defines the path under QT_INSTALL_EXAMPLES where examples are found. To match the way examples are packaged in Qt 5.6, prefix the install path with the repository name. Task-number: QTBUG-48736 Change-Id: Iafb0663b319f97d2fa3e8f938e4546ae11eaaa69 Reviewed-by: Venugopal Shivashankar Reviewed-by: Milian Wolff --- src/webchannel/doc/qtwebchannel.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webchannel/doc/qtwebchannel.qdocconf b/src/webchannel/doc/qtwebchannel.qdocconf index cfb47e4..fc036d2 100644 --- a/src/webchannel/doc/qtwebchannel.qdocconf +++ b/src/webchannel/doc/qtwebchannel.qdocconf @@ -4,7 +4,7 @@ project = QtWebChannel description = Qt WebChannel Reference Documentation version = $QT_VERSION -examplesinstallpath = webchannel +examplesinstallpath = qtwebchannel/webchannel qhp.projects = QtWebChannel -- cgit v1.2.1 From e82b9c37609ab8f686a6dfd312bf0423bb740f35 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 22 Dec 2015 13:28:10 +0100 Subject: Example: Modify JavaScript part of the HTML 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 --- examples/webchannel/standalone/index.html | 5 ++++- examples/webchannel/standalone/main.cpp | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/webchannel/standalone/index.html b/examples/webchannel/standalone/index.html index 778a502..cc3d72d 100644 --- a/examples/webchannel/standalone/index.html +++ b/examples/webchannel/standalone/index.html @@ -11,7 +11,10 @@ output.innerHTML = output.innerHTML + message + "\n"; } window.onload = function() { - var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]); + if (location.search != "") + var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]); + else + var baseUrl = "ws://localhost:12345"); output("Connecting to WebSocket server at " + baseUrl + "."); var socket = new WebSocket(baseUrl); diff --git a/examples/webchannel/standalone/main.cpp b/examples/webchannel/standalone/main.cpp index 8005301..9c03370 100644 --- a/examples/webchannel/standalone/main.cpp +++ b/examples/webchannel/standalone/main.cpp @@ -132,7 +132,6 @@ int main(int argc, char** argv) // open a browser window with the client HTML page QUrl url = QUrl::fromLocalFile(BUILD_DIR "/index.html"); - url.setQuery(QStringLiteral("webChannelBaseUrl=") + server.serverUrl().toString()); QDesktopServices::openUrl(url); dialog.displayMessage(QObject::tr("Initialization complete, opening browser at %1.").arg(url.toDisplayString())); -- cgit v1.2.1 From eaebf63c17964d449b75b7d2d6af3d0efaee5ed9 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Fri, 8 Jan 2016 14:54:47 +0100 Subject: Example: Add code to copy the JS file from the resource system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ƶ Reviewed-by: Milian Wolff --- examples/webchannel/standalone/index.html | 3 ++- examples/webchannel/standalone/main.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/webchannel/standalone/index.html b/examples/webchannel/standalone/index.html index cc3d72d..b5a9a49 100644 --- a/examples/webchannel/standalone/index.html +++ b/examples/webchannel/standalone/index.html @@ -14,7 +14,8 @@ if (location.search != "") var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]); else - var baseUrl = "ws://localhost:12345"); + var baseUrl = "ws://localhost:12345"; + output("Connecting to WebSocket server at " + baseUrl + "."); var socket = new WebSocket(baseUrl); diff --git a/examples/webchannel/standalone/main.cpp b/examples/webchannel/standalone/main.cpp index 9c03370..bd2b0a9 100644 --- a/examples/webchannel/standalone/main.cpp +++ b/examples/webchannel/standalone/main.cpp @@ -38,8 +38,8 @@ #include #include #include -#include - +#include +#include #include #include "../shared/websocketclientwrapper.h" @@ -111,6 +111,11 @@ int main(int argc, char** argv) { QApplication app(argc, argv); + QFileInfo jsFileInfo(QDir::currentPath() + "/qwebchannel.js"); + + if (!jsFileInfo.exists()) + QFile::copy(":/qtwebchannel/qwebchannel.js",jsFileInfo.absoluteFilePath()); + // setup the QWebSocketServer QWebSocketServer server(QStringLiteral("QWebChannel Standalone Example Server"), QWebSocketServer::NonSecureMode); if (!server.listen(QHostAddress::LocalHost, 12345)) { -- cgit v1.2.1 From 3fa1c9d2cf5e00e7431d042e7955a6dd75e6e2b1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 8 Feb 2016 14:56:41 +0100 Subject: Bump version Change-Id: I7c7c1a8702698b9b37752eaa7cb5d676857b9be8 --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 76d721c..eb2e19a 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += qt_example_installs warning_clean -MODULE_VERSION = 5.6.0 +MODULE_VERSION = 5.6.1 -- cgit v1.2.1 From 92d903d92b430222cd3f89eab08d61d947e5abea Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Sat, 6 Feb 2016 18:29:14 +0000 Subject: Add the "We mean it" warning to private headers Change-Id: I34bcf2e4a2d66c9cb126c2edae79a45064b82a67 Reviewed-by: Milian Wolff --- src/webchannel/qmetaobjectpublisher_p.h | 11 +++++++++++ src/webchannel/qqmlwebchannelattached_p.h | 11 +++++++++++ src/webchannel/qwebchannel_p.h | 11 +++++++++++ src/webchannel/signalhandler_p.h | 11 +++++++++++ src/webchannel/variantargument_p.h | 11 +++++++++++ 5 files changed, 55 insertions(+) diff --git a/src/webchannel/qmetaobjectpublisher_p.h b/src/webchannel/qmetaobjectpublisher_p.h index 2f8a3d7..cb3350e 100644 --- a/src/webchannel/qmetaobjectpublisher_p.h +++ b/src/webchannel/qmetaobjectpublisher_p.h @@ -34,6 +34,17 @@ #ifndef QMETAOBJECTPUBLISHER_P_H #define QMETAOBJECTPUBLISHER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "variantargument_p.h" #include "signalhandler_p.h" diff --git a/src/webchannel/qqmlwebchannelattached_p.h b/src/webchannel/qqmlwebchannelattached_p.h index d4fdcad..da014a3 100644 --- a/src/webchannel/qqmlwebchannelattached_p.h +++ b/src/webchannel/qqmlwebchannelattached_p.h @@ -34,6 +34,17 @@ #ifndef QQMLWEBCHANNELATTACHED_H #define QQMLWEBCHANNELATTACHED_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include "qwebchannelglobal.h" diff --git a/src/webchannel/qwebchannel_p.h b/src/webchannel/qwebchannel_p.h index 5d3bec2..1cd4eb9 100644 --- a/src/webchannel/qwebchannel_p.h +++ b/src/webchannel/qwebchannel_p.h @@ -34,6 +34,17 @@ #ifndef QWEBCHANNEL_P_H #define QWEBCHANNEL_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qwebchannelglobal.h" #include diff --git a/src/webchannel/signalhandler_p.h b/src/webchannel/signalhandler_p.h index d7c64c1..971c1c9 100644 --- a/src/webchannel/signalhandler_p.h +++ b/src/webchannel/signalhandler_p.h @@ -34,6 +34,17 @@ #ifndef SIGNALHANDLER_H #define SIGNALHANDLER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/webchannel/variantargument_p.h b/src/webchannel/variantargument_p.h index 17daaf5..cd0da79 100644 --- a/src/webchannel/variantargument_p.h +++ b/src/webchannel/variantargument_p.h @@ -34,6 +34,17 @@ #ifndef VARIANTARGUMENT_H #define VARIANTARGUMENT_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE -- cgit v1.2.1