summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@digia.com>2012-09-28 14:40:57 +0200
committerAurindam Jana <aurindam.jana@digia.com>2012-10-01 12:49:59 +0200
commitbb00f59d66a87a63987f93f83db9d36b18be433b (patch)
treee7f7fd5110b7842055c0fc59b55a6d14bde9b0aa
parentceb9319e4bbbc849ebed8f6103bc8710ff7e4b79 (diff)
downloadqt-creator-bb00f59d66a87a63987f93f83db9d36b18be433b.tar.gz
Debugger: Client for DeclarativeDebugger
A client for DeclarativeDebugger Service. The service is a backport of QmlDebugger service. Change-Id: I868a286756c2d6bcbb2f41904a13d7f691e9704c Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
-rw-r--r--src/libs/qmldebug/baseenginedebugclient.cpp24
-rw-r--r--src/libs/qmldebug/declarativeenginedebugclient.cpp (renamed from src/libs/qmldebug/qmlenginedebugclient.cpp)28
-rw-r--r--src/libs/qmldebug/declarativeenginedebugclient.h16
-rw-r--r--src/libs/qmldebug/declarativeenginedebugclientv2.h51
-rw-r--r--src/libs/qmldebug/qmldebug-lib.pri5
-rw-r--r--src/libs/qmldebug/qmldebug.qbs3
-rw-r--r--src/libs/qmldebug/qmldebugconstants.h3
-rw-r--r--src/libs/qmldebug/qmlenginedebugclient.h16
-rw-r--r--src/plugins/debugger/qml/qmlinspectoradapter.cpp11
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp35
10 files changed, 125 insertions, 67 deletions
diff --git a/src/libs/qmldebug/baseenginedebugclient.cpp b/src/libs/qmldebug/baseenginedebugclient.cpp
index a669d59f6b..15acd7a6c1 100644
--- a/src/libs/qmldebug/baseenginedebugclient.cpp
+++ b/src/libs/qmldebug/baseenginedebugclient.cpp
@@ -76,8 +76,8 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
QmlObjectData data;
ds >> data;
int parentId = -1;
- if (objectName() == QLatin1String("QmlDebugger") &&
- serviceVersion() >= Constants::CURRENT_SUPPORTED_VERSION )
+ // qt > 4.8.3
+ if (objectName() != QLatin1String(Constants::QDECLARATIVE_ENGINE))
ds >> parentId;
o.m_debugId = data.objectId;
o.m_className = data.objectType;
@@ -184,19 +184,15 @@ void BaseEngineDebugClient::messageReceived(const QByteArray &data)
QDataStream ds(data);
int queryId;
QByteArray type;
- ds >> type;
+ ds >> type >> queryId;
if (type == "OBJECT_CREATED") {
int engineId;
int objectId;
- ds >> engineId >> objectId;
- emit newObject(engineId, objectId, -1);
- return;
- }
-
- ds >> queryId;
-
- if (type == "LIST_ENGINES_R") {
+ int parentId;
+ ds >> engineId >> objectId >> parentId;
+ emit newObject(engineId, objectId, parentId);
+ } else if (type == "LIST_ENGINES_R") {
int count;
ds >> count;
QList<EngineReference> engines;
@@ -398,7 +394,7 @@ quint32 BaseEngineDebugClient::setBindingForObject(
id = getId();
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("SET_BINDING") << objectDebugId << propertyName
+ ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName
<< bindingExpression << isLiteralValue << source << line;
sendMessage(message);
}
@@ -414,7 +410,7 @@ quint32 BaseEngineDebugClient::resetBindingForObject(
id = getId();
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName;
+ ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName;
sendMessage(message);
}
return id;
@@ -429,7 +425,7 @@ quint32 BaseEngineDebugClient::setMethodBody(
id = getId();
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("SET_METHOD_BODY") << objectDebugId
+ ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId
<< methodName << methodBody;
sendMessage(message);
}
diff --git a/src/libs/qmldebug/qmlenginedebugclient.cpp b/src/libs/qmldebug/declarativeenginedebugclient.cpp
index 07c69a497c..2a5191e2a1 100644
--- a/src/libs/qmldebug/qmlenginedebugclient.cpp
+++ b/src/libs/qmldebug/declarativeenginedebugclient.cpp
@@ -27,18 +27,18 @@
**
**************************************************************************/
-#include "qmlenginedebugclient.h"
+#include "declarativeenginedebugclient.h"
#include "qmldebugconstants.h"
namespace QmlDebug {
-QmlEngineDebugClient::QmlEngineDebugClient(
+DeclarativeEngineDebugClient::DeclarativeEngineDebugClient(
QmlDebugConnection *connection)
- : BaseEngineDebugClient(QLatin1String(Constants::QML_DEBUGGER), connection)
+ : BaseEngineDebugClient(QLatin1String(Constants::QDECLARATIVE_ENGINE), connection)
{
}
-quint32 QmlEngineDebugClient::setBindingForObject(
+quint32 DeclarativeEngineDebugClient::setBindingForObject(
int objectDebugId,
const QString &propertyName,
const QVariant &bindingExpression,
@@ -50,14 +50,14 @@ quint32 QmlEngineDebugClient::setBindingForObject(
id = getId();
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName
+ ds << QByteArray("SET_BINDING") << objectDebugId << propertyName
<< bindingExpression << isLiteralValue << source << line;
sendMessage(message);
}
return id;
}
-quint32 QmlEngineDebugClient::resetBindingForObject(
+quint32 DeclarativeEngineDebugClient::resetBindingForObject(
int objectDebugId,
const QString &propertyName)
{
@@ -66,13 +66,13 @@ quint32 QmlEngineDebugClient::resetBindingForObject(
id = getId();
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName;
+ ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName;
sendMessage(message);
}
return id;
}
-quint32 QmlEngineDebugClient::setMethodBody(
+quint32 DeclarativeEngineDebugClient::setMethodBody(
int objectDebugId, const QString &methodName,
const QString &methodBody)
{
@@ -81,26 +81,24 @@ quint32 QmlEngineDebugClient::setMethodBody(
id = getId();
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId
+ ds << QByteArray("SET_METHOD_BODY") << objectDebugId
<< methodName << methodBody;
sendMessage(message);
}
return id;
}
-void QmlEngineDebugClient::messageReceived(const QByteArray &data)
+void DeclarativeEngineDebugClient::messageReceived(const QByteArray &data)
{
QDataStream ds(data);
- int queryId;
QByteArray type;
- ds >> type >> queryId;
+ ds >> type;
if (type == "OBJECT_CREATED") {
int engineId;
int objectId;
- int parentId;
- ds >> engineId >> objectId >> parentId;
- emit newObject(engineId, objectId, parentId);
+ ds >> engineId >> objectId;
+ emit newObject(engineId, objectId, -1);
return;
} else {
BaseEngineDebugClient::messageReceived(data);
diff --git a/src/libs/qmldebug/declarativeenginedebugclient.h b/src/libs/qmldebug/declarativeenginedebugclient.h
index 5cfe28279f..2807163ff0 100644
--- a/src/libs/qmldebug/declarativeenginedebugclient.h
+++ b/src/libs/qmldebug/declarativeenginedebugclient.h
@@ -40,10 +40,18 @@ class QMLDEBUG_EXPORT DeclarativeEngineDebugClient : public BaseEngineDebugClien
{
Q_OBJECT
public:
- DeclarativeEngineDebugClient(QmlDebugConnection *conn)
- : BaseEngineDebugClient(QLatin1String("QDeclarativeEngine"), conn)
- {
- }
+ explicit DeclarativeEngineDebugClient(QmlDebugConnection *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);
+
+protected:
+ void messageReceived(const QByteArray &data);
};
} // namespace QmlDebug
diff --git a/src/libs/qmldebug/declarativeenginedebugclientv2.h b/src/libs/qmldebug/declarativeenginedebugclientv2.h
new file mode 100644
index 0000000000..6db5743935
--- /dev/null
+++ b/src/libs/qmldebug/declarativeenginedebugclientv2.h
@@ -0,0 +1,51 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+** 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.
+**
+**
+**************************************************************************/
+
+#ifndef DECLARATIVEENGINEDEBUGCLIENTV2_H
+#define DECLARATIVEENGINEDEBUGCLIENTV2_H
+
+#include "baseenginedebugclient.h"
+
+namespace QmlDebug {
+
+class QmlDebugConnection;
+
+class QMLDEBUG_EXPORT DeclarativeEngineDebugClientV2 : public BaseEngineDebugClient
+{
+ Q_OBJECT
+public:
+ explicit DeclarativeEngineDebugClientV2(QmlDebugConnection *conn)
+ : BaseEngineDebugClient(QLatin1String("DeclarativeDebugger"), conn)
+ {
+ }
+};
+
+} // namespace QmlDebug
+
+#endif // DECLARATIVEENGINEDEBUGCLIENTV2_H
diff --git a/src/libs/qmldebug/qmldebug-lib.pri b/src/libs/qmldebug/qmldebug-lib.pri
index a1406ee580..54f09258b0 100644
--- a/src/libs/qmldebug/qmldebug-lib.pri
+++ b/src/libs/qmldebug/qmldebug-lib.pri
@@ -11,6 +11,7 @@ HEADERS += \
$$PWD/qmldebugclient.h \
$$PWD/baseenginedebugclient.h \
$$PWD/declarativeenginedebugclient.h \
+ $$PWD/declarativeenginedebugclientv2.h \
$$PWD/qmloutputparser.h \
$$PWD/qmldebug_global.h \
$$PWD/qmlprofilereventtypes.h \
@@ -32,8 +33,8 @@ SOURCES += \
$$PWD/qpacketprotocol.cpp \
$$PWD/qv8profilerclient.cpp \
$$PWD/qdebugmessageclient.cpp \
- $$PWD/qmlenginedebugclient.cpp \
$$PWD/basetoolsclient.cpp \
$$PWD/declarativetoolsclient.cpp \
- $$PWD/qmltoolsclient.cpp
+ $$PWD/qmltoolsclient.cpp \
+ $$PWD/declarativeenginedebugclient.cpp
diff --git a/src/libs/qmldebug/qmldebug.qbs b/src/libs/qmldebug/qmldebug.qbs
index c9fa8c01a4..c2e8a40996 100644
--- a/src/libs/qmldebug/qmldebug.qbs
+++ b/src/libs/qmldebug/qmldebug.qbs
@@ -20,7 +20,9 @@ QtcLibrary {
"baseenginedebugclient.h",
"basetoolsclient.cpp",
"basetoolsclient.h",
+ "declarativeenginedebugclient.cpp",
"declarativeenginedebugclient.h",
+ "declarativeenginedebugclientv2.h",
"declarativetoolsclient.cpp",
"declarativetoolsclient.h",
"qdebugmessageclient.cpp",
@@ -37,7 +39,6 @@ QtcLibrary {
"qmlprofilertraceclient.h",
"qpacketprotocol.cpp",
"qpacketprotocol.h",
- "qmlenginedebugclient.cpp",
"qmlenginedebugclient.h",
"qv8profilerclient.cpp",
"qv8profilerclient.h",
diff --git a/src/libs/qmldebug/qmldebugconstants.h b/src/libs/qmldebug/qmldebugconstants.h
index 36ccf4fb9e..147d4f62ec 100644
--- a/src/libs/qmldebug/qmldebugconstants.h
+++ b/src/libs/qmldebug/qmldebugconstants.h
@@ -42,8 +42,7 @@ const char STR_IGNORING_DEBUGGER[] = "Ignoring \"-qmljsdebugger=";
const char STR_IGNORING_DEBUGGER2[] = "Ignoring\"-qmljsdebugger="; // There is (was?) a bug in one of the error strings - safest to handle both
const char STR_CONNECTION_ESTABLISHED[] = "Connection established";
-const char QML_DEBUGGER[] = "QmlDebugger";
-const float CURRENT_SUPPORTED_VERSION = 2.0;
+const char QDECLARATIVE_ENGINE[] = "QDeclarativeEngine";
} // namespace Constants
} // namespace QmlDebug
diff --git a/src/libs/qmldebug/qmlenginedebugclient.h b/src/libs/qmldebug/qmlenginedebugclient.h
index eea286b810..7231d65d7d 100644
--- a/src/libs/qmldebug/qmlenginedebugclient.h
+++ b/src/libs/qmldebug/qmlenginedebugclient.h
@@ -40,18 +40,10 @@ class QMLDEBUG_EXPORT QmlEngineDebugClient : public BaseEngineDebugClient
{
Q_OBJECT
public:
- explicit QmlEngineDebugClient(QmlDebugConnection *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);
-
-protected:
- void messageReceived(const QByteArray &data);
+ explicit QmlEngineDebugClient(QmlDebugConnection *conn)
+ : BaseEngineDebugClient(QLatin1String("QmlDebugger"), conn)
+ {
+ }
};
} // namespace QmlDebug
diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
index 9528a1d5af..677bbe9997 100644
--- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
@@ -42,6 +42,7 @@
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icore.h>
#include <qmldebug/declarativeenginedebugclient.h>
+#include <qmldebug/declarativeenginedebugclientv2.h>
#include <qmldebug/declarativetoolsclient.h>
#include <qmldebug/qmlenginedebugclient.h>
#include <qmldebug/qmltoolsclient.h>
@@ -96,13 +97,23 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
connect(engineClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
+ DeclarativeEngineDebugClientV2 *engineClient3
+ = new DeclarativeEngineDebugClientV2(connection);
+ connect(engineClient3, SIGNAL(newStatus(QmlDebug::ClientStatus)),
+ this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
+ connect(engineClient3, SIGNAL(newStatus(QmlDebug::ClientStatus)),
+ this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
+
m_engineClients.insert(engineClient1->name(), engineClient1);
m_engineClients.insert(engineClient2->name(), engineClient2);
+ m_engineClients.insert(engineClient3->name(), engineClient3);
if (engineClient1->status() == QmlDebug::Enabled)
setActiveEngineClient(engineClient1);
if (engineClient2->status() == QmlDebug::Enabled)
setActiveEngineClient(engineClient2);
+ if (engineClient3->status() == QmlDebug::Enabled)
+ setActiveEngineClient(engineClient3);
DeclarativeToolsClient *toolsClient1 = new DeclarativeToolsClient(connection);
connect(toolsClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index 589be454c2..21734dbd9a 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -42,6 +42,7 @@
#include <QElapsedTimer>
using namespace QmlDebug;
+using namespace QmlDebug::Constants;
namespace Debugger {
namespace Internal {
@@ -476,7 +477,7 @@ void QmlInspectorAgent::newObject(int engineId, int objectId, int /*parentId*/)
return;
m_newObjectsCreated = true;
- if (m_engineClient->objectName() == QLatin1String(QmlDebug::Constants::QML_DEBUGGER))
+ if (m_engineClient->objectName() != QLatin1String(QDECLARATIVE_ENGINE))
fetchObject(objectId);
else
m_delayQueryTimer.start();
@@ -595,13 +596,13 @@ void QmlInspectorAgent::fetchObjectsInContextRecursive(const ContextReference &c
foreach (const ObjectReference & obj, context.objects()) {
using namespace QmlDebug::Constants;
- if (m_engineClient->objectName() == QLatin1String(QML_DEBUGGER) &&
- m_engineClient->serviceVersion() >= CURRENT_SUPPORTED_VERSION) {
- //Fetch only root objects
+ // qt <= 4.8.3
+ if (m_engineClient->objectName() == QLatin1String(QDECLARATIVE_ENGINE)) {
+ m_objectTreeQueryIds << m_engineClient->queryObjectRecursive(obj.debugId());
+ } else {
+ // Fetch only root objects for qt > 4.8.3
if (obj.parentId() == -1)
fetchObject(obj.debugId());
- } else {
- m_objectTreeQueryIds << m_engineClient->queryObjectRecursive(obj.debugId());
}
}
foreach (const ContextReference &child, context.contexts())
@@ -628,8 +629,8 @@ void QmlInspectorAgent::objectTreeFetched(const ObjectReference &object)
ObjectReference last;
QStack<QmlDebug::ObjectReference> stack;
- // 4.x
- if (m_newObjectsCreated && m_engineClient->objectName() != QLatin1String(QmlDebug::Constants::QML_DEBUGGER)) {
+ // qt <= 4.8.3
+ if (m_newObjectsCreated && m_engineClient->objectName() == QLatin1String(QDECLARATIVE_ENGINE)) {
// We need to reverse the stack as the root objects
// are pushed to the bottom since they are fetched first.
// The child objects need to placed in the correct position and therefore
@@ -645,8 +646,8 @@ void QmlInspectorAgent::objectTreeFetched(const ObjectReference &object)
int parentId = last.parentId();
QByteArray parentIname;
- // 4.x
- if (m_engineClient->objectName() != QLatin1String(QmlDebug::Constants::QML_DEBUGGER)) {
+ // qt <= 4.8.3
+ if (m_engineClient->objectName() == QLatin1String(QDECLARATIVE_ENGINE)) {
QHashIterator<int, QList<int> > i(m_debugIdChildIds);
while (i.hasNext()) {
i.next();
@@ -662,8 +663,8 @@ void QmlInspectorAgent::objectTreeFetched(const ObjectReference &object)
fetchObject(parentId);
return;
}
- // 5.x
- if (m_engineClient->objectName() == QLatin1String(QmlDebug::Constants::QML_DEBUGGER)
+ // qt > 4.8.3
+ if (m_engineClient->objectName() != QLatin1String(QDECLARATIVE_ENGINE)
&& m_newObjectsCreated && parentIname.isEmpty()) {
if (watchData.count())
break;
@@ -735,13 +736,13 @@ void QmlInspectorAgent::buildDebugIdHashRecursive(const ObjectReference &ref)
m_debugIdHash[file][location].append(ref.debugId());
m_debugIdLocations.insert(ref.debugId(), FileReference(filePath, lineNum, colNum));
- // 4.x
- if (m_newObjectsCreated && m_engineClient->objectName() != QLatin1String(QmlDebug::Constants::QML_DEBUGGER)) {
+ // qt <= 4.8.3
+ if (m_newObjectsCreated && m_engineClient->objectName() == QLatin1String(QDECLARATIVE_ENGINE)) {
QList<int> childIds;
foreach (const ObjectReference &c, ref.children()) {
childIds << c.debugId();
}
- // For 4.x, we do not get the parentId. Hence, store the child ids
+ // For qt <= 4.8.3, we do not get the parentId. Hence, store the child ids
// to look up correct insertion places later
m_debugIdChildIds.insert(ref.debugId(), childIds);
}
@@ -877,8 +878,8 @@ void QmlInspectorAgent::clearObjectTree()
m_debugIdToIname.clear();
m_debugIdChildIds.clear();
m_objectStack.clear();
- // reset only for 5.x.
- if (m_engineClient->objectName() == QLatin1String(QmlDebug::Constants::QML_DEBUGGER))
+ // reset only for qt > 4.8.3.
+ if (m_engineClient->objectName() != QLatin1String(QDECLARATIVE_ENGINE))
m_newObjectsCreated = false;
removeAllObjectWatches();