diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/echoclient/echoclient.pro | 4 | ||||
-rw-r--r-- | examples/echoserver/echoserver.pro | 4 | ||||
-rw-r--r-- | examples/examples.pro | 6 | ||||
-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 |
7 files changed, 95 insertions, 9 deletions
diff --git a/examples/echoclient/echoclient.pro b/examples/echoclient/echoclient.pro index 565eea3..f6891ef 100644 --- a/examples/echoclient/echoclient.pro +++ b/examples/echoclient/echoclient.pro @@ -1,4 +1,4 @@ -QT += core +QT += core websockets QT -= gui TARGET = echoclient @@ -9,8 +9,6 @@ mac:QMAKE_CXXFLAGS += -Wall -Werror -Wextra TEMPLATE = app -include(../../src/qwebsockets.pri) - SOURCES += \ main.cpp \ echoclient.cpp diff --git a/examples/echoserver/echoserver.pro b/examples/echoserver/echoserver.pro index 913cb6e..d2edcae 100644 --- a/examples/echoserver/echoserver.pro +++ b/examples/echoserver/echoserver.pro @@ -1,4 +1,4 @@ -QT += core +QT += core websockets QT -= gui TARGET = echoserver @@ -9,8 +9,6 @@ mac:QMAKE_CXXFLAGS += -Wall -Werror -Wextra TEMPLATE = app -include(../../src/qwebsockets.pri) - SOURCES += \ main.cpp \ echoserver.cpp diff --git a/examples/examples.pro b/examples/examples.pro index b350436..653df67 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,5 +1,5 @@ -cache() TEMPLATE = subdirs -SUBDIRS = echoclient \ - echoserver +SUBDIRS = echoclient \ + echoserver \ + qmlwebsocketclient 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 + |