Commit b2a2a7cc authored by Kai Koehne's avatar Kai Koehne

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: default avatarAurindam Jana <aurindam.jana@nokia.com>
parent e9277df8
...@@ -72,7 +72,7 @@ QDataStream &operator>>(QDataStream &ds, QmlObjectProperty &data) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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) ...@@ -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*/) ...@@ -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) ...@@ -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() ...@@ -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 & ...@@ -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 ...@@ -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, ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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);
......
...@@ -40,11 +40,11 @@ ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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>