diff options
Diffstat (limited to 'tests/auto/qml/debugger/shared')
7 files changed, 1 insertions, 931 deletions
diff --git a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp index 6f74edf863..956e97e7ba 100644 --- a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp +++ b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp @@ -46,7 +46,7 @@ QQmlDebugProcess::QQmlDebugProcess(const QString &executable, QObject *parent) this, &QQmlDebugProcess::processAppOutput); connect(&m_process, &QProcess::errorOccurred, this, &QQmlDebugProcess::processError); - connect(&m_process, QOverload<int>::of(&QProcess::finished), + connect(&m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this]() { m_timer.stop(); m_eventLoop.quit(); diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp deleted file mode 100644 index 7e736ec400..0000000000 --- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp +++ /dev/null @@ -1,508 +0,0 @@ -/**************************************************************************** -** -** 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: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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** 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 <private/qqmldebugconnection_p.h> - -struct QmlObjectData { - QUrl url; - int lineNumber; - int columnNumber; - QString idString; - QString objectName; - QString objectType; - int objectId; - int contextId; - int parentId; -}; - -QPacket &operator>>(QPacket &ds, QmlObjectData &data) -{ - ds >> data.url >> data.lineNumber >> data.columnNumber >> data.idString - >> data.objectName >> data.objectType >> data.objectId >> data.contextId - >> data.parentId; - return ds; -} - -struct QmlObjectProperty { - enum Type { Unknown, Basic, Object, List, SignalProperty }; - Type type; - QString name; - QVariant value; - QString valueTypeName; - QString binding; - bool hasNotifySignal; -}; - -QPacket &operator>>(QPacket &ds, QmlObjectProperty &data) -{ - int type; - ds >> type >> data.name >> data.value >> data.valueTypeName - >> data.binding >> data.hasNotifySignal; - data.type = (QmlObjectProperty::Type)type; - return ds; -} - -QQmlEngineDebugClient::QQmlEngineDebugClient( - QQmlDebugConnection *connection) - : QQmlDebugClient(QLatin1String("QmlDebugger"), connection), - m_nextId(0), - m_valid(false) -{ -} - -quint32 QQmlEngineDebugClient::addWatch( - const QmlDebugPropertyReference &property, bool *success) -{ - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("WATCH_PROPERTY") << id << property.objectDebugId - << property.name.toUtf8(); - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::addWatch( - const QmlDebugContextReference &, const QString &, bool *success) -{ - *success = false; - qWarning("QQmlEngineDebugClient::addWatch(): Not implemented"); - return 0; -} - -quint32 QQmlEngineDebugClient::addWatch( - const QmlDebugObjectReference &object, const QString &expr, - bool *success) -{ - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("WATCH_EXPR_OBJECT") << id << object.debugId << expr; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::addWatch( - const QmlDebugObjectReference &object, bool *success) -{ - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("WATCH_OBJECT") << id << object.debugId; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::addWatch( - const QmlDebugFileReference &, bool *success) -{ - *success = false; - qWarning("QQmlEngineDebugClient::addWatch(): Not implemented"); - return 0; -} - -void QQmlEngineDebugClient::removeWatch(quint32 id, bool *success) -{ - *success = false; - if (state() == QQmlDebugClient::Enabled) { - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("NO_WATCH") << id; - sendMessage(ds.data()); - *success = true; - } -} - -quint32 QQmlEngineDebugClient::queryAvailableEngines(bool *success) -{ - m_engines.clear(); - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("LIST_ENGINES") << id; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::queryRootContexts( - const QmlDebugEngineReference &engine, bool *success) -{ - m_rootContext = QmlDebugContextReference(); - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled && engine.debugId != -1) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("LIST_OBJECTS") << id << engine.debugId; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::queryObject( - const QmlDebugObjectReference &object, bool *success) -{ - m_object = QmlDebugObjectReference(); - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled && object.debugId != -1) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("FETCH_OBJECT") << id << object.debugId << false << true; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::queryObjectsForLocation( - const QString &file, int lineNumber, int columnNumber, bool *success) -{ - m_objects.clear(); - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id << file << lineNumber - << columnNumber << false << true; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::queryObjectRecursive( - const QmlDebugObjectReference &object, bool *success) -{ - m_object = QmlDebugObjectReference(); - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled && object.debugId != -1) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("FETCH_OBJECT") << id << object.debugId << true << true; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::queryObjectsForLocationRecursive(const QString &file, - int lineNumber, int columnNumber, bool *success) -{ - m_objects.clear(); - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id << file << lineNumber - << columnNumber << true << true; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::queryExpressionResult( - int objectDebugId, const QString &expr, bool *success) -{ - m_exprResult = QVariant(); - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr - << engines()[0].debugId; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::queryExpressionResultBC( - int objectDebugId, const QString &expr, bool *success) -{ - m_exprResult = QVariant(); - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::setBindingForObject( - int objectDebugId, - const QString &propertyName, - const QVariant &bindingExpression, - bool isLiteralValue, - QString source, int line, - bool *success) -{ - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName - << bindingExpression << isLiteralValue << source << line; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::resetBindingForObject( - int objectDebugId, - const QString &propertyName, - bool *success) -{ - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -quint32 QQmlEngineDebugClient::setMethodBody( - int objectDebugId, const QString &methodName, - const QString &methodBody, bool *success) -{ - quint32 id = -1; - *success = false; - if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) { - id = getId(); - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId - << methodName << methodBody; - sendMessage(ds.data()); - *success = true; - } - return id; -} - -void QQmlEngineDebugClient::decode(QPacket &ds, - QmlDebugObjectReference &o, - bool simple) -{ - QmlObjectData data; - ds >> data; - o.debugId = data.objectId; - o.className = data.objectType; - o.idString = data.idString; - o.name = data.objectName; - o.source.url = data.url; - o.source.lineNumber = data.lineNumber; - o.source.columnNumber = data.columnNumber; - o.contextDebugId = data.contextId; - - if (simple) - return; - - int childCount; - bool recur; - ds >> childCount >> recur; - - for (int ii = 0; ii < childCount; ++ii) { - o.children.append(QmlDebugObjectReference()); - decode(ds, o.children.last(), !recur); - } - - int propCount; - ds >> propCount; - - for (int ii = 0; ii < propCount; ++ii) { - QmlObjectProperty data; - ds >> data; - QmlDebugPropertyReference prop; - prop.objectDebugId = o.debugId; - prop.name = data.name; - prop.binding = data.binding; - prop.hasNotifySignal = data.hasNotifySignal; - prop.valueTypeName = data.valueTypeName; - switch (data.type) { - case QmlObjectProperty::Basic: - case QmlObjectProperty::List: - case QmlObjectProperty::SignalProperty: - { - prop.value = data.value; - break; - } - case QmlObjectProperty::Object: - { - QmlDebugObjectReference obj; - obj.name = data.value.toString(); - obj.className = prop.valueTypeName; - prop.value = qVariantFromValue(obj); - break; - } - case QmlObjectProperty::Unknown: - break; - } - o.properties << prop; - } -} - -void QQmlEngineDebugClient::decode(QPacket &ds, - QList<QmlDebugObjectReference> &o, - bool simple) -{ - int count; - ds >> count; - for (int i = 0; i < count; i++) { - QmlDebugObjectReference obj; - decode(ds, obj, simple); - o << obj; - } -} - -void QQmlEngineDebugClient::decode(QPacket &ds, - QmlDebugContextReference &c) -{ - ds >> c.name >> c.debugId; - - int contextCount; - ds >> contextCount; - - for (int ii = 0; ii < contextCount; ++ii) { - c.contexts.append(QmlDebugContextReference()); - decode(ds, c.contexts.last()); - } - - int objectCount; - ds >> objectCount; - - for (int ii = 0; ii < objectCount; ++ii) { - QmlDebugObjectReference obj; - decode(ds, obj, true); - - obj.contextDebugId = c.debugId; - c.objects << obj; - } -} - -void QQmlEngineDebugClient::messageReceived(const QByteArray &data) -{ - m_valid = false; - QPacket ds(connection()->currentDataStreamVersion(), data); - - int queryId; - QByteArray type; - ds >> type >> queryId; - - //qDebug() << "QQmlEngineDebugPrivate::message()" << type; - - if (type == "LIST_ENGINES_R") { - int count; - ds >> count; - - m_engines.clear(); - for (int ii = 0; ii < count; ++ii) { - QmlDebugEngineReference eng; - ds >> eng.name; - ds >> eng.debugId; - m_engines << eng; - } - } else if (type == "LIST_OBJECTS_R") { - if (!ds.atEnd()) - decode(ds, m_rootContext); - - } else if (type == "FETCH_OBJECT_R") { - if (!ds.atEnd()) - decode(ds, m_object, false); - - } else if (type == "FETCH_OBJECTS_FOR_LOCATION_R") { - if (!ds.atEnd()) - decode(ds, m_objects, false); - - } else if (type == "EVAL_EXPRESSION_R") {; - ds >> m_exprResult; - - } else if (type == "WATCH_PROPERTY_R") { - ds >> m_valid; - - } else if (type == "WATCH_OBJECT_R") { - ds >> m_valid; - - } else if (type == "WATCH_EXPR_OBJECT_R") { - ds >> m_valid; - - } else if (type == "UPDATE_WATCH") { - int debugId; - QByteArray name; - QVariant value; - ds >> debugId >> name >> value; - emit valueChanged(name, value); - return; - - } else if (type == "OBJECT_CREATED") { - int engineId, objectId, parentId; - ds >> engineId >> objectId >> parentId; - emit newObject(objectId); - return; - } else if (type == "SET_BINDING_R") { - ds >> m_valid; - } else if (type == "RESET_BINDING_R") { - ds >> m_valid; - } else if (type == "SET_METHOD_BODY_R") { - ds >> m_valid; - } else if (type == "NO_WATCH_R") { - ds >> m_valid; - } - emit result(); -} - diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h deleted file mode 100644 index 5d74f2d43c..0000000000 --- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** -** 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: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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** 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$ -** -****************************************************************************/ - -#ifndef QQMLENGINEDEBUGCLIENT_H -#define QQMLENGINEDEBUGCLIENT_H - -#include <private/qqmldebugclient_p.h> -#include <private/qpacket_p.h> - -#include <QtCore/qurl.h> -#include <QtCore/qvariant.h> - -struct QmlDebugPropertyReference -{ - QmlDebugPropertyReference() - : objectDebugId(-1), hasNotifySignal(false) - { - } - - QmlDebugPropertyReference &operator=( - const QmlDebugPropertyReference &o) - { - objectDebugId = o.objectDebugId; name = o.name; value = o.value; - valueTypeName = o.valueTypeName; binding = o.binding; - hasNotifySignal = o.hasNotifySignal; - return *this; - } - - int objectDebugId; - QString name; - QVariant value; - QString valueTypeName; - QString binding; - bool hasNotifySignal; -}; - -struct QmlDebugFileReference -{ - QmlDebugFileReference() - : lineNumber(-1), columnNumber(-1) - { - } - - QmlDebugFileReference &operator=( - const QmlDebugFileReference &o) - { - url = o.url; lineNumber = o.lineNumber; columnNumber = o.columnNumber; - return *this; - } - - QUrl url; - int lineNumber; - int columnNumber; -}; - -struct QmlDebugObjectReference -{ - QmlDebugObjectReference() - : debugId(-1), contextDebugId(-1) - { - } - - QmlDebugObjectReference(int id) - : debugId(id), contextDebugId(-1) - { - } - - QmlDebugObjectReference &operator=( - const QmlDebugObjectReference &o) - { - debugId = o.debugId; className = o.className; idString = o.idString; - name = o.name; source = o.source; contextDebugId = o.contextDebugId; - properties = o.properties; children = o.children; - return *this; - } - int debugId; - QString className; - QString idString; - QString name; - QmlDebugFileReference source; - int contextDebugId; - QList<QmlDebugPropertyReference> properties; - QList<QmlDebugObjectReference> children; -}; - -Q_DECLARE_METATYPE(QmlDebugObjectReference) - -struct QmlDebugContextReference -{ - QmlDebugContextReference() - : debugId(-1) - { - } - - QmlDebugContextReference &operator=( - const QmlDebugContextReference &o) - { - debugId = o.debugId; name = o.name; objects = o.objects; - contexts = o.contexts; - return *this; - } - - int debugId; - QString name; - QList<QmlDebugObjectReference> objects; - QList<QmlDebugContextReference> contexts; -}; - -struct QmlDebugEngineReference -{ - QmlDebugEngineReference() - : debugId(-1) - { - } - - QmlDebugEngineReference(int id) - : debugId(id) - { - } - - QmlDebugEngineReference &operator=( - const QmlDebugEngineReference &o) - { - debugId = o.debugId; name = o.name; - return *this; - } - - int debugId; - QString name; -}; - -class QQmlEngineDebugClient : public QQmlDebugClient -{ - Q_OBJECT -public: - explicit QQmlEngineDebugClient(QQmlDebugConnection *conn); - - quint32 addWatch(const QmlDebugPropertyReference &, - bool *success); - quint32 addWatch(const QmlDebugContextReference &, const QString &, - bool *success); - quint32 addWatch(const QmlDebugObjectReference &, const QString &, - bool *success); - quint32 addWatch(const QmlDebugObjectReference &, - bool *success); - quint32 addWatch(const QmlDebugFileReference &, - bool *success); - - void removeWatch(quint32 watch, bool *success); - - quint32 queryAvailableEngines(bool *success); - quint32 queryRootContexts(const QmlDebugEngineReference &, - bool *success); - quint32 queryObject(const QmlDebugObjectReference &, - bool *success); - quint32 queryObjectsForLocation(const QString &file, - int lineNumber, int columnNumber, bool *success); - quint32 queryObjectRecursive(const QmlDebugObjectReference &, - bool *success); - quint32 queryObjectsForLocationRecursive(const QString &file, - int lineNumber, int columnNumber, bool *success); - quint32 queryExpressionResult(int objectDebugId, - const QString &expr, - bool *success); - quint32 queryExpressionResultBC(int objectDebugId, - const QString &expr, - bool *success); - quint32 setBindingForObject(int objectDebugId, const QString &propertyName, - const QVariant &bindingExpression, - bool isLiteralValue, - QString source, int line, bool *success); - quint32 resetBindingForObject(int objectDebugId, - const QString &propertyName, bool *success); - quint32 setMethodBody(int objectDebugId, const QString &methodName, - const QString &methodBody, bool *success); - - quint32 getId() { return m_nextId++; } - - void decode(QPacket &ds, QmlDebugContextReference &); - void decode(QPacket &ds, QmlDebugObjectReference &, bool simple); - void decode(QPacket &ds, QList<QmlDebugObjectReference> &o, bool simple); - - QList<QmlDebugEngineReference> engines() { return m_engines; } - QmlDebugContextReference rootContext() { return m_rootContext; } - QmlDebugObjectReference object() { return m_object; } - QList<QmlDebugObjectReference> objects() { return m_objects; } - QVariant resultExpr() { return m_exprResult; } - bool valid() { return m_valid; } - -signals: - void newObject(int objectId); - void valueChanged(QByteArray,QVariant); - void result(); - -protected: - void messageReceived(const QByteArray &); - -private: - quint32 m_nextId; - bool m_valid; - QList<QmlDebugEngineReference> m_engines; - QmlDebugContextReference m_rootContext; - QmlDebugObjectReference m_object; - QList<QmlDebugObjectReference> m_objects; - QVariant m_exprResult; -}; - -#endif // QQMLENGINEDEBUGCLIENT_H diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri deleted file mode 100644 index a969b4f153..0000000000 --- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri +++ /dev/null @@ -1,3 +0,0 @@ -HEADERS += $$PWD/qqmlenginedebugclient.h - -SOURCES += $$PWD/qqmlenginedebugclient.cpp diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp deleted file mode 100644 index 20faef177e..0000000000 --- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** 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 "qqmlinspectorclient.h" - -#include <private/qpacket_p.h> -#include <private/qqmldebugconnection_p.h> -#include <QtCore/qdebug.h> - -QQmlInspectorClient::QQmlInspectorClient(QQmlDebugConnection *connection) : - QQmlDebugClient(QLatin1String("QmlInspector"), connection), - m_lastRequestId(-1) -{ -} - -int QQmlInspectorClient::setInspectToolEnabled(bool enabled) -{ - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("request") << ++m_lastRequestId - << QByteArray(enabled ? "enable" : "disable"); - - sendMessage(ds.data()); - return m_lastRequestId; -} - -int QQmlInspectorClient::setShowAppOnTop(bool showOnTop) -{ - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("request") << ++m_lastRequestId - << QByteArray("showAppOnTop") << showOnTop; - - sendMessage(ds.data()); - return m_lastRequestId; -} - -int QQmlInspectorClient::setAnimationSpeed(qreal speed) -{ - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("request") << ++m_lastRequestId - << QByteArray("setAnimationSpeed") << speed; - - sendMessage(ds.data()); - return m_lastRequestId; -} - -int QQmlInspectorClient::select(const QList<int> &objectIds) -{ - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("request") << ++m_lastRequestId - << QByteArray("select") << objectIds; - - sendMessage(ds.data()); - return m_lastRequestId; -} - -int QQmlInspectorClient::createObject(const QString &qml, int parentId, const QStringList &imports, - const QString &filename) -{ - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("request") << ++m_lastRequestId - << QByteArray("createObject") << qml << parentId << imports << filename; - sendMessage(ds.data()); - return m_lastRequestId; -} - -int QQmlInspectorClient::moveObject(int childId, int newParentId) -{ - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("request") << ++m_lastRequestId - << QByteArray("moveObject") << childId << newParentId; - sendMessage(ds.data()); - return m_lastRequestId; -} - -int QQmlInspectorClient::destroyObject(int objectId) -{ - QPacket ds(connection()->currentDataStreamVersion()); - ds << QByteArray("request") << ++m_lastRequestId - << QByteArray("destroyObject") << objectId; - sendMessage(ds.data()); - return m_lastRequestId; -} - -void QQmlInspectorClient::messageReceived(const QByteArray &message) -{ - QPacket ds(connection()->currentDataStreamVersion(), message); - QByteArray type; - ds >> type; - - if (type != QByteArray("response")) { - qDebug() << "Unhandled message of type" << type; - return; - } - - int responseId; - bool result; - ds >> responseId >> result; - emit responseReceived(responseId, result); -} diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h deleted file mode 100644 index bfb489c8f7..0000000000 --- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** 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$ -** -****************************************************************************/ -#ifndef QQMLINSPECTORCLIENT_H -#define QQMLINSPECTORCLIENT_H - -#include <private/qqmldebugclient_p.h> - -class QQmlInspectorClient : public QQmlDebugClient -{ - Q_OBJECT - -public: - QQmlInspectorClient(QQmlDebugConnection *connection); - - int setInspectToolEnabled(bool enabled); - int setShowAppOnTop(bool showOnTop); - int setAnimationSpeed(qreal speed); - int select(const QList<int> &objectIds); - int createObject(const QString &qml, int parentId, const QStringList &imports, - const QString &filename); - int moveObject(int childId, int newParentId); - int destroyObject(int objectId); - -signals: - void responseReceived(int requestId, bool result); - -protected: - void messageReceived(const QByteArray &message); - -private: - int m_lastRequestId; -}; - -#endif // QQMLINSPECTORCLIENT_H diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.pri b/tests/auto/qml/debugger/shared/qqmlinspectorclient.pri deleted file mode 100644 index c136e1313a..0000000000 --- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.pri +++ /dev/null @@ -1,3 +0,0 @@ -HEADERS += $$PWD/qqmlinspectorclient.h - -SOURCES += $$PWD/qqmlinspectorclient.cpp |