diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2014-07-03 14:57:03 +0200 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2014-07-04 20:19:27 +0200 |
commit | 20937e9192c52630b9b47765b58493ada64fcf65 (patch) | |
tree | ad21560ea9eec538fab10abe7b6f70bc2c9d3c17 /src/webchannel | |
parent | 856dc072acb649be03e02ac64c81015d3f2675c2 (diff) | |
download | qtwebchannel-20937e9192c52630b9b47765b58493ada64fcf65.tar.gz |
Only depend optionally on QtWebSockets, and only use it in the example.
The utility QWebChannelAbstractTransport implementation based on the
QtWebSocket has no big value. Instead, it would pull in the QtWebSocket
link-time dependency into QtWebKit/QtWebEngine, which is not desired.
Considering that the WebSocket usecase is minor, and only few people
will ever use it, we agreed that having the code in the example alone
is enough.
Change-Id: Ica038329a1d684f33e805fc296e9dff71b1446ba
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/webchannel')
-rw-r--r-- | src/webchannel/qwebchannelwebsockettransport.cpp | 79 | ||||
-rw-r--r-- | src/webchannel/qwebchannelwebsockettransport.h | 68 | ||||
-rw-r--r-- | src/webchannel/webchannel.pro | 8 |
3 files changed, 3 insertions, 152 deletions
diff --git a/src/webchannel/qwebchannelwebsockettransport.cpp b/src/webchannel/qwebchannelwebsockettransport.cpp deleted file mode 100644 index 59c9538..0000000 --- a/src/webchannel/qwebchannelwebsockettransport.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtWebChannel module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwebchannelwebsockettransport.h" - -/*! - \inmodule QtWebChannel - \brief QWebChannelAbstractSocket implementation that uses a QWebSocket internally. - - The transport delegates all messages received over the QWebSocket over its - textMessageReceived signal. Analogously, all calls to sendTextMessage will - be send over the QWebSocket to the remote client. -*/ - -QT_BEGIN_NAMESPACE - -struct QWebChannelWebSocketTransportPrivate -{ - QWebSocket *socket; -}; - -QWebChannelWebSocketTransport::QWebChannelWebSocketTransport(QWebSocket *socket) -: QWebChannelAbstractTransport(socket) -, d(new QWebChannelWebSocketTransportPrivate) -{ - d->socket = socket; - connect(socket, &QWebSocket::textMessageReceived, - this, &QWebChannelWebSocketTransport::textMessageReceived); -} - -QWebChannelWebSocketTransport::~QWebChannelWebSocketTransport() -{ - -} - -void QWebChannelWebSocketTransport::sendTextMessage(const QString &message) -{ - d->socket->sendTextMessage(message); -} - -QT_END_NAMESPACE diff --git a/src/webchannel/qwebchannelwebsockettransport.h b/src/webchannel/qwebchannelwebsockettransport.h deleted file mode 100644 index b718b9b..0000000 --- a/src/webchannel/qwebchannelwebsockettransport.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtWebChannel module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWEBCHANNELWEBSOCKETTRANSPORT_H -#define QWEBCHANNELWEBSOCKETTRANSPORT_H - -#include <QObject> -#include <QtWebChannel/QWebChannelAbstractTransport> -#include <QtWebChannel/qwebchannelglobal.h> -#include <QtWebSockets/QWebSocket> - -QT_BEGIN_NAMESPACE - -struct QWebChannelWebSocketTransportPrivate; -class Q_WEBCHANNEL_EXPORT QWebChannelWebSocketTransport : public QWebChannelAbstractTransport -{ - Q_OBJECT -public: - explicit QWebChannelWebSocketTransport(QWebSocket *socket); - virtual ~QWebChannelWebSocketTransport(); - - void sendTextMessage(const QString &message) Q_DECL_OVERRIDE; - -private: - QScopedPointer<QWebChannelWebSocketTransportPrivate> d; -}; - -QT_END_NAMESPACE - -#endif // QWEBCHANNELWEBSOCKETTRANSPORT_H diff --git a/src/webchannel/webchannel.pro b/src/webchannel/webchannel.pro index a50beaa..086deeb 100644 --- a/src/webchannel/webchannel.pro +++ b/src/webchannel/webchannel.pro @@ -1,5 +1,5 @@ TARGET = QtWebChannel -QT = core network websockets +QT = core network CONFIG += warn_on strict_flags load(qt_module) @@ -12,8 +12,7 @@ OTHER_FILES = \ PUBLIC_HEADERS += \ qwebchannel.h \ - qwebchannelabstracttransport.h \ - qwebchannelwebsockettransport.h + qwebchannelabstracttransport.h PRIVATE_HEADERS += \ qwebchannel_p.h \ @@ -24,8 +23,7 @@ PRIVATE_HEADERS += \ SOURCES += \ qwebchannel.cpp \ qmetaobjectpublisher.cpp \ - qwebchannelabstracttransport.cpp \ - qwebchannelwebsockettransport.cpp + qwebchannelabstracttransport.cpp qtHaveModule(qml) { QT += qml |