diff options
author | Steven Ceuppens <steven.ceuppens@icloud.com> | 2013-09-27 14:27:27 +0200 |
---|---|---|
committer | Kurt Pattyn <pattyn.kurt@gmail.com> | 2013-09-28 21:17:48 +0200 |
commit | 6e1e387174d20fb62a804b6e27438bcc5ea59f28 (patch) | |
tree | 68d5c273ea682a244398ba8d3c7fbeb4a5f76b9b /examples/qmlwebsocketclient | |
parent | 315e4fa0764f8d7a568be2a8063cc33c9ec13518 (diff) | |
download | qtwebsockets-6e1e387174d20fb62a804b6e27438bcc5ea59f28.tar.gz |
Changes to integrate the websocket module as a full Qt Add-On module
- Changed project files to use Qt structure
- Moved existing sources into subdirectory, to make room for moduels
- Created a "import/qmlwebsocket" module skeleton (works, but needs to be extended)
- Modified examples to not use "include(.pri)", but use "QT += websocket"
- Added qml example skeleton (works, but no useful functionality yet)
Project can be build with:
$ qmake
$ make
$ make install
Module can be used in other projects with
QT += websockets
Change-Id: I2123026958b264670dbf8a978dee76edf5855806
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Diffstat (limited to 'examples/qmlwebsocketclient')
-rw-r--r-- | examples/qmlwebsocketclient/data.qrc | 5 | ||||
-rw-r--r-- | examples/qmlwebsocketclient/main.cpp | 32 | ||||
-rw-r--r-- | examples/qmlwebsocketclient/qml/qmlwebsocketclient/main.qml | 42 | ||||
-rw-r--r-- | examples/qmlwebsocketclient/qmlwebsocketclient.pro | 11 |
4 files changed, 90 insertions, 0 deletions
diff --git a/examples/qmlwebsocketclient/data.qrc b/examples/qmlwebsocketclient/data.qrc new file mode 100644 index 0000000..3ac4604 --- /dev/null +++ b/examples/qmlwebsocketclient/data.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>qml/qmlwebsocketclient/main.qml</file> + </qresource> +</RCC> diff --git a/examples/qmlwebsocketclient/main.cpp b/examples/qmlwebsocketclient/main.cpp new file mode 100644 index 0000000..1df79e3 --- /dev/null +++ b/examples/qmlwebsocketclient/main.cpp @@ -0,0 +1,32 @@ +/* +QWebSockets implements the WebSocket protocol as defined in RFC 6455. +Copyright (C) 2013 Kurt Pattyn (pattyn.kurt@gmail.com) + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include <QtGui/QGuiApplication> +#include <QQuickView> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQuickView view; + view.setSource(QUrl(QStringLiteral("qrc:/qml/qmlwebsocketclient/main.qml"))); + view.show(); + + return app.exec(); +} diff --git a/examples/qmlwebsocketclient/qml/qmlwebsocketclient/main.qml b/examples/qmlwebsocketclient/qml/qmlwebsocketclient/main.qml new file mode 100644 index 0000000..7c227a4 --- /dev/null +++ b/examples/qmlwebsocketclient/qml/qmlwebsocketclient/main.qml @@ -0,0 +1,42 @@ +/* +QWebSockets implements the WebSocket protocol as defined in RFC 6455. +Copyright (C) 2013 Kurt Pattyn (pattyn.kurt@gmail.com) + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +import QtQuick 2.0 +import Qt.Playground.WebSockets 1.0 + +Rectangle { + width: 360 + height: 360 + + WebSocket { + + } + + Text { + text: qsTr("Hello World") + anchors.centerIn: parent + } + + MouseArea { + anchors.fill: parent + onClicked: { + Qt.quit(); + } + } +} diff --git a/examples/qmlwebsocketclient/qmlwebsocketclient.pro b/examples/qmlwebsocketclient/qmlwebsocketclient.pro new file mode 100644 index 0000000..e4a7d13 --- /dev/null +++ b/examples/qmlwebsocketclient/qmlwebsocketclient.pro @@ -0,0 +1,11 @@ +QT += qml quick + +TARGET = qmlwebsocketclient + +CONFIG -= app_bundle + +SOURCES += main.cpp + +RESOURCES += \ + data.qrc + |