aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_native
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-03 14:32:25 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-17 18:42:07 +0000
commit0b67dd7e132d7d618fa538e8c4a275c874543342 (patch)
tree3c6c7cdf8fbae8c6a7d0d333d96c22d130413980 /src/plugins/qmltooling/qmldbg_native
parente010b64d38cb8533d779ac0fe8d609f00a6793e7 (diff)
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 <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_native')
-rw-r--r--src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro6
-rw-r--r--src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp12
-rw-r--r--src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h1
3 files changed, 15 insertions, 4 deletions
diff --git a/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro b/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro
index 8621238eff..d490d77e50 100644
--- a/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro
+++ b/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro
@@ -1,15 +1,19 @@
TARGET = qmldbg_native
-QT += qml-private core-private
+QT += qml-private core-private packetprotocol-private
PLUGIN_TYPE = qmltooling
PLUGIN_CLASS_NAME = QQmlNativeDebugConnectorFactory
load(qt_plugin)
HEADERS += \
+ $$PWD/../shared/qqmldebugpacket.h \
$$PWD/qqmlnativedebugconnector.h
SOURCES += \
$$PWD/qqmlnativedebugconnector.cpp
+INCLUDEPATH += $$PWD \
+ $$PWD/../shared
+
OTHER_FILES += \
$$PWD/qqmlnativedebugconnector.json
diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
index faddaefdc7..7f5529636c 100644
--- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
+++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
@@ -32,9 +32,9 @@
****************************************************************************/
#include "qqmlnativedebugconnector.h"
-#include <private/qhooks_p.h>
-#include <private/qpacket_p.h>
+#include "qqmldebugpacket.h"
+#include <private/qhooks_p.h>
#include <qqmlengine.h>
#include <QtCore/qdebug.h>
@@ -65,7 +65,7 @@ Q_DECL_EXPORT void qt_qmlDebugConnectorOpen();
// member to some other place.
Q_DECL_EXPORT void qt_qmlDebugSetStreamVersion(int version)
{
- QPacket::setDataStreamVersion(version);
+ QQmlNativeDebugConnector::setDataStreamVersion(version);
}
@@ -311,6 +311,12 @@ bool QQmlNativeDebugConnector::open(const QVariantHash &configuration)
return true;
}
+void QQmlNativeDebugConnector::setDataStreamVersion(int version)
+{
+ Q_ASSERT(version <= QDataStream::Qt_DefaultCompiledVersion);
+ s_dataStreamVersion = version;
+}
+
void QQmlNativeDebugConnector::sendMessage(const QString &name, const QByteArray &message)
{
(*responseBuffer) += name.toUtf8() + ' ' + QByteArray::number(message.size()) + ' ' + message;
diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h
index f0d11957a7..d071d54368 100644
--- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h
+++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h
@@ -54,6 +54,7 @@ public:
bool addService(const QString &name, QQmlDebugService *service);
bool removeService(const QString &name);
bool open(const QVariantHash &configuration);
+ static void setDataStreamVersion(int version);
private slots:
void sendMessage(const QString &name, const QByteArray &message);