forked from qt-creator/qt-creator
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:
@@ -72,7 +72,7 @@ QDataStream &operator>>(QDataStream &ds, QmlObjectProperty &data)
|
||||
}
|
||||
|
||||
void BaseEngineDebugClient::decode(QDataStream &ds,
|
||||
QmlDebugObjectReference &o,
|
||||
ObjectReference &o,
|
||||
bool simple)
|
||||
{
|
||||
QmlObjectData data;
|
||||
@@ -100,7 +100,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
|
||||
ds >> childCount >> recur;
|
||||
|
||||
for (int ii = 0; ii < childCount; ++ii) {
|
||||
o.m_children.append(QmlDebugObjectReference());
|
||||
o.m_children.append(ObjectReference());
|
||||
decode(ds, o.m_children.last(), !recur);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
|
||||
for (int ii = 0; ii < propCount; ++ii) {
|
||||
QmlObjectProperty data;
|
||||
ds >> data;
|
||||
QmlDebugPropertyReference prop;
|
||||
PropertyReference prop;
|
||||
prop.m_objectDebugId = o.m_debugId;
|
||||
prop.m_name = data.name;
|
||||
prop.m_binding = data.binding;
|
||||
@@ -126,7 +126,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
|
||||
}
|
||||
case QmlObjectProperty::Object:
|
||||
{
|
||||
QmlDebugObjectReference obj;
|
||||
ObjectReference obj;
|
||||
obj.m_debugId = prop.m_value.toInt();
|
||||
prop.m_value = qVariantFromValue(obj);
|
||||
break;
|
||||
@@ -139,7 +139,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
|
||||
}
|
||||
|
||||
void BaseEngineDebugClient::decode(QDataStream &ds,
|
||||
QmlDebugContextReference &c)
|
||||
ContextReference &c)
|
||||
{
|
||||
ds >> c.m_name >> c.m_debugId;
|
||||
|
||||
@@ -147,7 +147,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
|
||||
ds >> contextCount;
|
||||
|
||||
for (int ii = 0; ii < contextCount; ++ii) {
|
||||
c.m_contexts.append(QmlDebugContextReference());
|
||||
c.m_contexts.append(ContextReference());
|
||||
decode(ds, c.m_contexts.last());
|
||||
}
|
||||
|
||||
@@ -155,14 +155,14 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
|
||||
ds >> objectCount;
|
||||
|
||||
for (int ii = 0; ii < objectCount; ++ii) {
|
||||
QmlDebugObjectReference obj;
|
||||
ObjectReference obj;
|
||||
decode(ds, obj, true);
|
||||
obj.m_contextDebugId = c.m_debugId;
|
||||
c.m_objects << obj;
|
||||
}
|
||||
}
|
||||
|
||||
void BaseEngineDebugClient::statusChanged(Status status)
|
||||
void BaseEngineDebugClient::statusChanged(ClientStatus status)
|
||||
{
|
||||
emit newStatus(status);
|
||||
}
|
||||
@@ -184,21 +184,21 @@ void BaseEngineDebugClient::messageReceived(const QByteArray &data)
|
||||
if (type == "LIST_ENGINES_R") {
|
||||
int count;
|
||||
ds >> count;
|
||||
QmlDebugEngineReferenceList engines;
|
||||
QList<EngineReference> engines;
|
||||
for (int ii = 0; ii < count; ++ii) {
|
||||
QmlDebugEngineReference eng;
|
||||
EngineReference eng;
|
||||
ds >> eng.m_name;
|
||||
ds >> eng.m_debugId;
|
||||
engines << eng;
|
||||
}
|
||||
emit result(queryId, QVariant::fromValue(engines), type);
|
||||
} else if (type == "LIST_OBJECTS_R") {
|
||||
QmlDebugContextReference rootContext;
|
||||
ContextReference rootContext;
|
||||
if (!ds.atEnd())
|
||||
decode(ds, rootContext);
|
||||
emit result(queryId, QVariant::fromValue(rootContext), type);
|
||||
} else if (type == "FETCH_OBJECT_R") {
|
||||
QmlDebugObjectReference object;
|
||||
ObjectReference object;
|
||||
if (!ds.atEnd())
|
||||
decode(ds, object, false);
|
||||
emit result(queryId, QVariant::fromValue(object), type);
|
||||
@@ -229,10 +229,10 @@ BaseEngineDebugClient::BaseEngineDebugClient(const QString &clientName,
|
||||
setObjectName(clientName);
|
||||
}
|
||||
|
||||
quint32 BaseEngineDebugClient::addWatch(const QmlDebugPropertyReference &property)
|
||||
quint32 BaseEngineDebugClient::addWatch(const PropertyReference &property)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled) {
|
||||
if (status() == Enabled) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -243,18 +243,18 @@ quint32 BaseEngineDebugClient::addWatch(const QmlDebugPropertyReference &propert
|
||||
return id;
|
||||
}
|
||||
|
||||
quint32 BaseEngineDebugClient::addWatch(const QmlDebugContextReference &/*context*/,
|
||||
quint32 BaseEngineDebugClient::addWatch(const ContextReference &/*context*/,
|
||||
const QString &/*id*/)
|
||||
{
|
||||
qWarning("QmlEngineDebugClient::addWatch(): Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
quint32 BaseEngineDebugClient::addWatch(const QmlDebugObjectReference &object,
|
||||
quint32 BaseEngineDebugClient::addWatch(const ObjectReference &object,
|
||||
const QString &expr)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled) {
|
||||
if (status() == Enabled) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -264,10 +264,10 @@ quint32 BaseEngineDebugClient::addWatch(const QmlDebugObjectReference &object,
|
||||
return id;
|
||||
}
|
||||
|
||||
quint32 BaseEngineDebugClient::addWatch(const QmlDebugObjectReference &object)
|
||||
quint32 BaseEngineDebugClient::addWatch(const ObjectReference &object)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled) {
|
||||
if (status() == Enabled) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -277,7 +277,7 @@ quint32 BaseEngineDebugClient::addWatch(const QmlDebugObjectReference &object)
|
||||
return id;
|
||||
}
|
||||
|
||||
quint32 BaseEngineDebugClient::addWatch(const QmlDebugFileReference &/*file*/)
|
||||
quint32 BaseEngineDebugClient::addWatch(const FileReference &/*file*/)
|
||||
{
|
||||
qWarning("QmlEngineDebugClient::addWatch(): Not implemented");
|
||||
return 0;
|
||||
@@ -285,7 +285,7 @@ quint32 BaseEngineDebugClient::addWatch(const QmlDebugFileReference &/*file*/)
|
||||
|
||||
void BaseEngineDebugClient::removeWatch(quint32 id)
|
||||
{
|
||||
if (status() == QmlDebugClient::Enabled) {
|
||||
if (status() == Enabled) {
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
ds << QByteArray("NO_WATCH") << id;
|
||||
@@ -296,7 +296,7 @@ void BaseEngineDebugClient::removeWatch(quint32 id)
|
||||
quint32 BaseEngineDebugClient::queryAvailableEngines()
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled) {
|
||||
if (status() == Enabled) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -306,10 +306,10 @@ quint32 BaseEngineDebugClient::queryAvailableEngines()
|
||||
return id;
|
||||
}
|
||||
|
||||
quint32 BaseEngineDebugClient::queryRootContexts(const QmlDebugEngineReference &engine)
|
||||
quint32 BaseEngineDebugClient::queryRootContexts(const EngineReference &engine)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && engine.m_debugId != -1) {
|
||||
if (status() == Enabled && engine.m_debugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -319,10 +319,10 @@ quint32 BaseEngineDebugClient::queryRootContexts(const QmlDebugEngineReference &
|
||||
return id;
|
||||
}
|
||||
|
||||
quint32 BaseEngineDebugClient::queryObject(const QmlDebugObjectReference &object)
|
||||
quint32 BaseEngineDebugClient::queryObject(const ObjectReference &object)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && object.m_debugId != -1) {
|
||||
if (status() == Enabled && object.m_debugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -333,10 +333,10 @@ quint32 BaseEngineDebugClient::queryObject(const QmlDebugObjectReference &object
|
||||
return id;
|
||||
}
|
||||
|
||||
quint32 BaseEngineDebugClient::queryObjectRecursive(const QmlDebugObjectReference &object)
|
||||
quint32 BaseEngineDebugClient::queryObjectRecursive(const ObjectReference &object)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && object.m_debugId != -1) {
|
||||
if (status() == Enabled && object.m_debugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -352,7 +352,7 @@ quint32 BaseEngineDebugClient::queryExpressionResult(int objectDebugId,
|
||||
int engineId)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) {
|
||||
if (status() == Enabled && objectDebugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -371,7 +371,7 @@ quint32 BaseEngineDebugClient::setBindingForObject(
|
||||
QString source, int line)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) {
|
||||
if (status() == Enabled && objectDebugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -387,7 +387,7 @@ quint32 BaseEngineDebugClient::resetBindingForObject(
|
||||
const QString &propertyName)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) {
|
||||
if (status() == Enabled && objectDebugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -402,7 +402,7 @@ quint32 BaseEngineDebugClient::setMethodBody(
|
||||
const QString &methodBody)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) {
|
||||
if (status() == Enabled && objectDebugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
|
||||
@@ -40,11 +40,11 @@
|
||||
namespace QmlDebug {
|
||||
|
||||
class QmlDebugConnection;
|
||||
class QmlDebugPropertyReference;
|
||||
class QmlDebugContextReference;
|
||||
class QmlDebugObjectReference;
|
||||
class QmlDebugFileReference;
|
||||
class QmlDebugEngineReference;
|
||||
class PropertyReference;
|
||||
class ContextReference;
|
||||
class ObjectReference;
|
||||
class FileReference;
|
||||
class EngineReference;
|
||||
|
||||
class QMLDEBUG_EXPORT BaseEngineDebugClient : public QmlDebugClient
|
||||
{
|
||||
@@ -53,18 +53,18 @@ public:
|
||||
BaseEngineDebugClient(const QString &clientName,
|
||||
QmlDebugConnection *conn);
|
||||
|
||||
quint32 addWatch(const QmlDebugPropertyReference &property);
|
||||
quint32 addWatch(const QmlDebugContextReference &context, const QString &id);
|
||||
quint32 addWatch(const QmlDebugObjectReference &object, const QString &expr);
|
||||
quint32 addWatch(const QmlDebugObjectReference &object);
|
||||
quint32 addWatch(const QmlDebugFileReference &file);
|
||||
quint32 addWatch(const PropertyReference &property);
|
||||
quint32 addWatch(const ContextReference &context, const QString &id);
|
||||
quint32 addWatch(const ObjectReference &object, const QString &expr);
|
||||
quint32 addWatch(const ObjectReference &object);
|
||||
quint32 addWatch(const FileReference &file);
|
||||
|
||||
void removeWatch(quint32 watch);
|
||||
|
||||
quint32 queryAvailableEngines();
|
||||
quint32 queryRootContexts(const QmlDebugEngineReference &context);
|
||||
quint32 queryObject(const QmlDebugObjectReference &object);
|
||||
quint32 queryObjectRecursive(const QmlDebugObjectReference &object);
|
||||
quint32 queryRootContexts(const EngineReference &context);
|
||||
quint32 queryObject(const ObjectReference &object);
|
||||
quint32 queryObjectRecursive(const ObjectReference &object);
|
||||
quint32 queryExpressionResult(int objectDebugId,
|
||||
const QString &expr, int engineId = -1);
|
||||
virtual quint32 setBindingForObject(int objectDebugId, const QString &propertyName,
|
||||
@@ -77,29 +77,29 @@ public:
|
||||
const QString &methodBody);
|
||||
|
||||
signals:
|
||||
void newStatus(QmlDebugClient::Status status);
|
||||
void newStatus(QmlDebug::ClientStatus status);
|
||||
void newObjects();
|
||||
void valueChanged(int debugId, const QByteArray &name,
|
||||
const QVariant &value);
|
||||
void result(quint32 queryId, const QVariant &result, const QByteArray &type);
|
||||
|
||||
protected:
|
||||
virtual void statusChanged(Status status);
|
||||
virtual void statusChanged(ClientStatus status);
|
||||
virtual void messageReceived(const QByteArray &);
|
||||
|
||||
quint32 getId() { return m_nextId++; }
|
||||
|
||||
void decode(QDataStream &d, QmlDebugContextReference &context);
|
||||
void decode(QDataStream &d, QmlDebugObjectReference &object, bool simple);
|
||||
void decode(QDataStream &d, ContextReference &context);
|
||||
void decode(QDataStream &d, ObjectReference &object, bool simple);
|
||||
|
||||
private:
|
||||
quint32 m_nextId;
|
||||
};
|
||||
|
||||
class QmlDebugFileReference
|
||||
class FileReference
|
||||
{
|
||||
public:
|
||||
QmlDebugFileReference() : m_lineNumber(-1), m_columnNumber(-1) {}
|
||||
FileReference() : m_lineNumber(-1), m_columnNumber(-1) {}
|
||||
|
||||
QUrl url() const { return m_url; }
|
||||
int lineNumber() const { return m_lineNumber; }
|
||||
@@ -112,11 +112,11 @@ private:
|
||||
int m_columnNumber;
|
||||
};
|
||||
|
||||
class QmlDebugEngineReference
|
||||
class EngineReference
|
||||
{
|
||||
public:
|
||||
QmlDebugEngineReference() : m_debugId(-1) {}
|
||||
explicit QmlDebugEngineReference(int id) : m_debugId(id) {}
|
||||
EngineReference() : m_debugId(-1) {}
|
||||
explicit EngineReference(int id) : m_debugId(id) {}
|
||||
|
||||
int debugId() const { return m_debugId; }
|
||||
QString name() const { return m_name; }
|
||||
@@ -127,13 +127,11 @@ private:
|
||||
QString m_name;
|
||||
};
|
||||
|
||||
typedef QList<QmlDebugEngineReference> QmlDebugEngineReferenceList;
|
||||
|
||||
class QmlDebugObjectReference
|
||||
class ObjectReference
|
||||
{
|
||||
public:
|
||||
QmlDebugObjectReference() : 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) {}
|
||||
ObjectReference() : m_debugId(-1), 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 parentId() const { return m_parentId; }
|
||||
@@ -141,14 +139,14 @@ public:
|
||||
QString idString() const { return m_idString; }
|
||||
QString name() const { return m_name; }
|
||||
|
||||
QmlDebugFileReference source() const { return m_source; }
|
||||
FileReference source() const { return m_source; }
|
||||
int contextDebugId() const { return m_contextDebugId; }
|
||||
bool needsMoreData() const { return m_needsMoreData; }
|
||||
|
||||
QList<QmlDebugPropertyReference> properties() const { return m_properties; }
|
||||
QList<QmlDebugObjectReference> children() const { return m_children; }
|
||||
QList<PropertyReference> properties() const { return m_properties; }
|
||||
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++) {
|
||||
if (m_children[i].debugId() == obj.debugId()) {
|
||||
@@ -162,7 +160,7 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool operator ==(const QmlDebugObjectReference &obj)
|
||||
bool operator ==(const ObjectReference &obj)
|
||||
{
|
||||
return m_debugId == obj.debugId();
|
||||
}
|
||||
@@ -174,36 +172,36 @@ private:
|
||||
QString m_className;
|
||||
QString m_idString;
|
||||
QString m_name;
|
||||
QmlDebugFileReference m_source;
|
||||
FileReference m_source;
|
||||
int m_contextDebugId;
|
||||
bool m_needsMoreData;
|
||||
QList<QmlDebugPropertyReference> m_properties;
|
||||
QList<QmlDebugObjectReference> m_children;
|
||||
QList<PropertyReference> m_properties;
|
||||
QList<ObjectReference> m_children;
|
||||
};
|
||||
|
||||
class QmlDebugContextReference
|
||||
class ContextReference
|
||||
{
|
||||
public:
|
||||
QmlDebugContextReference() : m_debugId(-1) {}
|
||||
ContextReference() : m_debugId(-1) {}
|
||||
|
||||
int debugId() const { return m_debugId; }
|
||||
QString name() const { return m_name; }
|
||||
|
||||
QList<QmlDebugObjectReference> objects() const { return m_objects; }
|
||||
QList<QmlDebugContextReference> contexts() const { return m_contexts; }
|
||||
QList<ObjectReference> objects() const { return m_objects; }
|
||||
QList<ContextReference> contexts() const { return m_contexts; }
|
||||
|
||||
private:
|
||||
friend class BaseEngineDebugClient;
|
||||
int m_debugId;
|
||||
QString m_name;
|
||||
QList<QmlDebugObjectReference> m_objects;
|
||||
QList<QmlDebugContextReference> m_contexts;
|
||||
QList<ObjectReference> m_objects;
|
||||
QList<ContextReference> m_contexts;
|
||||
};
|
||||
|
||||
class QmlDebugPropertyReference
|
||||
class PropertyReference
|
||||
{
|
||||
public:
|
||||
QmlDebugPropertyReference() : m_objectDebugId(-1), m_hasNotifySignal(false) {}
|
||||
PropertyReference() : m_objectDebugId(-1), m_hasNotifySignal(false) {}
|
||||
|
||||
int debugId() const { return m_objectDebugId; }
|
||||
QString name() const { return m_name; }
|
||||
@@ -224,23 +222,23 @@ private:
|
||||
|
||||
} // namespace QmlDebug
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDebug::QmlDebugObjectReference)
|
||||
Q_DECLARE_METATYPE(QmlDebug::QmlDebugEngineReference)
|
||||
Q_DECLARE_METATYPE(QmlDebug::QmlDebugEngineReferenceList)
|
||||
Q_DECLARE_METATYPE(QmlDebug::QmlDebugContextReference)
|
||||
Q_DECLARE_METATYPE(QmlDebug::ObjectReference)
|
||||
Q_DECLARE_METATYPE(QmlDebug::EngineReference)
|
||||
Q_DECLARE_METATYPE(QList<QmlDebug::EngineReference>)
|
||||
Q_DECLARE_METATYPE(QmlDebug::ContextReference)
|
||||
|
||||
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() << ")";
|
||||
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() << ")";
|
||||
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() << "/"
|
||||
<< (ref.idString().isEmpty() ? ref.idString() : ref.className()) << ")";
|
||||
return dbg.space();
|
||||
|
||||
@@ -39,17 +39,17 @@ BaseToolsClient::BaseToolsClient(QmlDebugConnection* client, QLatin1String clien
|
||||
setObjectName(clientName);
|
||||
}
|
||||
|
||||
void BaseToolsClient::statusChanged(Status status)
|
||||
void BaseToolsClient::statusChanged(ClientStatus status)
|
||||
{
|
||||
emit connectedStatusChanged(status);
|
||||
}
|
||||
|
||||
void BaseToolsClient::recurseObjectIdList(const QmlDebugObjectReference &ref,
|
||||
void BaseToolsClient::recurseObjectIdList(const ObjectReference &ref,
|
||||
QList<int> &debugIds, QList<QString> &objectIds)
|
||||
{
|
||||
debugIds << ref.debugId();
|
||||
objectIds << ref.idString();
|
||||
foreach (const QmlDebugObjectReference &child, ref.children())
|
||||
foreach (const ObjectReference &child, ref.children())
|
||||
recurseObjectIdList(child, debugIds, objectIds);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,12 +66,12 @@ public:
|
||||
|
||||
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
|
||||
virtual void setObjectIdList(
|
||||
const QList<QmlDebugObjectReference> &objectRoots) = 0;
|
||||
const QList<ObjectReference> &objectRoots) = 0;
|
||||
|
||||
virtual void clearComponentCache() = 0;
|
||||
|
||||
signals:
|
||||
void connectedStatusChanged(QmlDebugClient::Status status);
|
||||
void connectedStatusChanged(QmlDebug::ClientStatus status);
|
||||
|
||||
void currentObjectsChanged(const QList<int> &debugIds);
|
||||
void selectToolActivated();
|
||||
@@ -86,9 +86,9 @@ signals:
|
||||
void logActivity(QString client, QString message);
|
||||
|
||||
protected:
|
||||
void statusChanged(Status);
|
||||
void statusChanged(ClientStatus status);
|
||||
|
||||
void recurseObjectIdList(const QmlDebugObjectReference &ref,
|
||||
void recurseObjectIdList(const ObjectReference &ref,
|
||||
QList<int> &debugIds, QList<QString> &objectIds);
|
||||
protected:
|
||||
enum LogDirection {
|
||||
|
||||
@@ -263,7 +263,7 @@ void DeclarativeToolsClient::setCurrentObjects(const QList<int> &debugIds)
|
||||
}
|
||||
|
||||
void DeclarativeToolsClient::setObjectIdList(
|
||||
const QList<QmlDebugObjectReference> &objectRoots)
|
||||
const QList<ObjectReference> &objectRoots)
|
||||
{
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -271,7 +271,7 @@ void DeclarativeToolsClient::setObjectIdList(
|
||||
QList<int> debugIds;
|
||||
QList<QString> objectIds;
|
||||
|
||||
foreach (const QmlDebugObjectReference &ref, objectRoots)
|
||||
foreach (const ObjectReference &ref, objectRoots)
|
||||
recurseObjectIdList(ref, debugIds, objectIds);
|
||||
|
||||
InspectorProtocol::Message cmd = InspectorProtocol::ObjectIdList;
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
QList<int> currentObjects() const;
|
||||
|
||||
// ### 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();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ QDebugMessageClient::~QDebugMessageClient()
|
||||
{
|
||||
}
|
||||
|
||||
void QDebugMessageClient::statusChanged(Status status)
|
||||
void QDebugMessageClient::statusChanged(ClientStatus status)
|
||||
{
|
||||
emit newStatus(status);
|
||||
}
|
||||
|
||||
@@ -55,11 +55,11 @@ public:
|
||||
~QDebugMessageClient();
|
||||
|
||||
protected:
|
||||
virtual void statusChanged(Status status);
|
||||
virtual void statusChanged(ClientStatus status);
|
||||
virtual void messageReceived(const QByteArray &);
|
||||
|
||||
signals:
|
||||
void newStatus(QmlDebugClient::Status);
|
||||
void newStatus(QmlDebug::ClientStatus);
|
||||
void message(QtMsgType, const QString &,
|
||||
const QmlDebug::QDebugContextInfo &);
|
||||
|
||||
|
||||
@@ -149,9 +149,9 @@ void QmlDebugConnectionPrivate::readyRead()
|
||||
|
||||
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
|
||||
for (; iter != plugins.end(); ++iter) {
|
||||
QmlDebugClient::Status newStatus = QmlDebugClient::Unavailable;
|
||||
ClientStatus newStatus = Unavailable;
|
||||
if (serverPlugins.contains(iter.key()))
|
||||
newStatus = QmlDebugClient::Enabled;
|
||||
newStatus = Enabled;
|
||||
iter.value()->statusChanged(newStatus);
|
||||
}
|
||||
}
|
||||
@@ -188,9 +188,9 @@ void QmlDebugConnectionPrivate::readyRead()
|
||||
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
|
||||
for (; iter != plugins.end(); ++iter) {
|
||||
const QString pluginName = iter.key();
|
||||
QmlDebugClient::Status newStatus = QmlDebugClient::Unavailable;
|
||||
ClientStatus newStatus = Unavailable;
|
||||
if (serverPlugins.contains(pluginName))
|
||||
newStatus = QmlDebugClient::Enabled;
|
||||
newStatus = Enabled;
|
||||
|
||||
if (oldServerPlugins.contains(pluginName)
|
||||
!= serverPlugins.contains(pluginName)) {
|
||||
@@ -232,7 +232,7 @@ QmlDebugConnection::~QmlDebugConnection()
|
||||
QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin();
|
||||
for (; iter != d->plugins.end(); ++iter) {
|
||||
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();
|
||||
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;
|
||||
}
|
||||
|
||||
QmlDebugClient::Status QmlDebugClient::status() const
|
||||
ClientStatus QmlDebugClient::status() const
|
||||
{
|
||||
Q_D(const QmlDebugClient);
|
||||
if (!d->connection
|
||||
@@ -440,7 +440,7 @@ void QmlDebugClient::sendMessage(const QByteArray &message)
|
||||
d->connection->flush();
|
||||
}
|
||||
|
||||
void QmlDebugClient::statusChanged(Status)
|
||||
void QmlDebugClient::statusChanged(ClientStatus)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,12 @@ private:
|
||||
friend class QmlDebugClientPrivate;
|
||||
};
|
||||
|
||||
enum ClientStatus {
|
||||
NotConnected,
|
||||
Unavailable,
|
||||
Enabled
|
||||
};
|
||||
|
||||
class QmlDebugClientPrivate;
|
||||
class QMLDEBUG_EXPORT QmlDebugClient : public QObject
|
||||
{
|
||||
@@ -83,19 +89,17 @@ class QMLDEBUG_EXPORT QmlDebugClient : public QObject
|
||||
Q_DISABLE_COPY(QmlDebugClient)
|
||||
|
||||
public:
|
||||
enum Status { NotConnected, Unavailable, Enabled };
|
||||
|
||||
QmlDebugClient(const QString &, QmlDebugConnection *parent);
|
||||
~QmlDebugClient();
|
||||
|
||||
QString name() const;
|
||||
float serviceVersion() const;
|
||||
Status status() const;
|
||||
ClientStatus status() const;
|
||||
|
||||
virtual void sendMessage(const QByteArray &);
|
||||
|
||||
protected:
|
||||
virtual void statusChanged(Status);
|
||||
virtual void statusChanged(ClientStatus);
|
||||
virtual void messageReceived(const QByteArray &);
|
||||
|
||||
private:
|
||||
|
||||
@@ -48,7 +48,7 @@ quint32 QmlEngineDebugClient::setBindingForObject(
|
||||
QString source, int line)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) {
|
||||
if (status() == Enabled && objectDebugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -64,7 +64,7 @@ quint32 QmlEngineDebugClient::resetBindingForObject(
|
||||
const QString &propertyName)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) {
|
||||
if (status() == Enabled && objectDebugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
@@ -79,7 +79,7 @@ quint32 QmlEngineDebugClient::setMethodBody(
|
||||
const QString &methodBody)
|
||||
{
|
||||
quint32 id = 0;
|
||||
if (status() == QmlDebugClient::Enabled && objectDebugId != -1) {
|
||||
if (status() == Enabled && objectDebugId != -1) {
|
||||
id = getId();
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
|
||||
@@ -136,7 +136,7 @@ void QmlProfilerTraceClient::setRecordingFromServer(bool v)
|
||||
emit recordingChanged(v);
|
||||
}
|
||||
|
||||
void QmlProfilerTraceClient::statusChanged(Status /*status*/)
|
||||
void QmlProfilerTraceClient::statusChanged(ClientStatus /*status*/)
|
||||
{
|
||||
emit enabledChanged();
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ signals:
|
||||
void cleared();
|
||||
|
||||
protected:
|
||||
virtual void statusChanged(Status);
|
||||
virtual void statusChanged(ClientStatus status);
|
||||
virtual void messageReceived(const QByteArray &);
|
||||
|
||||
private:
|
||||
|
||||
@@ -130,7 +130,7 @@ void QmlToolsClient::setCurrentObjects(const QList<int> &debugIds)
|
||||
}
|
||||
|
||||
void QmlToolsClient::setObjectIdList(
|
||||
const QList<QmlDebugObjectReference> &/*objectRoots*/)
|
||||
const QList<ObjectReference> &/*objectRoots*/)
|
||||
{
|
||||
//NOT IMPLEMENTED
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
QList<int> currentObjects() const;
|
||||
|
||||
// ### 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();
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ void QV8ProfilerClient::setRecordingFromServer(bool v)
|
||||
emit recordingChanged(v);
|
||||
}
|
||||
|
||||
void QV8ProfilerClient::statusChanged(Status /*status*/)
|
||||
void QV8ProfilerClient::statusChanged(ClientStatus /*status*/)
|
||||
{
|
||||
emit enabledChanged();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
void setRecordingFromServer(bool);
|
||||
|
||||
protected:
|
||||
virtual void statusChanged(Status);
|
||||
virtual void statusChanged(ClientStatus);
|
||||
virtual void messageReceived(const QByteArray &);
|
||||
|
||||
private:
|
||||
|
||||
@@ -61,14 +61,14 @@ bool BaseQmlDebuggerClient::acceptsBreakpoint(const BreakpointModelId &/*id*/)
|
||||
return false;
|
||||
}
|
||||
|
||||
void BaseQmlDebuggerClient::statusChanged(Status status)
|
||||
void BaseQmlDebuggerClient::statusChanged(QmlDebug::ClientStatus status)
|
||||
{
|
||||
emit newStatus(status);
|
||||
}
|
||||
|
||||
void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg)
|
||||
{
|
||||
if (status() == Enabled) {
|
||||
if (status() == QmlDebug::Enabled) {
|
||||
QmlDebugClient::sendMessage(msg);
|
||||
} else {
|
||||
d->sendBuffer.append(msg);
|
||||
@@ -77,7 +77,7 @@ void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg)
|
||||
|
||||
void BaseQmlDebuggerClient::flushSendBuffer()
|
||||
{
|
||||
QTC_ASSERT(status() == QmlDebugClient::Enabled, return);
|
||||
QTC_ASSERT(status() == QmlDebug::Enabled, return);
|
||||
foreach (const QByteArray &msg, d->sendBuffer)
|
||||
QmlDebugClient::sendMessage(msg);
|
||||
d->sendBuffer.clear();
|
||||
|
||||
@@ -93,10 +93,10 @@ public:
|
||||
void flushSendBuffer();
|
||||
|
||||
signals:
|
||||
void newStatus(QmlDebugClient::Status status);
|
||||
void newStatus(QmlDebug::ClientStatus status);
|
||||
|
||||
protected:
|
||||
virtual void statusChanged(Status status);
|
||||
virtual void statusChanged(QmlDebug::ClientStatus status);
|
||||
void sendMessage(const QByteArray &msg);
|
||||
|
||||
private:
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
using namespace QmlDebug;
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
@@ -63,8 +65,8 @@ QmlAdapter::QmlAdapter(DebuggerEngine *engine, QObject *parent)
|
||||
|
||||
createDebuggerClients();
|
||||
m_msgClient = new QDebugMessageClient(m_conn);
|
||||
connect(m_msgClient, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(m_msgClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
||||
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;
|
||||
float version = 0;
|
||||
@@ -136,9 +138,9 @@ void QmlAdapter::clientStatusChanged(QmlDebugClient::Status 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;
|
||||
QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender());
|
||||
QTC_ASSERT(client, return);
|
||||
@@ -193,16 +195,16 @@ void QmlAdapter::checkConnectionState()
|
||||
void QmlAdapter::createDebuggerClients()
|
||||
{
|
||||
QScriptDebuggerClient *debugClient1 = new QScriptDebuggerClient(m_conn);
|
||||
connect(debugClient1, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(debugClient1, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(debugClientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(debugClient1, SIGNAL(newStatus(QmlDebug::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebug::Status)));
|
||||
connect(debugClient1, SIGNAL(newStatus(QmlDebug::Status)),
|
||||
this, SLOT(debugClientStatusChanged(QmlDebug::Status)));
|
||||
|
||||
QmlV8DebuggerClient *debugClient2 = new QmlV8DebuggerClient(m_conn);
|
||||
connect(debugClient2, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(debugClient2, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(debugClientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(debugClient2, SIGNAL(newStatus(QmlDebug::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebug::Status)));
|
||||
connect(debugClient2, SIGNAL(newStatus(QmlDebug::Status)),
|
||||
this, SLOT(debugClientStatusChanged(QmlDebug::Status)));
|
||||
|
||||
m_debugClients.insert(debugClient1->name(),debugClient1);
|
||||
m_debugClients.insert(debugClient2->name(),debugClient2);
|
||||
@@ -272,21 +274,21 @@ QDebugMessageClient *QmlAdapter::messageClient() const
|
||||
}
|
||||
|
||||
void QmlAdapter::logServiceStatusChange(const QString &service, float version,
|
||||
QmlDebugClient::Status newStatus)
|
||||
QmlDebug::ClientStatus newStatus)
|
||||
{
|
||||
switch (newStatus) {
|
||||
case QmlDebugClient::Unavailable: {
|
||||
case QmlDebug::Unavailable: {
|
||||
showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'unavailable'.").
|
||||
arg(service).arg(QString::number(version)));
|
||||
break;
|
||||
}
|
||||
case QmlDebugClient::Enabled: {
|
||||
case QmlDebug::Enabled: {
|
||||
showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'enabled'.").
|
||||
arg(service).arg(QString::number(version)));
|
||||
break;
|
||||
}
|
||||
|
||||
case QmlDebugClient::NotConnected: {
|
||||
case QmlDebug::NotConnected: {
|
||||
showConnectionStatusMessage(tr("Status of '%1' Version: %2 changed to 'not connected'.").
|
||||
arg(service).arg(QString::number(version)));
|
||||
break;
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
#include <QPointer>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace QmlDebug;
|
||||
|
||||
namespace QmlDebug {
|
||||
class BaseEngineDebugClient;
|
||||
class QmlDebugConnection;
|
||||
@@ -72,7 +70,7 @@ public:
|
||||
|
||||
bool isConnected() const;
|
||||
|
||||
QmlDebugConnection *connection() const;
|
||||
QmlDebug::QmlDebugConnection *connection() const;
|
||||
DebuggerEngine *debuggerEngine() const;
|
||||
|
||||
bool disableJsDebugging(bool block);
|
||||
@@ -80,12 +78,11 @@ public:
|
||||
BaseQmlDebuggerClient *activeDebuggerClient() const;
|
||||
QHash<QString, BaseQmlDebuggerClient*> debuggerClients() const;
|
||||
|
||||
BaseEngineDebugClient *engineDebugClient() const;
|
||||
QDebugMessageClient *messageClient() const;
|
||||
QmlDebug::QDebugMessageClient *messageClient() const;
|
||||
|
||||
public slots:
|
||||
void logServiceStatusChange(const QString &service, float version,
|
||||
QmlDebugClient::Status newStatus);
|
||||
QmlDebug::ClientStatus newStatus);
|
||||
void logServiceActivity(const QString &service, const QString &logMessage);
|
||||
|
||||
signals:
|
||||
@@ -97,8 +94,8 @@ signals:
|
||||
|
||||
private slots:
|
||||
void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
|
||||
void clientStatusChanged(QmlDebugClient::Status status);
|
||||
void debugClientStatusChanged(QmlDebugClient::Status status);
|
||||
void clientStatusChanged(QmlDebug::ClientStatus status);
|
||||
void debugClientStatusChanged(QmlDebug::ClientStatus status);
|
||||
void connectionStateChanged();
|
||||
void checkConnectionState();
|
||||
|
||||
@@ -111,9 +108,9 @@ private:
|
||||
QPointer<DebuggerEngine> m_engine;
|
||||
BaseQmlDebuggerClient *m_qmlClient;
|
||||
QTimer m_connectionTimer;
|
||||
QmlDebugConnection *m_conn;
|
||||
QmlDebug::QmlDebugConnection *m_conn;
|
||||
QHash<QString, BaseQmlDebuggerClient*> m_debugClients;
|
||||
QDebugMessageClient *m_msgClient;
|
||||
QmlDebug::QDebugMessageClient *m_msgClient;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -193,7 +193,7 @@ private:
|
||||
QmlInspectorAdapter m_inspectorAdapter;
|
||||
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
||||
QTimer m_noDebugOutputTimer;
|
||||
QmlOutputParser m_outputParser;
|
||||
QmlDebug::QmlOutputParser m_outputParser;
|
||||
QHash<QString, QTextDocument*> m_sourceDocuments;
|
||||
QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors;
|
||||
InteractiveInterpreter m_interpreter;
|
||||
|
||||
@@ -99,44 +99,44 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
|
||||
, m_selectAction(new QAction(this))
|
||||
, m_zoomAction(new QAction(this))
|
||||
{
|
||||
connect(m_agent, SIGNAL(objectFetched(QmlDebugObjectReference)),
|
||||
SLOT(onObjectFetched(QmlDebugObjectReference)));
|
||||
connect(m_agent, SIGNAL(objectFetched(QmlDebug::ObjectReference)),
|
||||
SLOT(onObjectFetched(QmlDebug::ObjectReference)));
|
||||
connect(m_agent, SIGNAL(objectTreeUpdated()),
|
||||
SLOT(onObjectTreeUpdated()));
|
||||
|
||||
QmlDebugConnection *connection = m_debugAdapter->connection();
|
||||
DeclarativeEngineDebugClient *engineClient1
|
||||
= new DeclarativeEngineDebugClient(connection);
|
||||
connect(engineClient1, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(engineClient1, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(engineClientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(engineClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
||||
connect(engineClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
||||
this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
|
||||
|
||||
QmlEngineDebugClient *engineClient2 = new QmlEngineDebugClient(connection);
|
||||
connect(engineClient2, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(engineClient2, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
this, SLOT(engineClientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(engineClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
||||
connect(engineClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
||||
this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
|
||||
|
||||
m_engineClients.insert(engineClient1->name(), engineClient1);
|
||||
m_engineClients.insert(engineClient2->name(), engineClient2);
|
||||
|
||||
if (engineClient1->status() == QmlDebugClient::Enabled)
|
||||
if (engineClient1->status() == QmlDebug::Enabled)
|
||||
setActiveEngineClient(engineClient1);
|
||||
if (engineClient2->status() == QmlDebugClient::Enabled)
|
||||
if (engineClient2->status() == QmlDebug::Enabled)
|
||||
setActiveEngineClient(engineClient2);
|
||||
|
||||
DeclarativeToolsClient *toolsClient1 = new DeclarativeToolsClient(connection);
|
||||
connect(toolsClient1, SIGNAL(connectedStatusChanged(QmlDebugClient::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(toolsClient1, SIGNAL(connectedStatusChanged(QmlDebugClient::Status)),
|
||||
this, SLOT(toolsClientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(toolsClient1, SIGNAL(connectedStatusChanged(QmlDebug::ClientStatus)),
|
||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
||||
connect(toolsClient1, SIGNAL(connectedStatusChanged(QmlDebug::ClientStatus)),
|
||||
this, SLOT(toolsClientStatusChanged(QmlDebug::ClientStatus)));
|
||||
|
||||
QmlToolsClient *toolsClient2 = new QmlToolsClient(connection);
|
||||
connect(toolsClient2, SIGNAL(connectedStatusChanged(QmlDebugClient::Status)),
|
||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(toolsClient2, SIGNAL(connectedStatusChanged(QmlDebugClient::Status)),
|
||||
this, SLOT(toolsClientStatusChanged(QmlDebugClient::Status)));
|
||||
connect(toolsClient2, SIGNAL(connectedStatusChanged(QmlDebug::ClientStatus)),
|
||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
||||
connect(toolsClient2, SIGNAL(connectedStatusChanged(QmlDebug::ClientStatus)),
|
||||
this, SLOT(toolsClientStatusChanged(QmlDebug::ClientStatus)));
|
||||
|
||||
// toolbar
|
||||
m_selectAction->setObjectName("QML Select Action");
|
||||
@@ -179,7 +179,7 @@ QString QmlInspectorAdapter::currentSelectedDisplayName() const
|
||||
return m_currentSelectedDebugName;
|
||||
}
|
||||
|
||||
void QmlInspectorAdapter::clientStatusChanged(QmlDebugClient::Status status)
|
||||
void QmlInspectorAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
|
||||
{
|
||||
QString serviceName;
|
||||
float version = 0;
|
||||
@@ -191,12 +191,12 @@ void QmlInspectorAdapter::clientStatusChanged(QmlDebugClient::Status 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::ActionManager *am = Core::ICore::actionManager();
|
||||
BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender());
|
||||
if (status == QmlDebugClient::Enabled) {
|
||||
if (status == QmlDebug::Enabled) {
|
||||
m_toolsClient = client;
|
||||
|
||||
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;
|
||||
|
||||
BaseEngineDebugClient *client
|
||||
@@ -279,7 +279,7 @@ void QmlInspectorAdapter::selectObjectsFromEditor(const QList<int> &debugIds)
|
||||
}
|
||||
m_cursorPositionChangedExternally = true;
|
||||
|
||||
QmlDebugObjectReference clientRef
|
||||
ObjectReference clientRef
|
||||
= agent()->objectForId(debugId);
|
||||
|
||||
// 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();
|
||||
|
||||
QmlDebugObjectReference clientRef
|
||||
ObjectReference clientRef
|
||||
= agent()->objectForId(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) {
|
||||
m_debugIdToSelect = -1;
|
||||
@@ -431,7 +431,7 @@ void QmlInspectorAdapter::onZoomActionTriggered(bool checked)
|
||||
void QmlInspectorAdapter::onShowAppOnTopChanged(const QVariant &value)
|
||||
{
|
||||
bool showAppOnTop = value.toBool();
|
||||
if (m_toolsClient->status() == QmlDebugClient::Enabled)
|
||||
if (m_toolsClient->status() == QmlDebug::Enabled)
|
||||
m_toolsClient->showAppOnTop(showAppOnTop);
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ void QmlInspectorAdapter::setActiveEngineClient(BaseEngineDebugClient *client)
|
||||
|
||||
|
||||
if (m_engineClient &&
|
||||
m_engineClient->status() == QmlDebugClient::Enabled) {
|
||||
m_engineClient->status() == QmlDebug::Enabled) {
|
||||
QmlJS::ModelManagerInterface *modelManager
|
||||
= QmlJS::ModelManagerInterface::instance();
|
||||
QmlJS::Snapshot snapshot = modelManager->snapshot();
|
||||
@@ -499,14 +499,14 @@ void QmlInspectorAdapter::showConnectionStatusMessage(const QString &message)
|
||||
}
|
||||
|
||||
void QmlInspectorAdapter::gotoObjectReferenceDefinition(
|
||||
const QmlDebugObjectReference &obj)
|
||||
const ObjectReference &obj)
|
||||
{
|
||||
if (m_cursorPositionChangedExternally) {
|
||||
m_cursorPositionChangedExternally = false;
|
||||
return;
|
||||
}
|
||||
|
||||
QmlDebugFileReference source = obj.source();
|
||||
FileReference source = obj.source();
|
||||
|
||||
const QString fileName = m_engine->toFileInProject(source.url());
|
||||
|
||||
@@ -520,7 +520,7 @@ void QmlInspectorAdapter::gotoObjectReferenceDefinition(
|
||||
m_selectionCallbackExpected = true;
|
||||
|
||||
if (textEditor) {
|
||||
QmlDebugObjectReference ref = objectReferenceForLocation(fileName);
|
||||
ObjectReference ref = objectReferenceForLocation(fileName);
|
||||
if (ref.debugId() != obj.debugId()) {
|
||||
m_selectionCallbackExpected = true;
|
||||
editorManager->addCurrentPositionToNavigationHistory();
|
||||
@@ -530,7 +530,7 @@ void QmlInspectorAdapter::gotoObjectReferenceDefinition(
|
||||
}
|
||||
}
|
||||
|
||||
QmlDebugObjectReference QmlInspectorAdapter::objectReferenceForLocation(
|
||||
ObjectReference QmlInspectorAdapter::objectReferenceForLocation(
|
||||
const QString &fileName, int cursorPosition) const
|
||||
{
|
||||
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
|
||||
if (obj.className() == "State") {
|
||||
foreach (const QmlDebugPropertyReference &prop, obj.properties()) {
|
||||
foreach (const PropertyReference &prop, obj.properties()) {
|
||||
if (prop.name() == "name")
|
||||
return prop.value().toString();
|
||||
}
|
||||
@@ -590,12 +590,12 @@ inline QString displayName(const QmlDebugObjectReference &obj)
|
||||
return QString("<%1>").arg(objTypeName);
|
||||
}
|
||||
|
||||
void QmlInspectorAdapter::selectObject(const QmlDebugObjectReference &obj,
|
||||
void QmlInspectorAdapter::selectObject(const ObjectReference &obj,
|
||||
SelectionTarget target)
|
||||
{
|
||||
if (target == ToolTarget)
|
||||
m_toolsClient->setObjectIdList(
|
||||
QList<QmlDebugObjectReference>() << obj);
|
||||
QList<ObjectReference>() << obj);
|
||||
|
||||
if (target == EditorTarget)
|
||||
gotoObjectReferenceDefinition(obj);
|
||||
|
||||
@@ -47,11 +47,9 @@ class IEditor;
|
||||
namespace QmlDebug {
|
||||
class BaseEngineDebugClient;
|
||||
class BaseToolsClient;
|
||||
class QmlDebugObjectReference;
|
||||
class ObjectReference;
|
||||
}
|
||||
|
||||
using namespace QmlDebug;
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
@@ -70,8 +68,8 @@ public:
|
||||
QObject *parent = 0);
|
||||
~QmlInspectorAdapter();
|
||||
|
||||
BaseEngineDebugClient *engineClient() const;
|
||||
BaseToolsClient *toolsClient() const;
|
||||
QmlDebug::BaseEngineDebugClient *engineClient() const;
|
||||
QmlDebug::BaseToolsClient *toolsClient() const;
|
||||
QmlInspectorAgent *agent() const;
|
||||
|
||||
int currentSelectedDebugId() const;
|
||||
@@ -82,13 +80,13 @@ signals:
|
||||
void selectionChanged();
|
||||
|
||||
private slots:
|
||||
void clientStatusChanged(QmlDebugClient::Status status);
|
||||
void toolsClientStatusChanged(QmlDebugClient::Status status);
|
||||
void engineClientStatusChanged(QmlDebugClient::Status status);
|
||||
void clientStatusChanged(QmlDebug::ClientStatus status);
|
||||
void toolsClientStatusChanged(QmlDebug::ClientStatus status);
|
||||
void engineClientStatusChanged(QmlDebug::ClientStatus status);
|
||||
|
||||
void selectObjectsFromEditor(const QList<int> &debugIds);
|
||||
void selectObjectsFromToolsClient(const QList<int> &debugIds);
|
||||
void onObjectFetched(const QmlDebugObjectReference &ref);
|
||||
void onObjectFetched(const QmlDebug::ObjectReference &ref);
|
||||
void onObjectTreeUpdated();
|
||||
|
||||
void createPreviewForEditor(Core::IEditor *newEditor);
|
||||
@@ -101,26 +99,26 @@ private slots:
|
||||
void onUpdateOnSaveChanged(const QVariant &value);
|
||||
|
||||
private:
|
||||
void setActiveEngineClient(BaseEngineDebugClient *client);
|
||||
void setActiveEngineClient(QmlDebug::BaseEngineDebugClient *client);
|
||||
|
||||
void initializePreviews();
|
||||
void showConnectionStatusMessage(const QString &message);
|
||||
|
||||
void gotoObjectReferenceDefinition(const QmlDebugObjectReference &obj);
|
||||
QmlDebugObjectReference objectReferenceForLocation(
|
||||
void gotoObjectReferenceDefinition(const QmlDebug::ObjectReference &obj);
|
||||
QmlDebug::ObjectReference objectReferenceForLocation(
|
||||
const QString &fileName, int cursorPosition = -1) const;
|
||||
|
||||
enum SelectionTarget { NoTarget, ToolTarget, EditorTarget };
|
||||
void selectObject(
|
||||
const QmlDebugObjectReference &objectReference,
|
||||
const QmlDebug::ObjectReference &objectReference,
|
||||
SelectionTarget target);
|
||||
|
||||
|
||||
QmlAdapter *m_debugAdapter;
|
||||
QmlEngine *m_engine;
|
||||
BaseEngineDebugClient *m_engineClient;
|
||||
QHash<QString, BaseEngineDebugClient*> m_engineClients;
|
||||
BaseToolsClient *m_toolsClient;
|
||||
QmlDebug::BaseEngineDebugClient *m_engineClient;
|
||||
QHash<QString, QmlDebug::BaseEngineDebugClient*> m_engineClients;
|
||||
QmlDebug::BaseToolsClient *m_toolsClient;
|
||||
QmlInspectorAgent *m_agent;
|
||||
|
||||
SelectionTarget m_targetToSync;
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/savedaction.h>
|
||||
|
||||
using namespace QmlDebug;
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
@@ -81,7 +83,7 @@ void QmlInspectorAgent::fetchObject(int debugId)
|
||||
qDebug() << __FUNCTION__ << "(" << debugId << ")";
|
||||
|
||||
m_fetchCurrentObjectsQueryIds
|
||||
<< fetchContextObject(QmlDebugObjectReference(debugId));
|
||||
<< fetchContextObject(ObjectReference(debugId));
|
||||
}
|
||||
|
||||
quint32 QmlInspectorAgent::queryExpressionResult(int debugId,
|
||||
@@ -102,7 +104,7 @@ void QmlInspectorAgent::updateWatchData(const WatchData &data)
|
||||
|
||||
if (data.id) {
|
||||
// objects
|
||||
QmlDebugObjectReference ref(data.id);
|
||||
ObjectReference ref(data.id);
|
||||
m_fetchCurrentObjectsQueryIds << fetchContextObject(ref);
|
||||
WatchData d = data;
|
||||
d.setAllUnneeded();
|
||||
@@ -134,7 +136,7 @@ void QmlInspectorAgent::selectObjectInTree(int debugId)
|
||||
// we've to fetch it
|
||||
m_objectToSelect = debugId;
|
||||
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;
|
||||
foreach (const QmlDebugObjectReference &it, m_rootObjects)
|
||||
QList<ObjectReference> result;
|
||||
foreach (const ObjectReference &it, m_rootObjects)
|
||||
result.append(objects(it));
|
||||
return result;
|
||||
}
|
||||
|
||||
QmlDebugObjectReference QmlInspectorAgent::objectForId(int debugId) const
|
||||
ObjectReference QmlInspectorAgent::objectForId(int debugId) const
|
||||
{
|
||||
foreach (const QmlDebugObjectReference &it, m_rootObjects) {
|
||||
QmlDebugObjectReference result = objectForId(debugId, it);
|
||||
foreach (const ObjectReference &it, m_rootObjects) {
|
||||
ObjectReference result = objectForId(debugId, it);
|
||||
if (result.debugId() == debugId)
|
||||
return result;
|
||||
}
|
||||
return QmlDebugObjectReference();
|
||||
return ObjectReference();
|
||||
}
|
||||
|
||||
QmlDebugObjectReference QmlInspectorAgent::objectForId(
|
||||
ObjectReference QmlInspectorAgent::objectForId(
|
||||
const QString &objectId) const
|
||||
{
|
||||
if (!objectId.isEmpty() && objectId[0].isLower()) {
|
||||
const QList<QmlDebugObjectReference> refs = objects();
|
||||
foreach (const QmlDebugObjectReference &ref, refs) {
|
||||
const QList<ObjectReference> refs = objects();
|
||||
foreach (const ObjectReference &ref, refs) {
|
||||
if (ref.idString() == objectId)
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
return QmlDebugObjectReference();
|
||||
return ObjectReference();
|
||||
}
|
||||
|
||||
QmlDebugObjectReference QmlInspectorAgent::objectForLocation(
|
||||
ObjectReference QmlInspectorAgent::objectForLocation(
|
||||
int line, int column) const
|
||||
{
|
||||
const QList<QmlDebugObjectReference> refs = objects();
|
||||
foreach (const QmlDebugObjectReference &ref, refs) {
|
||||
const QList<ObjectReference> refs = objects();
|
||||
foreach (const ObjectReference &ref, refs) {
|
||||
if (ref.source().lineNumber() == line
|
||||
&& ref.source().columnNumber() == column)
|
||||
return ref;
|
||||
}
|
||||
|
||||
return QmlDebugObjectReference();
|
||||
return ObjectReference();
|
||||
}
|
||||
|
||||
bool QmlInspectorAgent::addObjectWatch(int objectDebugId)
|
||||
@@ -287,7 +289,7 @@ bool QmlInspectorAgent::addObjectWatch(int objectDebugId)
|
||||
if (m_objectWatches.contains(objectDebugId))
|
||||
return true;
|
||||
|
||||
QmlDebugObjectReference ref = objectForId(objectDebugId);
|
||||
ObjectReference ref = objectForId(objectDebugId);
|
||||
if (ref.debugId() != objectDebugId)
|
||||
return false;
|
||||
|
||||
@@ -338,7 +340,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
|
||||
return;
|
||||
|
||||
if (m_engineClient) {
|
||||
disconnect(m_engineClient, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
disconnect(m_engineClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
||||
this, SLOT(updateStatus()));
|
||||
disconnect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)),
|
||||
this, SLOT(onResult(quint32,QVariant,QByteArray)));
|
||||
@@ -349,7 +351,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
|
||||
m_engineClient = client;
|
||||
|
||||
if (m_engineClient) {
|
||||
connect(m_engineClient, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||
connect(m_engineClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
||||
this, SLOT(updateStatus()));
|
||||
connect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)),
|
||||
this, SLOT(onResult(quint32,QVariant,QByteArray)));
|
||||
@@ -363,7 +365,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
|
||||
void QmlInspectorAgent::updateStatus()
|
||||
{
|
||||
if (m_engineClient
|
||||
&& (m_engineClient->status() == QmlDebugClient::Enabled)
|
||||
&& (m_engineClient->status() == QmlDebug::Enabled)
|
||||
&& debuggerCore()->boolSetting(ShowQmlObjectTree)) {
|
||||
reloadEngines();
|
||||
} else {
|
||||
@@ -381,24 +383,24 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
|
||||
|
||||
if (type == _("FETCH_OBJECT_R")) {
|
||||
log(LogReceive, _("FETCH_OBJECT_R %1").arg(
|
||||
qvariant_cast<QmlDebugObjectReference>(value).idString()));
|
||||
qvariant_cast<ObjectReference>(value).idString()));
|
||||
} else {
|
||||
log(LogReceive, QLatin1String(type));
|
||||
}
|
||||
|
||||
if (m_objectTreeQueryIds.contains(queryId)) {
|
||||
m_objectTreeQueryIds.removeOne(queryId);
|
||||
objectTreeFetched(qvariant_cast<QmlDebugObjectReference>(value));
|
||||
objectTreeFetched(qvariant_cast<ObjectReference>(value));
|
||||
} else if (queryId == m_engineQueryId) {
|
||||
m_engineQueryId = 0;
|
||||
updateEngineList(qvariant_cast<QmlDebugEngineReferenceList>(value));
|
||||
updateEngineList(qvariant_cast<QList<EngineReference> >(value));
|
||||
} else if (queryId == m_rootContextQueryId) {
|
||||
m_rootContextQueryId = 0;
|
||||
rootContextChanged(qvariant_cast<QmlDebugContextReference>(value));
|
||||
rootContextChanged(qvariant_cast<ContextReference>(value));
|
||||
} else if (m_fetchCurrentObjectsQueryIds.contains(queryId)) {
|
||||
m_fetchCurrentObjectsQueryIds.removeOne(queryId);
|
||||
QmlDebugObjectReference obj
|
||||
= qvariant_cast<QmlDebugObjectReference>(value);
|
||||
ObjectReference obj
|
||||
= qvariant_cast<ObjectReference>(value);
|
||||
m_fetchCurrentObjects.push_front(obj);
|
||||
onCurrentObjectsFetched(obj);
|
||||
} else {
|
||||
@@ -447,10 +449,10 @@ void QmlInspectorAgent::queryEngineContext(int id)
|
||||
log(LogSend, QString("LIST_OBJECTS %1").arg(QString::number(id)));
|
||||
|
||||
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)
|
||||
qDebug() << __FUNCTION__ << "(" << obj << ")";
|
||||
@@ -468,7 +470,7 @@ quint32 QmlInspectorAgent::fetchContextObject(const QmlDebugObjectReference &obj
|
||||
}
|
||||
|
||||
// fetch the root objects from the context + any child contexts
|
||||
void QmlInspectorAgent::fetchRootObjects(const QmlDebugContextReference &context,
|
||||
void QmlInspectorAgent::fetchRootObjects(const ContextReference &context,
|
||||
bool clear)
|
||||
{
|
||||
if (debug)
|
||||
@@ -482,7 +484,7 @@ void QmlInspectorAgent::fetchRootObjects(const QmlDebugContextReference &context
|
||||
m_rootObjects.clear();
|
||||
m_objectTreeQueryIds.clear();
|
||||
}
|
||||
foreach (const QmlDebugObjectReference & obj, context.objects()) {
|
||||
foreach (const ObjectReference & obj, context.objects()) {
|
||||
quint32 queryId = 0;
|
||||
using namespace QmlDebug::Constants;
|
||||
if (m_engineClient->objectName() == QML_DEBUGGER &&
|
||||
@@ -497,11 +499,11 @@ void QmlInspectorAgent::fetchRootObjects(const QmlDebugContextReference &context
|
||||
if (queryId)
|
||||
m_objectTreeQueryIds << queryId;
|
||||
}
|
||||
foreach (const QmlDebugContextReference &child, context.contexts())
|
||||
foreach (const ContextReference &child, context.contexts())
|
||||
fetchRootObjects(child, false);
|
||||
}
|
||||
|
||||
void QmlInspectorAgent::updateEngineList(const QmlDebugEngineReferenceList &engines)
|
||||
void QmlInspectorAgent::updateEngineList(const QList<EngineReference> &engines)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << __FUNCTION__ << "(" << engines << ")";
|
||||
@@ -512,7 +514,7 @@ void QmlInspectorAgent::updateEngineList(const QmlDebugEngineReferenceList &engi
|
||||
queryEngineContext(engines.first().debugId());
|
||||
}
|
||||
|
||||
void QmlInspectorAgent::rootContextChanged(const QmlDebugContextReference &context)
|
||||
void QmlInspectorAgent::rootContextChanged(const ContextReference &context)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << __FUNCTION__ << "(" << context << ")";
|
||||
@@ -520,7 +522,7 @@ void QmlInspectorAgent::rootContextChanged(const QmlDebugContextReference &conte
|
||||
fetchRootObjects(context, true);
|
||||
}
|
||||
|
||||
void QmlInspectorAgent::objectTreeFetched(const QmlDebugObjectReference &object)
|
||||
void QmlInspectorAgent::objectTreeFetched(const ObjectReference &object)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << __FUNCTION__ << "(" << object << ")";
|
||||
@@ -532,14 +534,14 @@ void QmlInspectorAgent::objectTreeFetched(const QmlDebugObjectReference &object)
|
||||
m_debugIdHash.clear();
|
||||
m_debugIdHash.reserve(old_count + 1);
|
||||
m_debugIdToIname.clear();
|
||||
foreach (const QmlDebugObjectReference &it, m_rootObjects)
|
||||
foreach (const ObjectReference &it, m_rootObjects)
|
||||
buildDebugIdHashRecursive(it);
|
||||
|
||||
emit objectTreeUpdated();
|
||||
|
||||
// sync tree with watchhandler
|
||||
QList<WatchData> watchData;
|
||||
foreach (const QmlDebugObjectReference &obj, m_rootObjects)
|
||||
foreach (const ObjectReference &obj, m_rootObjects)
|
||||
watchData.append(buildWatchData(obj, WatchData()));
|
||||
|
||||
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)
|
||||
qDebug() << __FUNCTION__ << "( " << obj << ")";
|
||||
@@ -561,10 +563,10 @@ void QmlInspectorAgent::onCurrentObjectsFetched(const QmlDebugObjectReference &o
|
||||
if (debug)
|
||||
qDebug() << " adding" << m_fetchCurrentObjects << "to tree";
|
||||
|
||||
foreach (const QmlDebugObjectReference &o, m_fetchCurrentObjects)
|
||||
foreach (const ObjectReference &o, m_fetchCurrentObjects)
|
||||
addObjectToTree(o, false);
|
||||
|
||||
QmlDebugObjectReference last = m_fetchCurrentObjects.last();
|
||||
ObjectReference last = m_fetchCurrentObjects.last();
|
||||
m_fetchCurrentObjects.clear();
|
||||
|
||||
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.
|
||||
bool QmlInspectorAgent::getObjectHierarchy(const QmlDebugObjectReference &obj)
|
||||
bool QmlInspectorAgent::getObjectHierarchy(const ObjectReference &obj)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << __FUNCTION__ << "(" << obj << ")";
|
||||
|
||||
QmlDebugObjectReference parent = objectForId(obj.parentId());
|
||||
ObjectReference parent = objectForId(obj.parentId());
|
||||
//for root object
|
||||
if (obj.parentId() == -1)
|
||||
return true;
|
||||
@@ -596,14 +598,14 @@ bool QmlInspectorAgent::getObjectHierarchy(const QmlDebugObjectReference &obj)
|
||||
//for other objects
|
||||
if (parent.debugId() == -1 || parent.needsMoreData()) {
|
||||
m_fetchCurrentObjectsQueryIds
|
||||
<< fetchContextObject(QmlDebugObjectReference(obj.parentId()));
|
||||
<< fetchContextObject(ObjectReference(obj.parentId()));
|
||||
} else {
|
||||
return getObjectHierarchy(parent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void QmlInspectorAgent::buildDebugIdHashRecursive(const QmlDebugObjectReference &ref)
|
||||
void QmlInspectorAgent::buildDebugIdHashRecursive(const ObjectReference &ref)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << __FUNCTION__ << "(" << ref << ")";
|
||||
@@ -631,7 +633,7 @@ void QmlInspectorAgent::buildDebugIdHashRecursive(const QmlDebugObjectReference
|
||||
if (!m_debugIdHash[file][location].contains(ref.debugId()))
|
||||
m_debugIdHash[file][location].append(ref.debugId());
|
||||
|
||||
foreach (const QmlDebugObjectReference &it, ref.children())
|
||||
foreach (const ObjectReference &it, ref.children())
|
||||
buildDebugIdHashRecursive(it);
|
||||
}
|
||||
|
||||
@@ -647,7 +649,7 @@ static QByteArray buildIName(const WatchData &parent, const QString &name)
|
||||
return parent.iname + "." + name.toLatin1();
|
||||
}
|
||||
|
||||
QList<WatchData> QmlInspectorAgent::buildWatchData(const QmlDebugObjectReference &obj,
|
||||
QList<WatchData> QmlInspectorAgent::buildWatchData(const ObjectReference &obj,
|
||||
const WatchData &parent)
|
||||
{
|
||||
if (debug)
|
||||
@@ -686,7 +688,7 @@ QList<WatchData> QmlInspectorAgent::buildWatchData(const QmlDebugObjectReference
|
||||
|
||||
list.append(propertiesWatch);
|
||||
|
||||
foreach (const QmlDebugPropertyReference &property, obj.properties()) {
|
||||
foreach (const PropertyReference &property, obj.properties()) {
|
||||
WatchData propertyWatch;
|
||||
propertyWatch.exp = property.name().toLatin1();
|
||||
propertyWatch.name = property.name();
|
||||
@@ -699,12 +701,12 @@ QList<WatchData> QmlInspectorAgent::buildWatchData(const QmlDebugObjectReference
|
||||
}
|
||||
|
||||
// recurse
|
||||
foreach (const QmlDebugObjectReference &child, obj.children())
|
||||
foreach (const ObjectReference &child, obj.children())
|
||||
list.append(buildWatchData(child, objWatch));
|
||||
return list;
|
||||
}
|
||||
|
||||
void QmlInspectorAgent::addObjectToTree(const QmlDebugObjectReference &obj,
|
||||
void QmlInspectorAgent::addObjectToTree(const ObjectReference &obj,
|
||||
bool notify)
|
||||
{
|
||||
int count = m_rootObjects.count();
|
||||
@@ -735,28 +737,28 @@ void QmlInspectorAgent::addObjectToTree(const QmlDebugObjectReference &obj,
|
||||
}
|
||||
}
|
||||
|
||||
QmlDebugObjectReference QmlInspectorAgent::objectForId(int debugId,
|
||||
const QmlDebugObjectReference &objectRef) const
|
||||
ObjectReference QmlInspectorAgent::objectForId(int debugId,
|
||||
const ObjectReference &objectRef) const
|
||||
{
|
||||
if (objectRef.debugId() == debugId)
|
||||
return objectRef;
|
||||
|
||||
foreach (const QmlDebugObjectReference &child, objectRef.children()) {
|
||||
QmlDebugObjectReference result = objectForId(debugId, child);
|
||||
foreach (const ObjectReference &child, objectRef.children()) {
|
||||
ObjectReference result = objectForId(debugId, child);
|
||||
if (result.debugId() == debugId)
|
||||
return result;
|
||||
}
|
||||
|
||||
return QmlDebugObjectReference();
|
||||
return ObjectReference();
|
||||
}
|
||||
|
||||
QList<QmlDebugObjectReference> QmlInspectorAgent::objects(
|
||||
const QmlDebugObjectReference &objectRef) const
|
||||
QList<ObjectReference> QmlInspectorAgent::objects(
|
||||
const ObjectReference &objectRef) const
|
||||
{
|
||||
QList<QmlDebugObjectReference> result;
|
||||
QList<ObjectReference> result;
|
||||
result.append(objectRef);
|
||||
|
||||
foreach (const QmlDebugObjectReference &child, objectRef.children())
|
||||
foreach (const ObjectReference &child, objectRef.children())
|
||||
result.append(objects(child));
|
||||
|
||||
return result;
|
||||
@@ -779,7 +781,7 @@ void QmlInspectorAgent::log(QmlInspectorAgent::LogDirection direction,
|
||||
bool QmlInspectorAgent::isConnected()
|
||||
{
|
||||
return m_engineClient
|
||||
&& (m_engineClient->status() == QmlDebugClient::Enabled);
|
||||
&& (m_engineClient->status() == QmlDebug::Enabled);
|
||||
}
|
||||
|
||||
} // Internal
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include <qmldebug/baseenginedebugclient.h>
|
||||
#include <watchdata.h>
|
||||
|
||||
using namespace QmlDebug;
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
class DebuggerEngine;
|
||||
@@ -77,11 +75,11 @@ public:
|
||||
quint32 resetBindingForObject(int objectDebugId,
|
||||
const QString &propertyName);
|
||||
|
||||
QList<QmlDebugObjectReference> objects() const;
|
||||
QmlDebugObjectReference objectForId(int debugId) const;
|
||||
QmlDebugObjectReference objectForId(const QString &objectId) const;
|
||||
QmlDebugObjectReference objectForLocation(int line, int column) const;
|
||||
QList<QmlDebugObjectReference> rootObjects() const { return m_rootObjects; }
|
||||
QList<QmlDebug::ObjectReference> objects() const;
|
||||
QmlDebug::ObjectReference objectForId(int debugId) const;
|
||||
QmlDebug::ObjectReference objectForId(const QString &objectId) const;
|
||||
QmlDebug::ObjectReference objectForLocation(int line, int column) const;
|
||||
QList<QmlDebug::ObjectReference> rootObjects() const { return m_rootObjects; }
|
||||
DebugIdHash debugIdHash() const { return m_debugIdHash; }
|
||||
|
||||
bool addObjectWatch(int objectDebugId);
|
||||
@@ -89,11 +87,11 @@ public:
|
||||
bool removeObjectWatch(int objectDebugId);
|
||||
void removeAllObjectWatches();
|
||||
|
||||
void setEngineClient(BaseEngineDebugClient *client);
|
||||
void setEngineClient(QmlDebug::BaseEngineDebugClient *client);
|
||||
|
||||
signals:
|
||||
void objectTreeUpdated();
|
||||
void objectFetched(const QmlDebugObjectReference &ref);
|
||||
void objectFetched(const QmlDebug::ObjectReference &ref);
|
||||
void expressionResult(quint32 queryId, const QVariant &value);
|
||||
void propertyChanged(int debugId, const QByteArray &propertyName,
|
||||
const QVariant &propertyValue);
|
||||
@@ -106,26 +104,26 @@ private slots:
|
||||
private:
|
||||
void reloadEngines();
|
||||
void queryEngineContext(int id);
|
||||
quint32 fetchContextObject(const QmlDebugObjectReference &obj);
|
||||
void fetchRootObjects(const QmlDebugContextReference &context, bool clear);
|
||||
quint32 fetchContextObject(const QmlDebug::ObjectReference &obj);
|
||||
void fetchRootObjects(const QmlDebug::ContextReference &context, bool clear);
|
||||
|
||||
void updateEngineList(const QmlDebugEngineReferenceList &engines);
|
||||
void rootContextChanged(const QmlDebugContextReference &context);
|
||||
void objectTreeFetched(const QmlDebugObjectReference &result);
|
||||
void onCurrentObjectsFetched(const QmlDebugObjectReference &result);
|
||||
bool getObjectHierarchy(const QmlDebugObjectReference &object);
|
||||
void updateEngineList(const QList<QmlDebug::EngineReference> &engines);
|
||||
void rootContextChanged(const QmlDebug::ContextReference &context);
|
||||
void objectTreeFetched(const QmlDebug::ObjectReference &result);
|
||||
void onCurrentObjectsFetched(const QmlDebug::ObjectReference &result);
|
||||
bool getObjectHierarchy(const QmlDebug::ObjectReference &object);
|
||||
|
||||
|
||||
void buildDebugIdHashRecursive(const QmlDebugObjectReference &ref);
|
||||
QList<WatchData> buildWatchData(const QmlDebugObjectReference &obj,
|
||||
void buildDebugIdHashRecursive(const QmlDebug::ObjectReference &ref);
|
||||
QList<WatchData> buildWatchData(const QmlDebug::ObjectReference &obj,
|
||||
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,
|
||||
const QmlDebugObjectReference &ref) const;
|
||||
QList<QmlDebugObjectReference> objects(
|
||||
const QmlDebugObjectReference &objectRef) const;
|
||||
const QmlDebug::ObjectReference &ref) const;
|
||||
QList<QmlDebug::ObjectReference> objects(
|
||||
const QmlDebug::ObjectReference &objectRef) const;
|
||||
|
||||
|
||||
enum LogDirection {
|
||||
@@ -144,10 +142,10 @@ private:
|
||||
quint32 m_rootContextQueryId;
|
||||
int m_objectToSelect;
|
||||
QList<quint32> m_objectTreeQueryIds;
|
||||
QList<QmlDebugObjectReference> m_rootObjects;
|
||||
QList<QmlDebug::ObjectReference> m_rootObjects;
|
||||
QList<quint32> m_fetchCurrentObjectsQueryIds;
|
||||
QList<QmlDebugObjectReference> m_fetchCurrentObjects;
|
||||
QmlDebugEngineReferenceList m_engines;
|
||||
QList<QmlDebug::ObjectReference> m_fetchCurrentObjects;
|
||||
QList<QmlDebug::EngineReference> m_engines;
|
||||
QHash<int, QByteArray> m_debugIdToIname;
|
||||
DebugIdHash m_debugIdHash;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace QmlDebug;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
|
||||
@@ -422,14 +423,14 @@ void QmlLiveTextPreview::setApplyChangesToQmlInspector(bool applyChanges)
|
||||
m_applyChangesToQmlInspector = applyChanges;
|
||||
}
|
||||
|
||||
static QList<int> findRootObjectRecursive(const QmlDebugObjectReference &object,
|
||||
static QList<int> findRootObjectRecursive(const ObjectReference &object,
|
||||
const Document::Ptr &doc)
|
||||
{
|
||||
QList<int> result;
|
||||
if (object.className() == doc->componentName())
|
||||
result += object.debugId();
|
||||
|
||||
foreach (const QmlDebugObjectReference &it, object.children()) {
|
||||
foreach (const ObjectReference &it, object.children()) {
|
||||
result += findRootObjectRecursive(it, doc);
|
||||
}
|
||||
return result;
|
||||
@@ -468,7 +469,7 @@ void QmlLiveTextPreview::updateDebugIds()
|
||||
if (doc->qmlProgram()->members && doc->qmlProgram()->members->member) {
|
||||
UiObjectMember *root = doc->qmlProgram()->members->member;
|
||||
QList<int> r;
|
||||
foreach (const QmlDebugObjectReference& it,
|
||||
foreach (const ObjectReference& it,
|
||||
m_inspectorAdapter->agent()->rootObjects()) {
|
||||
r += findRootObjectRecursive(it, doc);
|
||||
}
|
||||
@@ -516,7 +517,7 @@ void QmlLiveTextPreview::changeSelectedElements(QList<int> offsets,
|
||||
|
||||
m_updateNodeForOffset = false;
|
||||
m_lastOffsets = offsets;
|
||||
QmlDebugObjectReference objectRefUnderCursor;
|
||||
ObjectReference objectRefUnderCursor;
|
||||
objectRefUnderCursor
|
||||
= m_inspectorAdapter->agent()->objectForId(wordAtCursor);
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ void QmlProfilerClientManager::retryMessageBoxFinished(int result)
|
||||
void QmlProfilerClientManager::qmlComplete()
|
||||
{
|
||||
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();
|
||||
// once complete is sent, reset the flags
|
||||
d->qmlDataReady = false;
|
||||
@@ -354,7 +354,7 @@ void QmlProfilerClientManager::qmlComplete()
|
||||
void QmlProfilerClientManager::v8Complete()
|
||||
{
|
||||
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();
|
||||
// once complete is sent, reset the flags
|
||||
d->v8DataReady = false;
|
||||
|
||||
Reference in New Issue
Block a user