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)
}
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-><