diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-14 15:50:31 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-18 11:55:12 +0000 |
commit | 60bc2ccc956f84c0c9d1a5d610da98f05ff279a0 (patch) | |
tree | fca222705692bc999947115d268c2a98f757e235 /src/libs/qmldebug | |
parent | 2d79bdc29c242a04aad3519858ad64712be4de8e (diff) |
QmlDebug: Add socketState and flush() for local sockets
Change-Id: Ieb90f661eaa2a595c88e1e36653437c810a6aa3a
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/libs/qmldebug')
-rw-r--r-- | src/libs/qmldebug/qmldebugclient.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libs/qmldebug/qmldebugclient.cpp b/src/libs/qmldebug/qmldebugclient.cpp index 5a875a2c39..86fe261f09 100644 --- a/src/libs/qmldebug/qmldebugclient.cpp +++ b/src/libs/qmldebug/qmldebugclient.cpp @@ -42,7 +42,6 @@ const QString clientId = QLatin1String("QDeclarativeDebugClient"); class QmlDebugClientPrivate { - // Q_DECLARE_PUBLIC(QmlDebugClient) public: QmlDebugClientPrivate(); @@ -56,7 +55,7 @@ public: QmlDebugConnectionPrivate(); QPacketProtocol *protocol; QLocalServer *server; - QIODevice *device; // Currently a QTcpSocket + QIODevice *device; // Currently a QTcpSocket or a QLocalSocket bool gotHello; QHash <QString, float> serverPlugins; @@ -350,11 +349,10 @@ bool QmlDebugConnection::sendMessage(const QString &name, const QByteArray &mess void QmlDebugConnectionPrivate::flush() { - QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(device); - if (socket) { + if (QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(device)) + socket->flush(); + else if (QLocalSocket *socket = qobject_cast<QLocalSocket *>(device)) socket->flush(); - return; - } } void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port) @@ -432,15 +430,14 @@ void QmlDebugConnection::setMaximumDataStreamVersion(int maximumVersion) QAbstractSocket::SocketState QmlDebugConnection::socketState() const { Q_D(const QmlDebugConnection); - // TODO: when merging into master, add clause for local socket if (QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(d->device)) return socket->state(); + else if (QLocalSocket *socket = qobject_cast<QLocalSocket *>(d->device)) + return static_cast<QAbstractSocket::SocketState>(socket->state()); else return QAbstractSocket::UnconnectedState; } -// - QmlDebugClientPrivate::QmlDebugClientPrivate() : connection(0) { |