Commit ce134d37 authored by Olivier Goffart's avatar Olivier Goffart
Browse files

QmlDebugger: use another way for detecting new objects

parent 70ffe5ed
......@@ -66,6 +66,7 @@ public:
void message(const QByteArray &);
QDeclarativeEngineDebugClient *client;
QDeclarativeEngineDebug *q_ptr;
int nextId;
int getId();
......@@ -371,12 +372,15 @@ void QDeclarativeEngineDebugPrivate::message(const QByteArray &data)
if (!watch)
return;
emit watch->valueChanged(name, value);
} else if (type == "OBJECT_CREATED") {
emit q_ptr->newObjects();
}
}
QDeclarativeEngineDebug::QDeclarativeEngineDebug(QDeclarativeDebugConnection *client, QObject *parent)
: QObject(parent), d_ptr(new QDeclarativeEngineDebugPrivate(client))
{
d_ptr->q_ptr = this;
}
QDeclarativeEngineDebug::~QDeclarativeEngineDebug() {}
......
......@@ -100,6 +100,9 @@ public:
bool resetBindingForObject(int objectDebugId, const QString &propertyName);
bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
signals:
void newObjects();
private:
Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
Q_DISABLE_COPY(QDeclarativeEngineDebug)
......
......@@ -52,8 +52,11 @@ ClientProxy::ClientProxy(Debugger::Internal::QmlAdapter *adapter, QObject *paren
, m_engineQuery(0)
, m_contextQuery(0)
{
m_requestObjectsTimer.setSingleShot(true);
m_requestObjectsTimer.setInterval(3000);
connect(m_adapter, SIGNAL(aboutToDisconnect()), SLOT(disconnectFromServer()));
connect(m_client, SIGNAL(newObjects()), this, SLOT(newObjects()));
connect(&m_requestObjectsTimer, SIGNAL(timeout()), this, SLOT(refreshObjectTree()));
connectToServer();
}
......@@ -82,8 +85,8 @@ void ClientProxy::connectToServer()
SIGNAL(selectedColorChanged(QColor)));
connect(m_designClient, SIGNAL(contextPathUpdated(QStringList)),
SIGNAL(contextPathUpdated(QStringList)));
connect(m_designClient, SIGNAL(treeRefreshRequested()),
SLOT(refreshObjectTree()));
/* connect(m_designClient, SIGNAL(treeRefreshRequested()),
SLOT(refreshObjectTree()));*/
reloadEngines();
}
......@@ -131,6 +134,7 @@ void ClientProxy::disconnectFromServer()
void ClientProxy::refreshObjectTree()
{
if (!m_contextQuery) {
m_requestObjectsTimer.stop();
qDeleteAll(m_objectTreeQuery);
m_objectTreeQuery.clear();
queryEngineContext(m_engines.value(0).debugId());
......@@ -286,6 +290,7 @@ void ClientProxy::contextChanged()
qDeleteAll(m_objectTreeQuery);
m_objectTreeQuery.clear();
m_requestObjectsTimer.stop();
fetchContextObjectRecusrsive(rootContext);
}
......@@ -443,3 +448,10 @@ bool ClientProxy::isConnected() const
{
return m_adapter->isConnected();
}
void ClientProxy::newObjects()
{
if (!m_requestObjectsTimer.isActive())
m_requestObjectsTimer.start();
}
......@@ -125,6 +125,7 @@ private slots:
void updateEngineList();
void objectTreeFetched(QDeclarativeDebugQuery::State state = QDeclarativeDebugQuery::Completed);
void fetchContextObjectRecusrsive(const QmlJsDebugClient::QDeclarativeDebugContextReference& context);
void newObjects();
private:
bool isDesignClientConnected() const;
......@@ -146,6 +147,7 @@ private:
QList<QDeclarativeDebugObjectReference> m_rootObjects;
QList<QDeclarativeDebugEngineReference> m_engines;
QTimer m_requestObjectsTimer;
};
} // namespace Internal
......
......@@ -109,7 +109,7 @@ void QmlJSDesignDebugClient::messageReceived(const QByteArray &message)
ds >> contextPath;
emit contextPathUpdated(contextPath);
} else if (type == "SCENE_ITEM_COUNT_CHANGED") {
emit treeRefreshRequested();
//emit treeRefreshRequested();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment