QmlDebug: Renaming

Move Status enum out of QmlDebugClient and drop "QmlDebug"
prefix for the different 'Reference' structs. Allows to
avoid 'using namespace in QmlDebug' in header files.

Change-Id: Id9857977300e86d637cf128ff3417d8b24c8e995
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
Kai Koehne
2012-05-10 10:29:11 +02:00
parent e9277df87b
commit b2a2a7cc18
28 changed files with 296 additions and 296 deletions

View File

@@ -72,7 +72,7 @@ QDataStream &operator>>(QDataStream &ds, QmlObjectProperty &data)
} }
void BaseEngineDebugClient::decode(QDataStream &ds, void BaseEngineDebugClient::decode(QDataStream &ds,
QmlDebugObjectReference &o, ObjectReference &o,
bool simple) bool simple)
{ {
QmlObjectData data; QmlObjectData data;
@@ -100,7 +100,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
ds >> childCount >> recur; ds >> childCount >> recur;
for (int ii = 0; ii < childCount; ++ii) { for (int ii = 0; ii < childCount; ++ii) {
o.m_children.append(QmlDebugObjectReference()); o.m_children.append(ObjectReference());
decode(ds, o.m_children.last(), !recur); decode(ds, o.m_children.last(), !recur);
} }
@@ -110,7 +110,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
for (int ii = 0; ii < propCount; ++ii) { for (int ii = 0; ii < propCount; ++ii) {
QmlObjectProperty data; QmlObjectProperty data;
ds >> data; ds >> data;
QmlDebugPropertyReference prop; PropertyReference prop;
prop.m_objectDebugId = o.m_debugId; prop.m_objectDebugId = o.m_debugId;
prop.m_name = data.name; prop.m_name = data.name;
prop.m_binding = data.binding; prop.m_binding = data.binding;
@@ -126,7 +126,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
} }
case QmlObjectProperty::Object: case QmlObjectProperty::Object:
{ {
QmlDebugObjectReference obj; ObjectReference obj;
obj.m_debugId = prop.m_value.toInt(); obj.m_debugId = prop.m_value.toInt();
prop.m_value = qVariantFromValue(obj); prop.m_value = qVariantFromValue(obj);
break; break;
@@ -139,7 +139,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
} }
void BaseEngineDebugClient::decode(QDataStream &ds, void BaseEngineDebugClient::decode(QDataStream &ds,
QmlDebugContextReference &c) ContextReference &c)
{ {
ds >> c.m_name >> c.m_debugId; ds >> c.m_name >> c.m_debugId;
@@ -147,7 +147,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
ds >> contextCount; ds >> contextCount;
for (int ii = 0; ii < contextCount; ++ii) { for (int ii = 0; ii < contextCount; ++ii) {
c.m_contexts.append(QmlDebugContextReference()); c.m_contexts.append(ContextReference());
decode(ds, c.m_contexts.last()); decode(ds, c.m_contexts.last());
} }
@@ -155,14 +155,14 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
ds >> objectCount; ds >> objectCount;
for (int ii = 0; ii < objectCount; ++ii) { for (int ii = 0; ii < objectCount; ++ii) {
QmlDebugObjectReference obj; ObjectReference obj;
decode(ds, obj, true); decode(ds, obj, true);
obj.m_contextDebugId = c.m_debugId; obj.m_contextDebugId = c.m_debugId;
c.m_objects << obj; c.m_objects << obj;
} }
} }
void BaseEngineDebugClient::statusChanged(Status status) void BaseEngineDebugClient::statusChanged(ClientStatus status)
{ {
emit newStatus(status); emit newStatus(status);
} }
@@ -184,21 +184,21 @@ void BaseEngineDebugClient::messageReceived(const QByteArray &data)
if (type == "LIST_ENGINES_R") { if (type == "LIST_ENGINES_R") {
int count; int count;
ds >> count; ds >> count;
QmlDebugEngineReferenceList engines; QList<EngineReference> engines;
for (int ii = 0; ii < count; ++ii) { for (int ii = 0; ii < count; ++ii) {
QmlDebugEngineReference eng; EngineReference eng;
ds >> eng.m_name; ds >> eng.m_name;
ds >> eng.m_debugId; ds >> eng.m_debugId;
engines << eng; engines << eng;
} }
emit result(queryId, QVariant::fromValue(engines), type); emit result(queryId, QVariant::fromValue(engines), type);
} else if (type == "LIST_OBJECTS_R") { } else if (type == "LIST_OBJECTS_R") {
QmlDebugContextReference rootContext; ContextReference rootContext;
if (!ds.atEnd()) if (!ds.atEnd())
decode(ds, rootContext); decode(ds, rootContext);
emit result(queryId, QVariant::fromValue(rootContext), type); emit result(queryId, QVariant::fromValue(rootContext), type);
} else if (type == "FETCH_OBJECT_R") { } else if (type == "FETCH_OBJECT_R") {
QmlDebugObjectReference object; ObjectReference object;
if (!ds.atEnd()) if (!ds.atEnd())
decode(ds, object, false); decode(ds, object, false);
emit result(queryId, QVariant::fromValue(object), type); emit result(queryId, QVariant::fromValue(object), type);
@@ -229,10 +229,10 @@ BaseEngineDebugClient::BaseEngineDebugClient(const QString &clientName,
setObjectName(clientName); setObjectName(clientName);
} }
quint32 BaseEngineDebugClient::addWatch(const QmlDebugPropertyReference &property) quint32 BaseEngineDebugClient::addWatch(const PropertyReference &property)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled) { if (status() == Enabled) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -243,18 +243,18 @@ quint32 BaseEngineDebugClient::addWatch(const QmlDebugPropertyReference &propert
return id; return id;
} }
quint32 BaseEngineDebugClient::addWatch(const QmlDebugContextReference &/*context*/, quint32 BaseEngineDebugClient::addWatch(const ContextReference &/*context*/,
const QString &/*id*/) const QString &/*id*/)
{ {
qWarning("QmlEngineDebugClient::addWatch(): Not implemented"); qWarning("QmlEngineDebugClient::addWatch(): Not implemented");
return 0; return 0;
} }
quint32 BaseEngineDebugClient::addWatch(const QmlDebugObjectReference &object, quint32 BaseEngineDebugClient::addWatch(const ObjectReference &object,
const QString &expr) const QString &expr)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled) { if (status() == Enabled) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -264,10 +264,10 @@ quint32 BaseEngineDebugClient::addWatch(const QmlDebugObjectReference &object,
return id; return id;
} }
quint32 BaseEngineDebugClient::addWatch(const QmlDebugObjectReference &object) quint32 BaseEngineDebugClient::addWatch(const ObjectReference &object)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled) { if (status() == Enabled) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -277,7 +277,7 @@ quint32 BaseEngineDebugClient::addWatch(const QmlDebugObjectReference &object)
return id; return id;
} }
quint32 BaseEngineDebugClient::addWatch(const QmlDebugFileReference &/*file*/) quint32 BaseEngineDebugClient::addWatch(const FileReference &/*file*/)
{ {
qWarning("QmlEngineDebugClient::addWatch(): Not implemented"); qWarning("QmlEngineDebugClient::addWatch(): Not implemented");
return 0; return 0;
@@ -285,7 +285,7 @@ quint32 BaseEngineDebugClient::addWatch(const QmlDebugFileReference &/*file*/)
void BaseEngineDebugClient::removeWatch(quint32 id) void BaseEngineDebugClient::removeWatch(quint32 id)
{ {
if (status() == QmlDebugClient::Enabled) { if (status() == Enabled) {
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
ds << QByteArray("NO_WATCH") << id; ds << QByteArray("NO_WATCH") << id;
@@ -296,7 +296,7 @@ void BaseEngineDebugClient::removeWatch(quint32 id)
quint32 BaseEngineDebugClient::queryAvailableEngines() quint32 BaseEngineDebugClient::queryAvailableEngines()
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled) { if (status() == Enabled) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -306,10 +306,10 @@ quint32 BaseEngineDebugClient::queryAvailableEngines()
return id; return id;
} }
quint32 BaseEngineDebugClient::queryRootContexts(const QmlDebugEngineReference &engine) quint32 BaseEngineDebugClient::queryRootContexts(const EngineReference &engine)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && engine.m_debugId != -1) { if (status() == Enabled && engine.m_debugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -319,10 +319,10 @@ quint32 BaseEngineDebugClient::queryRootContexts(const QmlDebugEngineReference &
return id; return id;
} }
quint32 BaseEngineDebugClient::queryObject(const QmlDebugObjectReference &object) quint32 BaseEngineDebugClient::queryObject(const ObjectReference &object)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && object.m_debugId != -1) { if (status() == Enabled && object.m_debugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -333,10 +333,10 @@ quint32 BaseEngineDebugClient::queryObject(const QmlDebugObjectReference &object
return id; return id;
} }
quint32 BaseEngineDebugClient::queryObjectRecursive(const QmlDebugObjectReference &object) quint32 BaseEngineDebugClient::queryObjectRecursive(const ObjectReference &object)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && object.m_debugId != -1) { if (status() == Enabled && object.m_debugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -352,7 +352,7 @@ quint32 BaseEngineDebugClient::queryExpressionResult(int objectDebugId,
int engineId) int engineId)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) { if (status() == Enabled && objectDebugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -371,7 +371,7 @@ quint32 BaseEngineDebugClient::setBindingForObject(
QString source, int line) QString source, int line)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) { if (status() == Enabled && objectDebugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -387,7 +387,7 @@ quint32 BaseEngineDebugClient::resetBindingForObject(
const QString &propertyName) const QString &propertyName)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) { if (status() == Enabled && objectDebugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -402,7 +402,7 @@ quint32 BaseEngineDebugClient::setMethodBody(
const QString &methodBody) const QString &methodBody)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) { if (status() == Enabled && objectDebugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);

View File

@@ -40,11 +40,11 @@
namespace QmlDebug { namespace QmlDebug {
class QmlDebugConnection; class QmlDebugConnection;
class QmlDebugPropertyReference; class PropertyReference;
class QmlDebugContextReference; class ContextReference;
class QmlDebugObjectReference; class ObjectReference;
class QmlDebugFileReference; class FileReference;
class QmlDebugEngineReference; class EngineReference;
class QMLDEBUG_EXPORT BaseEngineDebugClient : public QmlDebugClient class QMLDEBUG_EXPORT BaseEngineDebugClient : public QmlDebugClient
{ {
@@ -53,18 +53,18 @@ public:
BaseEngineDebugClient(const QString &clientName, BaseEngineDebugClient(const QString &clientName,
QmlDebugConnection *conn); QmlDebugConnection *conn);
quint32 addWatch(const QmlDebugPropertyReference &property); quint32 addWatch(const PropertyReference &property);
quint32 addWatch(const QmlDebugContextReference &context, const QString &id); quint32 addWatch(const ContextReference &context, const QString &id);
quint32 addWatch(const QmlDebugObjectReference &object, const QString &expr); quint32 addWatch(const ObjectReference &object, const QString &expr);
quint32 addWatch(const QmlDebugObjectReference &object); quint32 addWatch(const ObjectReference &object);
quint32 addWatch(const QmlDebugFileReference &file); quint32 addWatch(const FileReference &file);
void removeWatch(quint32 watch); void removeWatch(quint32 watch);
quint32 queryAvailableEngines(); quint32 queryAvailableEngines();
quint32 queryRootContexts(const QmlDebugEngineReference &context); quint32 queryRootContexts(const EngineReference &context);
quint32 queryObject(const QmlDebugObjectReference &object); quint32 queryObject(const ObjectReference &object);
quint32 queryObjectRecursive(const QmlDebugObjectReference &object); quint32 queryObjectRecursive(const ObjectReference &object);
quint32 queryExpressionResult(int objectDebugId, quint32 queryExpressionResult(int objectDebugId,
const QString &expr, int engineId = -1); const QString &expr, int engineId = -1);
virtual quint32 setBindingForObject(int objectDebugId, const QString &propertyName, virtual quint32 setBindingForObject(int objectDebugId, const QString &propertyName,
@@ -77,29 +77,29 @@ public:
const QString &methodBody); const QString &methodBody);
signals: signals:
void newStatus(QmlDebugClient::Status status); void newStatus(QmlDebug::ClientStatus status);
void newObjects(); void newObjects();
void valueChanged(int debugId, const QByteArray &name, void valueChanged(int debugId, const QByteArray &name,
const QVariant &value); const QVariant &value);
void result(quint32 queryId, const QVariant &result, const QByteArray &type); void result(quint32 queryId, const QVariant &result, const QByteArray &type);
protected: protected:
virtual void statusChanged(Status status); virtual void statusChanged(ClientStatus status);
virtual void messageReceived(const QByteArray &); virtual void messageReceived(const QByteArray &);
quint32 getId() { return m_nextId++; } quint32 getId() { return m_nextId++; }
void decode(QDataStream &d, QmlDebugContextReference &context); void decode(QDataStream &d, ContextReference &context);
void decode(QDataStream &d, QmlDebugObjectReference &object, bool simple); void decode(QDataStream &d, ObjectReference &object, bool simple);
private: private:
quint32 m_nextId; quint32 m_nextId;
}; };
class QmlDebugFileReference class FileReference
{ {
public: public:
QmlDebugFileReference() : m_lineNumber(-1), m_columnNumber(-1) {} FileReference() : m_lineNumber(-1), m_columnNumber(-1) {}
QUrl url() const { return m_url; } QUrl url() const { return m_url; }
int lineNumber() const { return m_lineNumber; } int lineNumber() const { return m_lineNumber; }
@@ -112,11 +112,11 @@ private:
int m_columnNumber; int m_columnNumber;
}; };
class QmlDebugEngineReference class EngineReference
{ {
public: public:
QmlDebugEngineReference() : m_debugId(-1) {} EngineReference() : m_debugId(-1) {}
explicit QmlDebugEngineReference(int id) : m_debugId(id) {} explicit EngineReference(int id) : m_debugId(id) {}
int debugId() const { return m_debugId; } int debugId() const { return m_debugId; }
QString name() const { return m_name; } QString name() const { return m_name; }
@@ -127,13 +127,11 @@ private:
QString m_name; QString m_name;
}; };
typedef QList<QmlDebugEngineReference> QmlDebugEngineReferenceList; class ObjectReference
class QmlDebugObjectReference
{ {
public: public:
QmlDebugObjectReference() : m_debugId(-1), m_parentId(-1), m_contextDebugId(-1), m_needsMoreData(false) {} ObjectReference() : m_debugId(-1), m_parentId(-1), m_contextDebugId(-1), m_needsMoreData(false) {}
explicit QmlDebugObjectReference(int id) : m_debugId(id), m_parentId(-1), m_contextDebugId(-1), m_needsMoreData(false) {} explicit ObjectReference(int id) : m_debugId(id), m_parentId(-1), m_contextDebugId(-1), m_needsMoreData(false) {}
int debugId() const { return m_debugId; } int debugId() const { return m_debugId; }
int parentId() const { return m_parentId; } int parentId() const { return m_parentId; }
@@ -141,14 +139,14 @@ public:
QString idString() const { return m_idString; } QString idString() const { return m_idString; }
QString name() const { return m_name; } QString name() const { return m_name; }
QmlDebugFileReference source() const { return m_source; } FileReference source() const { return m_source; }
int contextDebugId() const { return m_contextDebugId; } int contextDebugId() const { return m_contextDebugId; }
bool needsMoreData() const { return m_needsMoreData; } bool needsMoreData() const { return m_needsMoreData; }
QList<QmlDebugPropertyReference> properties() const { return m_properties; } QList<PropertyReference> properties() const { return m_properties; }
QList<QmlDebugObjectReference> children() const { return m_children; } QList<ObjectReference> children() const { return m_children; }
int insertObjectInTree(const QmlDebugObjectReference &obj) int insertObjectInTree(const ObjectReference &obj)
{ {
for (int i = 0; i < m_children.count(); i++) { for (int i = 0; i < m_children.count(); i++) {
if (m_children[i].debugId() == obj.debugId()) { if (m_children[i].debugId() == obj.debugId()) {
@@ -162,7 +160,7 @@ public:
return -1; return -1;
} }
bool operator ==(const QmlDebugObjectReference &obj) bool operator ==(const ObjectReference &obj)
{ {
return m_debugId == obj.debugId(); return m_debugId == obj.debugId();
} }
@@ -174,36 +172,36 @@ private:
QString m_className; QString m_className;
QString m_idString; QString m_idString;
QString m_name; QString m_name;
QmlDebugFileReference m_source; FileReference m_source;
int m_contextDebugId; int m_contextDebugId;
bool m_needsMoreData; bool m_needsMoreData;
QList<QmlDebugPropertyReference> m_properties; QList<PropertyReference> m_properties;
QList<QmlDebugObjectReference> m_children; QList<ObjectReference> m_children;
}; };
class QmlDebugContextReference class ContextReference
{ {
public: public:
QmlDebugContextReference() : m_debugId(-1) {} ContextReference() : m_debugId(-1) {}
int debugId() const { return m_debugId; } int debugId() const { return m_debugId; }
QString name() const { return m_name; } QString name() const { return m_name; }
QList<QmlDebugObjectReference> objects() const { return m_objects; } QList<ObjectReference> objects() const { return m_objects; }
QList<QmlDebugContextReference> contexts() const { return m_contexts; } QList<ContextReference> contexts() const { return m_contexts; }
private: private:
friend class BaseEngineDebugClient; friend class BaseEngineDebugClient;
int m_debugId; int m_debugId;
QString m_name; QString m_name;
QList<QmlDebugObjectReference> m_objects; QList<ObjectReference> m_objects;
QList<QmlDebugContextReference> m_contexts; QList<ContextReference> m_contexts;
}; };
class QmlDebugPropertyReference class PropertyReference
{ {
public: public:
QmlDebugPropertyReference() : m_objectDebugId(-1), m_hasNotifySignal(false) {} PropertyReference() : m_objectDebugId(-1), m_hasNotifySignal(false) {}
int debugId() const { return m_objectDebugId; } int debugId() const { return m_objectDebugId; }
QString name() const { return m_name; } QString name() const { return m_name; }
@@ -224,23 +222,23 @@ private:
} // namespace QmlDebug } // namespace QmlDebug
Q_DECLARE_METATYPE(QmlDebug::QmlDebugObjectReference) Q_DECLARE_METATYPE(QmlDebug::ObjectReference)
Q_DECLARE_METATYPE(QmlDebug::QmlDebugEngineReference) Q_DECLARE_METATYPE(QmlDebug::EngineReference)
Q_DECLARE_METATYPE(QmlDebug::QmlDebugEngineReferenceList) Q_DECLARE_METATYPE(QList<QmlDebug::EngineReference>)
Q_DECLARE_METATYPE(QmlDebug::QmlDebugContextReference) Q_DECLARE_METATYPE(QmlDebug::ContextReference)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
inline QDebug operator<<(QDebug dbg, const QmlDebug::QmlDebugEngineReference &ref) { inline QDebug operator<<(QDebug dbg, const QmlDebug::EngineReference &ref) {
dbg.nospace() << "(Engine " << ref.debugId() << "/" << ref.name() << ")"; dbg.nospace() << "(Engine " << ref.debugId() << "/" << ref.name() << ")";
return dbg.space(); return dbg.space();
} }
inline QDebug operator<<(QDebug dbg, const QmlDebug::QmlDebugContextReference &ref) { inline QDebug operator<<(QDebug dbg, const QmlDebug::ContextReference &ref) {
dbg.nospace() << "(Context " << ref.debugId() << "/" << ref.name() << ")"; dbg.nospace() << "(Context " << ref.debugId() << "/" << ref.name() << ")";
return dbg.space(); return dbg.space();
} }
inline QDebug operator<<(QDebug dbg, const QmlDebug::QmlDebugObjectReference &ref) { inline QDebug operator<<(QDebug dbg, const QmlDebug::ObjectReference &ref) {
dbg.nospace() << "(Object " << ref.debugId() << "/" dbg.nospace() << "(Object " << ref.debugId() << "/"
<< (ref.idString().isEmpty() ? ref.idString() : ref.className()) << ")"; << (ref.idString().isEmpty() ? ref.idString() : ref.className()) << ")";
return dbg.space(); return dbg.space();

View File

@@ -39,17 +39,17 @@ BaseToolsClient::BaseToolsClient(QmlDebugConnection* client, QLatin1String clien
setObjectName(clientName); setObjectName(clientName);
} }
void BaseToolsClient::statusChanged(Status status) void BaseToolsClient::statusChanged(ClientStatus status)
{ {
emit connectedStatusChanged(status); emit connectedStatusChanged(status);
} }
void BaseToolsClient::recurseObjectIdList(const QmlDebugObjectReference &ref, void BaseToolsClient::recurseObjectIdList(const ObjectReference &ref,
QList<int> &debugIds, QList<QString> &objectIds) QList<int> &debugIds, QList<QString> &objectIds)
{ {
debugIds << ref.debugId(); debugIds << ref.debugId();
objectIds << ref.idString(); objectIds << ref.idString();
foreach (const QmlDebugObjectReference &child, ref.children()) foreach (const ObjectReference &child, ref.children())
recurseObjectIdList(child, debugIds, objectIds); recurseObjectIdList(child, debugIds, objectIds);
} }

View File

@@ -66,12 +66,12 @@ public:
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's // ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
virtual void setObjectIdList( virtual void setObjectIdList(
const QList<QmlDebugObjectReference> &objectRoots) = 0; const QList<ObjectReference> &objectRoots) = 0;
virtual void clearComponentCache() = 0; virtual void clearComponentCache() = 0;
signals: signals:
void connectedStatusChanged(QmlDebugClient::Status status); void connectedStatusChanged(QmlDebug::ClientStatus status);
void currentObjectsChanged(const QList<int> &debugIds); void currentObjectsChanged(const QList<int> &debugIds);
void selectToolActivated(); void selectToolActivated();
@@ -86,9 +86,9 @@ signals:
void logActivity(QString client, QString message); void logActivity(QString client, QString message);
protected: protected:
void statusChanged(Status); void statusChanged(ClientStatus status);
void recurseObjectIdList(const QmlDebugObjectReference &ref, void recurseObjectIdList(const ObjectReference &ref,
QList<int> &debugIds, QList<QString> &objectIds); QList<int> &debugIds, QList<QString> &objectIds);
protected: protected:
enum LogDirection { enum LogDirection {

View File

@@ -263,7 +263,7 @@ void DeclarativeToolsClient::setCurrentObjects(const QList<int> &debugIds)
} }
void DeclarativeToolsClient::setObjectIdList( void DeclarativeToolsClient::setObjectIdList(
const QList<QmlDebugObjectReference> &objectRoots) const QList<ObjectReference> &objectRoots)
{ {
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -271,7 +271,7 @@ void DeclarativeToolsClient::setObjectIdList(
QList<int> debugIds; QList<int> debugIds;
QList<QString> objectIds; QList<QString> objectIds;
foreach (const QmlDebugObjectReference &ref, objectRoots) foreach (const ObjectReference &ref, objectRoots)
recurseObjectIdList(ref, debugIds, objectIds); recurseObjectIdList(ref, debugIds, objectIds);
InspectorProtocol::Message cmd = InspectorProtocol::ObjectIdList; InspectorProtocol::Message cmd = InspectorProtocol::ObjectIdList;

View File

@@ -64,7 +64,7 @@ public:
QList<int> currentObjects() const; QList<int> currentObjects() const;
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's // ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
void setObjectIdList(const QList<QmlDebugObjectReference> &objectRoots); void setObjectIdList(const QList<ObjectReference> &objectRoots);
void clearComponentCache(); void clearComponentCache();

View File

@@ -43,7 +43,7 @@ QDebugMessageClient::~QDebugMessageClient()
{ {
} }
void QDebugMessageClient::statusChanged(Status status) void QDebugMessageClient::statusChanged(ClientStatus status)
{ {
emit newStatus(status); emit newStatus(status);
} }

View File

@@ -55,11 +55,11 @@ public:
~QDebugMessageClient(); ~QDebugMessageClient();
protected: protected:
virtual void statusChanged(Status status); virtual void statusChanged(ClientStatus status);
virtual void messageReceived(const QByteArray &); virtual void messageReceived(const QByteArray &);
signals: signals:
void newStatus(QmlDebugClient::Status); void newStatus(QmlDebug::ClientStatus);
void message(QtMsgType, const QString &, void message(QtMsgType, const QString &,
const QmlDebug::QDebugContextInfo &); const QmlDebug::QDebugContextInfo &);

View File

@@ -149,9 +149,9 @@ void QmlDebugConnectionPrivate::readyRead()
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin(); QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
for (; iter != plugins.end(); ++iter) { for (; iter != plugins.end(); ++iter) {
QmlDebugClient::Status newStatus = QmlDebugClient::Unavailable; ClientStatus newStatus = Unavailable;
if (serverPlugins.contains(iter.key())) if (serverPlugins.contains(iter.key()))
newStatus = QmlDebugClient::Enabled; newStatus = Enabled;
iter.value()->statusChanged(newStatus); iter.value()->statusChanged(newStatus);
} }
} }
@@ -188,9 +188,9 @@ void QmlDebugConnectionPrivate::readyRead()
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin(); QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
for (; iter != plugins.end(); ++iter) { for (; iter != plugins.end(); ++iter) {
const QString pluginName = iter.key(); const QString pluginName = iter.key();
QmlDebugClient::Status newStatus = QmlDebugClient::Unavailable; ClientStatus newStatus = Unavailable;
if (serverPlugins.contains(pluginName)) if (serverPlugins.contains(pluginName))
newStatus = QmlDebugClient::Enabled; newStatus = Enabled;
if (oldServerPlugins.contains(pluginName) if (oldServerPlugins.contains(pluginName)
!= serverPlugins.contains(pluginName)) { != serverPlugins.contains(pluginName)) {
@@ -232,7 +232,7 @@ QmlDebugConnection::~QmlDebugConnection()
QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin(); QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin();
for (; iter != d->plugins.end(); ++iter) { for (; iter != d->plugins.end(); ++iter) {
iter.value()->d_func()->connection = 0; iter.value()->d_func()->connection = 0;
iter.value()->statusChanged(QmlDebugClient::NotConnected); iter.value()->statusChanged(NotConnected);
} }
} }
@@ -276,7 +276,7 @@ void QmlDebugConnection::close()
QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin(); QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin();
for (; iter != d->plugins.end(); ++iter) { for (; iter != d->plugins.end(); ++iter) {
iter.value()->statusChanged(QmlDebugClient::NotConnected); iter.value()->statusChanged(NotConnected);
} }
} }
} }
@@ -414,7 +414,7 @@ float QmlDebugClient::serviceVersion() const
return -1; return -1;
} }
QmlDebugClient::Status QmlDebugClient::status() const ClientStatus QmlDebugClient::status() const
{ {
Q_D(const QmlDebugClient); Q_D(const QmlDebugClient);
if (!d->connection if (!d->connection
@@ -440,7 +440,7 @@ void QmlDebugClient::sendMessage(const QByteArray &message)
d->connection->flush(); d->connection->flush();
} }
void QmlDebugClient::statusChanged(Status) void QmlDebugClient::statusChanged(ClientStatus)
{ {
} }

View File

@@ -75,6 +75,12 @@ private:
friend class QmlDebugClientPrivate; friend class QmlDebugClientPrivate;
}; };
enum ClientStatus {
NotConnected,
Unavailable,
Enabled
};
class QmlDebugClientPrivate; class QmlDebugClientPrivate;
class QMLDEBUG_EXPORT QmlDebugClient : public QObject class QMLDEBUG_EXPORT QmlDebugClient : public QObject
{ {
@@ -83,19 +89,17 @@ class QMLDEBUG_EXPORT QmlDebugClient : public QObject
Q_DISABLE_COPY(QmlDebugClient) Q_DISABLE_COPY(QmlDebugClient)
public: public:
enum Status { NotConnected, Unavailable, Enabled };
QmlDebugClient(const QString &, QmlDebugConnection *parent); QmlDebugClient(const QString &, QmlDebugConnection *parent);
~QmlDebugClient(); ~QmlDebugClient();
QString name() const; QString name() const;
float serviceVersion() const; float serviceVersion() const;
Status status() const; ClientStatus status() const;
virtual void sendMessage(const QByteArray &); virtual void sendMessage(const QByteArray &);
protected: protected:
virtual void statusChanged(Status); virtual void statusChanged(ClientStatus);
virtual void messageReceived(const QByteArray &); virtual void messageReceived(const QByteArray &);
private: private:

View File

@@ -48,7 +48,7 @@ quint32 QmlEngineDebugClient::setBindingForObject(
QString source, int line) QString source, int line)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) { if (status() == Enabled && objectDebugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -64,7 +64,7 @@ quint32 QmlEngineDebugClient::resetBindingForObject(
const QString &propertyName) const QString &propertyName)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) { if (status() == Enabled && objectDebugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);
@@ -79,7 +79,7 @@ quint32 QmlEngineDebugClient::setMethodBody(
const QString &methodBody) const QString &methodBody)
{ {
quint32 id = 0; quint32 id = 0;
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) { if (status() == Enabled && objectDebugId != -1) {
id = getId(); id = getId();
QByteArray message; QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly); QDataStream ds(&message, QIODevice::WriteOnly);

View File

@@ -136,7 +136,7 @@ void QmlProfilerTraceClient::setRecordingFromServer(bool v)
emit recordingChanged(v); emit recordingChanged(v);
} }
void QmlProfilerTraceClient::statusChanged(Status /*status*/) void QmlProfilerTraceClient::statusChanged(ClientStatus /*status*/)
{ {
emit enabledChanged(); emit enabledChanged();
} }

View File

@@ -102,7 +102,7 @@ signals:
void cleared(); void cleared();
protected: protected:
virtual void statusChanged(Status); virtual void statusChanged(ClientStatus status);
virtual void messageReceived(const QByteArray &); virtual void messageReceived(const QByteArray &);
private: private:

View File

@@ -130,7 +130,7 @@ void QmlToolsClient::setCurrentObjects(const QList<int> &debugIds)
} }
void QmlToolsClient::setObjectIdList( void QmlToolsClient::setObjectIdList(
const QList<QmlDebugObjectReference> &/*objectRoots*/) const QList<ObjectReference> &/*objectRoots*/)
{ {
//NOT IMPLEMENTED //NOT IMPLEMENTED
} }

View File

@@ -64,7 +64,7 @@ public:
QList<int> currentObjects() const; QList<int> currentObjects() const;
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's // ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
void setObjectIdList(const QList<QmlDebugObjectReference> &objectRoots); void setObjectIdList(const QList<ObjectReference> &objectRoots);
void clearComponentCache(); void clearComponentCache();

View File

@@ -128,7 +128,7 @@ void QV8ProfilerClient::setRecordingFromServer(bool v)
emit recordingChanged(v); emit recordingChanged(v);
} }
void QV8ProfilerClient::statusChanged(Status /*status*/) void QV8ProfilerClient::statusChanged(ClientStatus /*status*/)
{ {
emit enabledChanged(); emit enabledChanged();
} }

View File

@@ -84,7 +84,7 @@ private:
void setRecordingFromServer(bool); void setRecordingFromServer(bool);
protected: protected:
virtual void statusChanged(Status); virtual void statusChanged(ClientStatus);
virtual void messageReceived(const QByteArray &); virtual void messageReceived(const QByteArray &);
private: private:

View File

@@ -61,14 +61,14 @@ bool BaseQmlDebuggerClient::acceptsBreakpoint(const BreakpointModelId &/*id*/)
return false; return false;
} }
void BaseQmlDebuggerClient::statusChanged(Status status) void BaseQmlDebuggerClient::statusChanged(QmlDebug::ClientStatus status)
{ {
emit newStatus(status); emit newStatus(status);
} }
void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg) void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg)
{ {
if (status() == Enabled) { if (status() == QmlDebug::Enabled) {
QmlDebugClient::sendMessage(msg); QmlDebugClient::sendMessage(msg);
} else { } else {
d->sendBuffer.append(msg); d->sendBuffer.append(msg);
@@ -77,7 +77,7 @@ void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg)
void BaseQmlDebuggerClient::flushSendBuffer() void BaseQmlDebuggerClient::flushSendBuffer()
{ {
QTC_ASSERT(status() == QmlDebugClient::Enabled, return); QTC_ASSERT(status() == QmlDebug::Enabled, return);
foreach (const QByteArray &msg, d->sendBuffer) foreach (const QByteArray &msg, d->sendBuffer)
QmlDebugClient::sendMessage(msg); QmlDebugClient::sendMessage(msg);
d->sendBuffer.clear(); d->sendBuffer.clear();

View File

@@ -93,10 +93,10 @@ public:
void flushSendBuffer(); void flushSendBuffer();
signals: signals:
void newStatus(QmlDebugClient::Status status); void newStatus(QmlDebug::ClientStatus status);
protected: protected:
virtual void statusChanged(Status status); virtual void statusChanged(QmlDebug::ClientStatus status);
void sendMessage(const QByteArray &msg); void sendMessage(const QByteArray &msg);
private: private:

View File

@@ -41,6 +41,8 @@
#include <QDebug> #include <QDebug>
using namespace QmlDebug;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -63,8 +65,8 @@ QmlAdapter::QmlAdapter(DebuggerEngine *engine, QObject *parent)
createDebuggerClients(); createDebuggerClients();
m_msgClient = new QDebugMessageClient(m_conn); m_msgClient = new QDebugMessageClient(m_conn);
connect(m_msgClient, SIGNAL(newStatus(QmlDebugClient::Status)), connect(m_msgClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
this, SLOT(clientStatusChanged(QmlDebugClient::Status))); this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
} }
@@ -124,7 +126,7 @@ void QmlAdapter::connectionErrorOccurred(QAbstractSocket::SocketError socketErro
} }
} }
void QmlAdapter::clientStatusChanged(QmlDebugClient::Status status) void QmlAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
{ {
QString serviceName; QString serviceName;
float version = 0; float version = 0;
@@ -136,9 +138,9 @@ void QmlAdapter::clientStatusChanged(QmlDebugClient::Status status)
logServiceStatusChange(serviceName, version, status); logServiceStatusChange(serviceName, version, status);
} }
void QmlAdapter::debugClientStatusChanged(QmlDebugClient::Status status) void QmlAdapter::debugClientStatusChanged(QmlDebug::ClientStatus status)
{ {
if (status != QmlDebugClient::Enabled) if (status != QmlDebug::Enabled)
return; return;
QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender()); QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender());
QTC_ASSERT(client, return); QTC_ASSERT(client, return);
@@ -193,16 +195,16 @@ void QmlAdapter::checkConnectionState()
void QmlAdapter::createDebuggerClients() void QmlAdapter::createDebuggerClients()
{ {
QScriptDebuggerClient *debugClient1 = new QScriptDebuggerClient(m_conn); QScriptDebuggerClient *debugClient1 = new QScriptDebuggerClient(m_conn);
connect(debugClient1, SIGNAL(newStatus(QmlDebugClient::Status)), connect(debugClient1, SIGNAL(newStatus(QmlDebug::Status)),
this, SLOT(clientStatusChanged(QmlDebugClient::Status))); this, SLOT(clientStatusChanged(QmlDebug::Status)));
connect(debugClient1, SIGNAL(newStatus(QmlDebugClient::Status)), connect(debugClient1, SIGNAL(newStatus(QmlDebug::Status)),
this, SLOT(debugClientStatusChanged(QmlDebugClient::Status))); this, SLOT(debugClientStatusChanged(QmlDebug::Status)));
QmlV8DebuggerClient *debugClient2 = new QmlV8DebuggerClient(m_conn); QmlV8DebuggerClient *debugClient2 = new QmlV8DebuggerClient(m_conn);
connect(debugClient2, SIGNAL(newStatus(QmlDebugClient::Status)), connect(debugClient2, SIGNAL(newStatus(QmlDebug::Status)),
this, SLOT(clientStatusChanged(QmlDebugClient::Status))); this, SLOT(clientStatusChanged(QmlDebug::Status)));
connect(debugClient2, SIGNAL(newStatus(QmlDebugClient::Status)), connect(debugClient2, SIGNAL(newStatus(QmlDebug::Status)),
this, SLOT(debugClientStatusChanged(QmlDebugClient::Status))); this, SLOT(debugClientStatusChanged(QmlDebug::Status)));
m_debugClients.insert(debugClient1->name(),debugClient1); m_debugClients.insert(debugClient1->name(),debugClient1);
m_debugClients.insert(debugClient2->name(),debugClient2); m_debugClients.insert(debugClient2->name(),debugClient2);
@@ -272,21 +274,21 @@ QDebugMessageClient *QmlAdapter::messageClient() const
} }
void QmlAdapter::logServiceStatusChange(const QString &service, float version, void QmlAdapter::logServiceStatusChange(const QString &service, float version,
QmlDebugClient::Status newStatus) QmlDebug::ClientStatus newStatus)
{ {
switch (newStatus) { switch (newStatus) {
case QmlDebugClient::Unavailable: { case QmlDebug::Unavailable: {
showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'unavailable'."). showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'unavailable'.").
arg(service).arg(QString::number(version))); arg(service).arg(QString::number(version)));
break; break;
} }
case QmlDebugClient::Enabled: { case QmlDebug::Enabled: {
showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'enabled'."). showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'enabled'.").
arg(service).arg(QString::number(version))); arg(service).arg(QString::number(version)));
break; break;
} }
case QmlDebugClient::NotConnected: { case QmlDebug::NotConnected: {
showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'not connected'."). showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'not connected'.").
arg(service).arg(QString::number(version))); arg(service).arg(QString::number(version)));
break; break;

View File

@@ -42,8 +42,6 @@
#include <QPointer> #include <QPointer>
#include <QTimer> #include <QTimer>
using namespace QmlDebug;
namespace QmlDebug { namespace QmlDebug {
class BaseEngineDebugClient; class BaseEngineDebugClient;
class QmlDebugConnection; class QmlDebugConnection;
@@ -72,7 +70,7 @@ public:
bool isConnected() const; bool isConnected() const;
QmlDebugConnection *connection() const; QmlDebug::QmlDebugConnection *connection() const;
DebuggerEngine *debuggerEngine() const; DebuggerEngine *debuggerEngine() const;
bool disableJsDebugging(bool block); bool disableJsDebugging(bool block);
@@ -80,12 +78,11 @@ public:
BaseQmlDebuggerClient *activeDebuggerClient() const; BaseQmlDebuggerClient *activeDebuggerClient() const;
QHash<QString, BaseQmlDebuggerClient*> debuggerClients() const; QHash<QString, BaseQmlDebuggerClient*> debuggerClients() const;
BaseEngineDebugClient *engineDebugClient() const; QmlDebug::QDebugMessageClient *messageClient() const;
QDebugMessageClient *messageClient() const;
public slots: public slots:
void logServiceStatusChange(const QString &service, float version, void logServiceStatusChange(const QString &service, float version,
QmlDebugClient::Status newStatus); QmlDebug::ClientStatus newStatus);
void logServiceActivity(const QString &service, const QString &logMessage); void logServiceActivity(const QString &service, const QString &logMessage);
signals: signals:
@@ -97,8 +94,8 @@ signals:
private slots: private slots:
void connectionErrorOccurred(QAbstractSocket::SocketError socketError); void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
void clientStatusChanged(QmlDebugClient::Status status); void clientStatusChanged(QmlDebug::ClientStatus status);
void debugClientStatusChanged(QmlDebugClient::Status status); void debugClientStatusChanged(QmlDebug::ClientStatus status);
void connectionStateChanged(); void connectionStateChanged();
void checkConnectionState(); void checkConnectionState();
@@ -111,9 +108,9 @@ private:
QPointer<DebuggerEngine> m_engine; QPointer<DebuggerEngine> m_engine;
BaseQmlDebuggerClient *m_qmlClient; BaseQmlDebuggerClient *m_qmlClient;
QTimer m_connectionTimer; QTimer m_connectionTimer;
QmlDebugConnection *m_conn; QmlDebug::QmlDebugConnection *m_conn;
QHash<QString, BaseQmlDebuggerClient*> m_debugClients; QHash<QString, BaseQmlDebuggerClient*> m_debugClients;
QDebugMessageClient *m_msgClient; QmlDebug::QDebugMessageClient *m_msgClient;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -193,7 +193,7 @@ private:
QmlInspectorAdapter m_inspectorAdapter; QmlInspectorAdapter m_inspectorAdapter;
ProjectExplorer::ApplicationLauncher m_applicationLauncher; ProjectExplorer::ApplicationLauncher m_applicationLauncher;
QTimer m_noDebugOutputTimer; QTimer m_noDebugOutputTimer;
QmlOutputParser m_outputParser; QmlDebug::QmlOutputParser m_outputParser;
QHash<QString, QTextDocument*> m_sourceDocuments; QHash<QString, QTextDocument*> m_sourceDocuments;
QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors; QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors;
InteractiveInterpreter m_interpreter; InteractiveInterpreter m_interpreter;

View File

@@ -99,44 +99,44 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
, m_selectAction(new QAction(this)) , m_selectAction(new QAction(this))
, m_zoomAction(new QAction(this)) , m_zoomAction(new QAction(this))
{ {
connect(m_agent, SIGNAL(objectFetched(QmlDebugObjectReference)), connect(m_agent, SIGNAL(objectFetched(QmlDebug::ObjectReference)),
SLOT(onObjectFetched(QmlDebugObjectReference))); SLOT(onObjectFetched(QmlDebug::ObjectReference)));
connect(m_agent, SIGNAL(objectTreeUpdated()), connect(m_agent, SIGNAL(objectTreeUpdated()),
SLOT(onObjectTreeUpdated())); SLOT(onObjectTreeUpdated()));
QmlDebugConnection *connection = m_debugAdapter->connection(); QmlDebugConnection *connection = m_debugAdapter->connection();
DeclarativeEngineDebugClient *engineClient1 DeclarativeEngineDebugClient *engineClient1
= new DeclarativeEngineDebugClient(connection); = new DeclarativeEngineDebugClient(connection);
connect(engineClient1, SIGNAL(newStatus(QmlDebugClient::Status)), connect(engineClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
this, SLOT(clientStatusChanged(QmlDebugClient::Status))); this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
connect(engineClient1, SIGNAL(newStatus(QmlDebugClient::Status)), connect(engineClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
this, SLOT(engineClientStatusChanged(QmlDebugClient::Status))); this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
QmlEngineDebugClient *engineClient2 = new QmlEngineDebugClient(connection); QmlEngineDebugClient *engineClient2 = new QmlEngineDebugClient(connection);
connect(engineClient2, SIGNAL(newStatus(QmlDebugClient::Status)), connect(engineClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
this, SLOT(clientStatusChanged(QmlDebugClient::Status))); this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
connect(engineClient2, SIGNAL(newStatus(QmlDebugClient::Status)), connect(engineClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
this, SLOT(engineClientStatusChanged(QmlDebugClient::Status))); this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
m_engineClients.insert(engineClient1->name(), engineClient1); m_engineClients.insert(engineClient1->name(), engineClient1);
m_engineClients.insert(engineClient2->name(), engineClient2); m_engineClients.insert(engineClient2->name(), engineClient2);
if (engineClient1->status() == QmlDebugClient::Enabled) if (engineClient1->status() == QmlDebug::Enabled)
setActiveEngineClient(engineClient1); setActiveEngineClient(engineClient1);
if (engineClient2->status() == QmlDebugClient::Enabled) if (engineClient2->status() == QmlDebug::Enabled)
setActiveEngineClient(engineClient2); setActiveEngineClient(engineClient2);
DeclarativeToolsClient *toolsClient1 = new DeclarativeToolsClient(connection); DeclarativeToolsClient *toolsClient1 = new DeclarativeToolsClient(connection);
connect(toolsClient1, SIGNAL(connectedStatusChanged(QmlDebugClient::Status)), connect(toolsClient1, SIGNAL(connectedStatusChanged(QmlDebug::ClientStatus)),
this, SLOT(clientStatusChanged(QmlDebugClient::Status))); this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
connect(toolsClient1, SIGNAL(connectedStatusChanged(QmlDebugClient::Status)), connect(toolsClient1, SIGNAL(connectedStatusChanged(QmlDebug::ClientStatus)),
this, SLOT(toolsClientStatusChanged(QmlDebugClient::Status))); this, SLOT(toolsClientStatusChanged(QmlDebug::ClientStatus)));
QmlToolsClient *toolsClient2 = new QmlToolsClient(connection); QmlToolsClient *toolsClient2 = new QmlToolsClient(connection);
connect(toolsClient2, SIGNAL(connectedStatusChanged(QmlDebugClient::Status)), connect(toolsClient2, SIGNAL(connectedStatusChanged(QmlDebug::ClientStatus)),
this, SLOT(clientStatusChanged(QmlDebugClient::Status))); this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
connect(toolsClient2, SIGNAL(connectedStatusChanged(QmlDebugClient::Status)), connect(toolsClient2, SIGNAL(connectedStatusChanged(QmlDebug::ClientStatus)),
this, SLOT(toolsClientStatusChanged(QmlDebugClient::Status))); this, SLOT(toolsClientStatusChanged(QmlDebug::ClientStatus)));
// toolbar // toolbar
m_selectAction->setObjectName("QML Select Action"); m_selectAction->setObjectName("QML Select Action");
@@ -179,7 +179,7 @@ QString QmlInspectorAdapter::currentSelectedDisplayName() const
return m_currentSelectedDebugName; return m_currentSelectedDebugName;
} }
void QmlInspectorAdapter::clientStatusChanged(QmlDebugClient::Status status) void QmlInspectorAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
{ {
QString serviceName; QString serviceName;
float version = 0; float version = 0;
@@ -191,12 +191,12 @@ void QmlInspectorAdapter::clientStatusChanged(QmlDebugClient::Status status)
m_debugAdapter->logServiceStatusChange(serviceName, version, status); m_debugAdapter->logServiceStatusChange(serviceName, version, status);
} }
void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebugClient::Status status) void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status)
{ {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager *am = Core::ICore::actionManager();
BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender()); BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender());
if (status == QmlDebugClient::Enabled) { if (status == QmlDebug::Enabled) {
m_toolsClient = client; m_toolsClient = client;
connect(client, SIGNAL(currentObjectsChanged(QList<int>)), connect(client, SIGNAL(currentObjectsChanged(QList<int>)),
@@ -258,9 +258,9 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebugClient::Status status
} }
} }
void QmlInspectorAdapter::engineClientStatusChanged(QmlDebugClient::Status status) void QmlInspectorAdapter::engineClientStatusChanged(QmlDebug::ClientStatus status)
{ {
if (status != QmlDebugClient::Enabled) if (status != QmlDebug::Enabled)
return; return;
BaseEngineDebugClient *client BaseEngineDebugClient *client
@@ -279,7 +279,7 @@ void QmlInspectorAdapter::selectObjectsFromEditor(const QList<int> &debugIds)
} }
m_cursorPositionChangedExternally = true; m_cursorPositionChangedExternally = true;
QmlDebugObjectReference clientRef ObjectReference clientRef
= agent()->objectForId(debugId); = agent()->objectForId(debugId);
// if children haven't been loaded yet do so first, the editor // if children haven't been loaded yet do so first, the editor
@@ -301,7 +301,7 @@ void QmlInspectorAdapter::selectObjectsFromToolsClient(const QList<int> &debugId
int debugId = debugIds.first(); int debugId = debugIds.first();
QmlDebugObjectReference clientRef ObjectReference clientRef
= agent()->objectForId(debugId); = agent()->objectForId(debugId);
if (clientRef.debugId() != debugId) { if (clientRef.debugId() != debugId) {
@@ -313,7 +313,7 @@ void QmlInspectorAdapter::selectObjectsFromToolsClient(const QList<int> &debugId
} }
} }
void QmlInspectorAdapter::onObjectFetched(const QmlDebugObjectReference &ref) void QmlInspectorAdapter::onObjectFetched(const ObjectReference &ref)
{ {
if (ref.debugId() == m_debugIdToSelect) { if (ref.debugId() == m_debugIdToSelect) {
m_debugIdToSelect = -1; m_debugIdToSelect = -1;
@@ -431,7 +431,7 @@ void QmlInspectorAdapter::onZoomActionTriggered(bool checked)
void QmlInspectorAdapter::onShowAppOnTopChanged(const QVariant &value) void QmlInspectorAdapter::onShowAppOnTopChanged(const QVariant &value)
{ {
bool showAppOnTop = value.toBool(); bool showAppOnTop = value.toBool();
if (m_toolsClient->status() == QmlDebugClient::Enabled) if (m_toolsClient->status() == QmlDebug::Enabled)
m_toolsClient->showAppOnTop(showAppOnTop); m_toolsClient->showAppOnTop(showAppOnTop);
} }
@@ -455,7 +455,7 @@ void QmlInspectorAdapter::setActiveEngineClient(BaseEngineDebugClient *client)
if (m_engineClient && if (m_engineClient &&
m_engineClient->status() == QmlDebugClient::Enabled) { m_engineClient->status() == QmlDebug::Enabled) {
QmlJS::ModelManagerInterface *modelManager QmlJS::ModelManagerInterface *modelManager
= QmlJS::ModelManagerInterface::instance(); = QmlJS::ModelManagerInterface::instance();
QmlJS::Snapshot snapshot = modelManager->snapshot(); QmlJS::Snapshot snapshot = modelManager->snapshot();
@@ -499,14 +499,14 @@ void QmlInspectorAdapter::showConnectionStatusMessage(const QString &message)
} }
void QmlInspectorAdapter::gotoObjectReferenceDefinition( void QmlInspectorAdapter::gotoObjectReferenceDefinition(
const QmlDebugObjectReference &obj) const ObjectReference &obj)
{ {
if (m_cursorPositionChangedExternally) { if (m_cursorPositionChangedExternally) {
m_cursorPositionChangedExternally = false; m_cursorPositionChangedExternally = false;
return; return;
} }
QmlDebugFileReference source = obj.source(); FileReference source = obj.source();
const QString fileName = m_engine->toFileInProject(source.url()); const QString fileName = m_engine->toFileInProject(source.url());
@@ -520,7 +520,7 @@ void QmlInspectorAdapter::gotoObjectReferenceDefinition(
m_selectionCallbackExpected = true; m_selectionCallbackExpected = true;
if (textEditor) { if (textEditor) {
QmlDebugObjectReference ref = objectReferenceForLocation(fileName); ObjectReference ref = objectReferenceForLocation(fileName);
if (ref.debugId() != obj.debugId()) { if (ref.debugId() != obj.debugId()) {
m_selectionCallbackExpected = true; m_selectionCallbackExpected = true;
editorManager->addCurrentPositionToNavigationHistory(); editorManager->addCurrentPositionToNavigationHistory();
@@ -530,7 +530,7 @@ void QmlInspectorAdapter::gotoObjectReferenceDefinition(
} }
} }
QmlDebugObjectReference QmlInspectorAdapter::objectReferenceForLocation( ObjectReference QmlInspectorAdapter::objectReferenceForLocation(
const QString &fileName, int cursorPosition) const const QString &fileName, int cursorPosition) const
{ {
Core::EditorManager *editorManager = Core::EditorManager::instance(); Core::EditorManager *editorManager = Core::EditorManager::instance();
@@ -559,14 +559,14 @@ QmlDebugObjectReference QmlInspectorAdapter::objectReferenceForLocation(
} }
} }
} }
return QmlDebugObjectReference(); return ObjectReference();
} }
inline QString displayName(const QmlDebugObjectReference &obj) inline QString displayName(const ObjectReference &obj)
{ {
// special! state names // special! state names
if (obj.className() == "State") { if (obj.className() == "State") {
foreach (const QmlDebugPropertyReference &prop, obj.properties()) { foreach (const PropertyReference &prop, obj.properties()) {
if (prop.name() == "name") if (prop.name() == "name")
return prop.value().toString(); return prop.value().toString();
} }
@@ -590,12 +590,12 @@ inline QString displayName(const QmlDebugObjectReference &obj)
return QString("<%1>").arg(objTypeName); return QString("<%1>").arg(objTypeName);
} }
void QmlInspectorAdapter::selectObject(const QmlDebugObjectReference &obj, void QmlInspectorAdapter::selectObject(const ObjectReference &obj,
SelectionTarget target) SelectionTarget target)
{ {
if (target == ToolTarget) if (target == ToolTarget)
m_toolsClient->setObjectIdList( m_toolsClient->setObjectIdList(
QList<QmlDebugObjectReference>() << obj); QList<ObjectReference>() << obj);
if (target == EditorTarget) if (target == EditorTarget)
gotoObjectReferenceDefinition(obj); gotoObjectReferenceDefinition(obj);

View File

@@ -47,11 +47,9 @@ class IEditor;
namespace QmlDebug { namespace QmlDebug {
class BaseEngineDebugClient; class BaseEngineDebugClient;
class BaseToolsClient; class BaseToolsClient;
class QmlDebugObjectReference; class ObjectReference;
} }
using namespace QmlDebug;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -70,8 +68,8 @@ public:
QObject *parent = 0); QObject *parent = 0);
~QmlInspectorAdapter(); ~QmlInspectorAdapter();
BaseEngineDebugClient *engineClient() const; QmlDebug::BaseEngineDebugClient *engineClient() const;
BaseToolsClient *toolsClient() const; QmlDebug::BaseToolsClient *toolsClient() const;
QmlInspectorAgent *agent() const; QmlInspectorAgent *agent() const;
int currentSelectedDebugId() const; int currentSelectedDebugId() const;
@@ -82,13 +80,13 @@ signals:
void selectionChanged(); void selectionChanged();
private slots: private slots:
void clientStatusChanged(QmlDebugClient::Status status); void clientStatusChanged(QmlDebug::ClientStatus status);
void toolsClientStatusChanged(QmlDebugClient::Status status); void toolsClientStatusChanged(QmlDebug::ClientStatus status);
void engineClientStatusChanged(QmlDebugClient::Status status); void engineClientStatusChanged(QmlDebug::ClientStatus status);
void selectObjectsFromEditor(const QList<int> &debugIds); void selectObjectsFromEditor(const QList<int> &debugIds);
void selectObjectsFromToolsClient(const QList<int> &debugIds); void selectObjectsFromToolsClient(const QList<int> &debugIds);
void onObjectFetched(const QmlDebugObjectReference &ref); void onObjectFetched(const QmlDebug::ObjectReference &ref);
void onObjectTreeUpdated(); void onObjectTreeUpdated();
void createPreviewForEditor(Core::IEditor *newEditor); void createPreviewForEditor(Core::IEditor *newEditor);
@@ -101,26 +99,26 @@ private slots:
void onUpdateOnSaveChanged(const QVariant &value); void onUpdateOnSaveChanged(const QVariant &value);
private: private:
void setActiveEngineClient(BaseEngineDebugClient *client); void setActiveEngineClient(QmlDebug::BaseEngineDebugClient *client);
void initializePreviews(); void initializePreviews();
void showConnectionStatusMessage(const QString &message); void showConnectionStatusMessage(const QString &message);
void gotoObjectReferenceDefinition(const QmlDebugObjectReference &obj); void gotoObjectReferenceDefinition(const QmlDebug::ObjectReference &obj);
QmlDebugObjectReference objectReferenceForLocation( QmlDebug::ObjectReference objectReferenceForLocation(
const QString &fileName, int cursorPosition = -1) const; const QString &fileName, int cursorPosition = -1) const;
enum SelectionTarget { NoTarget, ToolTarget, EditorTarget }; enum SelectionTarget { NoTarget, ToolTarget, EditorTarget };
void selectObject( void selectObject(
const QmlDebugObjectReference &objectReference, const QmlDebug::ObjectReference &objectReference,
SelectionTarget target); SelectionTarget target);
QmlAdapter *m_debugAdapter; QmlAdapter *m_debugAdapter;
QmlEngine *m_engine; QmlEngine *m_engine;
BaseEngineDebugClient *m_engineClient; QmlDebug::BaseEngineDebugClient *m_engineClient;
QHash<QString, BaseEngineDebugClient*> m_engineClients; QHash<QString, QmlDebug::BaseEngineDebugClient*> m_engineClients;
BaseToolsClient *m_toolsClient; QmlDebug::BaseToolsClient *m_toolsClient;
QmlInspectorAgent *m_agent; QmlInspectorAgent *m_agent;
SelectionTarget m_targetToSync; SelectionTarget m_targetToSync;

View File

@@ -42,6 +42,8 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
using namespace QmlDebug;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -81,7 +83,7 @@ void QmlInspectorAgent::fetchObject(int debugId)
qDebug() << __FUNCTION__ << "(" << debugId << ")"; qDebug() << __FUNCTION__ << "(" << debugId << ")";
m_fetchCurrentObjectsQueryIds m_fetchCurrentObjectsQueryIds
<< fetchContextObject(QmlDebugObjectReference(debugId)); << fetchContextObject(ObjectReference(debugId));
} }
quint32 QmlInspectorAgent::queryExpressionResult(int debugId, quint32 QmlInspectorAgent::queryExpressionResult(int debugId,
@@ -102,7 +104,7 @@ void QmlInspectorAgent::updateWatchData(const WatchData &data)
if (data.id) { if (data.id) {
// objects // objects
QmlDebugObjectReference ref(data.id); ObjectReference ref(data.id);
m_fetchCurrentObjectsQueryIds << fetchContextObject(ref); m_fetchCurrentObjectsQueryIds << fetchContextObject(ref);
WatchData d = data; WatchData d = data;
d.setAllUnneeded(); d.setAllUnneeded();
@@ -134,7 +136,7 @@ void QmlInspectorAgent::selectObjectInTree(int debugId)
// we've to fetch it // we've to fetch it
m_objectToSelect = debugId; m_objectToSelect = debugId;
m_fetchCurrentObjectsQueryIds m_fetchCurrentObjectsQueryIds
<< fetchContextObject(QmlDebugObjectReference(debugId)); << fetchContextObject(ObjectReference(debugId));
} }
} }
@@ -227,48 +229,48 @@ quint32 QmlInspectorAgent::resetBindingForObject(int objectDebugId,
} }
QList<QmlDebugObjectReference> QmlInspectorAgent::objects() const QList<ObjectReference> QmlInspectorAgent::objects() const
{ {
QList<QmlDebugObjectReference> result; QList<ObjectReference> result;
foreach (const QmlDebugObjectReference &it, m_rootObjects) foreach (const ObjectReference &it, m_rootObjects)
result.append(objects(it)); result.append(objects(it));
return result; return result;
} }
QmlDebugObjectReference QmlInspectorAgent::objectForId(int debugId) const ObjectReference QmlInspectorAgent::objectForId(int debugId) const
{ {
foreach (const QmlDebugObjectReference &it, m_rootObjects) { foreach (const ObjectReference &it, m_rootObjects) {
QmlDebugObjectReference result = objectForId(debugId, it); ObjectReference result = objectForId(debugId, it);
if (result.debugId() == debugId) if (result.debugId() == debugId)
return result; return result;
} }
return QmlDebugObjectReference(); return ObjectReference();
} }
QmlDebugObjectReference QmlInspectorAgent::objectForId( ObjectReference QmlInspectorAgent::objectForId(
const QString &objectId) const const QString &objectId) const
{ {
if (!objectId.isEmpty() && objectId[0].isLower()) { if (!objectId.isEmpty() && objectId[0].isLower()) {
const QList<QmlDebugObjectReference> refs = objects(); const QList<ObjectReference> refs = objects();
foreach (const QmlDebugObjectReference &ref, refs) { foreach (const ObjectReference &ref, refs) {
if (ref.idString() == objectId) if (ref.idString() == objectId)
return ref; return ref;
} }
} }
return QmlDebugObjectReference(); return ObjectReference();
} }
QmlDebugObjectReference QmlInspectorAgent::objectForLocation( ObjectReference QmlInspectorAgent::objectForLocation(
int line, int column) const int line, int column) const
{ {
const QList<QmlDebugObjectReference> refs = objects(); const QList<ObjectReference> refs = objects();
foreach (const QmlDebugObjectReference &ref, refs) { foreach (const ObjectReference &ref, refs) {
if (ref.source().lineNumber() == line if (ref.source().lineNumber() == line
&& ref.source().columnNumber() == column) && ref.source().columnNumber() == column)
return ref; return ref;
} }
return QmlDebugObjectReference(); return ObjectReference();
} }
bool QmlInspectorAgent::addObjectWatch(int objectDebugId) bool QmlInspectorAgent::addObjectWatch(int objectDebugId)
@@ -287,7 +289,7 @@ bool QmlInspectorAgent::addObjectWatch(int objectDebugId)
if (m_objectWatches.contains(objectDebugId)) if (m_objectWatches.contains(objectDebugId))
return true; return true;
QmlDebugObjectReference ref = objectForId(objectDebugId); ObjectReference ref = objectForId(objectDebugId);
if (ref.debugId() != objectDebugId) if (ref.debugId() != objectDebugId)
return false; return false;
@@ -338,7 +340,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
return; return;
if (m_engineClient) { if (m_engineClient) {
disconnect(m_engineClient, SIGNAL(newStatus(QmlDebugClient::Status)), disconnect(m_engineClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
this, SLOT(updateStatus())); this, SLOT(updateStatus()));
disconnect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)), disconnect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)),
this, SLOT(onResult(quint32,QVariant,QByteArray))); this, SLOT(onResult(quint32,QVariant,QByteArray)));
@@ -349,7 +351,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
m_engineClient = client; m_engineClient = client;
if (m_engineClient) { if (m_engineClient) {
connect(m_engineClient, SIGNAL(newStatus(QmlDebugClient::Status)), connect(m_engineClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
this, SLOT(updateStatus())); this, SLOT(updateStatus()));
connect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)), connect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)),
this, SLOT(onResult(quint32,QVariant,QByteArray))); this, SLOT(onResult(quint32,QVariant,QByteArray)));
@@ -363,7 +365,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
void QmlInspectorAgent::updateStatus() void QmlInspectorAgent::updateStatus()
{ {
if (m_engineClient if (m_engineClient
&& (m_engineClient->status() == QmlDebugClient::Enabled) && (m_engineClient->status() == QmlDebug::Enabled)
&& debuggerCore()->boolSetting(ShowQmlObjectTree)) { && debuggerCore()->boolSetting(ShowQmlObjectTree)) {
reloadEngines(); reloadEngines();
} else { } else {
@@ -381,24 +383,24 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
if (type == _("FETCH_OBJECT_R")) { if (type == _("FETCH_OBJECT_R")) {
log(LogReceive, _("FETCH_OBJECT_R %1").arg( log(LogReceive, _("FETCH_OBJECT_R %1").arg(
qvariant_cast<QmlDebugObjectReference>(value).idString())); qvariant_cast<ObjectReference>(value).idString()));
} else { } else {
log(LogReceive, QLatin1String(type)); log(LogReceive, QLatin1String(type));
} }
if (m_objectTreeQueryIds.contains(queryId)) { if (m_objectTreeQueryIds.contains(queryId)) {
m_objectTreeQueryIds.removeOne(queryId); m_objectTreeQueryIds.removeOne(queryId);
objectTreeFetched(qvariant_cast<QmlDebugObjectReference>(value)); objectTreeFetched(qvariant_cast<ObjectReference>(value));
} else if (queryId == m_engineQueryId) { } else if (queryId == m_engineQueryId) {
m_engineQueryId = 0; m_engineQueryId = 0;
updateEngineList(qvariant_cast<QmlDebugEngineReferenceList>(value)); updateEngineList(qvariant_cast<QList<EngineReference> >(value));
} else if (queryId == m_rootContextQueryId) { } else if (queryId == m_rootContextQueryId) {
m_rootContextQueryId = 0; m_rootContextQueryId = 0;
rootContextChanged(qvariant_cast<QmlDebugContextReference>(value)); rootContextChanged(qvariant_cast<ContextReference>(value));
} else if (m_fetchCurrentObjectsQueryIds.contains(queryId)) { } else if (m_fetchCurrentObjectsQueryIds.contains(queryId)) {
m_fetchCurrentObjectsQueryIds.removeOne(queryId); m_fetchCurrentObjectsQueryIds.removeOne(queryId);
QmlDebugObjectReference obj ObjectReference obj
= qvariant_cast<QmlDebugObjectReference>(value); = qvariant_cast<ObjectReference>(value);
m_fetchCurrentObjects.push_front(obj); m_fetchCurrentObjects.push_front(obj);
onCurrentObjectsFetched(obj); onCurrentObjectsFetched(obj);
} else { } else {
@@ -447,10 +449,10 @@ void QmlInspectorAgent::queryEngineContext(int id)
log(LogSend, QString("LIST_OBJECTS %1").arg(QString::number(id))); log(LogSend, QString("LIST_OBJECTS %1").arg(QString::number(id)));
m_rootContextQueryId m_rootContextQueryId
= m_engineClient->queryRootContexts(QmlDebugEngineReference(id)); = m_engineClient->queryRootContexts(EngineReference(id));
} }
quint32 QmlInspectorAgent::fetchContextObject(const QmlDebugObjectReference &obj) quint32 QmlInspectorAgent::fetchContextObject(const ObjectReference &obj)
{ {
if (debug) if (debug)
qDebug() << __FUNCTION__ << "(" << obj << ")"; qDebug() << __FUNCTION__ << "(" << obj << ")";
@@ -468,7 +470,7 @@ quint32 QmlInspectorAgent::fetchContextObject(const QmlDebugObjectReference &obj
} }
// fetch the root objects from the context + any child contexts // fetch the root objects from the context + any child contexts
void QmlInspectorAgent::fetchRootObjects(const QmlDebugContextReference &context, void QmlInspectorAgent::fetchRootObjects(const ContextReference &context,
bool clear) bool clear)
{ {
if (debug) if (debug)
@@ -482,7 +484,7 @@ void QmlInspectorAgent::fetchRootObjects(const QmlDebugContextReference &context
m_rootObjects.clear(); m_rootObjects.clear();
m_objectTreeQueryIds.clear(); m_objectTreeQueryIds.clear();
} }
foreach (const QmlDebugObjectReference & obj, context.objects()) { foreach (const ObjectReference & obj, context.objects()) {
quint32 queryId = 0; quint32 queryId = 0;
using namespace QmlDebug::Constants; using namespace QmlDebug::Constants;
if (m_engineClient->objectName() == QML_DEBUGGER && if (m_engineClient->objectName() == QML_DEBUGGER &&
@@ -497,11 +499,11 @@ void QmlInspectorAgent::fetchRootObjects(const QmlDebugContextReference &context
if (queryId) if (queryId)
m_objectTreeQueryIds << queryId; m_objectTreeQueryIds << queryId;
} }
foreach (const QmlDebugContextReference &child, context.contexts()) foreach (const ContextReference &child, context.contexts())
fetchRootObjects(child, false); fetchRootObjects(child, false);
} }
void QmlInspectorAgent::updateEngineList(const QmlDebugEngineReferenceList &engines) void QmlInspectorAgent::updateEngineList(const QList<EngineReference> &engines)
{ {
if (debug) if (debug)
qDebug() << __FUNCTION__ << "(" << engines << ")"; qDebug() << __FUNCTION__ << "(" << engines << ")";
@@ -512,7 +514,7 @@ void QmlInspectorAgent::updateEngineList(const QmlDebugEngineReferenceList &engi
queryEngineContext(engines.first().debugId()); queryEngineContext(engines.first().debugId());
} }
void QmlInspectorAgent::rootContextChanged(const QmlDebugContextReference &context) void QmlInspectorAgent::rootContextChanged(const ContextReference &context)
{ {
if (debug) if (debug)
qDebug() << __FUNCTION__ << "(" << context << ")"; qDebug() << __FUNCTION__ << "(" << context << ")";
@@ -520,7 +522,7 @@ void QmlInspectorAgent::rootContextChanged(const QmlDebugContextReference &conte
fetchRootObjects(context, true); fetchRootObjects(context, true);
} }
void QmlInspectorAgent::objectTreeFetched(const QmlDebugObjectReference &object) void QmlInspectorAgent::objectTreeFetched(const ObjectReference &object)
{ {
if (debug) if (debug)
qDebug() << __FUNCTION__ << "(" << object << ")"; qDebug() << __FUNCTION__ << "(" << object << ")";
@@ -532,14 +534,14 @@ void QmlInspectorAgent::objectTreeFetched(const QmlDebugObjectReference &object)
m_debugIdHash.clear(); m_debugIdHash.clear();
m_debugIdHash.reserve(old_count + 1); m_debugIdHash.reserve(old_count + 1);
m_debugIdToIname.clear(); m_debugIdToIname.clear();
foreach (const QmlDebugObjectReference &it, m_rootObjects) foreach (const ObjectReference &it, m_rootObjects)
buildDebugIdHashRecursive(it); buildDebugIdHashRecursive(it);
emit objectTreeUpdated(); emit objectTreeUpdated();
// sync tree with watchhandler // sync tree with watchhandler
QList<WatchData> watchData; QList<WatchData> watchData;
foreach (const QmlDebugObjectReference &obj, m_rootObjects) foreach (const ObjectReference &obj, m_rootObjects)
watchData.append(buildWatchData(obj, WatchData())); watchData.append(buildWatchData(obj, WatchData()));
WatchHandler *watchHandler = m_engine->watchHandler(); WatchHandler *watchHandler = m_engine->watchHandler();
@@ -549,7 +551,7 @@ void QmlInspectorAgent::objectTreeFetched(const QmlDebugObjectReference &object)
} }
} }
void QmlInspectorAgent::onCurrentObjectsFetched(const QmlDebugObjectReference &obj) void QmlInspectorAgent::onCurrentObjectsFetched(const ObjectReference &obj)
{ {
if (debug) if (debug)
qDebug() << __FUNCTION__ << "( " << obj << ")"; qDebug() << __FUNCTION__ << "( " << obj << ")";
@@ -561,10 +563,10 @@ void QmlInspectorAgent::onCurrentObjectsFetched(const QmlDebugObjectReference &o
if (debug) if (debug)
qDebug() << " adding" << m_fetchCurrentObjects << "to tree"; qDebug() << " adding" << m_fetchCurrentObjects << "to tree";
foreach (const QmlDebugObjectReference &o, m_fetchCurrentObjects) foreach (const ObjectReference &o, m_fetchCurrentObjects)
addObjectToTree(o, false); addObjectToTree(o, false);
QmlDebugObjectReference last = m_fetchCurrentObjects.last(); ObjectReference last = m_fetchCurrentObjects.last();
m_fetchCurrentObjects.clear(); m_fetchCurrentObjects.clear();
if (m_objectToSelect == last.debugId()) { if (m_objectToSelect == last.debugId()) {
@@ -583,12 +585,12 @@ void QmlInspectorAgent::onCurrentObjectsFetched(const QmlDebugObjectReference &o
} }
// Fetches all anchestors of object. Returns if all has been fetched already. // Fetches all anchestors of object. Returns if all has been fetched already.
bool QmlInspectorAgent::getObjectHierarchy(const QmlDebugObjectReference &obj) bool QmlInspectorAgent::getObjectHierarchy(const ObjectReference &obj)
{ {
if (debug) if (debug)
qDebug() << __FUNCTION__ << "(" << obj << ")"; qDebug() << __FUNCTION__ << "(" << obj << ")";
QmlDebugObjectReference parent = objectForId(obj.parentId()); ObjectReference parent = objectForId(obj.parentId());
//for root object //for root object
if (obj.parentId() == -1) if (obj.parentId() == -1)
return true; return true;
@@ -596,14 +598,14 @@ bool QmlInspectorAgent::getObjectHierarchy(const QmlDebugObjectReference &obj)
//for other objects //for other objects
if (parent.debugId() == -1 || parent.needsMoreData()) { if (parent.debugId() == -1 || parent.needsMoreData()) {
m_fetchCurrentObjectsQueryIds m_fetchCurrentObjectsQueryIds
<< fetchContextObject(QmlDebugObjectReference(obj.parentId())); << fetchContextObject(ObjectReference(obj.parentId()));
} else { } else {
return getObjectHierarchy(parent); return getObjectHierarchy(parent);
} }
return false; return false;
} }
void QmlInspectorAgent::buildDebugIdHashRecursive(const QmlDebugObjectReference &ref) void QmlInspectorAgent::buildDebugIdHashRecursive(const ObjectReference &ref)
{ {
if (debug) if (debug)
qDebug() << __FUNCTION__ << "(" << ref << ")"; qDebug() << __FUNCTION__ << "(" << ref << ")";
@@ -631,7 +633,7 @@ void QmlInspectorAgent::buildDebugIdHashRecursive(const QmlDebugObjectReference
if (!m_debugIdHash[file][location].contains(ref.debugId())) if (!m_debugIdHash[file][location].contains(ref.debugId()))
m_debugIdHash[file][location].append(ref.debugId()); m_debugIdHash[file][location].append(ref.debugId());
foreach (const QmlDebugObjectReference &it, ref.children()) foreach (const ObjectReference &it, ref.children())
buildDebugIdHashRecursive(it); buildDebugIdHashRecursive(it);
} }
@@ -647,7 +649,7 @@ static QByteArray buildIName(const WatchData &parent, const QString &name)
return parent.iname + "." + name.toLatin1(); return parent.iname + "." + name.toLatin1();
} }
QList<WatchData> QmlInspectorAgent::buildWatchData(const QmlDebugObjectReference &obj, QList<WatchData> QmlInspectorAgent::buildWatchData(const ObjectReference &obj,
const WatchData &parent) const WatchData &parent)
{ {
if (debug) if (debug)
@@ -686,7 +688,7 @@ QList<WatchData> QmlInspectorAgent::buildWatchData(const QmlDebugObjectReference
list.append(propertiesWatch); list.append(propertiesWatch);
foreach (const QmlDebugPropertyReference &property, obj.properties()) { foreach (const PropertyReference &property, obj.properties()) {
WatchData propertyWatch; WatchData propertyWatch;
propertyWatch.exp = property.name().toLatin1(); propertyWatch.exp = property.name().toLatin1();
propertyWatch.name = property.name(); propertyWatch.name = property.name();
@@ -699,12 +701,12 @@ QList<WatchData> QmlInspectorAgent::buildWatchData(const QmlDebugObjectReference
} }
// recurse // recurse
foreach (const QmlDebugObjectReference &child, obj.children()) foreach (const ObjectReference &child, obj.children())
list.append(buildWatchData(child, objWatch)); list.append(buildWatchData(child, objWatch));
return list; return list;
} }
void QmlInspectorAgent::addObjectToTree(const QmlDebugObjectReference &obj, void QmlInspectorAgent::addObjectToTree(const ObjectReference &obj,
bool notify) bool notify)
{ {
int count = m_rootObjects.count(); int count = m_rootObjects.count();
@@ -735,28 +737,28 @@ void QmlInspectorAgent::addObjectToTree(const QmlDebugObjectReference &obj,
} }
} }
QmlDebugObjectReference QmlInspectorAgent::objectForId(int debugId, ObjectReference QmlInspectorAgent::objectForId(int debugId,
const QmlDebugObjectReference &objectRef) const const ObjectReference &objectRef) const
{ {
if (objectRef.debugId() == debugId) if (objectRef.debugId() == debugId)
return objectRef; return objectRef;
foreach (const QmlDebugObjectReference &child, objectRef.children()) { foreach (const ObjectReference &child, objectRef.children()) {
QmlDebugObjectReference result = objectForId(debugId, child); ObjectReference result = objectForId(debugId, child);
if (result.debugId() == debugId) if (result.debugId() == debugId)
return result; return result;
} }
return QmlDebugObjectReference(); return ObjectReference();
} }
QList<QmlDebugObjectReference> QmlInspectorAgent::objects( QList<ObjectReference> QmlInspectorAgent::objects(
const QmlDebugObjectReference &objectRef) const const ObjectReference &objectRef) const
{ {
QList<QmlDebugObjectReference> result; QList<ObjectReference> result;
result.append(objectRef); result.append(objectRef);
foreach (const QmlDebugObjectReference &child, objectRef.children()) foreach (const ObjectReference &child, objectRef.children())
result.append(objects(child)); result.append(objects(child));
return result; return result;
@@ -779,7 +781,7 @@ void QmlInspectorAgent::log(QmlInspectorAgent::LogDirection direction,
bool QmlInspectorAgent::isConnected() bool QmlInspectorAgent::isConnected()
{ {
return m_engineClient return m_engineClient
&& (m_engineClient->status() == QmlDebugClient::Enabled); && (m_engineClient->status() == QmlDebug::Enabled);
} }
} // Internal } // Internal

View File

@@ -38,8 +38,6 @@
#include <qmldebug/baseenginedebugclient.h> #include <qmldebug/baseenginedebugclient.h>
#include <watchdata.h> #include <watchdata.h>
using namespace QmlDebug;
namespace Debugger { namespace Debugger {
class DebuggerEngine; class DebuggerEngine;
@@ -77,11 +75,11 @@ public:
quint32 resetBindingForObject(int objectDebugId, quint32 resetBindingForObject(int objectDebugId,
const QString &propertyName); const QString &propertyName);
QList<QmlDebugObjectReference> objects() const; QList<QmlDebug::ObjectReference> objects() const;
QmlDebugObjectReference objectForId(int debugId) const; QmlDebug::ObjectReference objectForId(int debugId) const;
QmlDebugObjectReference objectForId(const QString &objectId) const; QmlDebug::ObjectReference objectForId(const QString &objectId) const;
QmlDebugObjectReference objectForLocation(int line, int column) const; QmlDebug::ObjectReference objectForLocation(int line, int column) const;
QList<QmlDebugObjectReference> rootObjects() const { return m_rootObjects; } QList<QmlDebug::ObjectReference> rootObjects() const { return m_rootObjects; }
DebugIdHash debugIdHash() const { return m_debugIdHash; } DebugIdHash debugIdHash() const { return m_debugIdHash; }
bool addObjectWatch(int objectDebugId); bool addObjectWatch(int objectDebugId);
@@ -89,11 +87,11 @@ public:
bool removeObjectWatch(int objectDebugId); bool removeObjectWatch(int objectDebugId);
void removeAllObjectWatches(); void removeAllObjectWatches();
void setEngineClient(BaseEngineDebugClient *client); void setEngineClient(QmlDebug::BaseEngineDebugClient *client);
signals: signals:
void objectTreeUpdated(); void objectTreeUpdated();
void objectFetched(const QmlDebugObjectReference &ref); void objectFetched(const QmlDebug::ObjectReference &ref);
void expressionResult(quint32 queryId, const QVariant &value); void expressionResult(quint32 queryId, const QVariant &value);
void propertyChanged(int debugId, const QByteArray &propertyName, void propertyChanged(int debugId, const QByteArray &propertyName,
const QVariant &propertyValue); const QVariant &propertyValue);
@@ -106,26 +104,26 @@ private slots:
private: private:
void reloadEngines(); void reloadEngines();
void queryEngineContext(int id); void queryEngineContext(int id);
quint32 fetchContextObject(const QmlDebugObjectReference &obj); quint32 fetchContextObject(const QmlDebug::ObjectReference &obj);
void fetchRootObjects(const QmlDebugContextReference &context, bool clear); void fetchRootObjects(const QmlDebug::ContextReference &context, bool clear);
void updateEngineList(const QmlDebugEngineReferenceList &engines); void updateEngineList(const QList<QmlDebug::EngineReference> &engines);
void rootContextChanged(const QmlDebugContextReference &context); void rootContextChanged(const QmlDebug::ContextReference &context);
void objectTreeFetched(const QmlDebugObjectReference &result); void objectTreeFetched(const QmlDebug::ObjectReference &result);
void onCurrentObjectsFetched(const QmlDebugObjectReference &result); void onCurrentObjectsFetched(const QmlDebug::ObjectReference &result);
bool getObjectHierarchy(const QmlDebugObjectReference &object); bool getObjectHierarchy(const QmlDebug::ObjectReference &object);
void buildDebugIdHashRecursive(const QmlDebugObjectReference &ref); void buildDebugIdHashRecursive(const QmlDebug::ObjectReference &ref);
QList<WatchData> buildWatchData(const QmlDebugObjectReference &obj, QList<WatchData> buildWatchData(const QmlDebug::ObjectReference &obj,
const WatchData &parent); const WatchData &parent);
void addObjectToTree(const QmlDebugObjectReference &obj, bool notify); void addObjectToTree(const QmlDebug::ObjectReference &obj, bool notify);
QmlDebugObjectReference objectForId( QmlDebug::ObjectReference objectForId(
int debugId, int debugId,
const QmlDebugObjectReference &ref) const; const QmlDebug::ObjectReference &ref) const;
QList<QmlDebugObjectReference> objects( QList<QmlDebug::ObjectReference> objects(
const QmlDebugObjectReference &objectRef) const; const QmlDebug::ObjectReference &objectRef) const;
enum LogDirection { enum LogDirection {
@@ -144,10 +142,10 @@ private:
quint32 m_rootContextQueryId; quint32 m_rootContextQueryId;
int m_objectToSelect; int m_objectToSelect;
QList<quint32> m_objectTreeQueryIds; QList<quint32> m_objectTreeQueryIds;
QList<QmlDebugObjectReference> m_rootObjects; QList<QmlDebug::ObjectReference> m_rootObjects;
QList<quint32> m_fetchCurrentObjectsQueryIds; QList<quint32> m_fetchCurrentObjectsQueryIds;
QList<QmlDebugObjectReference> m_fetchCurrentObjects; QList<QmlDebug::ObjectReference> m_fetchCurrentObjects;
QmlDebugEngineReferenceList m_engines; QList<QmlDebug::EngineReference> m_engines;
QHash<int, QByteArray> m_debugIdToIname; QHash<int, QByteArray> m_debugIdToIname;
DebugIdHash m_debugIdHash; DebugIdHash m_debugIdHash;

View File

@@ -43,6 +43,7 @@
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace QmlDebug;
using namespace QmlJS; using namespace QmlJS;
using namespace QmlJS::AST; using namespace QmlJS::AST;
@@ -422,14 +423,14 @@ void QmlLiveTextPreview::setApplyChangesToQmlInspector(bool applyChanges)
m_applyChangesToQmlInspector = applyChanges; m_applyChangesToQmlInspector = applyChanges;
} }
static QList<int> findRootObjectRecursive(const QmlDebugObjectReference &object, static QList<int> findRootObjectRecursive(const ObjectReference &object,
const Document::Ptr &doc) const Document::Ptr &doc)
{ {
QList<int> result; QList<int> result;
if (object.className() == doc->componentName()) if (object.className() == doc->componentName())
result += object.debugId(); result += object.debugId();
foreach (const QmlDebugObjectReference &it, object.children()) { foreach (const ObjectReference &it, object.children()) {
result += findRootObjectRecursive(it, doc); result += findRootObjectRecursive(it, doc);
} }
return result; return result;
@@ -468,7 +469,7 @@ void QmlLiveTextPreview::updateDebugIds()
if (doc->qmlProgram()->members && doc->qmlProgram()->members->member) { if (doc->qmlProgram()->members && doc->qmlProgram()->members->member) {
UiObjectMember *root = doc->qmlProgram()->members->member; UiObjectMember *root = doc->qmlProgram()->members->member;
QList<int> r; QList<int> r;
foreach (const QmlDebugObjectReference& it, foreach (const ObjectReference& it,
m_inspectorAdapter->agent()->rootObjects()) { m_inspectorAdapter->agent()->rootObjects()) {
r += findRootObjectRecursive(it, doc); r += findRootObjectRecursive(it, doc);
} }
@@ -516,7 +517,7 @@ void QmlLiveTextPreview::changeSelectedElements(QList<int> offsets,
m_updateNodeForOffset = false; m_updateNodeForOffset = false;
m_lastOffsets = offsets; m_lastOffsets = offsets;
QmlDebugObjectReference objectRefUnderCursor; ObjectReference objectRefUnderCursor;
objectRefUnderCursor objectRefUnderCursor
= m_inspectorAdapter->agent()->objectForId(wordAtCursor); = m_inspectorAdapter->agent()->objectForId(wordAtCursor);

View File

@@ -343,7 +343,7 @@ void QmlProfilerClientManager::retryMessageBoxFinished(int result)
void QmlProfilerClientManager::qmlComplete() void QmlProfilerClientManager::qmlComplete()
{ {
d->qmlDataReady = true; d->qmlDataReady = true;
if (!d->v8clientplugin || d->v8clientplugin.data()->status() != QmlDebugClient::Enabled || d->v8DataReady) { if (!d->v8clientplugin || d->v8clientplugin.data()->status() != QmlDebug::Enabled || d->v8DataReady) {
emit dataReadyForProcessing(); emit dataReadyForProcessing();
// once complete is sent, reset the flags // once complete is sent, reset the flags
d->qmlDataReady = false; d->qmlDataReady = false;
@@ -354,7 +354,7 @@ void QmlProfilerClientManager::qmlComplete()
void QmlProfilerClientManager::v8Complete() void QmlProfilerClientManager::v8Complete()
{ {
d->v8DataReady = true; d->v8DataReady = true;
if (!d->qmlclientplugin || d->qmlclientplugin.data()->status() != QmlDebugClient::Enabled || d->qmlDataReady) { if (!d->qmlclientplugin || d->qmlclientplugin.data()->status() != QmlDebug::Enabled || d->qmlDataReady) {
emit dataReadyForProcessing(); emit dataReadyForProcessing();
// once complete is sent, reset the flags // once complete is sent, reset the flags
d->v8DataReady = false; d->v8DataReady = false;