aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp')
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp129
1 files changed, 52 insertions, 77 deletions
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
index 9b48b40c07..3ad7beb7ff 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
@@ -1,38 +1,33 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company 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 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qqmlenginedebugclient.h"
-#include "qdatastream.h"
+#include <private/qqmldebugconnection_p.h>
struct QmlObjectData {
QUrl url;
@@ -46,7 +41,7 @@ struct QmlObjectData {
int parentId;
};
-QDataStream &operator>>(QDataStream &ds, QmlObjectData &data)
+QPacket &operator>>(QPacket &ds, QmlObjectData &data)
{
ds >> data.url >> data.lineNumber >> data.columnNumber >> data.idString
>> data.objectName >> data.objectType >> data.objectId >> data.contextId
@@ -64,7 +59,7 @@ struct QmlObjectProperty {
bool hasNotifySignal;
};
-QDataStream &operator>>(QDataStream &ds, QmlObjectProperty &data)
+QPacket &operator>>(QPacket &ds, QmlObjectProperty &data)
{
int type;
ds >> type >> data.name >> data.value >> data.valueTypeName
@@ -77,8 +72,7 @@ QQmlEngineDebugClient::QQmlEngineDebugClient(
QQmlDebugConnection *connection)
: QQmlDebugClient(QLatin1String("QmlDebugger"), connection),
m_nextId(0),
- m_valid(false),
- m_connection(connection)
+ m_valid(false)
{
}
@@ -89,11 +83,10 @@ quint32 QQmlEngineDebugClient::addWatch(
*success = false;
if (state() == QQmlDebugClient::Enabled) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("WATCH_PROPERTY") << id << property.objectDebugId
<< property.name.toUtf8();
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -115,10 +108,9 @@ quint32 QQmlEngineDebugClient::addWatch(
*success = false;
if (state() == QQmlDebugClient::Enabled) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("WATCH_EXPR_OBJECT") << id << object.debugId << expr;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -131,10 +123,9 @@ quint32 QQmlEngineDebugClient::addWatch(
*success = false;
if (state() == QQmlDebugClient::Enabled) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("WATCH_OBJECT") << id << object.debugId;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -152,10 +143,9 @@ void QQmlEngineDebugClient::removeWatch(quint32 id, bool *success)
{
*success = false;
if (state() == QQmlDebugClient::Enabled) {
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("NO_WATCH") << id;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
}
@@ -167,10 +157,9 @@ quint32 QQmlEngineDebugClient::queryAvailableEngines(bool *success)
*success = false;
if (state() == QQmlDebugClient::Enabled) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("LIST_ENGINES") << id;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -184,10 +173,9 @@ quint32 QQmlEngineDebugClient::queryRootContexts(
*success = false;
if (state() == QQmlDebugClient::Enabled && engine.debugId != -1) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("LIST_OBJECTS") << id << engine.debugId;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -201,11 +189,9 @@ quint32 QQmlEngineDebugClient::queryObject(
*success = false;
if (state() == QQmlDebugClient::Enabled && object.debugId != -1) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("FETCH_OBJECT") << id << object.debugId << false <<
- true;
- sendMessage(message);
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("FETCH_OBJECT") << id << object.debugId << false << true;
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -219,11 +205,10 @@ quint32 QQmlEngineDebugClient::queryObjectsForLocation(
*success = false;
if (state() == QQmlDebugClient::Enabled) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id << file << lineNumber
<< columnNumber << false << true;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -237,11 +222,9 @@ quint32 QQmlEngineDebugClient::queryObjectRecursive(
*success = false;
if (state() == QQmlDebugClient::Enabled && object.debugId != -1) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("FETCH_OBJECT") << id << object.debugId << true <<
- true;
- sendMessage(message);
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("FETCH_OBJECT") << id << object.debugId << true << true;
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -255,11 +238,10 @@ quint32 QQmlEngineDebugClient::queryObjectsForLocationRecursive(const QString &f
*success = false;
if (state() == QQmlDebugClient::Enabled) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id << file << lineNumber
<< columnNumber << true << true;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -273,11 +255,10 @@ quint32 QQmlEngineDebugClient::queryExpressionResult(
*success = false;
if (state() == QQmlDebugClient::Enabled) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr
<< engines()[0].debugId;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -291,10 +272,9 @@ quint32 QQmlEngineDebugClient::queryExpressionResultBC(
*success = false;
if (state() == QQmlDebugClient::Enabled) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -312,11 +292,10 @@ quint32 QQmlEngineDebugClient::setBindingForObject(
*success = false;
if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName
<< bindingExpression << isLiteralValue << source << line;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -331,10 +310,9 @@ quint32 QQmlEngineDebugClient::resetBindingForObject(
*success = false;
if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
@@ -348,17 +326,16 @@ quint32 QQmlEngineDebugClient::setMethodBody(
*success = false;
if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
id = getId();
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
+ QPacket ds(connection()->currentDataStreamVersion());
ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId
<< methodName << methodBody;
- sendMessage(message);
+ sendMessage(ds.data());
*success = true;
}
return id;
}
-void QQmlEngineDebugClient::decode(QDataStream &ds,
+void QQmlEngineDebugClient::decode(QPacket &ds,
QmlDebugObjectReference &o,
bool simple)
{
@@ -419,7 +396,7 @@ void QQmlEngineDebugClient::decode(QDataStream &ds,
}
}
-void QQmlEngineDebugClient::decode(QDataStream &ds,
+void QQmlEngineDebugClient::decode(QPacket &ds,
QList<QmlDebugObjectReference> &o,
bool simple)
{
@@ -432,7 +409,7 @@ void QQmlEngineDebugClient::decode(QDataStream &ds,
}
}
-void QQmlEngineDebugClient::decode(QDataStream &ds,
+void QQmlEngineDebugClient::decode(QPacket &ds,
QmlDebugContextReference &c)
{
ds >> c.name >> c.debugId;
@@ -460,9 +437,7 @@ void QQmlEngineDebugClient::decode(QDataStream &ds,
void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
{
m_valid = false;
- QDataStream ds(data);
- ds.setVersion(m_connection->dataStreamVersion());
-
+ QPacket ds(connection()->currentDataStreamVersion(), data);
int queryId;
QByteArray type;