From 0b67dd7e132d7d618fa538e8c4a275c874543342 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 3 Nov 2015 14:32:25 +0100 Subject: QmlDebug: Restructure QPacket and QPacketProtocol We cannot use the same data stream version for the client and server versions of QPacket and QPacketProtocol should not deal with QPackets but with simple byte arrays because the underlying QDataStream is hard to copy. The new QQmlDebugPacket picks its data stream version from QQmlDebugConnector now, which adjusts it when connecting. As there can only ever be one QQmlDebugConnector, we can keep the version static. The clients need to query the connection for the correct version. We may connect to several different servers sequentially or we may have a server running while using a client, and we don't want to confuse the versions between those. With this in place, all remaining occurrences of QDataStream are replaced with QPacket or QQmlDebugPacket. Change-Id: I3f6ba73fcbfad5e8df917c5feb9308116738a614 Reviewed-by: Simon Hausmann --- tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp') diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp index 0c7ab60f5e..5fce58c17d 100644 --- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp +++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp @@ -32,35 +32,34 @@ ****************************************************************************/ #include "qqmlinspectorclient.h" -#include "qdatastream.h" +#include +#include #include void QQmlInspectorClient::setShowAppOnTop(bool showOnTop) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("request") << m_requestId++ << QByteArray("showAppOnTop") << showOnTop; - sendMessage(message); + sendMessage(ds.data()); } void QQmlInspectorClient::reloadQml(const QHash &changesHash) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); m_reloadRequestId = m_requestId; ds << QByteArray("request") << m_requestId++ << QByteArray("reload") << changesHash; - sendMessage(message); + sendMessage(ds.data()); } void QQmlInspectorClient::messageReceived(const QByteArray &message) { - QDataStream ds(message); + QPacket ds(connection()->currentDataStreamVersion(), message); QByteArray type; ds >> type; -- cgit v1.2.3