diff --git a/src/libs/qmljsdebugclient/qdeclarativeengineclient.h b/src/libs/qmljsdebugclient/qdeclarativeengineclient.h new file mode 100644 index 0000000000000000000000000000000000000000..841ec03a51879d8c867a3dc45f964354b41081e6 --- /dev/null +++ b/src/libs/qmljsdebugclient/qdeclarativeengineclient.h @@ -0,0 +1,53 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef QDECLARATIVEENGINECLIENT_H +#define QDECLARATIVEENGINECLIENT_H + +#include "qmlenginedebugclient.h" + +namespace QmlJsDebugClient { + +class QDeclarativeDebugConnection; + +class QMLJSDEBUGCLIENT_EXPORT QDeclarativeEngineClient : public QmlEngineDebugClient +{ + Q_OBJECT +public: + QDeclarativeEngineClient(QDeclarativeDebugConnection *conn) + : QmlEngineDebugClient(QLatin1String("QDeclarativeEngine"), conn) + { + } +}; + +} // namespace QmlJsDebugClient + +#endif // QDECLARATIVEENGINECLIENT_H diff --git a/src/libs/qmljsdebugclient/qmldebuggerclient.cpp b/src/libs/qmljsdebugclient/qmldebuggerclient.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f995e710d17db0197b8d03169b045b619960c74b --- /dev/null +++ b/src/libs/qmljsdebugclient/qmldebuggerclient.cpp @@ -0,0 +1,92 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#include "qmldebuggerclient.h" + +namespace QmlJsDebugClient { + +QmlDebuggerClient::QmlDebuggerClient( + QDeclarativeDebugConnection *connection) + : QmlEngineDebugClient(QLatin1String("QmlDebugger"), connection) +{ +} + +quint32 QmlDebuggerClient::setBindingForObject( + int objectDebugId, + const QString &propertyName, + const QVariant &bindingExpression, + bool isLiteralValue, + QString source, int line) +{ + quint32 id = 0; + if (status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { + id = getId(); + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName + << bindingExpression << isLiteralValue << source << line; + sendMessage(message); + } + return id; +} + +quint32 QmlDebuggerClient::resetBindingForObject( + int objectDebugId, + const QString &propertyName) +{ + quint32 id = 0; + if (status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { + id = getId(); + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName; + sendMessage(message); + } + return id; +} + +quint32 QmlDebuggerClient::setMethodBody( + int objectDebugId, const QString &methodName, + const QString &methodBody) +{ + quint32 id = 0; + if (status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { + id = getId(); + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId + << methodName << methodBody; + sendMessage(message); + } + return id; +} + +} // namespace QmlJsDebugClient diff --git a/src/libs/qmljsdebugclient/qmldebuggerclient.h b/src/libs/qmljsdebugclient/qmldebuggerclient.h new file mode 100644 index 0000000000000000000000000000000000000000..9fa453c17f7e74487b17820e6201b860924fcaee --- /dev/null +++ b/src/libs/qmljsdebugclient/qmldebuggerclient.h @@ -0,0 +1,58 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef QMLDEBUGGERCLIENT_H +#define QMLDEBUGGERCLIENT_H + +#include "qmlenginedebugclient.h" + +namespace QmlJsDebugClient { + +class QDeclarativeDebugConnection; + +class QMLJSDEBUGCLIENT_EXPORT QmlDebuggerClient : public QmlEngineDebugClient +{ + Q_OBJECT +public: + explicit QmlDebuggerClient(QDeclarativeDebugConnection *conn); + + quint32 setBindingForObject(int objectDebugId, const QString &propertyName, + const QVariant &bindingExpression, + bool isLiteralValue, + QString source, int line); + quint32 resetBindingForObject(int objectDebugId, const QString &propertyName); + quint32 setMethodBody(int objectDebugId, const QString &methodName, + const QString &methodBody); +}; + +} // namespace QmlJsDebugClient + +#endif // QMLDEBUGGERCLIENT_H diff --git a/src/libs/qmljsdebugclient/qmlenginedebugclient.cpp b/src/libs/qmljsdebugclient/qmlenginedebugclient.cpp index 17a0035352902ace3f008ede03576d8658a233e9..3bf9858fbf225398a2452477125cd5daaa8b56d0 100644 --- a/src/libs/qmljsdebugclient/qmlenginedebugclient.cpp +++ b/src/libs/qmljsdebugclient/qmlenginedebugclient.cpp @@ -214,11 +214,12 @@ void QmlEngineDebugClient::messageReceived(const QByteArray &data) } } -QmlEngineDebugClient::QmlEngineDebugClient( - QDeclarativeDebugConnection *connection) - : QDeclarativeDebugClient(QLatin1String("QDeclarativeEngine"), connection), +QmlEngineDebugClient::QmlEngineDebugClient(const QString &clientName, + QDeclarativeDebugConnection *conn) + : QDeclarativeDebugClient(clientName, conn), m_nextId(1) { + setObjectName(clientName); } quint32 QmlEngineDebugClient::addWatch(const QmlDebugPropertyReference &property) diff --git a/src/libs/qmljsdebugclient/qmlenginedebugclient.h b/src/libs/qmljsdebugclient/qmlenginedebugclient.h index 48917cdade0c513b2d6dc6003f843972e91607e4..b1a29e3b6b0b86361359446c9a04d475ee973ff8 100644 --- a/src/libs/qmljsdebugclient/qmlenginedebugclient.h +++ b/src/libs/qmljsdebugclient/qmlenginedebugclient.h @@ -50,7 +50,8 @@ class QMLJSDEBUGCLIENT_EXPORT QmlEngineDebugClient : public QDeclarativeDebugCli { Q_OBJECT public: - QmlEngineDebugClient(QDeclarativeDebugConnection *conn); + QmlEngineDebugClient(const QString &clientName, + QDeclarativeDebugConnection *conn); quint32 addWatch(const QmlDebugPropertyReference &property); quint32 addWatch(const QmlDebugContextReference &context, const QString &id); @@ -66,13 +67,13 @@ public: quint32 queryObjectRecursive(const QmlDebugObjectReference &object); quint32 queryExpressionResult(int objectDebugId, const QString &expr); - quint32 setBindingForObject(int objectDebugId, const QString &propertyName, + virtual quint32 setBindingForObject(int objectDebugId, const QString &propertyName, const QVariant &bindingExpression, bool isLiteralValue, QString source, int line); - quint32 resetBindingForObject(int objectDebugId, + virtual quint32 resetBindingForObject(int objectDebugId, const QString &propertyName); - quint32 setMethodBody(int objectDebugId, const QString &methodName, + virtual quint32 setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody); signals: @@ -86,7 +87,6 @@ protected: virtual void statusChanged(Status status); virtual void messageReceived(const QByteArray &); -private: quint32 getId() { return m_nextId++; } void decode(QDataStream &d, QmlDebugContextReference &context); diff --git a/src/libs/qmljsdebugclient/qmljsdebugclient-lib.pri b/src/libs/qmljsdebugclient/qmljsdebugclient-lib.pri index e8dd76b804af540c1f201ce4026c1531c1fb7e68..ccc71ec9c8276d3c8f71782ed80a2863606965d0 100644 --- a/src/libs/qmljsdebugclient/qmljsdebugclient-lib.pri +++ b/src/libs/qmljsdebugclient/qmljsdebugclient-lib.pri @@ -10,6 +10,7 @@ HEADERS += \ $$PWD/qmlprofilereventlocation.h \ $$PWD/qdeclarativedebugclient.h \ $$PWD/qmlenginedebugclient.h \ + $$PWD/qdeclarativeengineclient.h \ $$PWD/qdeclarativeoutputparser.h \ $$PWD/qmljsdebugclient_global.h \ $$PWD/qmlprofilereventtypes.h \ @@ -17,7 +18,8 @@ HEADERS += \ $$PWD/qpacketprotocol.h \ $$PWD/qv8profilerclient.h \ $$PWD/qmljsdebugclientconstants.h \ - $$PWD/qdebugmessageclient.h + $$PWD/qdebugmessageclient.h \ + $$PWD/qmldebuggerclient.h SOURCES += \ $$PWD/qdeclarativedebugclient.cpp \ @@ -26,7 +28,8 @@ SOURCES += \ $$PWD/qmlprofilertraceclient.cpp \ $$PWD/qpacketprotocol.cpp \ $$PWD/qv8profilerclient.cpp \ - $$PWD/qdebugmessageclient.cpp + $$PWD/qdebugmessageclient.cpp \ + $$PWD/qmldebuggerclient.cpp OTHER_FILES += \ $$PWD/qmljsdebugclient.pri \ diff --git a/src/libs/qmljsdebugclient/qmljsdebugclient.qbs b/src/libs/qmljsdebugclient/qmljsdebugclient.qbs index 3a946644eea00ccfc096a5cb922f2defc831d495..a53a64715a9810998eeed27a474bf4fe86d13cf7 100644 --- a/src/libs/qmljsdebugclient/qmljsdebugclient.qbs +++ b/src/libs/qmljsdebugclient/qmljsdebugclient.qbs @@ -36,7 +36,10 @@ DynamicLibrary { "qmlprofilertraceclient.h", "qpacketprotocol.h", "qdebugmessageclient.cpp", - "qdebugmessageclient.h" + "qdebugmessageclient.h", + "qdeclarativeengineclient.h", + "qmldebuggerclient.h", + "qmldebuggerclient.cpp" ] ProductModule { diff --git a/src/plugins/debugger/qml/qmljsprivateapi.h b/src/plugins/debugger/qml/qmljsprivateapi.h index 45ab37d39a910ef8f3d1a7d1a787e2c04148dee8..003938c548f260f435f655dfe0f93f8dc96df6b5 100644 --- a/src/plugins/debugger/qml/qmljsprivateapi.h +++ b/src/plugins/debugger/qml/qmljsprivateapi.h @@ -34,6 +34,8 @@ #include <qmljsdebugclient/qmlenginedebugclient.h> #include <qmljsdebugclient/qdeclarativedebugclient.h> +#include <qmljsdebugclient/qdeclarativeengineclient.h> +#include <qmljsdebugclient/qmldebuggerclient.h> using namespace QmlJsDebugClient; diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.cpp b/src/plugins/qmljsinspector/qmljsclientproxy.cpp index 132a03f73b7e549d1734d63653533be0d0b2b1a6..490012341b5925f2fd30a4ef7be14ec228953a22 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.cpp +++ b/src/plugins/qmljsinspector/qmljsclientproxy.cpp @@ -72,18 +72,20 @@ ClientProxy::~ClientProxy() void ClientProxy::connectToServer() { - m_engineClient = new QmlEngineDebugClient(m_adapter.data()->connection()); + QmlEngineDebugClient *client1 = new QDeclarativeEngineClient( + m_adapter.data()->connection()); + QmlEngineDebugClient *client2 = new QmlDebuggerClient( + m_adapter.data()->connection()); - connect(m_engineClient, SIGNAL(newObjects()), this, SLOT(newObjects())); - connect(m_engineClient, SIGNAL(newStatus(QDeclarativeDebugClient::Status)), + connect(client1, SIGNAL(newStatus(QDeclarativeDebugClient::Status)), SLOT(clientStatusChanged(QDeclarativeDebugClient::Status))); - connect(m_engineClient, SIGNAL(newStatus(QDeclarativeDebugClient::Status)), + connect(client1, SIGNAL(newStatus(QDeclarativeDebugClient::Status)), SLOT(engineClientStatusChanged(QDeclarativeDebugClient::Status))); - connect(m_engineClient, SIGNAL(result(quint32,QVariant)), - SLOT(onResult(quint32,QVariant))); - connect(m_engineClient, SIGNAL(valueChanged(int,QByteArray,QVariant)), - SLOT(objectWatchTriggered(int,QByteArray,QVariant))); + connect(client2, SIGNAL(newStatus(QDeclarativeDebugClient::Status)), + SLOT(clientStatusChanged(QDeclarativeDebugClient::Status))); + connect(client2, SIGNAL(newStatus(QDeclarativeDebugClient::Status)), + SLOT(engineClientStatusChanged(QDeclarativeDebugClient::Status))); m_inspectorClient = new QmlJSInspectorClient(m_adapter.data()->connection(), this); @@ -135,8 +137,14 @@ void ClientProxy::clientStatusChanged(QDeclarativeDebugClient::Status status) void ClientProxy::engineClientStatusChanged(QDeclarativeDebugClient::Status status) { if (status == QDeclarativeDebugClient::Enabled) { - m_adapter.data()->setEngineDebugClient( - qobject_cast<QmlEngineDebugClient *>(sender())); + m_engineClient = qobject_cast<QmlEngineDebugClient *>(sender()); + connect(m_engineClient, SIGNAL(newObjects()), this, SLOT(newObjects())); + connect(m_engineClient, SIGNAL(result(quint32,QVariant)), + SLOT(onResult(quint32,QVariant))); + connect(m_engineClient, SIGNAL(valueChanged(int,QByteArray,QVariant)), + SLOT(objectWatchTriggered(int,QByteArray,QVariant))); + m_adapter.data()->setEngineDebugClient(m_engineClient); + updateConnected(); } } diff --git a/src/plugins/qmljsinspector/qmljsprivateapi.h b/src/plugins/qmljsinspector/qmljsprivateapi.h index 45ab37d39a910ef8f3d1a7d1a787e2c04148dee8..003938c548f260f435f655dfe0f93f8dc96df6b5 100644 --- a/src/plugins/qmljsinspector/qmljsprivateapi.h +++ b/src/plugins/qmljsinspector/qmljsprivateapi.h @@ -34,6 +34,8 @@ #include <qmljsdebugclient/qmlenginedebugclient.h> #include <qmljsdebugclient/qdeclarativedebugclient.h> +#include <qmljsdebugclient/qdeclarativeengineclient.h> +#include <qmljsdebugclient/qmldebuggerclient.h> using namespace QmlJsDebugClient;