forked from qt-creator/qt-creator
QmlDebugger: use another way for detecting new objects
This commit is contained in:
@@ -66,6 +66,7 @@ public:
|
|||||||
void message(const QByteArray &);
|
void message(const QByteArray &);
|
||||||
|
|
||||||
QDeclarativeEngineDebugClient *client;
|
QDeclarativeEngineDebugClient *client;
|
||||||
|
QDeclarativeEngineDebug *q_ptr;
|
||||||
int nextId;
|
int nextId;
|
||||||
int getId();
|
int getId();
|
||||||
|
|
||||||
@@ -371,12 +372,15 @@ void QDeclarativeEngineDebugPrivate::message(const QByteArray &data)
|
|||||||
if (!watch)
|
if (!watch)
|
||||||
return;
|
return;
|
||||||
emit watch->valueChanged(name, value);
|
emit watch->valueChanged(name, value);
|
||||||
|
} else if (type == "OBJECT_CREATED") {
|
||||||
|
emit q_ptr->newObjects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeEngineDebug::QDeclarativeEngineDebug(QDeclarativeDebugConnection *client, QObject *parent)
|
QDeclarativeEngineDebug::QDeclarativeEngineDebug(QDeclarativeDebugConnection *client, QObject *parent)
|
||||||
: QObject(parent), d_ptr(new QDeclarativeEngineDebugPrivate(client))
|
: QObject(parent), d_ptr(new QDeclarativeEngineDebugPrivate(client))
|
||||||
{
|
{
|
||||||
|
d_ptr->q_ptr = this;
|
||||||
}
|
}
|
||||||
QDeclarativeEngineDebug::~QDeclarativeEngineDebug() {}
|
QDeclarativeEngineDebug::~QDeclarativeEngineDebug() {}
|
||||||
|
|
||||||
|
@@ -100,6 +100,9 @@ public:
|
|||||||
bool resetBindingForObject(int objectDebugId, const QString &propertyName);
|
bool resetBindingForObject(int objectDebugId, const QString &propertyName);
|
||||||
bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
|
bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void newObjects();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
|
Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
|
||||||
Q_DISABLE_COPY(QDeclarativeEngineDebug)
|
Q_DISABLE_COPY(QDeclarativeEngineDebug)
|
||||||
|
@@ -52,8 +52,11 @@ ClientProxy::ClientProxy(Debugger::Internal::QmlAdapter *adapter, QObject *paren
|
|||||||
, m_engineQuery(0)
|
, m_engineQuery(0)
|
||||||
, m_contextQuery(0)
|
, m_contextQuery(0)
|
||||||
{
|
{
|
||||||
|
m_requestObjectsTimer.setSingleShot(true);
|
||||||
|
m_requestObjectsTimer.setInterval(3000);
|
||||||
connect(m_adapter, SIGNAL(aboutToDisconnect()), SLOT(disconnectFromServer()));
|
connect(m_adapter, SIGNAL(aboutToDisconnect()), SLOT(disconnectFromServer()));
|
||||||
|
connect(m_client, SIGNAL(newObjects()), this, SLOT(newObjects()));
|
||||||
|
connect(&m_requestObjectsTimer, SIGNAL(timeout()), this, SLOT(refreshObjectTree()));
|
||||||
connectToServer();
|
connectToServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,8 +85,8 @@ void ClientProxy::connectToServer()
|
|||||||
SIGNAL(selectedColorChanged(QColor)));
|
SIGNAL(selectedColorChanged(QColor)));
|
||||||
connect(m_designClient, SIGNAL(contextPathUpdated(QStringList)),
|
connect(m_designClient, SIGNAL(contextPathUpdated(QStringList)),
|
||||||
SIGNAL(contextPathUpdated(QStringList)));
|
SIGNAL(contextPathUpdated(QStringList)));
|
||||||
connect(m_designClient, SIGNAL(treeRefreshRequested()),
|
/* connect(m_designClient, SIGNAL(treeRefreshRequested()),
|
||||||
SLOT(refreshObjectTree()));
|
SLOT(refreshObjectTree()));*/
|
||||||
|
|
||||||
reloadEngines();
|
reloadEngines();
|
||||||
}
|
}
|
||||||
@@ -131,6 +134,7 @@ void ClientProxy::disconnectFromServer()
|
|||||||
void ClientProxy::refreshObjectTree()
|
void ClientProxy::refreshObjectTree()
|
||||||
{
|
{
|
||||||
if (!m_contextQuery) {
|
if (!m_contextQuery) {
|
||||||
|
m_requestObjectsTimer.stop();
|
||||||
qDeleteAll(m_objectTreeQuery);
|
qDeleteAll(m_objectTreeQuery);
|
||||||
m_objectTreeQuery.clear();
|
m_objectTreeQuery.clear();
|
||||||
queryEngineContext(m_engines.value(0).debugId());
|
queryEngineContext(m_engines.value(0).debugId());
|
||||||
@@ -286,6 +290,7 @@ void ClientProxy::contextChanged()
|
|||||||
|
|
||||||
qDeleteAll(m_objectTreeQuery);
|
qDeleteAll(m_objectTreeQuery);
|
||||||
m_objectTreeQuery.clear();
|
m_objectTreeQuery.clear();
|
||||||
|
m_requestObjectsTimer.stop();
|
||||||
|
|
||||||
fetchContextObjectRecusrsive(rootContext);
|
fetchContextObjectRecusrsive(rootContext);
|
||||||
}
|
}
|
||||||
@@ -443,3 +448,10 @@ bool ClientProxy::isConnected() const
|
|||||||
{
|
{
|
||||||
return m_adapter->isConnected();
|
return m_adapter->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientProxy::newObjects()
|
||||||
|
{
|
||||||
|
if (!m_requestObjectsTimer.isActive())
|
||||||
|
m_requestObjectsTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -125,6 +125,7 @@ private slots:
|
|||||||
void updateEngineList();
|
void updateEngineList();
|
||||||
void objectTreeFetched(QDeclarativeDebugQuery::State state = QDeclarativeDebugQuery::Completed);
|
void objectTreeFetched(QDeclarativeDebugQuery::State state = QDeclarativeDebugQuery::Completed);
|
||||||
void fetchContextObjectRecusrsive(const QmlJsDebugClient::QDeclarativeDebugContextReference& context);
|
void fetchContextObjectRecusrsive(const QmlJsDebugClient::QDeclarativeDebugContextReference& context);
|
||||||
|
void newObjects();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isDesignClientConnected() const;
|
bool isDesignClientConnected() const;
|
||||||
@@ -146,6 +147,7 @@ private:
|
|||||||
|
|
||||||
QList<QDeclarativeDebugObjectReference> m_rootObjects;
|
QList<QDeclarativeDebugObjectReference> m_rootObjects;
|
||||||
QList<QDeclarativeDebugEngineReference> m_engines;
|
QList<QDeclarativeDebugEngineReference> m_engines;
|
||||||
|
QTimer m_requestObjectsTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -109,7 +109,7 @@ void QmlJSDesignDebugClient::messageReceived(const QByteArray &message)
|
|||||||
ds >> contextPath;
|
ds >> contextPath;
|
||||||
emit contextPathUpdated(contextPath);
|
emit contextPathUpdated(contextPath);
|
||||||
} else if (type == "SCENE_ITEM_COUNT_CHANGED") {
|
} else if (type == "SCENE_ITEM_COUNT_CHANGED") {
|
||||||
emit treeRefreshRequested();
|
//emit treeRefreshRequested();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user