diff options
Diffstat (limited to 'src/declarative/debugger')
11 files changed, 1458 insertions, 1458 deletions
diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 261b2ff..dedea55 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -1,15 +1,15 @@ INCLUDEPATH += $$PWD SOURCES += \ - $$PWD/qmldebuggerstatus.cpp \ + $$PWD/qdeclarativedebuggerstatus.cpp \ $$PWD/qpacketprotocol.cpp \ - $$PWD/qmldebugservice.cpp \ - $$PWD/qmldebugclient.cpp \ - $$PWD/qmldebug.cpp + $$PWD/qdeclarativedebugservice.cpp \ + $$PWD/qdeclarativedebugclient.cpp \ + $$PWD/qdeclarativedebug.cpp HEADERS += \ - $$PWD/qmldebuggerstatus_p.h \ + $$PWD/qdeclarativedebuggerstatus_p.h \ $$PWD/qpacketprotocol_p.h \ - $$PWD/qmldebugservice_p.h \ - $$PWD/qmldebugclient_p.h \ - $$PWD/qmldebug_p.h + $$PWD/qdeclarativedebugservice_p.h \ + $$PWD/qdeclarativedebugclient_p.h \ + $$PWD/qdeclarativedebug_p.h diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp new file mode 100644 index 0000000..e4b7d4d --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebug.cpp @@ -0,0 +1,937 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativedebug_p.h" + +#include "qdeclarativedebugclient_p.h" + +#include <qdeclarativeenginedebug_p.h> + +#include <private/qobject_p.h> + +QT_BEGIN_NAMESPACE + +class QDeclarativeEngineDebugClient : public QDeclarativeDebugClient +{ +public: + QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client, QDeclarativeEngineDebugPrivate *p); + +protected: + virtual void messageReceived(const QByteArray &); + +private: + QDeclarativeEngineDebugPrivate *priv; +}; + +class QDeclarativeEngineDebugPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeEngineDebug) +public: + QDeclarativeEngineDebugPrivate(QDeclarativeDebugConnection *); + + void message(const QByteArray &); + + QDeclarativeEngineDebugClient *client; + int nextId; + int getId(); + + void decode(QDataStream &, QDeclarativeDebugContextReference &); + void decode(QDataStream &, QDeclarativeDebugObjectReference &, bool simple); + + static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugEnginesQuery *); + static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugRootContextQuery *); + static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugObjectQuery *); + static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugExpressionQuery *); + + QHash<int, QDeclarativeDebugEnginesQuery *> enginesQuery; + QHash<int, QDeclarativeDebugRootContextQuery *> rootContextQuery; + QHash<int, QDeclarativeDebugObjectQuery *> objectQuery; + QHash<int, QDeclarativeDebugExpressionQuery *> expressionQuery; + + QHash<int, QDeclarativeDebugWatch *> watched; +}; + +QDeclarativeEngineDebugClient::QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client, + QDeclarativeEngineDebugPrivate *p) +: QDeclarativeDebugClient(QLatin1String("QDeclarativeEngine"), client), priv(p) +{ + setEnabled(true); +} + +void QDeclarativeEngineDebugClient::messageReceived(const QByteArray &data) +{ + priv->message(data); +} + +QDeclarativeEngineDebugPrivate::QDeclarativeEngineDebugPrivate(QDeclarativeDebugConnection *c) +: client(new QDeclarativeEngineDebugClient(c, this)), nextId(0) +{ +} + +int QDeclarativeEngineDebugPrivate::getId() +{ + return nextId++; +} + +void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugEnginesQuery *q) +{ + if (c && q) { + QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c); + p->enginesQuery.remove(q->m_queryId); + } +} + +void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, + QDeclarativeDebugRootContextQuery *q) +{ + if (c && q) { + QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c); + p->rootContextQuery.remove(q->m_queryId); + } +} + +void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugObjectQuery *q) +{ + if (c && q) { + QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c); + p->objectQuery.remove(q->m_queryId); + } +} + +void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugExpressionQuery *q) +{ + if (c && q) { + QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c); + p->expressionQuery.remove(q->m_queryId); + } +} + +void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugObjectReference &o, + bool simple) +{ + QDeclarativeEngineDebugServer::QDeclarativeObjectData data; + ds >> data; + o.m_debugId = data.objectId; + o.m_class = data.objectType; + o.m_name = data.objectName; + o.m_source.m_url = data.url; + o.m_source.m_lineNumber = data.lineNumber; + o.m_source.m_columnNumber = data.columnNumber; + o.m_contextDebugId = data.contextId; + + if (simple) + return; + + int childCount; + bool recur; + ds >> childCount >> recur; + + for (int ii = 0; ii < childCount; ++ii) { + o.m_children.append(QDeclarativeDebugObjectReference()); + decode(ds, o.m_children.last(), !recur); + } + + int propCount; + ds >> propCount; + + for (int ii = 0; ii < propCount; ++ii) { + QDeclarativeEngineDebugServer::QDeclarativeObjectProperty data; + ds >> data; + QDeclarativeDebugPropertyReference prop; + prop.m_objectDebugId = o.m_debugId; + prop.m_name = data.name; + prop.m_binding = data.binding; + prop.m_hasNotifySignal = data.hasNotifySignal; + prop.m_valueTypeName = data.valueTypeName; + switch (data.type) { + case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Basic: + case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::List: + case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::SignalProperty: + { + prop.m_value = data.value; + break; + } + case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Object: + { + QDeclarativeDebugObjectReference obj; + obj.m_debugId = prop.m_value.toInt(); + prop.m_value = qVariantFromValue(obj); + break; + } + case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Unknown: + break; + } + o.m_properties << prop; + } +} + +void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugContextReference &c) +{ + ds >> c.m_name >> c.m_debugId; + + int contextCount; + ds >> contextCount; + + for (int ii = 0; ii < contextCount; ++ii) { + c.m_contexts.append(QDeclarativeDebugContextReference()); + decode(ds, c.m_contexts.last()); + } + + int objectCount; + ds >> objectCount; + + for (int ii = 0; ii < objectCount; ++ii) { + QDeclarativeDebugObjectReference obj; + decode(ds, obj, true); + + obj.m_contextDebugId = c.m_debugId; + c.m_objects << obj; + } +} + +void QDeclarativeEngineDebugPrivate::message(const QByteArray &data) +{ + QDataStream ds(data); + + QByteArray type; + ds >> type; + + //qDebug() << "QDeclarativeEngineDebugPrivate::message()" << type; + + if (type == "LIST_ENGINES_R") { + int queryId; + ds >> queryId; + + QDeclarativeDebugEnginesQuery *query = enginesQuery.value(queryId); + if (!query) + return; + enginesQuery.remove(queryId); + + int count; + ds >> count; + + for (int ii = 0; ii < count; ++ii) { + QDeclarativeDebugEngineReference ref; + ds >> ref.m_name; + ds >> ref.m_debugId; + query->m_engines << ref; + } + + query->m_client = 0; + query->setState(QDeclarativeDebugQuery::Completed); + } else if (type == "LIST_OBJECTS_R") { + int queryId; + ds >> queryId; + + QDeclarativeDebugRootContextQuery *query = rootContextQuery.value(queryId); + if (!query) + return; + rootContextQuery.remove(queryId); + + if (!ds.atEnd()) + decode(ds, query->m_context); + + query->m_client = 0; + query->setState(QDeclarativeDebugQuery::Completed); + } else if (type == "FETCH_OBJECT_R") { + int queryId; + ds >> queryId; + + QDeclarativeDebugObjectQuery *query = objectQuery.value(queryId); + if (!query) + return; + objectQuery.remove(queryId); + + if (!ds.atEnd()) + decode(ds, query->m_object, false); + + query->m_client = 0; + query->setState(QDeclarativeDebugQuery::Completed); + } else if (type == "EVAL_EXPRESSION_R") { + int queryId; + QVariant result; + ds >> queryId >> result; + + QDeclarativeDebugExpressionQuery *query = expressionQuery.value(queryId); + if (!query) + return; + expressionQuery.remove(queryId); + + query->m_result = result; + query->m_client = 0; + query->setState(QDeclarativeDebugQuery::Completed); + } else if (type == "WATCH_PROPERTY_R") { + int queryId; + bool ok; + ds >> queryId >> ok; + + QDeclarativeDebugWatch *watch = watched.value(queryId); + if (!watch) + return; + + watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive); + } else if (type == "WATCH_OBJECT_R") { + int queryId; + bool ok; + ds >> queryId >> ok; + + QDeclarativeDebugWatch *watch = watched.value(queryId); + if (!watch) + return; + + watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive); + } else if (type == "WATCH_EXPR_OBJECT_R") { + int queryId; + bool ok; + ds >> queryId >> ok; + + QDeclarativeDebugWatch *watch = watched.value(queryId); + if (!watch) + return; + + watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive); + } else if (type == "UPDATE_WATCH") { + int queryId; + int debugId; + QByteArray name; + QVariant value; + ds >> queryId >> debugId >> name >> value; + + QDeclarativeDebugWatch *watch = watched.value(queryId, 0); + if (!watch) + return; + emit watch->valueChanged(name, value); + } +} + +QDeclarativeEngineDebug::QDeclarativeEngineDebug(QDeclarativeDebugConnection *client, QObject *parent) +: QObject(*(new QDeclarativeEngineDebugPrivate(client)), parent) +{ +} + +QDeclarativeDebugPropertyWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugPropertyReference &property, QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + + QDeclarativeDebugPropertyWatch *watch = new QDeclarativeDebugPropertyWatch(parent); + if (d->client->isConnected()) { + int queryId = d->getId(); + watch->m_queryId = queryId; + watch->m_client = this; + watch->m_objectDebugId = property.objectDebugId(); + watch->m_name = property.name(); + d->watched.insert(queryId, watch); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8(); + d->client->sendMessage(message); + } else { + watch->m_state = QDeclarativeDebugWatch::Dead; + } + + return watch; +} + +QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugContextReference &, const QString &, QObject *) +{ + qWarning("QDeclarativeEngineDebug::addWatch(): Not implemented"); + return 0; +} + +QDeclarativeDebugObjectExpressionWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugObjectReference &object, const QString &expr, QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + QDeclarativeDebugObjectExpressionWatch *watch = new QDeclarativeDebugObjectExpressionWatch(parent); + if (d->client->isConnected()) { + int queryId = d->getId(); + watch->m_queryId = queryId; + watch->m_client = this; + watch->m_objectDebugId = object.debugId(); + watch->m_expr = expr; + d->watched.insert(queryId, watch); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("WATCH_EXPR_OBJECT") << queryId << object.debugId() << expr; + d->client->sendMessage(message); + } else { + watch->m_state = QDeclarativeDebugWatch::Dead; + } + return watch; +} + +QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugObjectReference &object, QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + + QDeclarativeDebugWatch *watch = new QDeclarativeDebugWatch(parent); + if (d->client->isConnected()) { + int queryId = d->getId(); + watch->m_queryId = queryId; + watch->m_client = this; + watch->m_objectDebugId = object.debugId(); + d->watched.insert(queryId, watch); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("WATCH_OBJECT") << queryId << object.debugId(); + d->client->sendMessage(message); + } else { + watch->m_state = QDeclarativeDebugWatch::Dead; + } + + return watch; +} + +QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugFileReference &, QObject *) +{ + qWarning("QDeclarativeEngineDebug::addWatch(): Not implemented"); + return 0; +} + +void QDeclarativeEngineDebug::removeWatch(QDeclarativeDebugWatch *watch) +{ + Q_D(QDeclarativeEngineDebug); + + if (!watch || !watch->m_client) + return; + + watch->m_client = 0; + watch->setState(QDeclarativeDebugWatch::Inactive); + + d->watched.remove(watch->queryId()); + + if (d->client && d->client->isConnected()) { + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("NO_WATCH") << watch->queryId(); + d->client->sendMessage(message); + } +} + +QDeclarativeDebugEnginesQuery *QDeclarativeEngineDebug::queryAvailableEngines(QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + + QDeclarativeDebugEnginesQuery *query = new QDeclarativeDebugEnginesQuery(parent); + if (d->client->isConnected()) { + query->m_client = this; + int queryId = d->getId(); + query->m_queryId = queryId; + d->enginesQuery.insert(queryId, query); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("LIST_ENGINES") << queryId; + d->client->sendMessage(message); + } else { + query->m_state = QDeclarativeDebugQuery::Error; + } + + return query; +} + +QDeclarativeDebugRootContextQuery *QDeclarativeEngineDebug::queryRootContexts(const QDeclarativeDebugEngineReference &engine, QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + + QDeclarativeDebugRootContextQuery *query = new QDeclarativeDebugRootContextQuery(parent); + if (d->client->isConnected() && engine.debugId() != -1) { + query->m_client = this; + int queryId = d->getId(); + query->m_queryId = queryId; + d->rootContextQuery.insert(queryId, query); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("LIST_OBJECTS") << queryId << engine.debugId(); + d->client->sendMessage(message); + } else { + query->m_state = QDeclarativeDebugQuery::Error; + } + + return query; +} + +QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObject(const QDeclarativeDebugObjectReference &object, QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + + QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent); + if (d->client->isConnected() && object.debugId() != -1) { + query->m_client = this; + int queryId = d->getId(); + query->m_queryId = queryId; + d->objectQuery.insert(queryId, query); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId() + << false; + d->client->sendMessage(message); + } else { + query->m_state = QDeclarativeDebugQuery::Error; + } + + return query; +} + +QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObjectRecursive(const QDeclarativeDebugObjectReference &object, QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + + QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent); + if (d->client->isConnected() && object.debugId() != -1) { + query->m_client = this; + int queryId = d->getId(); + query->m_queryId = queryId; + d->objectQuery.insert(queryId, query); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId() + << true; + d->client->sendMessage(message); + } else { + query->m_state = QDeclarativeDebugQuery::Error; + } + + return query; +} + +QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + + QDeclarativeDebugExpressionQuery *query = new QDeclarativeDebugExpressionQuery(parent); + if (d->client->isConnected() && objectDebugId != -1) { + query->m_client = this; + query->m_expr = expr; + int queryId = d->getId(); + query->m_queryId = queryId; + d->expressionQuery.insert(queryId, query); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("EVAL_EXPRESSION") << queryId << objectDebugId << expr; + d->client->sendMessage(message); + } else { + query->m_state = QDeclarativeDebugQuery::Error; + } + + return query; +} + +QDeclarativeDebugWatch::QDeclarativeDebugWatch(QObject *parent) +: QObject(parent), m_state(Waiting), m_queryId(-1), m_client(0), m_objectDebugId(-1) +{ +} + +QDeclarativeDebugWatch::~QDeclarativeDebugWatch() +{ +} + +int QDeclarativeDebugWatch::queryId() const +{ + return m_queryId; +} + +int QDeclarativeDebugWatch::objectDebugId() const +{ + return m_objectDebugId; +} + +QDeclarativeDebugWatch::State QDeclarativeDebugWatch::state() const +{ + return m_state; +} + +void QDeclarativeDebugWatch::setState(State s) +{ + if (m_state == s) + return; + m_state = s; + emit stateChanged(m_state); +} + +QDeclarativeDebugPropertyWatch::QDeclarativeDebugPropertyWatch(QObject *parent) + : QDeclarativeDebugWatch(parent) +{ +} + +QString QDeclarativeDebugPropertyWatch::name() const +{ + return m_name; +} + + +QDeclarativeDebugObjectExpressionWatch::QDeclarativeDebugObjectExpressionWatch(QObject *parent) + : QDeclarativeDebugWatch(parent) +{ +} + +QString QDeclarativeDebugObjectExpressionWatch::expression() const +{ + return m_expr; +} + + +QDeclarativeDebugQuery::QDeclarativeDebugQuery(QObject *parent) +: QObject(parent), m_state(Waiting) +{ +} + +QDeclarativeDebugQuery::State QDeclarativeDebugQuery::state() const +{ + return m_state; +} + +bool QDeclarativeDebugQuery::isWaiting() const +{ + return m_state == Waiting; +} + +void QDeclarativeDebugQuery::setState(State s) +{ + if (m_state == s) + return; + m_state = s; + emit stateChanged(m_state); +} + +QDeclarativeDebugEnginesQuery::QDeclarativeDebugEnginesQuery(QObject *parent) +: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1) +{ +} + +QDeclarativeDebugEnginesQuery::~QDeclarativeDebugEnginesQuery() +{ + if (m_client && m_queryId != -1) + QDeclarativeEngineDebugPrivate::remove(m_client, this); +} + +QList<QDeclarativeDebugEngineReference> QDeclarativeDebugEnginesQuery::engines() const +{ + return m_engines; +} + +QDeclarativeDebugRootContextQuery::QDeclarativeDebugRootContextQuery(QObject *parent) +: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1) +{ +} + +QDeclarativeDebugRootContextQuery::~QDeclarativeDebugRootContextQuery() +{ + if (m_client && m_queryId != -1) + QDeclarativeEngineDebugPrivate::remove(m_client, this); +} + +QDeclarativeDebugContextReference QDeclarativeDebugRootContextQuery::rootContext() const +{ + return m_context; +} + +QDeclarativeDebugObjectQuery::QDeclarativeDebugObjectQuery(QObject *parent) +: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1) +{ +} + +QDeclarativeDebugObjectQuery::~QDeclarativeDebugObjectQuery() +{ + if (m_client && m_queryId != -1) + QDeclarativeEngineDebugPrivate::remove(m_client, this); +} + +QDeclarativeDebugObjectReference QDeclarativeDebugObjectQuery::object() const +{ + return m_object; +} + +QDeclarativeDebugExpressionQuery::QDeclarativeDebugExpressionQuery(QObject *parent) +: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1) +{ +} + +QDeclarativeDebugExpressionQuery::~QDeclarativeDebugExpressionQuery() +{ + if (m_client && m_queryId != -1) + QDeclarativeEngineDebugPrivate::remove(m_client, this); +} + +QString QDeclarativeDebugExpressionQuery::expression() const +{ + return m_expr; +} + +QVariant QDeclarativeDebugExpressionQuery::result() const +{ + return m_result; +} + +QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference() +: m_debugId(-1) +{ +} + +QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(int debugId) +: m_debugId(debugId) +{ +} + +QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &o) +: m_debugId(o.m_debugId), m_name(o.m_name) +{ +} + +QDeclarativeDebugEngineReference & +QDeclarativeDebugEngineReference::operator=(const QDeclarativeDebugEngineReference &o) +{ + m_debugId = o.m_debugId; m_name = o.m_name; + return *this; +} + +int QDeclarativeDebugEngineReference::debugId() const +{ + return m_debugId; +} + +QString QDeclarativeDebugEngineReference::name() const +{ + return m_name; +} + +QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference() +: m_debugId(-1), m_contextDebugId(-1) +{ +} + +QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(int debugId) +: m_debugId(debugId), m_contextDebugId(-1) +{ +} + +QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &o) +: m_debugId(o.m_debugId), m_class(o.m_class), m_name(o.m_name), + m_source(o.m_source), m_contextDebugId(o.m_contextDebugId), + m_properties(o.m_properties), m_children(o.m_children) +{ +} + +QDeclarativeDebugObjectReference & +QDeclarativeDebugObjectReference::operator=(const QDeclarativeDebugObjectReference &o) +{ + m_debugId = o.m_debugId; m_class = o.m_class; m_name = o.m_name; + m_source = o.m_source; m_contextDebugId = o.m_contextDebugId; + m_properties = o.m_properties; m_children = o.m_children; + return *this; +} + +int QDeclarativeDebugObjectReference::debugId() const +{ + return m_debugId; +} + +QString QDeclarativeDebugObjectReference::className() const +{ + return m_class; +} + +QString QDeclarativeDebugObjectReference::name() const +{ + return m_name; +} + +QDeclarativeDebugFileReference QDeclarativeDebugObjectReference::source() const +{ + return m_source; +} + +int QDeclarativeDebugObjectReference::contextDebugId() const +{ + return m_contextDebugId; +} + +QList<QDeclarativeDebugPropertyReference> QDeclarativeDebugObjectReference::properties() const +{ + return m_properties; +} + +QList<QDeclarativeDebugObjectReference> QDeclarativeDebugObjectReference::children() const +{ + return m_children; +} + +QDeclarativeDebugContextReference::QDeclarativeDebugContextReference() +: m_debugId(-1) +{ +} + +QDeclarativeDebugContextReference::QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &o) +: m_debugId(o.m_debugId), m_name(o.m_name), m_objects(o.m_objects), m_contexts(o.m_contexts) +{ +} + +QDeclarativeDebugContextReference &QDeclarativeDebugContextReference::operator=(const QDeclarativeDebugContextReference &o) +{ + m_debugId = o.m_debugId; m_name = o.m_name; m_objects = o.m_objects; + m_contexts = o.m_contexts; + return *this; +} + +int QDeclarativeDebugContextReference::debugId() const +{ + return m_debugId; +} + +QString QDeclarativeDebugContextReference::name() const +{ + return m_name; +} + +QList<QDeclarativeDebugObjectReference> QDeclarativeDebugContextReference::objects() const +{ + return m_objects; +} + +QList<QDeclarativeDebugContextReference> QDeclarativeDebugContextReference::contexts() const +{ + return m_contexts; +} + +QDeclarativeDebugFileReference::QDeclarativeDebugFileReference() +: m_lineNumber(-1), m_columnNumber(-1) +{ +} + +QDeclarativeDebugFileReference::QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &o) +: m_url(o.m_url), m_lineNumber(o.m_lineNumber), m_columnNumber(o.m_columnNumber) +{ +} + +QDeclarativeDebugFileReference &QDeclarativeDebugFileReference::operator=(const QDeclarativeDebugFileReference &o) +{ + m_url = o.m_url; m_lineNumber = o.m_lineNumber; m_columnNumber = o.m_columnNumber; + return *this; +} + +QUrl QDeclarativeDebugFileReference::url() const +{ + return m_url; +} + +void QDeclarativeDebugFileReference::setUrl(const QUrl &u) +{ + m_url = u; +} + +int QDeclarativeDebugFileReference::lineNumber() const +{ + return m_lineNumber; +} + +void QDeclarativeDebugFileReference::setLineNumber(int l) +{ + m_lineNumber = l; +} + +int QDeclarativeDebugFileReference::columnNumber() const +{ + return m_columnNumber; +} + +void QDeclarativeDebugFileReference::setColumnNumber(int c) +{ + m_columnNumber = c; +} + +QDeclarativeDebugPropertyReference::QDeclarativeDebugPropertyReference() +: m_objectDebugId(-1), m_hasNotifySignal(false) +{ +} + +QDeclarativeDebugPropertyReference::QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &o) +: m_objectDebugId(o.m_objectDebugId), m_name(o.m_name), m_value(o.m_value), + m_valueTypeName(o.m_valueTypeName), m_binding(o.m_binding), + m_hasNotifySignal(o.m_hasNotifySignal) +{ +} + +QDeclarativeDebugPropertyReference &QDeclarativeDebugPropertyReference::operator=(const QDeclarativeDebugPropertyReference &o) +{ + m_objectDebugId = o.m_objectDebugId; m_name = o.m_name; m_value = o.m_value; + m_valueTypeName = o.m_valueTypeName; m_binding = o.m_binding; + m_hasNotifySignal = o.m_hasNotifySignal; + return *this; +} + +int QDeclarativeDebugPropertyReference::objectDebugId() const +{ + return m_objectDebugId; +} + +QString QDeclarativeDebugPropertyReference::name() const +{ + return m_name; +} + +QString QDeclarativeDebugPropertyReference::valueTypeName() const +{ + return m_valueTypeName; +} + +QVariant QDeclarativeDebugPropertyReference::value() const +{ + return m_value; +} + +QString QDeclarativeDebugPropertyReference::binding() const +{ + return m_binding; +} + +bool QDeclarativeDebugPropertyReference::hasNotifySignal() const +{ + return m_hasNotifySignal; +} + +QT_END_NAMESPACE + diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h new file mode 100644 index 0000000..f0c7a77 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebug_p.h @@ -0,0 +1,371 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QDECLARATIVEDEBUG_H +#define QDECLARATIVEDEBUG_H + +#include <QtCore/qobject.h> +#include <QtCore/qurl.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeDebugConnection; +class QDeclarativeDebugWatch; +class QDeclarativeDebugPropertyWatch; +class QDeclarativeDebugObjectExpressionWatch; +class QDeclarativeDebugEnginesQuery; +class QDeclarativeDebugRootContextQuery; +class QDeclarativeDebugObjectQuery; +class QDeclarativeDebugExpressionQuery; +class QDeclarativeDebugPropertyReference; +class QDeclarativeDebugContextReference; +class QDeclarativeDebugObjectReference; +class QDeclarativeDebugFileReference; +class QDeclarativeDebugEngineReference; +class QDeclarativeEngineDebugPrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeEngineDebug : public QObject +{ +Q_OBJECT +public: + QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0); + + QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &, + QObject *parent = 0); + QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugContextReference &, const QString &, + QObject *parent = 0); + QDeclarativeDebugObjectExpressionWatch *addWatch(const QDeclarativeDebugObjectReference &, const QString &, + QObject *parent = 0); + QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugObjectReference &, + QObject *parent = 0); + QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugFileReference &, + QObject *parent = 0); + + void removeWatch(QDeclarativeDebugWatch *watch); + + QDeclarativeDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0); + QDeclarativeDebugRootContextQuery *queryRootContexts(const QDeclarativeDebugEngineReference &, + QObject *parent = 0); + QDeclarativeDebugObjectQuery *queryObject(const QDeclarativeDebugObjectReference &, + QObject *parent = 0); + QDeclarativeDebugObjectQuery *queryObjectRecursive(const QDeclarativeDebugObjectReference &, + QObject *parent = 0); + QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId, + const QString &expr, + QObject *parent = 0); + +private: + Q_DECLARE_PRIVATE(QDeclarativeEngineDebug) +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugWatch : public QObject +{ +Q_OBJECT +public: + enum State { Waiting, Active, Inactive, Dead }; + + QDeclarativeDebugWatch(QObject *); + ~QDeclarativeDebugWatch(); + + int queryId() const; + int objectDebugId() const; + State state() const; + +Q_SIGNALS: + void stateChanged(QDeclarativeDebugWatch::State); + //void objectChanged(int, const QDeclarativeDebugObjectReference &); + //void valueChanged(int, const QVariant &); + + // Server sends value as string if it is a user-type variant + void valueChanged(const QByteArray &name, const QVariant &value); + +private: + friend class QDeclarativeEngineDebug; + friend class QDeclarativeEngineDebugPrivate; + void setState(State); + State m_state; + int m_queryId; + QDeclarativeEngineDebug *m_client; + int m_objectDebugId; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugPropertyWatch : public QDeclarativeDebugWatch +{ + Q_OBJECT +public: + QDeclarativeDebugPropertyWatch(QObject *parent); + + QString name() const; + +private: + friend class QDeclarativeEngineDebug; + QString m_name; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugObjectExpressionWatch : public QDeclarativeDebugWatch +{ + Q_OBJECT +public: + QDeclarativeDebugObjectExpressionWatch(QObject *parent); + + QString expression() const; + +private: + friend class QDeclarativeEngineDebug; + QString m_expr; + int m_debugId; +}; + + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugQuery : public QObject +{ +Q_OBJECT +public: + enum State { Waiting, Error, Completed }; + + State state() const; + bool isWaiting() const; + +// bool waitUntilCompleted(); + +Q_SIGNALS: + void stateChanged(QDeclarativeDebugQuery::State); + +protected: + QDeclarativeDebugQuery(QObject *); + +private: + friend class QDeclarativeEngineDebug; + friend class QDeclarativeEngineDebugPrivate; + void setState(State); + State m_state; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugFileReference +{ +public: + QDeclarativeDebugFileReference(); + QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &); + QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &); + + QUrl url() const; + void setUrl(const QUrl &); + int lineNumber() const; + void setLineNumber(int); + int columnNumber() const; + void setColumnNumber(int); + +private: + friend class QDeclarativeEngineDebugPrivate; + QUrl m_url; + int m_lineNumber; + int m_columnNumber; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugEngineReference +{ +public: + QDeclarativeDebugEngineReference(); + QDeclarativeDebugEngineReference(int); + QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &); + QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &); + + int debugId() const; + QString name() const; + +private: + friend class QDeclarativeEngineDebugPrivate; + int m_debugId; + QString m_name; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugObjectReference +{ +public: + QDeclarativeDebugObjectReference(); + QDeclarativeDebugObjectReference(int); + QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &); + QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &); + + int debugId() const; + QString className() const; + QString name() const; + + QDeclarativeDebugFileReference source() const; + int contextDebugId() const; + + QList<QDeclarativeDebugPropertyReference> properties() const; + QList<QDeclarativeDebugObjectReference> children() const; + +private: + friend class QDeclarativeEngineDebugPrivate; + int m_debugId; + QString m_class; + QString m_name; + QDeclarativeDebugFileReference m_source; + int m_contextDebugId; + QList<QDeclarativeDebugPropertyReference> m_properties; + QList<QDeclarativeDebugObjectReference> m_children; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugContextReference +{ +public: + QDeclarativeDebugContextReference(); + QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &); + QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &); + + int debugId() const; + QString name() const; + + QList<QDeclarativeDebugObjectReference> objects() const; + QList<QDeclarativeDebugContextReference> contexts() const; + +private: + friend class QDeclarativeEngineDebugPrivate; + int m_debugId; + QString m_name; + QList<QDeclarativeDebugObjectReference> m_objects; + QList<QDeclarativeDebugContextReference> m_contexts; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugPropertyReference +{ +public: + QDeclarativeDebugPropertyReference(); + QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &); + QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &); + + int objectDebugId() const; + QString name() const; + QVariant value() const; + QString valueTypeName() const; + QString binding() const; + bool hasNotifySignal() const; + +private: + friend class QDeclarativeEngineDebugPrivate; + int m_objectDebugId; + QString m_name; + QVariant m_value; + QString m_valueTypeName; + QString m_binding; + bool m_hasNotifySignal; +}; + + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery +{ +Q_OBJECT +public: + virtual ~QDeclarativeDebugEnginesQuery(); + QList<QDeclarativeDebugEngineReference> engines() const; +private: + friend class QDeclarativeEngineDebug; + friend class QDeclarativeEngineDebugPrivate; + QDeclarativeDebugEnginesQuery(QObject *); + QDeclarativeEngineDebug *m_client; + int m_queryId; + QList<QDeclarativeDebugEngineReference> m_engines; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery +{ +Q_OBJECT +public: + virtual ~QDeclarativeDebugRootContextQuery(); + QDeclarativeDebugContextReference rootContext() const; +private: + friend class QDeclarativeEngineDebug; + friend class QDeclarativeEngineDebugPrivate; + QDeclarativeDebugRootContextQuery(QObject *); + QDeclarativeEngineDebug *m_client; + int m_queryId; + QDeclarativeDebugContextReference m_context; +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery +{ +Q_OBJECT +public: + virtual ~QDeclarativeDebugObjectQuery(); + QDeclarativeDebugObjectReference object() const; +private: + friend class QDeclarativeEngineDebug; + friend class QDeclarativeEngineDebugPrivate; + QDeclarativeDebugObjectQuery(QObject *); + QDeclarativeEngineDebug *m_client; + int m_queryId; + QDeclarativeDebugObjectReference m_object; + +}; + +class Q_DECLARATIVE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery +{ +Q_OBJECT +public: + virtual ~QDeclarativeDebugExpressionQuery(); + QString expression() const; + QVariant result() const; +private: + friend class QDeclarativeEngineDebug; + friend class QDeclarativeEngineDebugPrivate; + QDeclarativeDebugExpressionQuery(QObject *); + QDeclarativeEngineDebug *m_client; + int m_queryId; + QString m_expr; + QVariant m_result; + +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QDeclarativeDebugEngineReference) +Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference) +Q_DECLARE_METATYPE(QDeclarativeDebugContextReference) +Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference) + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUG_H diff --git a/src/declarative/debugger/qmldebugclient.cpp b/src/declarative/debugger/qdeclarativedebugclient.cpp index ae42b5b..c23e32f 100644 --- a/src/declarative/debugger/qmldebugclient.cpp +++ b/src/declarative/debugger/qdeclarativedebugclient.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmldebugclient_p.h" +#include "qdeclarativedebugclient_p.h" #include "qpacketprotocol_p.h" @@ -50,22 +50,22 @@ QT_BEGIN_NAMESPACE -class QmlDebugConnectionPrivate : public QObject +class QDeclarativeDebugConnectionPrivate : public QObject { Q_OBJECT public: - QmlDebugConnectionPrivate(QmlDebugConnection *c); - QmlDebugConnection *q; + QDeclarativeDebugConnectionPrivate(QDeclarativeDebugConnection *c); + QDeclarativeDebugConnection *q; QPacketProtocol *protocol; QStringList enabled; - QHash<QString, QmlDebugClient *> plugins; + QHash<QString, QDeclarativeDebugClient *> plugins; public Q_SLOTS: void connected(); void readyRead(); }; -QmlDebugConnectionPrivate::QmlDebugConnectionPrivate(QmlDebugConnection *c) +QDeclarativeDebugConnectionPrivate::QDeclarativeDebugConnectionPrivate(QDeclarativeDebugConnection *c) : QObject(c), q(c), protocol(0) { protocol = new QPacketProtocol(q, this); @@ -73,59 +73,59 @@ QmlDebugConnectionPrivate::QmlDebugConnectionPrivate(QmlDebugConnection *c) QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); } -void QmlDebugConnectionPrivate::connected() +void QDeclarativeDebugConnectionPrivate::connected() { QPacket pack; - pack << QString(QLatin1String("QmlDebugServer")) << enabled; + pack << QString(QLatin1String("QDeclarativeDebugServer")) << enabled; protocol->send(pack); } -void QmlDebugConnectionPrivate::readyRead() +void QDeclarativeDebugConnectionPrivate::readyRead() { QPacket pack = protocol->read(); QString name; QByteArray message; pack >> name >> message; - QHash<QString, QmlDebugClient *>::Iterator iter = + QHash<QString, QDeclarativeDebugClient *>::Iterator iter = plugins.find(name); if (iter == plugins.end()) { - qWarning() << "QmlDebugConnection: Message received for missing plugin" << name; + qWarning() << "QDeclarativeDebugConnection: Message received for missing plugin" << name; } else { (*iter)->messageReceived(message); } } -QmlDebugConnection::QmlDebugConnection(QObject *parent) -: QTcpSocket(parent), d(new QmlDebugConnectionPrivate(this)) +QDeclarativeDebugConnection::QDeclarativeDebugConnection(QObject *parent) +: QTcpSocket(parent), d(new QDeclarativeDebugConnectionPrivate(this)) { } -bool QmlDebugConnection::isConnected() const +bool QDeclarativeDebugConnection::isConnected() const { return state() == ConnectedState; } -class QmlDebugClientPrivate : public QObjectPrivate +class QDeclarativeDebugClientPrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QmlDebugClient) + Q_DECLARE_PUBLIC(QDeclarativeDebugClient) public: - QmlDebugClientPrivate(); + QDeclarativeDebugClientPrivate(); QString name; - QmlDebugConnection *client; + QDeclarativeDebugConnection *client; bool enabled; }; -QmlDebugClientPrivate::QmlDebugClientPrivate() +QDeclarativeDebugClientPrivate::QDeclarativeDebugClientPrivate() : client(0), enabled(false) { } -QmlDebugClient::QmlDebugClient(const QString &name, - QmlDebugConnection *parent) -: QObject(*(new QmlDebugClientPrivate), parent) +QDeclarativeDebugClient::QDeclarativeDebugClient(const QString &name, + QDeclarativeDebugConnection *parent) +: QObject(*(new QDeclarativeDebugClientPrivate), parent) { - Q_D(QmlDebugClient); + Q_D(QDeclarativeDebugClient); d->name = name; d->client = parent; @@ -133,28 +133,28 @@ QmlDebugClient::QmlDebugClient(const QString &name, return; if (d->client->d->plugins.contains(name)) { - qWarning() << "QmlDebugClient: Conflicting plugin name" << name; + qWarning() << "QDeclarativeDebugClient: Conflicting plugin name" << name; d->client = 0; } else { d->client->d->plugins.insert(name, this); } } -QString QmlDebugClient::name() const +QString QDeclarativeDebugClient::name() const { - Q_D(const QmlDebugClient); + Q_D(const QDeclarativeDebugClient); return d->name; } -bool QmlDebugClient::isEnabled() const +bool QDeclarativeDebugClient::isEnabled() const { - Q_D(const QmlDebugClient); + Q_D(const QDeclarativeDebugClient); return d->enabled; } -void QmlDebugClient::setEnabled(bool e) +void QDeclarativeDebugClient::setEnabled(bool e) { - Q_D(QmlDebugClient); + Q_D(QDeclarativeDebugClient); if (e == d->enabled) return; @@ -168,7 +168,7 @@ void QmlDebugClient::setEnabled(bool e) if (d->client->state() == QTcpSocket::ConnectedState) { QPacket pack; - pack << QString(QLatin1String("QmlDebugServer")); + pack << QString(QLatin1String("QDeclarativeDebugServer")); if (e) pack << (int)1; else pack << (int)2; pack << d->name; @@ -177,18 +177,18 @@ void QmlDebugClient::setEnabled(bool e) } } -bool QmlDebugClient::isConnected() const +bool QDeclarativeDebugClient::isConnected() const { - Q_D(const QmlDebugClient); + Q_D(const QDeclarativeDebugClient); if (!d->client) return false; return d->client->isConnected(); } -void QmlDebugClient::sendMessage(const QByteArray &message) +void QDeclarativeDebugClient::sendMessage(const QByteArray &message) { - Q_D(QmlDebugClient); + Q_D(QDeclarativeDebugClient); if (!d->client || !d->client->isConnected()) return; @@ -198,10 +198,10 @@ void QmlDebugClient::sendMessage(const QByteArray &message) d->client->d->protocol->send(pack); } -void QmlDebugClient::messageReceived(const QByteArray &) +void QDeclarativeDebugClient::messageReceived(const QByteArray &) { } QT_END_NAMESPACE -#include <qmldebugclient.moc> +#include <qdeclarativedebugclient.moc> diff --git a/src/declarative/debugger/qmldebugclient_p.h b/src/declarative/debugger/qdeclarativedebugclient_p.h index c3e6eff..4144a66 100644 --- a/src/declarative/debugger/qmldebugclient_p.h +++ b/src/declarative/debugger/qdeclarativedebugclient_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLDEBUGCLIENT_H -#define QMLDEBUGCLIENT_H +#ifndef QDECLARATIVEDEBUGCLIENT_H +#define QDECLARATIVEDEBUGCLIENT_H #include <QtNetwork/qtcpsocket.h> @@ -50,30 +50,30 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QmlDebugConnectionPrivate; -class Q_DECLARATIVE_EXPORT QmlDebugConnection : public QTcpSocket +class QDeclarativeDebugConnectionPrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeDebugConnection : public QTcpSocket { Q_OBJECT - Q_DISABLE_COPY(QmlDebugConnection) + Q_DISABLE_COPY(QDeclarativeDebugConnection) public: - QmlDebugConnection(QObject * = 0); + QDeclarativeDebugConnection(QObject * = 0); bool isConnected() const; private: - QmlDebugConnectionPrivate *d; - friend class QmlDebugClient; - friend class QmlDebugClientPrivate; + QDeclarativeDebugConnectionPrivate *d; + friend class QDeclarativeDebugClient; + friend class QDeclarativeDebugClientPrivate; }; -class QmlDebugClientPrivate; -class Q_DECLARATIVE_EXPORT QmlDebugClient : public QObject +class QDeclarativeDebugClientPrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeDebugClient : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QmlDebugClient) - Q_DISABLE_COPY(QmlDebugClient) + Q_DECLARE_PRIVATE(QDeclarativeDebugClient) + Q_DISABLE_COPY(QDeclarativeDebugClient) public: - QmlDebugClient(const QString &, QmlDebugConnection *parent); + QDeclarativeDebugClient(const QString &, QDeclarativeDebugConnection *parent); QString name() const; @@ -88,12 +88,12 @@ protected: virtual void messageReceived(const QByteArray &); private: - friend class QmlDebugConnection; - friend class QmlDebugConnectionPrivate; + friend class QDeclarativeDebugConnection; + friend class QDeclarativeDebugConnectionPrivate; }; QT_END_NAMESPACE QT_END_HEADER -#endif // QMLDEBUGCLIENT_H +#endif // QDECLARATIVEDEBUGCLIENT_H diff --git a/src/declarative/debugger/qmldebuggerstatus.cpp b/src/declarative/debugger/qdeclarativedebuggerstatus.cpp index 0f2a973..5908628 100644 --- a/src/declarative/debugger/qmldebuggerstatus.cpp +++ b/src/declarative/debugger/qdeclarativedebuggerstatus.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qmldebuggerstatus_p.h" +#include "qdeclarativedebuggerstatus_p.h" QT_BEGIN_NAMESPACE -QmlDebuggerStatus::~QmlDebuggerStatus() +QDeclarativeDebuggerStatus::~QDeclarativeDebuggerStatus() { } -void QmlDebuggerStatus::setSelectedState(bool) +void QDeclarativeDebuggerStatus::setSelectedState(bool) { } diff --git a/src/declarative/debugger/qmldebuggerstatus_p.h b/src/declarative/debugger/qdeclarativedebuggerstatus_p.h index 42538f3..a3ba40a 100644 --- a/src/declarative/debugger/qmldebuggerstatus_p.h +++ b/src/declarative/debugger/qdeclarativedebuggerstatus_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLDEBUGGERSTATUS_P_H -#define QMLDEBUGGERSTATUS_P_H +#ifndef QDECLARATIVEDEBUGGERSTATUS_P_H +#define QDECLARATIVEDEBUGGERSTATUS_P_H #include <QtCore/qobject.h> @@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QmlDebuggerStatus +class Q_DECLARATIVE_EXPORT QDeclarativeDebuggerStatus { public: - virtual ~QmlDebuggerStatus(); + virtual ~QDeclarativeDebuggerStatus(); virtual void setSelectedState(bool); }; -Q_DECLARE_INTERFACE(QmlDebuggerStatus, "com.trolltech.qml.QmlDebuggerStatus") +Q_DECLARE_INTERFACE(QDeclarativeDebuggerStatus, "com.trolltech.qml.QDeclarativeDebuggerStatus") QT_END_NAMESPACE diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 7b21869..d9bbdb5 100644 --- a/src/declarative/debugger/qmldebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmldebugservice_p.h" +#include "qdeclarativedebugservice_p.h" #include "qpacketprotocol_p.h" @@ -52,14 +52,14 @@ QT_BEGIN_NAMESPACE -class QmlDebugServerPrivate; -class QmlDebugServer : public QObject +class QDeclarativeDebugServerPrivate; +class QDeclarativeDebugServer : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QmlDebugServer) - Q_DISABLE_COPY(QmlDebugServer) + Q_DECLARE_PRIVATE(QDeclarativeDebugServer) + Q_DISABLE_COPY(QDeclarativeDebugServer) public: - static QmlDebugServer *instance(); + static QDeclarativeDebugServer *instance(); void wait(); void registerForStartNotification(QObject *object, const char *receiver); @@ -68,63 +68,63 @@ private Q_SLOTS: void registeredObjectDestroyed(QObject *object); private: - friend class QmlDebugService; - friend class QmlDebugServicePrivate; - QmlDebugServer(int); + friend class QDeclarativeDebugService; + friend class QDeclarativeDebugServicePrivate; + QDeclarativeDebugServer(int); }; -class QmlDebugServerPrivate : public QObjectPrivate +class QDeclarativeDebugServerPrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QmlDebugServer) + Q_DECLARE_PUBLIC(QDeclarativeDebugServer) public: - QmlDebugServerPrivate(); + QDeclarativeDebugServerPrivate(); void wait(); int port; QTcpSocket *connection; QPacketProtocol *protocol; - QHash<QString, QmlDebugService *> plugins; + QHash<QString, QDeclarativeDebugService *> plugins; QStringList enabledPlugins; QList<QPair<QObject*, QByteArray> > notifyClients; }; -class QmlDebugServicePrivate : public QObjectPrivate +class QDeclarativeDebugServicePrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QmlDebugService) + Q_DECLARE_PUBLIC(QDeclarativeDebugService) public: - QmlDebugServicePrivate(); + QDeclarativeDebugServicePrivate(); QString name; - QmlDebugServer *server; + QDeclarativeDebugServer *server; }; -QmlDebugServerPrivate::QmlDebugServerPrivate() +QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : connection(0), protocol(0) { } -void QmlDebugServerPrivate::wait() +void QDeclarativeDebugServerPrivate::wait() { - Q_Q(QmlDebugServer); + Q_Q(QDeclarativeDebugServer); QTcpServer server; if (!server.listen(QHostAddress::Any, port)) { - qWarning("QmlDebugServer: Unable to listen on port %d", port); + qWarning("QDeclarativeDebugServer: Unable to listen on port %d", port); return; } - qWarning("QmlDebugServer: Waiting for connection on port %d...", port); + qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", port); for (int i=0; i<notifyClients.count(); i++) { if (!QMetaObject::invokeMethod(notifyClients[i].first, notifyClients[i].second)) { - qWarning() << "QmlDebugServer: unable to call method" << notifyClients[i].second + qWarning() << "QDeclarativeDebugServer: unable to call method" << notifyClients[i].second << "on object" << notifyClients[i].first << "to notify of debug server start"; } } notifyClients.clear(); if (!server.waitForNewConnection(-1)) { - qWarning("QmlDebugServer: Connection error"); + qWarning("QDeclarativeDebugServer: Connection error"); return; } @@ -139,8 +139,8 @@ void QmlDebugServerPrivate::wait() QPacket hello = protocol->read(); QString name; hello >> name >> enabledPlugins; - if (name != QLatin1String("QmlDebugServer")) { - qWarning("QmlDebugServer: Invalid hello message"); + if (name != QLatin1String("QDeclarativeDebugServer")) { + qWarning("QDeclarativeDebugServer: Invalid hello message"); delete protocol; delete connection; connection = 0; protocol = 0; return; } @@ -148,13 +148,13 @@ void QmlDebugServerPrivate::wait() QObject::connect(protocol, SIGNAL(readyRead()), q, SLOT(readyRead())); q->readyRead(); - qWarning("QmlDebugServer: Connection established"); + qWarning("QDeclarativeDebugServer: Connection established"); } -QmlDebugServer *QmlDebugServer::instance() +QDeclarativeDebugServer *QDeclarativeDebugServer::instance() { static bool envTested = false; - static QmlDebugServer *server = 0; + static QDeclarativeDebugServer *server = 0; if (!envTested) { envTested = true; @@ -164,28 +164,28 @@ QmlDebugServer *QmlDebugServer::instance() int port = env.toInt(&ok); if (ok && port > 1024) - server = new QmlDebugServer(port); + server = new QDeclarativeDebugServer(port); } return server; } -void QmlDebugServer::wait() +void QDeclarativeDebugServer::wait() { - Q_D(QmlDebugServer); + Q_D(QDeclarativeDebugServer); d->wait(); } -void QmlDebugServer::registerForStartNotification(QObject *object, const char *methodName) +void QDeclarativeDebugServer::registerForStartNotification(QObject *object, const char *methodName) { - Q_D(QmlDebugServer); + Q_D(QDeclarativeDebugServer); connect(object, SIGNAL(destroyed(QObject*)), SLOT(registeredObjectDestroyed(QObject*))); d->notifyClients.append(qMakePair(object, QByteArray(methodName))); } -void QmlDebugServer::registeredObjectDestroyed(QObject *object) +void QDeclarativeDebugServer::registeredObjectDestroyed(QObject *object) { - Q_D(QmlDebugServer); + Q_D(QDeclarativeDebugServer); QMutableListIterator<QPair<QObject*, QByteArray> > i(d->notifyClients); while (i.hasNext()) { if (i.next().first == object) @@ -193,18 +193,18 @@ void QmlDebugServer::registeredObjectDestroyed(QObject *object) } } -QmlDebugServer::QmlDebugServer(int port) -: QObject(*(new QmlDebugServerPrivate)) +QDeclarativeDebugServer::QDeclarativeDebugServer(int port) +: QObject(*(new QDeclarativeDebugServerPrivate)) { - Q_D(QmlDebugServer); + Q_D(QDeclarativeDebugServer); d->port = port; } -void QmlDebugServer::readyRead() +void QDeclarativeDebugServer::readyRead() { - Q_D(QmlDebugServer); + Q_D(QDeclarativeDebugServer); - QString debugServer(QLatin1String("QmlDebugServer")); + QString debugServer(QLatin1String("QDeclarativeDebugServer")); while (d->protocol->packetsAvailable()) { QPacket pack = d->protocol->read(); @@ -220,7 +220,7 @@ void QmlDebugServer::readyRead() // Enable if (!d->enabledPlugins.contains(plugin)) { d->enabledPlugins.append(plugin); - QHash<QString, QmlDebugService *>::Iterator iter = + QHash<QString, QDeclarativeDebugService *>::Iterator iter = d->plugins.find(plugin); if (iter != d->plugins.end()) (*iter)->enabledChanged(true); @@ -230,23 +230,23 @@ void QmlDebugServer::readyRead() // Disable if (d->enabledPlugins.contains(plugin)) { d->enabledPlugins.removeAll(plugin); - QHash<QString, QmlDebugService *>::Iterator iter = + QHash<QString, QDeclarativeDebugService *>::Iterator iter = d->plugins.find(plugin); if (iter != d->plugins.end()) (*iter)->enabledChanged(false); } } else { - qWarning("QmlDebugServer: Invalid control message %d", op); + qWarning("QDeclarativeDebugServer: Invalid control message %d", op); } } else { QByteArray message; pack >> message; - QHash<QString, QmlDebugService *>::Iterator iter = + QHash<QString, QDeclarativeDebugService *>::Iterator iter = d->plugins.find(name); if (iter == d->plugins.end()) { - qWarning() << "QmlDebugServer: Message received for missing plugin" << name; + qWarning() << "QDeclarativeDebugServer: Message received for missing plugin" << name; } else { (*iter)->messageReceived(message); } @@ -254,38 +254,38 @@ void QmlDebugServer::readyRead() } } -QmlDebugServicePrivate::QmlDebugServicePrivate() +QDeclarativeDebugServicePrivate::QDeclarativeDebugServicePrivate() : server(0) { } -QmlDebugService::QmlDebugService(const QString &name, QObject *parent) -: QObject(*(new QmlDebugServicePrivate), parent) +QDeclarativeDebugService::QDeclarativeDebugService(const QString &name, QObject *parent) +: QObject(*(new QDeclarativeDebugServicePrivate), parent) { - Q_D(QmlDebugService); + Q_D(QDeclarativeDebugService); d->name = name; - d->server = QmlDebugServer::instance(); + d->server = QDeclarativeDebugServer::instance(); if (!d->server) return; if (d->server->d_func()->plugins.contains(name)) { - qWarning() << "QmlDebugService: Conflicting plugin name" << name; + qWarning() << "QDeclarativeDebugService: Conflicting plugin name" << name; d->server = 0; } else { d->server->d_func()->plugins.insert(name, this); } } -QString QmlDebugService::name() const +QString QDeclarativeDebugService::name() const { - Q_D(const QmlDebugService); + Q_D(const QDeclarativeDebugService); return d->name; } -bool QmlDebugService::isEnabled() const +bool QDeclarativeDebugService::isEnabled() const { - Q_D(const QmlDebugService); + Q_D(const QDeclarativeDebugService); return (d->server && d->server->d_func()->enabledPlugins.contains(d->name)); } @@ -315,7 +315,7 @@ Q_GLOBAL_STATIC(ObjectReferenceHash, objectReferenceHash); Returns a unique id for \a object. Calling this method multiple times for the same object will return the same id. */ -int QmlDebugService::idForObject(QObject *object) +int QDeclarativeDebugService::idForObject(QObject *object) { if (!object) return -1; @@ -348,7 +348,7 @@ int QmlDebugService::idForObject(QObject *object) assigned an id, through idForObject(), then 0 is returned. If the object has been destroyed, 0 is returned. */ -QObject *QmlDebugService::objectForId(int id) +QObject *QDeclarativeDebugService::objectForId(int id) { ObjectReferenceHash *hash = objectReferenceHash(); @@ -370,12 +370,12 @@ QObject *QmlDebugService::objectForId(int id) } } -bool QmlDebugService::isDebuggingEnabled() +bool QDeclarativeDebugService::isDebuggingEnabled() { - return QmlDebugServer::instance() != 0; + return QDeclarativeDebugServer::instance() != 0; } -QString QmlDebugService::objectToString(QObject *obj) +QString QDeclarativeDebugService::objectToString(QObject *obj) { if(!obj) return QLatin1String("NULL"); @@ -390,19 +390,19 @@ QString QmlDebugService::objectToString(QObject *obj) return rv; } -void QmlDebugService::waitForClients() +void QDeclarativeDebugService::waitForClients() { - QmlDebugServer::instance()->wait(); + QDeclarativeDebugServer::instance()->wait(); } -void QmlDebugService::notifyOnServerStart(QObject *object, const char *receiver) +void QDeclarativeDebugService::notifyOnServerStart(QObject *object, const char *receiver) { - QmlDebugServer::instance()->registerForStartNotification(object, receiver); + QDeclarativeDebugServer::instance()->registerForStartNotification(object, receiver); } -void QmlDebugService::sendMessage(const QByteArray &message) +void QDeclarativeDebugService::sendMessage(const QByteArray &message) { - Q_D(QmlDebugService); + Q_D(QDeclarativeDebugService); if (!d->server || !d->server->d_func()->connection) return; @@ -413,14 +413,14 @@ void QmlDebugService::sendMessage(const QByteArray &message) d->server->d_func()->connection->flush(); } -void QmlDebugService::enabledChanged(bool) +void QDeclarativeDebugService::enabledChanged(bool) { } -void QmlDebugService::messageReceived(const QByteArray &) +void QDeclarativeDebugService::messageReceived(const QByteArray &) { } QT_END_NAMESPACE -#include <qmldebugservice.moc> +#include <qdeclarativedebugservice.moc> diff --git a/src/declarative/debugger/qmldebugservice_p.h b/src/declarative/debugger/qdeclarativedebugservice_p.h index 33ddda0..498edf3 100644 --- a/src/declarative/debugger/qmldebugservice_p.h +++ b/src/declarative/debugger/qdeclarativedebugservice_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLDEBUGSERVICE_H -#define QMLDEBUGSERVICE_H +#ifndef QDECLARATIVEDEBUGSERVICE_H +#define QDECLARATIVEDEBUGSERVICE_H #include <QtCore/qobject.h> @@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QmlDebugServicePrivate; -class Q_DECLARATIVE_EXPORT QmlDebugService : public QObject +class QDeclarativeDebugServicePrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeDebugService : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QmlDebugService) - Q_DISABLE_COPY(QmlDebugService) + Q_DECLARE_PRIVATE(QDeclarativeDebugService) + Q_DISABLE_COPY(QDeclarativeDebugService) public: - QmlDebugService(const QString &, QObject *parent = 0); + QDeclarativeDebugService(const QString &, QObject *parent = 0); QString name() const; @@ -81,12 +81,12 @@ protected: private: void registerForStartNotification(QObject *object, const char *methodName); - friend class QmlDebugServer; + friend class QDeclarativeDebugServer; }; QT_END_NAMESPACE QT_END_HEADER -#endif // QMLDEBUGSERVICE_H +#endif // QDECLARATIVEDEBUGSERVICE_H diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp deleted file mode 100644 index 32d8bbb..0000000 --- a/src/declarative/debugger/qmldebug.cpp +++ /dev/null @@ -1,937 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmldebug_p.h" - -#include "qmldebugclient_p.h" - -#include <qmlenginedebug_p.h> - -#include <private/qobject_p.h> - -QT_BEGIN_NAMESPACE - -class QmlEngineDebugClient : public QmlDebugClient -{ -public: - QmlEngineDebugClient(QmlDebugConnection *client, QmlEngineDebugPrivate *p); - -protected: - virtual void messageReceived(const QByteArray &); - -private: - QmlEngineDebugPrivate *priv; -}; - -class QmlEngineDebugPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QmlEngineDebug) -public: - QmlEngineDebugPrivate(QmlDebugConnection *); - - void message(const QByteArray &); - - QmlEngineDebugClient *client; - int nextId; - int getId(); - - void decode(QDataStream &, QmlDebugContextReference &); - void decode(QDataStream &, QmlDebugObjectReference &, bool simple); - - static void remove(QmlEngineDebug *, QmlDebugEnginesQuery *); - static void remove(QmlEngineDebug *, QmlDebugRootContextQuery *); - static void remove(QmlEngineDebug *, QmlDebugObjectQuery *); - static void remove(QmlEngineDebug *, QmlDebugExpressionQuery *); - - QHash<int, QmlDebugEnginesQuery *> enginesQuery; - QHash<int, QmlDebugRootContextQuery *> rootContextQuery; - QHash<int, QmlDebugObjectQuery *> objectQuery; - QHash<int, QmlDebugExpressionQuery *> expressionQuery; - - QHash<int, QmlDebugWatch *> watched; -}; - -QmlEngineDebugClient::QmlEngineDebugClient(QmlDebugConnection *client, - QmlEngineDebugPrivate *p) -: QmlDebugClient(QLatin1String("QmlEngine"), client), priv(p) -{ - setEnabled(true); -} - -void QmlEngineDebugClient::messageReceived(const QByteArray &data) -{ - priv->message(data); -} - -QmlEngineDebugPrivate::QmlEngineDebugPrivate(QmlDebugConnection *c) -: client(new QmlEngineDebugClient(c, this)), nextId(0) -{ -} - -int QmlEngineDebugPrivate::getId() -{ - return nextId++; -} - -void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugEnginesQuery *q) -{ - if (c && q) { - QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c); - p->enginesQuery.remove(q->m_queryId); - } -} - -void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, - QmlDebugRootContextQuery *q) -{ - if (c && q) { - QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c); - p->rootContextQuery.remove(q->m_queryId); - } -} - -void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugObjectQuery *q) -{ - if (c && q) { - QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c); - p->objectQuery.remove(q->m_queryId); - } -} - -void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugExpressionQuery *q) -{ - if (c && q) { - QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c); - p->expressionQuery.remove(q->m_queryId); - } -} - -void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o, - bool simple) -{ - QmlEngineDebugServer::QmlObjectData data; - ds >> data; - o.m_debugId = data.objectId; - o.m_class = data.objectType; - o.m_name = data.objectName; - o.m_source.m_url = data.url; - o.m_source.m_lineNumber = data.lineNumber; - o.m_source.m_columnNumber = data.columnNumber; - o.m_contextDebugId = data.contextId; - - if (simple) - return; - - int childCount; - bool recur; - ds >> childCount >> recur; - - for (int ii = 0; ii < childCount; ++ii) { - o.m_children.append(QmlDebugObjectReference()); - decode(ds, o.m_children.last(), !recur); - } - - int propCount; - ds >> propCount; - - for (int ii = 0; ii < propCount; ++ii) { - QmlEngineDebugServer::QmlObjectProperty data; - ds >> data; - QmlDebugPropertyReference prop; - prop.m_objectDebugId = o.m_debugId; - prop.m_name = data.name; - prop.m_binding = data.binding; - prop.m_hasNotifySignal = data.hasNotifySignal; - prop.m_valueTypeName = data.valueTypeName; - switch (data.type) { - case QmlEngineDebugServer::QmlObjectProperty::Basic: - case QmlEngineDebugServer::QmlObjectProperty::List: - case QmlEngineDebugServer::QmlObjectProperty::SignalProperty: - { - prop.m_value = data.value; - break; - } - case QmlEngineDebugServer::QmlObjectProperty::Object: - { - QmlDebugObjectReference obj; - obj.m_debugId = prop.m_value.toInt(); - prop.m_value = qVariantFromValue(obj); - break; - } - case QmlEngineDebugServer::QmlObjectProperty::Unknown: - break; - } - o.m_properties << prop; - } -} - -void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugContextReference &c) -{ - ds >> c.m_name >> c.m_debugId; - - int contextCount; - ds >> contextCount; - - for (int ii = 0; ii < contextCount; ++ii) { - c.m_contexts.append(QmlDebugContextReference()); - decode(ds, c.m_contexts.last()); - } - - int objectCount; - ds >> objectCount; - - for (int ii = 0; ii < objectCount; ++ii) { - QmlDebugObjectReference obj; - decode(ds, obj, true); - - obj.m_contextDebugId = c.m_debugId; - c.m_objects << obj; - } -} - -void QmlEngineDebugPrivate::message(const QByteArray &data) -{ - QDataStream ds(data); - - QByteArray type; - ds >> type; - - //qDebug() << "QmlEngineDebugPrivate::message()" << type; - - if (type == "LIST_ENGINES_R") { - int queryId; - ds >> queryId; - - QmlDebugEnginesQuery *query = enginesQuery.value(queryId); - if (!query) - return; - enginesQuery.remove(queryId); - - int count; - ds >> count; - - for (int ii = 0; ii < count; ++ii) { - QmlDebugEngineReference ref; - ds >> ref.m_name; - ds >> ref.m_debugId; - query->m_engines << ref; - } - - query->m_client = 0; - query->setState(QmlDebugQuery::Completed); - } else if (type == "LIST_OBJECTS_R") { - int queryId; - ds >> queryId; - - QmlDebugRootContextQuery *query = rootContextQuery.value(queryId); - if (!query) - return; - rootContextQuery.remove(queryId); - - if (!ds.atEnd()) - decode(ds, query->m_context); - - query->m_client = 0; - query->setState(QmlDebugQuery::Completed); - } else if (type == "FETCH_OBJECT_R") { - int queryId; - ds >> queryId; - - QmlDebugObjectQuery *query = objectQuery.value(queryId); - if (!query) - return; - objectQuery.remove(queryId); - - if (!ds.atEnd()) - decode(ds, query->m_object, false); - - query->m_client = 0; - query->setState(QmlDebugQuery::Completed); - } else if (type == "EVAL_EXPRESSION_R") { - int queryId; - QVariant result; - ds >> queryId >> result; - - QmlDebugExpressionQuery *query = expressionQuery.value(queryId); - if (!query) - return; - expressionQuery.remove(queryId); - - query->m_result = result; - query->m_client = 0; - query->setState(QmlDebugQuery::Completed); - } else if (type == "WATCH_PROPERTY_R") { - int queryId; - bool ok; - ds >> queryId >> ok; - - QmlDebugWatch *watch = watched.value(queryId); - if (!watch) - return; - - watch->setState(ok ? QmlDebugWatch::Active : QmlDebugWatch::Inactive); - } else if (type == "WATCH_OBJECT_R") { - int queryId; - bool ok; - ds >> queryId >> ok; - - QmlDebugWatch *watch = watched.value(queryId); - if (!watch) - return; - - watch->setState(ok ? QmlDebugWatch::Active : QmlDebugWatch::Inactive); - } else if (type == "WATCH_EXPR_OBJECT_R") { - int queryId; - bool ok; - ds >> queryId >> ok; - - QmlDebugWatch *watch = watched.value(queryId); - if (!watch) - return; - - watch->setState(ok ? QmlDebugWatch::Active : QmlDebugWatch::Inactive); - } else if (type == "UPDATE_WATCH") { - int queryId; - int debugId; - QByteArray name; - QVariant value; - ds >> queryId >> debugId >> name >> value; - - QmlDebugWatch *watch = watched.value(queryId, 0); - if (!watch) - return; - emit watch->valueChanged(name, value); - } -} - -QmlEngineDebug::QmlEngineDebug(QmlDebugConnection *client, QObject *parent) -: QObject(*(new QmlEngineDebugPrivate(client)), parent) -{ -} - -QmlDebugPropertyWatch *QmlEngineDebug::addWatch(const QmlDebugPropertyReference &property, QObject *parent) -{ - Q_D(QmlEngineDebug); - - QmlDebugPropertyWatch *watch = new QmlDebugPropertyWatch(parent); - if (d->client->isConnected()) { - int queryId = d->getId(); - watch->m_queryId = queryId; - watch->m_client = this; - watch->m_objectDebugId = property.objectDebugId(); - watch->m_name = property.name(); - d->watched.insert(queryId, watch); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8(); - d->client->sendMessage(message); - } else { - watch->m_state = QmlDebugWatch::Dead; - } - - return watch; -} - -QmlDebugWatch *QmlEngineDebug::addWatch(const QmlDebugContextReference &, const QString &, QObject *) -{ - qWarning("QmlEngineDebug::addWatch(): Not implemented"); - return 0; -} - -QmlDebugObjectExpressionWatch *QmlEngineDebug::addWatch(const QmlDebugObjectReference &object, const QString &expr, QObject *parent) -{ - Q_D(QmlEngineDebug); - QmlDebugObjectExpressionWatch *watch = new QmlDebugObjectExpressionWatch(parent); - if (d->client->isConnected()) { - int queryId = d->getId(); - watch->m_queryId = queryId; - watch->m_client = this; - watch->m_objectDebugId = object.debugId(); - watch->m_expr = expr; - d->watched.insert(queryId, watch); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("WATCH_EXPR_OBJECT") << queryId << object.debugId() << expr; - d->client->sendMessage(message); - } else { - watch->m_state = QmlDebugWatch::Dead; - } - return watch; -} - -QmlDebugWatch *QmlEngineDebug::addWatch(const QmlDebugObjectReference &object, QObject *parent) -{ - Q_D(QmlEngineDebug); - - QmlDebugWatch *watch = new QmlDebugWatch(parent); - if (d->client->isConnected()) { - int queryId = d->getId(); - watch->m_queryId = queryId; - watch->m_client = this; - watch->m_objectDebugId = object.debugId(); - d->watched.insert(queryId, watch); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("WATCH_OBJECT") << queryId << object.debugId(); - d->client->sendMessage(message); - } else { - watch->m_state = QmlDebugWatch::Dead; - } - - return watch; -} - -QmlDebugWatch *QmlEngineDebug::addWatch(const QmlDebugFileReference &, QObject *) -{ - qWarning("QmlEngineDebug::addWatch(): Not implemented"); - return 0; -} - -void QmlEngineDebug::removeWatch(QmlDebugWatch *watch) -{ - Q_D(QmlEngineDebug); - - if (!watch || !watch->m_client) - return; - - watch->m_client = 0; - watch->setState(QmlDebugWatch::Inactive); - - d->watched.remove(watch->queryId()); - - if (d->client && d->client->isConnected()) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("NO_WATCH") << watch->queryId(); - d->client->sendMessage(message); - } -} - -QmlDebugEnginesQuery *QmlEngineDebug::queryAvailableEngines(QObject *parent) -{ - Q_D(QmlEngineDebug); - - QmlDebugEnginesQuery *query = new QmlDebugEnginesQuery(parent); - if (d->client->isConnected()) { - query->m_client = this; - int queryId = d->getId(); - query->m_queryId = queryId; - d->enginesQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("LIST_ENGINES") << queryId; - d->client->sendMessage(message); - } else { - query->m_state = QmlDebugQuery::Error; - } - - return query; -} - -QmlDebugRootContextQuery *QmlEngineDebug::queryRootContexts(const QmlDebugEngineReference &engine, QObject *parent) -{ - Q_D(QmlEngineDebug); - - QmlDebugRootContextQuery *query = new QmlDebugRootContextQuery(parent); - if (d->client->isConnected() && engine.debugId() != -1) { - query->m_client = this; - int queryId = d->getId(); - query->m_queryId = queryId; - d->rootContextQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("LIST_OBJECTS") << queryId << engine.debugId(); - d->client->sendMessage(message); - } else { - query->m_state = QmlDebugQuery::Error; - } - - return query; -} - -QmlDebugObjectQuery *QmlEngineDebug::queryObject(const QmlDebugObjectReference &object, QObject *parent) -{ - Q_D(QmlEngineDebug); - - QmlDebugObjectQuery *query = new QmlDebugObjectQuery(parent); - if (d->client->isConnected() && object.debugId() != -1) { - query->m_client = this; - int queryId = d->getId(); - query->m_queryId = queryId; - d->objectQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId() - << false; - d->client->sendMessage(message); - } else { - query->m_state = QmlDebugQuery::Error; - } - - return query; -} - -QmlDebugObjectQuery *QmlEngineDebug::queryObjectRecursive(const QmlDebugObjectReference &object, QObject *parent) -{ - Q_D(QmlEngineDebug); - - QmlDebugObjectQuery *query = new QmlDebugObjectQuery(parent); - if (d->client->isConnected() && object.debugId() != -1) { - query->m_client = this; - int queryId = d->getId(); - query->m_queryId = queryId; - d->objectQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId() - << true; - d->client->sendMessage(message); - } else { - query->m_state = QmlDebugQuery::Error; - } - - return query; -} - -QmlDebugExpressionQuery *QmlEngineDebug::queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent) -{ - Q_D(QmlEngineDebug); - - QmlDebugExpressionQuery *query = new QmlDebugExpressionQuery(parent); - if (d->client->isConnected() && objectDebugId != -1) { - query->m_client = this; - query->m_expr = expr; - int queryId = d->getId(); - query->m_queryId = queryId; - d->expressionQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("EVAL_EXPRESSION") << queryId << objectDebugId << expr; - d->client->sendMessage(message); - } else { - query->m_state = QmlDebugQuery::Error; - } - - return query; -} - -QmlDebugWatch::QmlDebugWatch(QObject *parent) -: QObject(parent), m_state(Waiting), m_queryId(-1), m_client(0), m_objectDebugId(-1) -{ -} - -QmlDebugWatch::~QmlDebugWatch() -{ -} - -int QmlDebugWatch::queryId() const -{ - return m_queryId; -} - -int QmlDebugWatch::objectDebugId() const -{ - return m_objectDebugId; -} - -QmlDebugWatch::State QmlDebugWatch::state() const -{ - return m_state; -} - -void QmlDebugWatch::setState(State s) -{ - if (m_state == s) - return; - m_state = s; - emit stateChanged(m_state); -} - -QmlDebugPropertyWatch::QmlDebugPropertyWatch(QObject *parent) - : QmlDebugWatch(parent) -{ -} - -QString QmlDebugPropertyWatch::name() const -{ - return m_name; -} - - -QmlDebugObjectExpressionWatch::QmlDebugObjectExpressionWatch(QObject *parent) - : QmlDebugWatch(parent) -{ -} - -QString QmlDebugObjectExpressionWatch::expression() const -{ - return m_expr; -} - - -QmlDebugQuery::QmlDebugQuery(QObject *parent) -: QObject(parent), m_state(Waiting) -{ -} - -QmlDebugQuery::State QmlDebugQuery::state() const -{ - return m_state; -} - -bool QmlDebugQuery::isWaiting() const -{ - return m_state == Waiting; -} - -void QmlDebugQuery::setState(State s) -{ - if (m_state == s) - return; - m_state = s; - emit stateChanged(m_state); -} - -QmlDebugEnginesQuery::QmlDebugEnginesQuery(QObject *parent) -: QmlDebugQuery(parent), m_client(0), m_queryId(-1) -{ -} - -QmlDebugEnginesQuery::~QmlDebugEnginesQuery() -{ - if (m_client && m_queryId != -1) - QmlEngineDebugPrivate::remove(m_client, this); -} - -QList<QmlDebugEngineReference> QmlDebugEnginesQuery::engines() const -{ - return m_engines; -} - -QmlDebugRootContextQuery::QmlDebugRootContextQuery(QObject *parent) -: QmlDebugQuery(parent), m_client(0), m_queryId(-1) -{ -} - -QmlDebugRootContextQuery::~QmlDebugRootContextQuery() -{ - if (m_client && m_queryId != -1) - QmlEngineDebugPrivate::remove(m_client, this); -} - -QmlDebugContextReference QmlDebugRootContextQuery::rootContext() const -{ - return m_context; -} - -QmlDebugObjectQuery::QmlDebugObjectQuery(QObject *parent) -: QmlDebugQuery(parent), m_client(0), m_queryId(-1) -{ -} - -QmlDebugObjectQuery::~QmlDebugObjectQuery() -{ - if (m_client && m_queryId != -1) - QmlEngineDebugPrivate::remove(m_client, this); -} - -QmlDebugObjectReference QmlDebugObjectQuery::object() const -{ - return m_object; -} - -QmlDebugExpressionQuery::QmlDebugExpressionQuery(QObject *parent) -: QmlDebugQuery(parent), m_client(0), m_queryId(-1) -{ -} - -QmlDebugExpressionQuery::~QmlDebugExpressionQuery() -{ - if (m_client && m_queryId != -1) - QmlEngineDebugPrivate::remove(m_client, this); -} - -QString QmlDebugExpressionQuery::expression() const -{ - return m_expr; -} - -QVariant QmlDebugExpressionQuery::result() const -{ - return m_result; -} - -QmlDebugEngineReference::QmlDebugEngineReference() -: m_debugId(-1) -{ -} - -QmlDebugEngineReference::QmlDebugEngineReference(int debugId) -: m_debugId(debugId) -{ -} - -QmlDebugEngineReference::QmlDebugEngineReference(const QmlDebugEngineReference &o) -: m_debugId(o.m_debugId), m_name(o.m_name) -{ -} - -QmlDebugEngineReference & -QmlDebugEngineReference::operator=(const QmlDebugEngineReference &o) -{ - m_debugId = o.m_debugId; m_name = o.m_name; - return *this; -} - -int QmlDebugEngineReference::debugId() const -{ - return m_debugId; -} - -QString QmlDebugEngineReference::name() const -{ - return m_name; -} - -QmlDebugObjectReference::QmlDebugObjectReference() -: m_debugId(-1), m_contextDebugId(-1) -{ -} - -QmlDebugObjectReference::QmlDebugObjectReference(int debugId) -: m_debugId(debugId), m_contextDebugId(-1) -{ -} - -QmlDebugObjectReference::QmlDebugObjectReference(const QmlDebugObjectReference &o) -: m_debugId(o.m_debugId), m_class(o.m_class), m_name(o.m_name), - m_source(o.m_source), m_contextDebugId(o.m_contextDebugId), - m_properties(o.m_properties), m_children(o.m_children) -{ -} - -QmlDebugObjectReference & -QmlDebugObjectReference::operator=(const QmlDebugObjectReference &o) -{ - m_debugId = o.m_debugId; m_class = o.m_class; m_name = o.m_name; - m_source = o.m_source; m_contextDebugId = o.m_contextDebugId; - m_properties = o.m_properties; m_children = o.m_children; - return *this; -} - -int QmlDebugObjectReference::debugId() const -{ - return m_debugId; -} - -QString QmlDebugObjectReference::className() const -{ - return m_class; -} - -QString QmlDebugObjectReference::name() const -{ - return m_name; -} - -QmlDebugFileReference QmlDebugObjectReference::source() const -{ - return m_source; -} - -int QmlDebugObjectReference::contextDebugId() const -{ - return m_contextDebugId; -} - -QList<QmlDebugPropertyReference> QmlDebugObjectReference::properties() const -{ - return m_properties; -} - -QList<QmlDebugObjectReference> QmlDebugObjectReference::children() const -{ - return m_children; -} - -QmlDebugContextReference::QmlDebugContextReference() -: m_debugId(-1) -{ -} - -QmlDebugContextReference::QmlDebugContextReference(const QmlDebugContextReference &o) -: m_debugId(o.m_debugId), m_name(o.m_name), m_objects(o.m_objects), m_contexts(o.m_contexts) -{ -} - -QmlDebugContextReference &QmlDebugContextReference::operator=(const QmlDebugContextReference &o) -{ - m_debugId = o.m_debugId; m_name = o.m_name; m_objects = o.m_objects; - m_contexts = o.m_contexts; - return *this; -} - -int QmlDebugContextReference::debugId() const -{ - return m_debugId; -} - -QString QmlDebugContextReference::name() const -{ - return m_name; -} - -QList<QmlDebugObjectReference> QmlDebugContextReference::objects() const -{ - return m_objects; -} - -QList<QmlDebugContextReference> QmlDebugContextReference::contexts() const -{ - return m_contexts; -} - -QmlDebugFileReference::QmlDebugFileReference() -: m_lineNumber(-1), m_columnNumber(-1) -{ -} - -QmlDebugFileReference::QmlDebugFileReference(const QmlDebugFileReference &o) -: m_url(o.m_url), m_lineNumber(o.m_lineNumber), m_columnNumber(o.m_columnNumber) -{ -} - -QmlDebugFileReference &QmlDebugFileReference::operator=(const QmlDebugFileReference &o) -{ - m_url = o.m_url; m_lineNumber = o.m_lineNumber; m_columnNumber = o.m_columnNumber; - return *this; -} - -QUrl QmlDebugFileReference::url() const -{ - return m_url; -} - -void QmlDebugFileReference::setUrl(const QUrl &u) -{ - m_url = u; -} - -int QmlDebugFileReference::lineNumber() const -{ - return m_lineNumber; -} - -void QmlDebugFileReference::setLineNumber(int l) -{ - m_lineNumber = l; -} - -int QmlDebugFileReference::columnNumber() const -{ - return m_columnNumber; -} - -void QmlDebugFileReference::setColumnNumber(int c) -{ - m_columnNumber = c; -} - -QmlDebugPropertyReference::QmlDebugPropertyReference() -: m_objectDebugId(-1), m_hasNotifySignal(false) -{ -} - -QmlDebugPropertyReference::QmlDebugPropertyReference(const QmlDebugPropertyReference &o) -: m_objectDebugId(o.m_objectDebugId), m_name(o.m_name), m_value(o.m_value), - m_valueTypeName(o.m_valueTypeName), m_binding(o.m_binding), - m_hasNotifySignal(o.m_hasNotifySignal) -{ -} - -QmlDebugPropertyReference &QmlDebugPropertyReference::operator=(const QmlDebugPropertyReference &o) -{ - m_objectDebugId = o.m_objectDebugId; m_name = o.m_name; m_value = o.m_value; - m_valueTypeName = o.m_valueTypeName; m_binding = o.m_binding; - m_hasNotifySignal = o.m_hasNotifySignal; - return *this; -} - -int QmlDebugPropertyReference::objectDebugId() const -{ - return m_objectDebugId; -} - -QString QmlDebugPropertyReference::name() const -{ - return m_name; -} - -QString QmlDebugPropertyReference::valueTypeName() const -{ - return m_valueTypeName; -} - -QVariant QmlDebugPropertyReference::value() const -{ - return m_value; -} - -QString QmlDebugPropertyReference::binding() const -{ - return m_binding; -} - -bool QmlDebugPropertyReference::hasNotifySignal() const -{ - return m_hasNotifySignal; -} - -QT_END_NAMESPACE - diff --git a/src/declarative/debugger/qmldebug_p.h b/src/declarative/debugger/qmldebug_p.h deleted file mode 100644 index a1371d5..0000000 --- a/src/declarative/debugger/qmldebug_p.h +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QMLDEBUG_H -#define QMLDEBUG_H - -#include <QtCore/qobject.h> -#include <QtCore/qurl.h> -#include <QtCore/qvariant.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlDebugConnection; -class QmlDebugWatch; -class QmlDebugPropertyWatch; -class QmlDebugObjectExpressionWatch; -class QmlDebugEnginesQuery; -class QmlDebugRootContextQuery; -class QmlDebugObjectQuery; -class QmlDebugExpressionQuery; -class QmlDebugPropertyReference; -class QmlDebugContextReference; -class QmlDebugObjectReference; -class QmlDebugFileReference; -class QmlDebugEngineReference; -class QmlEngineDebugPrivate; -class Q_DECLARATIVE_EXPORT QmlEngineDebug : public QObject -{ -Q_OBJECT -public: - QmlEngineDebug(QmlDebugConnection *, QObject * = 0); - - QmlDebugPropertyWatch *addWatch(const QmlDebugPropertyReference &, - QObject *parent = 0); - QmlDebugWatch *addWatch(const QmlDebugContextReference &, const QString &, - QObject *parent = 0); - QmlDebugObjectExpressionWatch *addWatch(const QmlDebugObjectReference &, const QString &, - QObject *parent = 0); - QmlDebugWatch *addWatch(const QmlDebugObjectReference &, - QObject *parent = 0); - QmlDebugWatch *addWatch(const QmlDebugFileReference &, - QObject *parent = 0); - - void removeWatch(QmlDebugWatch *watch); - - QmlDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0); - QmlDebugRootContextQuery *queryRootContexts(const QmlDebugEngineReference &, - QObject *parent = 0); - QmlDebugObjectQuery *queryObject(const QmlDebugObjectReference &, - QObject *parent = 0); - QmlDebugObjectQuery *queryObjectRecursive(const QmlDebugObjectReference &, - QObject *parent = 0); - QmlDebugExpressionQuery *queryExpressionResult(int objectDebugId, - const QString &expr, - QObject *parent = 0); - -private: - Q_DECLARE_PRIVATE(QmlEngineDebug) -}; - -class Q_DECLARATIVE_EXPORT QmlDebugWatch : public QObject -{ -Q_OBJECT -public: - enum State { Waiting, Active, Inactive, Dead }; - - QmlDebugWatch(QObject *); - ~QmlDebugWatch(); - - int queryId() const; - int objectDebugId() const; - State state() const; - -Q_SIGNALS: - void stateChanged(QmlDebugWatch::State); - //void objectChanged(int, const QmlDebugObjectReference &); - //void valueChanged(int, const QVariant &); - - // Server sends value as string if it is a user-type variant - void valueChanged(const QByteArray &name, const QVariant &value); - -private: - friend class QmlEngineDebug; - friend class QmlEngineDebugPrivate; - void setState(State); - State m_state; - int m_queryId; - QmlEngineDebug *m_client; - int m_objectDebugId; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugPropertyWatch : public QmlDebugWatch -{ - Q_OBJECT -public: - QmlDebugPropertyWatch(QObject *parent); - - QString name() const; - -private: - friend class QmlEngineDebug; - QString m_name; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugObjectExpressionWatch : public QmlDebugWatch -{ - Q_OBJECT -public: - QmlDebugObjectExpressionWatch(QObject *parent); - - QString expression() const; - -private: - friend class QmlEngineDebug; - QString m_expr; - int m_debugId; -}; - - -class Q_DECLARATIVE_EXPORT QmlDebugQuery : public QObject -{ -Q_OBJECT -public: - enum State { Waiting, Error, Completed }; - - State state() const; - bool isWaiting() const; - -// bool waitUntilCompleted(); - -Q_SIGNALS: - void stateChanged(QmlDebugQuery::State); - -protected: - QmlDebugQuery(QObject *); - -private: - friend class QmlEngineDebug; - friend class QmlEngineDebugPrivate; - void setState(State); - State m_state; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugFileReference -{ -public: - QmlDebugFileReference(); - QmlDebugFileReference(const QmlDebugFileReference &); - QmlDebugFileReference &operator=(const QmlDebugFileReference &); - - QUrl url() const; - void setUrl(const QUrl &); - int lineNumber() const; - void setLineNumber(int); - int columnNumber() const; - void setColumnNumber(int); - -private: - friend class QmlEngineDebugPrivate; - QUrl m_url; - int m_lineNumber; - int m_columnNumber; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugEngineReference -{ -public: - QmlDebugEngineReference(); - QmlDebugEngineReference(int); - QmlDebugEngineReference(const QmlDebugEngineReference &); - QmlDebugEngineReference &operator=(const QmlDebugEngineReference &); - - int debugId() const; - QString name() const; - -private: - friend class QmlEngineDebugPrivate; - int m_debugId; - QString m_name; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugObjectReference -{ -public: - QmlDebugObjectReference(); - QmlDebugObjectReference(int); - QmlDebugObjectReference(const QmlDebugObjectReference &); - QmlDebugObjectReference &operator=(const QmlDebugObjectReference &); - - int debugId() const; - QString className() const; - QString name() const; - - QmlDebugFileReference source() const; - int contextDebugId() const; - - QList<QmlDebugPropertyReference> properties() const; - QList<QmlDebugObjectReference> children() const; - -private: - friend class QmlEngineDebugPrivate; - int m_debugId; - QString m_class; - QString m_name; - QmlDebugFileReference m_source; - int m_contextDebugId; - QList<QmlDebugPropertyReference> m_properties; - QList<QmlDebugObjectReference> m_children; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugContextReference -{ -public: - QmlDebugContextReference(); - QmlDebugContextReference(const QmlDebugContextReference &); - QmlDebugContextReference &operator=(const QmlDebugContextReference &); - - int debugId() const; - QString name() const; - - QList<QmlDebugObjectReference> objects() const; - QList<QmlDebugContextReference> contexts() const; - -private: - friend class QmlEngineDebugPrivate; - int m_debugId; - QString m_name; - QList<QmlDebugObjectReference> m_objects; - QList<QmlDebugContextReference> m_contexts; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugPropertyReference -{ -public: - QmlDebugPropertyReference(); - QmlDebugPropertyReference(const QmlDebugPropertyReference &); - QmlDebugPropertyReference &operator=(const QmlDebugPropertyReference &); - - int objectDebugId() const; - QString name() const; - QVariant value() const; - QString valueTypeName() const; - QString binding() const; - bool hasNotifySignal() const; - -private: - friend class QmlEngineDebugPrivate; - int m_objectDebugId; - QString m_name; - QVariant m_value; - QString m_valueTypeName; - QString m_binding; - bool m_hasNotifySignal; -}; - - -class Q_DECLARATIVE_EXPORT QmlDebugEnginesQuery : public QmlDebugQuery -{ -Q_OBJECT -public: - virtual ~QmlDebugEnginesQuery(); - QList<QmlDebugEngineReference> engines() const; -private: - friend class QmlEngineDebug; - friend class QmlEngineDebugPrivate; - QmlDebugEnginesQuery(QObject *); - QmlEngineDebug *m_client; - int m_queryId; - QList<QmlDebugEngineReference> m_engines; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugRootContextQuery : public QmlDebugQuery -{ -Q_OBJECT -public: - virtual ~QmlDebugRootContextQuery(); - QmlDebugContextReference rootContext() const; -private: - friend class QmlEngineDebug; - friend class QmlEngineDebugPrivate; - QmlDebugRootContextQuery(QObject *); - QmlEngineDebug *m_client; - int m_queryId; - QmlDebugContextReference m_context; -}; - -class Q_DECLARATIVE_EXPORT QmlDebugObjectQuery : public QmlDebugQuery -{ -Q_OBJECT -public: - virtual ~QmlDebugObjectQuery(); - QmlDebugObjectReference object() const; -private: - friend class QmlEngineDebug; - friend class QmlEngineDebugPrivate; - QmlDebugObjectQuery(QObject *); - QmlEngineDebug *m_client; - int m_queryId; - QmlDebugObjectReference m_object; - -}; - -class Q_DECLARATIVE_EXPORT QmlDebugExpressionQuery : public QmlDebugQuery -{ -Q_OBJECT -public: - virtual ~QmlDebugExpressionQuery(); - QString expression() const; - QVariant result() const; -private: - friend class QmlEngineDebug; - friend class QmlEngineDebugPrivate; - QmlDebugExpressionQuery(QObject *); - QmlEngineDebug *m_client; - int m_queryId; - QString m_expr; - QVariant m_result; - -}; - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(QmlDebugEngineReference) -Q_DECLARE_METATYPE(QmlDebugObjectReference) -Q_DECLARE_METATYPE(QmlDebugContextReference) -Q_DECLARE_METATYPE(QmlDebugPropertyReference) - -QT_END_HEADER - -#endif // QMLDEBUG_H |