From bb00f59d66a87a63987f93f83db9d36b18be433b Mon Sep 17 00:00:00 2001 From: Aurindam Jana Date: Fri, 28 Sep 2012 14:40:57 +0200 Subject: Debugger: Client for DeclarativeDebugger A client for DeclarativeDebugger Service. The service is a backport of QmlDebugger service. Change-Id: I868a286756c2d6bcbb2f41904a13d7f691e9704c Reviewed-by: Christiaan Janssen --- src/plugins/debugger/qml/qmlinspectoragent.cpp | 35 +++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/plugins/debugger/qml/qmlinspectoragent.cpp') 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 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 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 > 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 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(); -- cgit v1.2.1