summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2012-03-15 12:11:41 +0100
committerAurindam Jana <aurindam.jana@nokia.com>2012-03-22 14:21:53 +0100
commit66ed2b37ba2491f6bfd3940ec0c74ea105b44059 (patch)
treec3095bde90568ebc3bd79f79c980f28f39f1059b
parent4cd2e32659aea8df84e359b811cafc77509c16b8 (diff)
downloadqt-creator-66ed2b37ba2491f6bfd3940ec0c74ea105b44059.tar.gz
QmlDebugging: Add service client for QmlDebugger
Qt5 has renamed the service 'QDeclarativeEngine' to 'QmlDebugger'. Add a new client to connect to the service. Change-Id: I3a03181c4f34c311e47d4a963283b66dc778726b Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
-rw-r--r--src/libs/qmljsdebugclient/qdeclarativeengineclient.h53
-rw-r--r--src/libs/qmljsdebugclient/qmldebuggerclient.cpp92
-rw-r--r--src/libs/qmljsdebugclient/qmldebuggerclient.h58
-rw-r--r--src/libs/qmljsdebugclient/qmlenginedebugclient.cpp7
-rw-r--r--src/libs/qmljsdebugclient/qmlenginedebugclient.h10
-rw-r--r--src/libs/qmljsdebugclient/qmljsdebugclient-lib.pri7
-rw-r--r--src/libs/qmljsdebugclient/qmljsdebugclient.qbs5
-rw-r--r--src/plugins/debugger/qml/qmljsprivateapi.h2
-rw-r--r--src/plugins/qmljsinspector/qmljsclientproxy.cpp28
-rw-r--r--src/plugins/qmljsinspector/qmljsprivateapi.h2
10 files changed, 243 insertions, 21 deletions
diff --git a/src/libs/qmljsdebugclient/qdeclarativeengineclient.h b/src/libs/qmljsdebugclient/qdeclarativeengineclient.h
new file mode 100644
index 0000000000..841ec03a51
--- /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 0000000000..f995e710d1
--- /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 0000000000..9fa453c17f
--- /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 17a0035352..3bf9858fbf 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 48917cdade..b1a29e3b6b 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 e8dd76b804..ccc71ec9c8 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 3a946644ee..a53a64715a 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 45ab37d39a..003938c548 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 132a03f73b..490012341b 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 45ab37d39a..003938c548 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;