summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSteven Ceuppens <steven.ceuppens@icloud.com>2013-09-27 14:27:27 +0200
committerKurt Pattyn <pattyn.kurt@gmail.com>2013-09-28 21:17:48 +0200
commit6e1e387174d20fb62a804b6e27438bcc5ea59f28 (patch)
tree68d5c273ea682a244398ba8d3c7fbeb4a5f76b9b /examples
parent315e4fa0764f8d7a568be2a8063cc33c9ec13518 (diff)
downloadqtwebsockets-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')
-rw-r--r--examples/echoclient/echoclient.pro4
-rw-r--r--examples/echoserver/echoserver.pro4
-rw-r--r--examples/examples.pro6
-rw-r--r--examples/qmlwebsocketclient/data.qrc5
-rw-r--r--examples/qmlwebsocketclient/main.cpp32
-rw-r--r--examples/qmlwebsocketclient/qml/qmlwebsocketclient/main.qml42
-rw-r--r--examples/qmlwebsocketclient/qmlwebsocketclient.pro11
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
+