diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-15 21:17:21 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-15 21:17:21 +0100 |
commit | a9bad172f62fe1dda280df5477a8b7c1bd57690d (patch) | |
tree | a22948b7300a57902a6e46d5346104e32c898e64 /examples/webchannel/standalone/main.cpp | |
parent | 9507cdc31ff6778cba77764bb0991e538c493a9e (diff) | |
parent | e777ff1f88e58c1b47044ac83aafa8ccafa3840f (diff) | |
download | qtwebchannel-a9bad172f62fe1dda280df5477a8b7c1bd57690d.tar.gz |
Merge remote-tracking branch 'origin/5.6' into 5.7v5.7.0-alpha1
Conflicts:
.qmake.conf
Change-Id: I42bfb38e5a9bf03b43636309fe9e29e8d772bb06
Diffstat (limited to 'examples/webchannel/standalone/main.cpp')
-rw-r--r-- | examples/webchannel/standalone/main.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/webchannel/standalone/main.cpp b/examples/webchannel/standalone/main.cpp index 921aa4c..b53e9a6 100644 --- a/examples/webchannel/standalone/main.cpp +++ b/examples/webchannel/standalone/main.cpp @@ -55,8 +55,8 @@ #include <QVariantMap> #include <QDesktopServices> #include <QUrl> -#include <QDebug> - +#include <QDir> +#include <QFileInfo> #include <QtWebSockets/QWebSocketServer> #include "../shared/websocketclientwrapper.h" @@ -128,6 +128,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)) { @@ -149,7 +154,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())); |