diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-09-16 13:23:19 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-15 08:23:15 +0000 |
commit | 2f03049d4cabfac822bcf6b5886b078d70064968 (patch) | |
tree | e79c7cdc5e300d8889d0525d0a3b1f5582921aa1 /src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp | |
parent | 1a123472ba0e56d1fd772db430e6d4532f672a6e (diff) |
Put QPacketProtocol into its own static library
We need it in 3 places in qtdeclarative and we could also use it in
QtCreator. We don't want to bundle it with the debug client code as it
is also necessary for the server.
QPacket replaces QQmlDebugStream as it has the same purpose. This
also fixes the inconsitent handling of data stream versions.
Change-Id: I650fae353f267511c551b427d9169f4d718aa7f2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp index fa6dca7aca..d1bba54969 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp @@ -40,6 +40,7 @@ #include <QtCore/private/qabstractanimation_p.h> #include <QtQml/private/qqmldebugconnector_p.h> #include <QtQml/private/qqmlcontext_p.h> +#include <QtQml/private/qpacket_p.h> #include <QtGui/QMouseEvent> #include <QtGui/QTouchEvent> @@ -262,18 +263,16 @@ void AbstractViewInspector::onQmlObjectDestroyed(QObject *object) QPair<int, int> ids = m_hashObjectsTobeDestroyed.take(object); - QByteArray response; - - QQmlDebugStream rs(&response, QIODevice::WriteOnly); + QPacket rs; rs << QByteArray(RESPONSE) << ids.first << true << ids.second; - emit m_debugService->messageToClient(m_debugService->name(), response); + emit m_debugService->messageToClient(m_debugService->name(), rs.data()); } void AbstractViewInspector::handleMessage(const QByteArray &message) { bool success = true; - QQmlDebugStream ds(message); + QPacket ds(message); QByteArray type; ds >> type; @@ -358,16 +357,14 @@ void AbstractViewInspector::handleMessage(const QByteArray &message) } - QByteArray response; - QQmlDebugStream rs(&response, QIODevice::WriteOnly); + QPacket rs; rs << QByteArray(RESPONSE) << requestId << success; - emit m_debugService->messageToClient(m_debugService->name(), response); + emit m_debugService->messageToClient(m_debugService->name(), rs.data()); } void AbstractViewInspector::sendCurrentObjects(const QList<QObject*> &objects) { - QByteArray message; - QQmlDebugStream ds(&message, QIODevice::WriteOnly); + QPacket ds; ds << QByteArray(EVENT) << m_eventId++ << QByteArray(SELECT); @@ -377,7 +374,7 @@ void AbstractViewInspector::sendCurrentObjects(const QList<QObject*> &objects) debugIds << QQmlDebugService::idForObject(object); ds << debugIds; - emit m_debugService->messageToClient(m_debugService->name(), message); + emit m_debugService->messageToClient(m_debugService->name(), ds.data()); } void AbstractViewInspector::sendQmlFileReloaded(bool success) @@ -387,10 +384,10 @@ void AbstractViewInspector::sendQmlFileReloaded(bool success) QByteArray response; - QQmlDebugStream rs(&response, QIODevice::WriteOnly); + QPacket rs; rs << QByteArray(RESPONSE) << m_reloadEventId << success; - emit m_debugService->messageToClient(m_debugService->name(), response); + emit m_debugService->messageToClient(m_debugService->name(), rs.data()); } QString AbstractViewInspector::idStringForObject(QObject *obj) const |