summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-11-02 03:46:08 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-11-02 03:46:08 (GMT)
commit1795271ac03a8662ff0eac153c63c3d562f91921 (patch)
tree505258455ab2c430df22a2f5d79b2a17d0e4770b /src
parent9a3e15a05a0c6fb0797d4ef9029c0483ab495bdd (diff)
parent93b624c74f0486330c1e8f3aa3fe2b24d95f54b5 (diff)
downloadQt-1795271ac03a8662ff0eac153c63c3d562f91921.zip
Qt-1795271ac03a8662ff0eac153c63c3d562f91921.tar.gz
Qt-1795271ac03a8662ff0eac153c63c3d562f91921.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r--src/declarative/debugger/qmldebug.cpp42
-rw-r--r--src/declarative/qml/qmlenginedebug.cpp60
-rw-r--r--src/declarative/qml/qmlenginedebug_p.h2
3 files changed, 77 insertions, 27 deletions
diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp
index ebad10f..b06a250 100644
--- a/src/declarative/debugger/qmldebug.cpp
+++ b/src/declarative/debugger/qmldebug.cpp
@@ -150,6 +150,15 @@ void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o,
if (simple)
return;
+ int childCount;
+ bool recur;
+ ds >> childCount >> recur;
+
+ for (int ii = 0; ii < childCount; ++ii) {
+ o.m_children.append(QmlDebugObjectReference());
+ decode(ds, o.m_children.last(), !recur);
+ }
+
int propCount;
ds >> propCount;
@@ -162,25 +171,26 @@ void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o,
prop.m_binding = data.binding;
prop.m_hasNotifySignal = data.hasNotifySignal;
prop.m_valueTypeName = data.valueTypeName;
- if (data.type == QmlEngineDebugServer::QmlObjectProperty::Basic
- || data.type == QmlEngineDebugServer::QmlObjectProperty::List) {
- prop.m_value = data.value;
- } else if (data.type == QmlEngineDebugServer::QmlObjectProperty::Object) {
- QmlDebugObjectReference obj;
- obj.m_debugId = prop.m_value.toInt();
- prop.m_value = qVariantFromValue(obj);
+ switch (data.type) {
+ case QmlEngineDebugServer::QmlObjectProperty::Basic:
+ case QmlEngineDebugServer::QmlObjectProperty::List:
+ case QmlEngineDebugServer::QmlObjectProperty::SignalProperty:
+ {
+ prop.m_value = data.value;
+ break;
+ }
+ case QmlEngineDebugServer::QmlObjectProperty::Object:
+ {
+ QmlDebugObjectReference obj;
+ obj.m_debugId = prop.m_value.toInt();
+ prop.m_value = qVariantFromValue(obj);
+ break;
+ }
+ case QmlEngineDebugServer::QmlObjectProperty::Unknown:
+ break;
}
o.m_properties << prop;
}
-
- int childCount;
- bool recur;
- ds >> childCount >> recur;
-
- for (int ii = 0; ii < childCount; ++ii) {
- o.m_children.append(QmlDebugObjectReference());
- decode(ds, o.m_children.last(), !recur);
- }
}
void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugContextReference &c)
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp
index 05c5429..2d8acf7 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qmlenginedebug.cpp
@@ -143,7 +143,7 @@ QVariant QmlEngineDebugServer::valueContents(const QVariant &value) const
if (o) {
QString name = o->objectName();
if (name.isEmpty())
- name = QLatin1String("<unnamed>");
+ name = QLatin1String("<unnamed object>");
return name;
}
}
@@ -155,21 +155,61 @@ void QmlEngineDebugServer::buildObjectDump(QDataStream &message,
QObject *object, bool recur)
{
message << objectData(object);
- message << object->metaObject()->propertyCount();
- for (int ii = 0; ii < object->metaObject()->propertyCount(); ++ii)
- message << propertyData(object, ii);
+ // Some children aren't added to an object until particular properties are read
+ // - e.g. child state objects aren't added until the 'states' property is read -
+ // but this should only affect internal objects that aren't shown by the
+ // debugger anyway.
QObjectList children = object->children();
- message << children.count() << recur;
+
+ int childrenCount = children.count();
+ for (int ii = 0; ii < children.count(); ++ii) {
+ if (QmlBoundSignal::cast(children[ii]))
+ --childrenCount;
+ }
+
+ message << childrenCount << recur;
+
+ QList<QmlObjectProperty> fakeProperties;
for (int ii = 0; ii < children.count(); ++ii) {
QObject *child = children.at(ii);
- if (recur)
- buildObjectDump(message, child, recur);
- else
- message << objectData(child);
+ QmlBoundSignal *signal = QmlBoundSignal::cast(child);
+ if (signal) {
+ QmlObjectProperty prop;
+ prop.type = QmlObjectProperty::SignalProperty;
+ prop.hasNotifySignal = false;
+ QmlExpression *expr = signal->expression();
+ if (expr) {
+ prop.value = expr->expression();
+ QObject *scope = expr->scopeObject();
+ if (scope) {
+ QString sig = scope->metaObject()->method(signal->index()).signature();
+ int lparen = sig.indexOf(QLatin1Char('('));
+ if (lparen >= 0) {
+ QString methodName = sig.mid(0, lparen);
+ prop.name = QLatin1String("on") + methodName[0].toUpper()
+ + methodName.mid(1);
+ }
+ }
+ }
+ fakeProperties << prop;
+ } else {
+ if (recur)
+ buildObjectDump(message, child, recur);
+ else
+ message << objectData(child);
+ }
}
+
+ message << (object->metaObject()->propertyCount() + fakeProperties.count());
+
+ for (int ii = 0; ii < object->metaObject()->propertyCount(); ++ii)
+ message << propertyData(object, ii);
+
+ for (int ii = 0; ii < fakeProperties.count(); ++ii)
+ message << fakeProperties[ii];
}
void QmlEngineDebugServer::buildObjectList(QDataStream &message,
@@ -378,7 +418,7 @@ void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProp
QByteArray reply;
QDataStream rs(&reply, QIODevice::WriteOnly);
- rs << QByteArray("UPDATE_WATCH") << id << objectId << QString::fromUtf8(property.name()) << valueContents(value);
+ rs << QByteArray("UPDATE_WATCH") << id << objectId << QByteArray(property.name()) << valueContents(value);
sendMessage(reply);
}
diff --git a/src/declarative/qml/qmlenginedebug_p.h b/src/declarative/qml/qmlenginedebug_p.h
index 23e2c30..8ba3d38 100644
--- a/src/declarative/qml/qmlenginedebug_p.h
+++ b/src/declarative/qml/qmlenginedebug_p.h
@@ -81,7 +81,7 @@ public:
};
struct QmlObjectProperty {
- enum Type { Unknown, Basic, Object, List };
+ enum Type { Unknown, Basic, Object, List, SignalProperty };
Type type;
QString name;
QVariant value;