forked from qt-creator/qt-creator
QmlDebugClient: Rename "status" to "state" for consistency
"state" is the more widely used term and we should follow that convention. We also need to distinguish between the state of the underlying network socket and the client itself. The change makes this explicit. As preparation for the upcoming centralized debug support the "State" enum of the debug client is also moved into the QmlDebugClient class. Change-Id: Ib9d7e03d23528f16ed696ed3518e813d11ea1c32 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -174,9 +174,9 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseEngineDebugClient::statusChanged(ClientStatus status)
|
void BaseEngineDebugClient::stateChanged(State state)
|
||||||
{
|
{
|
||||||
emit newStatus(status);
|
emit newState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseEngineDebugClient::messageReceived(const QByteArray &data)
|
void BaseEngineDebugClient::messageReceived(const QByteArray &data)
|
||||||
@@ -251,7 +251,7 @@ BaseEngineDebugClient::BaseEngineDebugClient(const QString &clientName,
|
|||||||
quint32 BaseEngineDebugClient::addWatch(const PropertyReference &property)
|
quint32 BaseEngineDebugClient::addWatch(const PropertyReference &property)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -273,7 +273,7 @@ quint32 BaseEngineDebugClient::addWatch(const ObjectReference &object,
|
|||||||
const QString &expr)
|
const QString &expr)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -286,7 +286,7 @@ quint32 BaseEngineDebugClient::addWatch(const ObjectReference &object,
|
|||||||
quint32 BaseEngineDebugClient::addWatch(int objectDebugId)
|
quint32 BaseEngineDebugClient::addWatch(int objectDebugId)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -304,7 +304,7 @@ quint32 BaseEngineDebugClient::addWatch(const FileReference &/*file*/)
|
|||||||
|
|
||||||
void BaseEngineDebugClient::removeWatch(quint32 id)
|
void BaseEngineDebugClient::removeWatch(quint32 id)
|
||||||
{
|
{
|
||||||
if (status() == Enabled) {
|
if (state() == Enabled) {
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
ds << QByteArray("NO_WATCH") << id;
|
ds << QByteArray("NO_WATCH") << id;
|
||||||
@@ -315,7 +315,7 @@ void BaseEngineDebugClient::removeWatch(quint32 id)
|
|||||||
quint32 BaseEngineDebugClient::queryAvailableEngines()
|
quint32 BaseEngineDebugClient::queryAvailableEngines()
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -328,7 +328,7 @@ quint32 BaseEngineDebugClient::queryAvailableEngines()
|
|||||||
quint32 BaseEngineDebugClient::queryRootContexts(const EngineReference &engine)
|
quint32 BaseEngineDebugClient::queryRootContexts(const EngineReference &engine)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && engine.m_debugId != -1) {
|
if (state() == Enabled && engine.m_debugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -341,7 +341,7 @@ quint32 BaseEngineDebugClient::queryRootContexts(const EngineReference &engine)
|
|||||||
quint32 BaseEngineDebugClient::queryObject(int objectId)
|
quint32 BaseEngineDebugClient::queryObject(int objectId)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectId != -1) {
|
if (state() == Enabled && objectId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -355,7 +355,7 @@ quint32 BaseEngineDebugClient::queryObject(int objectId)
|
|||||||
quint32 BaseEngineDebugClient::queryObjectRecursive(int objectId)
|
quint32 BaseEngineDebugClient::queryObjectRecursive(int objectId)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectId != -1) {
|
if (state() == Enabled && objectId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -371,7 +371,7 @@ quint32 BaseEngineDebugClient::queryExpressionResult(int objectDebugId,
|
|||||||
int engineId)
|
int engineId)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -390,7 +390,7 @@ quint32 BaseEngineDebugClient::setBindingForObject(
|
|||||||
QString source, int line)
|
QString source, int line)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -406,7 +406,7 @@ quint32 BaseEngineDebugClient::resetBindingForObject(
|
|||||||
const QString &propertyName)
|
const QString &propertyName)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -421,7 +421,7 @@ quint32 BaseEngineDebugClient::setMethodBody(
|
|||||||
const QString &methodBody)
|
const QString &methodBody)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -436,7 +436,7 @@ quint32 BaseEngineDebugClient::queryObjectsForLocation(
|
|||||||
const QString &fileName, int lineNumber, int columnNumber)
|
const QString &fileName, int lineNumber, int columnNumber)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|||||||
@@ -78,14 +78,14 @@ public:
|
|||||||
int columnNumber);
|
int columnNumber);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newStatus(QmlDebug::ClientStatus status);
|
void newState(QmlDebug::QmlDebugClient::State status);
|
||||||
void newObject(int engineId, int objectId, int parentId);
|
void newObject(int engineId, int objectId, int parentId);
|
||||||
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(ClientStatus status);
|
virtual void stateChanged(State status);
|
||||||
virtual void messageReceived(const QByteArray &);
|
virtual void messageReceived(const QByteArray &);
|
||||||
|
|
||||||
quint32 getId() { return m_nextId++; }
|
quint32 getId() { return m_nextId++; }
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ BaseToolsClient::BaseToolsClient(QmlDebugConnection* client, QLatin1String clien
|
|||||||
setObjectName(clientName);
|
setObjectName(clientName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseToolsClient::statusChanged(ClientStatus status)
|
void BaseToolsClient::stateChanged(State state)
|
||||||
{
|
{
|
||||||
emit newStatus(status);
|
emit newState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseToolsClient::recurseObjectIdList(const ObjectReference &ref,
|
void BaseToolsClient::recurseObjectIdList(const ObjectReference &ref,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
virtual void clearComponentCache() = 0;
|
virtual void clearComponentCache() = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newStatus(QmlDebug::ClientStatus status);
|
void newState(QmlDebug::QmlDebugClient::State status);
|
||||||
|
|
||||||
void currentObjectsChanged(const QList<int> &debugIds);
|
void currentObjectsChanged(const QList<int> &debugIds);
|
||||||
void selectToolActivated();
|
void selectToolActivated();
|
||||||
@@ -86,7 +86,7 @@ signals:
|
|||||||
void logActivity(QString client, QString message);
|
void logActivity(QString client, QString message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void statusChanged(ClientStatus status);
|
void stateChanged(State status);
|
||||||
|
|
||||||
void recurseObjectIdList(const ObjectReference &ref,
|
void recurseObjectIdList(const ObjectReference &ref,
|
||||||
QList<int> &debugIds, QList<QString> &objectIds);
|
QList<int> &debugIds, QList<QString> &objectIds);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ quint32 DeclarativeEngineDebugClient::setBindingForObject(
|
|||||||
QString source, int line)
|
QString source, int line)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -63,7 +63,7 @@ quint32 DeclarativeEngineDebugClient::resetBindingForObject(
|
|||||||
const QString &propertyName)
|
const QString &propertyName)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -78,7 +78,7 @@ quint32 DeclarativeEngineDebugClient::setMethodBody(
|
|||||||
const QString &methodBody)
|
const QString &methodBody)
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (status() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ QDebugMessageClient::~QDebugMessageClient()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDebugMessageClient::statusChanged(ClientStatus status)
|
void QDebugMessageClient::stateChanged(State state)
|
||||||
{
|
{
|
||||||
emit newStatus(status);
|
emit newState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDebugMessageClient::messageReceived(const QByteArray &data)
|
void QDebugMessageClient::messageReceived(const QByteArray &data)
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ public:
|
|||||||
~QDebugMessageClient();
|
~QDebugMessageClient();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void statusChanged(ClientStatus status);
|
virtual void stateChanged(State state);
|
||||||
virtual void messageReceived(const QByteArray &);
|
virtual void messageReceived(const QByteArray &);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newStatus(QmlDebug::ClientStatus);
|
void newState(QmlDebug::QmlDebugClient::State);
|
||||||
void message(QtMsgType, const QString &,
|
void message(QtMsgType, const QString &,
|
||||||
const QmlDebug::QDebugContextInfo &);
|
const QmlDebug::QDebugContextInfo &);
|
||||||
|
|
||||||
|
|||||||
@@ -150,10 +150,10 @@ void QmlDebugConnectionPrivate::readyRead()
|
|||||||
|
|
||||||
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
|
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
|
||||||
for (; iter != plugins.end(); ++iter) {
|
for (; iter != plugins.end(); ++iter) {
|
||||||
ClientStatus newStatus = Unavailable;
|
QmlDebugClient::State newState = QmlDebugClient::Unavailable;
|
||||||
if (serverPlugins.contains(iter.key()))
|
if (serverPlugins.contains(iter.key()))
|
||||||
newStatus = Enabled;
|
newState = QmlDebugClient::Enabled;
|
||||||
iter.value()->statusChanged(newStatus);
|
iter.value()->stateChanged(newState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,13 +189,13 @@ void QmlDebugConnectionPrivate::readyRead()
|
|||||||
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
|
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
|
||||||
for (; iter != plugins.end(); ++iter) {
|
for (; iter != plugins.end(); ++iter) {
|
||||||
const QString pluginName = iter.key();
|
const QString pluginName = iter.key();
|
||||||
ClientStatus newStatus = Unavailable;
|
QmlDebugClient::State newState = QmlDebugClient::Unavailable;
|
||||||
if (serverPlugins.contains(pluginName))
|
if (serverPlugins.contains(pluginName))
|
||||||
newStatus = Enabled;
|
newState = QmlDebugClient::Enabled;
|
||||||
|
|
||||||
if (oldServerPlugins.contains(pluginName)
|
if (oldServerPlugins.contains(pluginName)
|
||||||
!= serverPlugins.contains(pluginName)) {
|
!= serverPlugins.contains(pluginName)) {
|
||||||
iter.value()->statusChanged(newStatus);
|
iter.value()->stateChanged(newState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -225,24 +225,24 @@ QmlDebugConnection::~QmlDebugConnection()
|
|||||||
QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin();
|
QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin();
|
||||||
for (; iter != d->plugins.end(); ++iter) {
|
for (; iter != d->plugins.end(); ++iter) {
|
||||||
iter.value()->d_func()->connection = 0;
|
iter.value()->d_func()->connection = 0;
|
||||||
iter.value()->statusChanged(NotConnected);
|
iter.value()->stateChanged(QmlDebugClient::NotConnected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlDebugConnection::isConnected() const
|
bool QmlDebugConnection::isConnected() const
|
||||||
{
|
{
|
||||||
return state() == QAbstractSocket::ConnectedState;
|
return socketState() == QAbstractSocket::ConnectedState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlDebugConnection::close()
|
void QmlDebugConnection::close()
|
||||||
{
|
{
|
||||||
if (d->device->isOpen()) {
|
if (d->device->isOpen()) {
|
||||||
d->device->close();
|
d->device->close();
|
||||||
emit stateChanged(QAbstractSocket::UnconnectedState);
|
emit socketStateChanged(QAbstractSocket::UnconnectedState);
|
||||||
|
|
||||||
QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin();
|
QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin();
|
||||||
for (; iter != d->plugins.end(); ++iter) {
|
for (; iter != d->plugins.end(); ++iter) {
|
||||||
iter.value()->statusChanged(NotConnected);
|
iter.value()->stateChanged(QmlDebugClient::NotConnected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ QString QmlDebugConnection::errorString() const
|
|||||||
|
|
||||||
// For ease of refactoring we use QAbstractSocket's states even if we're actually using a OstChannel underneath
|
// For ease of refactoring we use QAbstractSocket's states even if we're actually using a OstChannel underneath
|
||||||
// since serial ports have a subset of the socket states afaics
|
// since serial ports have a subset of the socket states afaics
|
||||||
QAbstractSocket::SocketState QmlDebugConnection::state() const
|
QAbstractSocket::SocketState QmlDebugConnection::socketState() const
|
||||||
{
|
{
|
||||||
QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
|
QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
|
||||||
if (socket)
|
if (socket)
|
||||||
@@ -280,7 +280,7 @@ void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
|
|||||||
d->protocol = new QPacketProtocol(d->device, this);
|
d->protocol = new QPacketProtocol(d->device, this);
|
||||||
connect(d->protocol, SIGNAL(readyRead()), d, SLOT(readyRead()));
|
connect(d->protocol, SIGNAL(readyRead()), d, SLOT(readyRead()));
|
||||||
d->gotHello = false;
|
d->gotHello = false;
|
||||||
connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
|
connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(socketStateChanged(QAbstractSocket::SocketState)));
|
||||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
|
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||||
connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
|
connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
|
||||||
socket->connectToHost(hostName, port);
|
socket->connectToHost(hostName, port);
|
||||||
@@ -336,7 +336,7 @@ float QmlDebugClient::serviceVersion() const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientStatus QmlDebugClient::status() const
|
QmlDebugClient::State QmlDebugClient::state() const
|
||||||
{
|
{
|
||||||
Q_D(const QmlDebugClient);
|
Q_D(const QmlDebugClient);
|
||||||
if (!d->connection
|
if (!d->connection
|
||||||
@@ -353,7 +353,7 @@ ClientStatus QmlDebugClient::status() const
|
|||||||
void QmlDebugClient::sendMessage(const QByteArray &message)
|
void QmlDebugClient::sendMessage(const QByteArray &message)
|
||||||
{
|
{
|
||||||
Q_D(QmlDebugClient);
|
Q_D(QmlDebugClient);
|
||||||
if (status() != Enabled)
|
if (state() != Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPacket pack;
|
QPacket pack;
|
||||||
@@ -362,7 +362,7 @@ void QmlDebugClient::sendMessage(const QByteArray &message)
|
|||||||
d->connection->flush();
|
d->connection->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlDebugClient::statusChanged(ClientStatus)
|
void QmlDebugClient::stateChanged(State)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ public:
|
|||||||
void connectToHost(const QString &hostName, quint16 port);
|
void connectToHost(const QString &hostName, quint16 port);
|
||||||
|
|
||||||
bool isConnected() const;
|
bool isConnected() const;
|
||||||
QAbstractSocket::SocketState state() const;
|
QAbstractSocket::SocketState socketState() const;
|
||||||
void flush();
|
void flush();
|
||||||
void close();
|
void close();
|
||||||
QString errorString() const;
|
QString errorString() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void connected();
|
void connected();
|
||||||
void stateChanged(QAbstractSocket::SocketState socketState);
|
void socketStateChanged(QAbstractSocket::SocketState state);
|
||||||
void error(QAbstractSocket::SocketError socketError);
|
void error(QAbstractSocket::SocketError socketError);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -65,12 +65,6 @@ private:
|
|||||||
friend class QmlDebugClientPrivate;
|
friend class QmlDebugClientPrivate;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ClientStatus {
|
|
||||||
NotConnected,
|
|
||||||
Unavailable,
|
|
||||||
Enabled
|
|
||||||
};
|
|
||||||
|
|
||||||
class QmlDebugClientPrivate;
|
class QmlDebugClientPrivate;
|
||||||
class QMLDEBUG_EXPORT QmlDebugClient : public QObject
|
class QMLDEBUG_EXPORT QmlDebugClient : public QObject
|
||||||
{
|
{
|
||||||
@@ -79,17 +73,19 @@ class QMLDEBUG_EXPORT QmlDebugClient : public QObject
|
|||||||
Q_DISABLE_COPY(QmlDebugClient)
|
Q_DISABLE_COPY(QmlDebugClient)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum State { NotConnected, Unavailable, Enabled };
|
||||||
|
|
||||||
QmlDebugClient(const QString &, QmlDebugConnection *parent);
|
QmlDebugClient(const QString &, QmlDebugConnection *parent);
|
||||||
~QmlDebugClient();
|
~QmlDebugClient();
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
float serviceVersion() const;
|
float serviceVersion() const;
|
||||||
ClientStatus status() const;
|
State state() const;
|
||||||
|
|
||||||
virtual void sendMessage(const QByteArray &);
|
virtual void sendMessage(const QByteArray &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void statusChanged(ClientStatus);
|
virtual void stateChanged(State);
|
||||||
virtual void messageReceived(const QByteArray &);
|
virtual void messageReceived(const QByteArray &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void QmlProfilerTraceClient::sendRecordingStatus()
|
|||||||
|
|
||||||
bool QmlProfilerTraceClient::isEnabled() const
|
bool QmlProfilerTraceClient::isEnabled() const
|
||||||
{
|
{
|
||||||
return status() == Enabled;
|
return state() == Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProfilerTraceClient::isRecording() const
|
bool QmlProfilerTraceClient::isRecording() const
|
||||||
@@ -118,7 +118,7 @@ void QmlProfilerTraceClient::setRecording(bool v)
|
|||||||
|
|
||||||
d->recording = v;
|
d->recording = v;
|
||||||
|
|
||||||
if (status() == Enabled)
|
if (state() == Enabled)
|
||||||
sendRecordingStatus();
|
sendRecordingStatus();
|
||||||
|
|
||||||
emit recordingChanged(v);
|
emit recordingChanged(v);
|
||||||
@@ -132,7 +132,7 @@ void QmlProfilerTraceClient::setRecordingFromServer(bool v)
|
|||||||
emit recordingChanged(v);
|
emit recordingChanged(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTraceClient::statusChanged(ClientStatus /*status*/)
|
void QmlProfilerTraceClient::stateChanged(State /*status*/)
|
||||||
{
|
{
|
||||||
emit enabledChanged();
|
emit enabledChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ signals:
|
|||||||
void cleared();
|
void cleared();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void statusChanged(ClientStatus status);
|
virtual void stateChanged(State status);
|
||||||
virtual void messageReceived(const QByteArray &);
|
virtual void messageReceived(const QByteArray &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void QV8ProfilerClient::clearData()
|
|||||||
|
|
||||||
bool QV8ProfilerClient::isEnabled() const
|
bool QV8ProfilerClient::isEnabled() const
|
||||||
{
|
{
|
||||||
return status() == Enabled;
|
return state() == Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QV8ProfilerClient::sendRecordingStatus()
|
void QV8ProfilerClient::sendRecordingStatus()
|
||||||
@@ -107,7 +107,7 @@ void QV8ProfilerClient::setRecording(bool v)
|
|||||||
|
|
||||||
d->recording = v;
|
d->recording = v;
|
||||||
|
|
||||||
if (status() == Enabled)
|
if (state() == Enabled)
|
||||||
sendRecordingStatus();
|
sendRecordingStatus();
|
||||||
|
|
||||||
emit recordingChanged(v);
|
emit recordingChanged(v);
|
||||||
@@ -123,7 +123,7 @@ void QV8ProfilerClient::setRecordingFromServer(bool v)
|
|||||||
emit recordingChanged(v);
|
emit recordingChanged(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QV8ProfilerClient::statusChanged(ClientStatus /*status*/)
|
void QV8ProfilerClient::stateChanged(State /*status*/)
|
||||||
{
|
{
|
||||||
emit enabledChanged();
|
emit enabledChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ private:
|
|||||||
void setRecordingFromServer(bool);
|
void setRecordingFromServer(bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void statusChanged(ClientStatus);
|
virtual void stateChanged(State);
|
||||||
virtual void messageReceived(const QByteArray &);
|
virtual void messageReceived(const QByteArray &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -56,14 +56,14 @@ bool BaseQmlDebuggerClient::acceptsBreakpoint(const BreakpointModelId &/*id*/)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseQmlDebuggerClient::statusChanged(QmlDebug::ClientStatus status)
|
void BaseQmlDebuggerClient::stateChanged(State state)
|
||||||
{
|
{
|
||||||
emit newStatus(status);
|
emit newState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg)
|
void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg)
|
||||||
{
|
{
|
||||||
if (status() == QmlDebug::Enabled)
|
if (state() == Enabled)
|
||||||
QmlDebugClient::sendMessage(msg);
|
QmlDebugClient::sendMessage(msg);
|
||||||
else
|
else
|
||||||
d->sendBuffer.append(msg);
|
d->sendBuffer.append(msg);
|
||||||
@@ -71,7 +71,7 @@ void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg)
|
|||||||
|
|
||||||
void BaseQmlDebuggerClient::flushSendBuffer()
|
void BaseQmlDebuggerClient::flushSendBuffer()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(status() == QmlDebug::Enabled, return);
|
QTC_ASSERT(state() == Enabled, return);
|
||||||
foreach (const QByteArray &msg, d->sendBuffer)
|
foreach (const QByteArray &msg, d->sendBuffer)
|
||||||
QmlDebugClient::sendMessage(msg);
|
QmlDebugClient::sendMessage(msg);
|
||||||
d->sendBuffer.clear();
|
d->sendBuffer.clear();
|
||||||
|
|||||||
@@ -91,11 +91,11 @@ public:
|
|||||||
void flushSendBuffer();
|
void flushSendBuffer();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newStatus(QmlDebug::ClientStatus status);
|
void newState(QmlDebug::QmlDebugClient::State state);
|
||||||
void stackFrameCompleted();
|
void stackFrameCompleted();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void statusChanged(QmlDebug::ClientStatus status);
|
virtual void stateChanged(State state);
|
||||||
void sendMessage(const QByteArray &msg);
|
void sendMessage(const QByteArray &msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -59,15 +59,15 @@ QmlAdapter::QmlAdapter(DebuggerEngine *engine, QObject *parent)
|
|||||||
connect(&m_connectionTimer, SIGNAL(timeout()), SLOT(checkConnectionState()));
|
connect(&m_connectionTimer, SIGNAL(timeout()), SLOT(checkConnectionState()));
|
||||||
|
|
||||||
m_conn = new QmlDebugConnection(this);
|
m_conn = new QmlDebugConnection(this);
|
||||||
connect(m_conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
connect(m_conn, SIGNAL(socketStateChanged(QAbstractSocket::SocketState)),
|
||||||
SLOT(connectionStateChanged()));
|
SLOT(connectionStateChanged()));
|
||||||
connect(m_conn, SIGNAL(error(QAbstractSocket::SocketError)),
|
connect(m_conn, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||||
SLOT(connectionErrorOccurred(QAbstractSocket::SocketError)));
|
SLOT(connectionErrorOccurred(QAbstractSocket::SocketError)));
|
||||||
|
|
||||||
createDebuggerClients();
|
createDebuggerClients();
|
||||||
m_msgClient = new QDebugMessageClient(m_conn);
|
m_msgClient = new QDebugMessageClient(m_conn);
|
||||||
connect(m_msgClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(m_msgClient, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(clientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,10 +78,10 @@ QmlAdapter::~QmlAdapter()
|
|||||||
void QmlAdapter::beginConnectionTcp(const QString &address, quint16 port)
|
void QmlAdapter::beginConnectionTcp(const QString &address, quint16 port)
|
||||||
{
|
{
|
||||||
if (m_engine.isNull()
|
if (m_engine.isNull()
|
||||||
|| (m_conn && m_conn->state() != QAbstractSocket::UnconnectedState))
|
|| (m_conn && m_conn->socketState() != QAbstractSocket::UnconnectedState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
showConnectionStatusMessage(tr("Connecting to debug server %1:%2").arg(address).arg(
|
showConnectionStateMessage(tr("Connecting to debug server %1:%2").arg(address).arg(
|
||||||
QString::number(port)));
|
QString::number(port)));
|
||||||
m_conn->connectToHost(address, port);
|
m_conn->connectToHost(address, port);
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ void QmlAdapter::closeConnection()
|
|||||||
|
|
||||||
void QmlAdapter::connectionErrorOccurred(QAbstractSocket::SocketError socketError)
|
void QmlAdapter::connectionErrorOccurred(QAbstractSocket::SocketError socketError)
|
||||||
{
|
{
|
||||||
showConnectionStatusMessage(tr("Error: (%1) %2", "%1=error code, %2=error message")
|
showConnectionStateMessage(tr("Error: (%1) %2", "%1=error code, %2=error message")
|
||||||
.arg(socketError).arg(m_conn->errorString()));
|
.arg(socketError).arg(m_conn->errorString()));
|
||||||
|
|
||||||
// this is only an error if we are already connected and something goes wrong.
|
// this is only an error if we are already connected and something goes wrong.
|
||||||
@@ -113,7 +113,7 @@ void QmlAdapter::connectionErrorOccurred(QAbstractSocket::SocketError socketErro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
|
void QmlAdapter::clientStateChanged(QmlDebugClient::State state)
|
||||||
{
|
{
|
||||||
QString serviceName;
|
QString serviceName;
|
||||||
float version = 0;
|
float version = 0;
|
||||||
@@ -122,12 +122,12 @@ void QmlAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
|
|||||||
version = client->serviceVersion();
|
version = client->serviceVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
logServiceStatusChange(serviceName, version, status);
|
logServiceStateChange(serviceName, version, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlAdapter::debugClientStatusChanged(QmlDebug::ClientStatus status)
|
void QmlAdapter::debugClientStateChanged(QmlDebugClient::State state)
|
||||||
{
|
{
|
||||||
if (status != QmlDebug::Enabled)
|
if (state != QmlDebug::QmlDebugClient::Enabled)
|
||||||
return;
|
return;
|
||||||
QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender());
|
QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender());
|
||||||
QTC_ASSERT(client, return);
|
QTC_ASSERT(client, return);
|
||||||
@@ -138,23 +138,23 @@ void QmlAdapter::debugClientStatusChanged(QmlDebug::ClientStatus status)
|
|||||||
|
|
||||||
void QmlAdapter::connectionStateChanged()
|
void QmlAdapter::connectionStateChanged()
|
||||||
{
|
{
|
||||||
switch (m_conn->state()) {
|
switch (m_conn->socketState()) {
|
||||||
case QAbstractSocket::UnconnectedState:
|
case QAbstractSocket::UnconnectedState:
|
||||||
{
|
{
|
||||||
showConnectionStatusMessage(tr("Disconnected.") + QLatin1String("\n\n"));
|
showConnectionStateMessage(tr("Disconnected.") + QLatin1String("\n\n"));
|
||||||
emit disconnected();
|
emit disconnected();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAbstractSocket::HostLookupState:
|
case QAbstractSocket::HostLookupState:
|
||||||
showConnectionStatusMessage(tr("Resolving host."));
|
showConnectionStateMessage(tr("Resolving host."));
|
||||||
break;
|
break;
|
||||||
case QAbstractSocket::ConnectingState:
|
case QAbstractSocket::ConnectingState:
|
||||||
showConnectionStatusMessage(tr("Connecting to debug server."));
|
showConnectionStateMessage(tr("Connecting to debug server."));
|
||||||
break;
|
break;
|
||||||
case QAbstractSocket::ConnectedState:
|
case QAbstractSocket::ConnectedState:
|
||||||
{
|
{
|
||||||
showConnectionStatusMessage(tr("Connected.") + QLatin1Char('\n'));
|
showConnectionStateMessage(tr("Connected.") + QLatin1Char('\n'));
|
||||||
|
|
||||||
m_connectionTimer.stop();
|
m_connectionTimer.stop();
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ void QmlAdapter::connectionStateChanged()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAbstractSocket::ClosingState:
|
case QAbstractSocket::ClosingState:
|
||||||
showConnectionStatusMessage(tr("Closing."));
|
showConnectionStateMessage(tr("Closing."));
|
||||||
break;
|
break;
|
||||||
case QAbstractSocket::BoundState:
|
case QAbstractSocket::BoundState:
|
||||||
case QAbstractSocket::ListeningState:
|
case QAbstractSocket::ListeningState:
|
||||||
@@ -181,22 +181,22 @@ void QmlAdapter::checkConnectionState()
|
|||||||
|
|
||||||
bool QmlAdapter::isConnected() const
|
bool QmlAdapter::isConnected() const
|
||||||
{
|
{
|
||||||
return m_conn && m_qmlClient && m_conn->state() == QAbstractSocket::ConnectedState;
|
return m_conn && m_qmlClient && m_conn->socketState() == QAbstractSocket::ConnectedState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlAdapter::createDebuggerClients()
|
void QmlAdapter::createDebuggerClients()
|
||||||
{
|
{
|
||||||
QScriptDebuggerClient *debugClient1 = new QScriptDebuggerClient(m_conn);
|
QScriptDebuggerClient *debugClient1 = new QScriptDebuggerClient(m_conn);
|
||||||
connect(debugClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(debugClient1, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(clientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
connect(debugClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(debugClient1, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(debugClientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(debugClientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
|
|
||||||
QmlV8DebuggerClient *debugClient2 = new QmlV8DebuggerClient(m_conn);
|
QmlV8DebuggerClient *debugClient2 = new QmlV8DebuggerClient(m_conn);
|
||||||
connect(debugClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(debugClient2, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(clientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
connect(debugClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(debugClient2, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(debugClientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(debugClientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
|
|
||||||
m_debugClients.insert(debugClient1->name(),debugClient1);
|
m_debugClients.insert(debugClient1->name(),debugClient1);
|
||||||
m_debugClients.insert(debugClient2->name(),debugClient2);
|
m_debugClients.insert(debugClient2->name(),debugClient2);
|
||||||
@@ -215,7 +215,7 @@ DebuggerEngine *QmlAdapter::debuggerEngine() const
|
|||||||
return m_engine.data();
|
return m_engine.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlAdapter::showConnectionStatusMessage(const QString &message)
|
void QmlAdapter::showConnectionStateMessage(const QString &message)
|
||||||
{
|
{
|
||||||
if (!m_engine.isNull())
|
if (!m_engine.isNull())
|
||||||
m_engine.data()->showMessage(_("QML Debugger: ") + message, LogStatus);
|
m_engine.data()->showMessage(_("QML Debugger: ") + message, LogStatus);
|
||||||
@@ -242,23 +242,23 @@ QDebugMessageClient *QmlAdapter::messageClient() const
|
|||||||
return m_msgClient;
|
return m_msgClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlAdapter::logServiceStatusChange(const QString &service, float version,
|
void QmlAdapter::logServiceStateChange(const QString &service, float version,
|
||||||
QmlDebug::ClientStatus newStatus)
|
QmlDebug::QmlDebugClient::State newState)
|
||||||
{
|
{
|
||||||
switch (newStatus) {
|
switch (newState) {
|
||||||
case QmlDebug::Unavailable: {
|
case QmlDebug::QmlDebugClient::Unavailable: {
|
||||||
showConnectionStatusMessage(_("Status of \"%1\" Version: %2 changed to \"unavailable\".").
|
showConnectionStateMessage(_("Status of \"%1\" Version: %2 changed to 'unavailable'.").
|
||||||
arg(service).arg(QString::number(version)));
|
arg(service).arg(QString::number(version)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QmlDebug::Enabled: {
|
case QmlDebug::QmlDebugClient::Enabled: {
|
||||||
showConnectionStatusMessage(_("Status of \"%1\" Version: %2 changed to \"enabled\".").
|
showConnectionStateMessage(_("Status of \"%1\" Version: %2 changed to 'enabled'.").
|
||||||
arg(service).arg(QString::number(version)));
|
arg(service).arg(QString::number(version)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case QmlDebug::NotConnected: {
|
case QmlDebug::QmlDebugClient::NotConnected: {
|
||||||
showConnectionStatusMessage(_("Status of \"%1\" Version: %2 changed to \"not connected\".").
|
showConnectionStateMessage(_("Status of \"%1\" Version: %2 changed to 'not connected'.").
|
||||||
arg(service).arg(QString::number(version)));
|
arg(service).arg(QString::number(version)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ public:
|
|||||||
QmlDebug::QDebugMessageClient *messageClient() const;
|
QmlDebug::QDebugMessageClient *messageClient() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void logServiceStatusChange(const QString &service, float version,
|
void logServiceStateChange(const QString &service, float version,
|
||||||
QmlDebug::ClientStatus newStatus);
|
QmlDebug::QmlDebugClient::State newState);
|
||||||
void logServiceActivity(const QString &service, const QString &logMessage);
|
void logServiceActivity(const QString &service, const QString &logMessage);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -82,15 +82,15 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
|
void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
|
||||||
void clientStatusChanged(QmlDebug::ClientStatus status);
|
void clientStateChanged(QmlDebug::QmlDebugClient::State state);
|
||||||
void debugClientStatusChanged(QmlDebug::ClientStatus status);
|
void debugClientStateChanged(QmlDebug::QmlDebugClient::State state);
|
||||||
void connectionStateChanged();
|
void connectionStateChanged();
|
||||||
void checkConnectionState();
|
void checkConnectionState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isConnected() const;
|
bool isConnected() const;
|
||||||
void createDebuggerClients();
|
void createDebuggerClients();
|
||||||
void showConnectionStatusMessage(const QString &message);
|
void showConnectionStateMessage(const QString &message);
|
||||||
void showConnectionErrorMessage(const QString &message);
|
void showConnectionErrorMessage(const QString &message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -92,46 +92,46 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
|
|||||||
QmlDebugConnection *connection = m_debugAdapter->connection();
|
QmlDebugConnection *connection = m_debugAdapter->connection();
|
||||||
DeclarativeEngineDebugClient *engineClient1
|
DeclarativeEngineDebugClient *engineClient1
|
||||||
= new DeclarativeEngineDebugClient(connection);
|
= new DeclarativeEngineDebugClient(connection);
|
||||||
connect(engineClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(engineClient1, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(clientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
connect(engineClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(engineClient1, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(engineClientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
|
|
||||||
QmlEngineDebugClient *engineClient2 = new QmlEngineDebugClient(connection);
|
QmlEngineDebugClient *engineClient2 = new QmlEngineDebugClient(connection);
|
||||||
connect(engineClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(engineClient2, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(clientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
connect(engineClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(engineClient2, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(engineClientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
|
|
||||||
DeclarativeEngineDebugClientV2 *engineClient3
|
DeclarativeEngineDebugClientV2 *engineClient3
|
||||||
= new DeclarativeEngineDebugClientV2(connection);
|
= new DeclarativeEngineDebugClientV2(connection);
|
||||||
connect(engineClient3, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(engineClient3, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(clientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
connect(engineClient3, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(engineClient3, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(engineClientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(engineClientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
|
|
||||||
m_engineClients.insert(engineClient1->name(), engineClient1);
|
m_engineClients.insert(engineClient1->name(), engineClient1);
|
||||||
m_engineClients.insert(engineClient2->name(), engineClient2);
|
m_engineClients.insert(engineClient2->name(), engineClient2);
|
||||||
m_engineClients.insert(engineClient3->name(), engineClient3);
|
m_engineClients.insert(engineClient3->name(), engineClient3);
|
||||||
|
|
||||||
if (engineClient1->status() == QmlDebug::Enabled)
|
if (engineClient1->state() == QmlDebugClient::Enabled)
|
||||||
setActiveEngineClient(engineClient1);
|
setActiveEngineClient(engineClient1);
|
||||||
if (engineClient2->status() == QmlDebug::Enabled)
|
if (engineClient2->state() == QmlDebugClient::Enabled)
|
||||||
setActiveEngineClient(engineClient2);
|
setActiveEngineClient(engineClient2);
|
||||||
if (engineClient3->status() == QmlDebug::Enabled)
|
if (engineClient3->state() == QmlDebugClient::Enabled)
|
||||||
setActiveEngineClient(engineClient3);
|
setActiveEngineClient(engineClient3);
|
||||||
|
|
||||||
DeclarativeToolsClient *toolsClient1 = new DeclarativeToolsClient(connection);
|
DeclarativeToolsClient *toolsClient1 = new DeclarativeToolsClient(connection);
|
||||||
connect(toolsClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(toolsClient1, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(clientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
connect(toolsClient1, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(toolsClient1, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(toolsClientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(toolsClientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
|
|
||||||
QmlToolsClient *toolsClient2 = new QmlToolsClient(connection);
|
QmlToolsClient *toolsClient2 = new QmlToolsClient(connection);
|
||||||
connect(toolsClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(toolsClient2, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(clientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
connect(toolsClient2, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(toolsClient2, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(toolsClientStatusChanged(QmlDebug::ClientStatus)));
|
this, SLOT(toolsClientStateChanged(QmlDebug::QmlDebugClient::State)));
|
||||||
|
|
||||||
// toolbar
|
// toolbar
|
||||||
m_selectAction->setObjectName(QLatin1String("QML Select Action"));
|
m_selectAction->setObjectName(QLatin1String("QML Select Action"));
|
||||||
@@ -184,7 +184,7 @@ QString QmlInspectorAdapter::currentSelectedDisplayName() const
|
|||||||
return m_currentSelectedDebugName;
|
return m_currentSelectedDebugName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
|
void QmlInspectorAdapter::clientStateChanged(QmlDebugClient::State state)
|
||||||
{
|
{
|
||||||
QString serviceName;
|
QString serviceName;
|
||||||
float version = 0;
|
float version = 0;
|
||||||
@@ -193,14 +193,14 @@ void QmlInspectorAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
|
|||||||
version = client->serviceVersion();
|
version = client->serviceVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_debugAdapter->logServiceStatusChange(serviceName, version, status);
|
m_debugAdapter->logServiceStateChange(serviceName, version, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status)
|
void QmlInspectorAdapter::toolsClientStateChanged(QmlDebugClient::State state)
|
||||||
{
|
{
|
||||||
BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender());
|
BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender());
|
||||||
QTC_ASSERT(client, return);
|
QTC_ASSERT(client, return);
|
||||||
if (status == QmlDebug::Enabled) {
|
if (state == QmlDebugClient::Enabled) {
|
||||||
m_toolsClient = client;
|
m_toolsClient = client;
|
||||||
|
|
||||||
connect(client, SIGNAL(currentObjectsChanged(QList<int>)),
|
connect(client, SIGNAL(currentObjectsChanged(QList<int>)),
|
||||||
@@ -256,12 +256,12 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorAdapter::engineClientStatusChanged(QmlDebug::ClientStatus status)
|
void QmlInspectorAdapter::engineClientStateChanged(QmlDebugClient::State state)
|
||||||
{
|
{
|
||||||
BaseEngineDebugClient *client
|
BaseEngineDebugClient *client
|
||||||
= qobject_cast<BaseEngineDebugClient*>(sender());
|
= qobject_cast<BaseEngineDebugClient*>(sender());
|
||||||
|
|
||||||
if (status == QmlDebug::Enabled && !m_engineClientConnected) {
|
if (state == QmlDebugClient::Enabled && !m_engineClientConnected) {
|
||||||
// We accept the first client that is enabled and reject the others.
|
// We accept the first client that is enabled and reject the others.
|
||||||
QTC_ASSERT(client, return);
|
QTC_ASSERT(client, return);
|
||||||
setActiveEngineClient(client);
|
setActiveEngineClient(client);
|
||||||
@@ -419,7 +419,7 @@ void QmlInspectorAdapter::setActiveEngineClient(BaseEngineDebugClient *client)
|
|||||||
m_engineClientConnected = true;
|
m_engineClientConnected = true;
|
||||||
|
|
||||||
if (m_engineClient &&
|
if (m_engineClient &&
|
||||||
m_engineClient->status() == QmlDebug::Enabled) {
|
m_engineClient->state() == QmlDebugClient::Enabled) {
|
||||||
QmlJS::ModelManagerInterface *modelManager
|
QmlJS::ModelManagerInterface *modelManager
|
||||||
= QmlJS::ModelManagerInterface::instance();
|
= QmlJS::ModelManagerInterface::instance();
|
||||||
if (modelManager) {
|
if (modelManager) {
|
||||||
@@ -468,7 +468,7 @@ void QmlInspectorAdapter::initializePreviews()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorAdapter::showConnectionStatusMessage(const QString &message)
|
void QmlInspectorAdapter::showConnectionStateMessage(const QString &message)
|
||||||
{
|
{
|
||||||
m_engine->showMessage(_("QML Inspector: ") + message, LogStatus);
|
m_engine->showMessage(_("QML Inspector: ") + message, LogStatus);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ signals:
|
|||||||
private slots:
|
private slots:
|
||||||
void onEngineStateChanged(const Debugger::DebuggerState);
|
void onEngineStateChanged(const Debugger::DebuggerState);
|
||||||
|
|
||||||
void clientStatusChanged(QmlDebug::ClientStatus status);
|
void clientStateChanged(QmlDebug::QmlDebugClient::State state);
|
||||||
void toolsClientStatusChanged(QmlDebug::ClientStatus status);
|
void toolsClientStateChanged(QmlDebug::QmlDebugClient::State state);
|
||||||
void engineClientStatusChanged(QmlDebug::ClientStatus status);
|
void engineClientStateChanged(QmlDebug::QmlDebugClient::State state);
|
||||||
|
|
||||||
void selectObjectsFromToolsClient(const QList<int> &debugIds);
|
void selectObjectsFromToolsClient(const QList<int> &debugIds);
|
||||||
void onObjectFetched(const QmlDebug::ObjectReference &ref);
|
void onObjectFetched(const QmlDebug::ObjectReference &ref);
|
||||||
@@ -102,7 +102,7 @@ private:
|
|||||||
void setActiveEngineClient(QmlDebug::BaseEngineDebugClient *client);
|
void setActiveEngineClient(QmlDebug::BaseEngineDebugClient *client);
|
||||||
|
|
||||||
void initializePreviews();
|
void initializePreviews();
|
||||||
void showConnectionStatusMessage(const QString &message);
|
void showConnectionStateMessage(const QString &message);
|
||||||
|
|
||||||
enum SelectionTarget { NoTarget, ToolTarget, EditorTarget };
|
enum SelectionTarget { NoTarget, ToolTarget, EditorTarget };
|
||||||
void selectObject(
|
void selectObject(
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ QmlInspectorAgent::QmlInspectorAgent(DebuggerEngine *engine, QObject *parent)
|
|||||||
{
|
{
|
||||||
m_debugIdToIname.insert(-1, QByteArray("inspect"));
|
m_debugIdToIname.insert(-1, QByteArray("inspect"));
|
||||||
connect(debuggerCore()->action(ShowQmlObjectTree),
|
connect(debuggerCore()->action(ShowQmlObjectTree),
|
||||||
SIGNAL(valueChanged(QVariant)), SLOT(updateStatus()));
|
SIGNAL(valueChanged(QVariant)), SLOT(updateState()));
|
||||||
m_delayQueryTimer.setSingleShot(true);
|
m_delayQueryTimer.setSingleShot(true);
|
||||||
m_delayQueryTimer.setInterval(100);
|
m_delayQueryTimer.setInterval(100);
|
||||||
connect(&m_delayQueryTimer, SIGNAL(timeout()), SLOT(queryEngineContext()));
|
connect(&m_delayQueryTimer, SIGNAL(timeout()), SLOT(queryEngineContext()));
|
||||||
@@ -393,8 +393,8 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_engineClient) {
|
if (m_engineClient) {
|
||||||
disconnect(m_engineClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
disconnect(m_engineClient, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(updateStatus()));
|
this, SLOT(updateState()));
|
||||||
disconnect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)),
|
disconnect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)),
|
||||||
this, SLOT(onResult(quint32,QVariant,QByteArray)));
|
this, SLOT(onResult(quint32,QVariant,QByteArray)));
|
||||||
disconnect(m_engineClient, SIGNAL(newObject(int,int,int)),
|
disconnect(m_engineClient, SIGNAL(newObject(int,int,int)),
|
||||||
@@ -406,8 +406,8 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
|
|||||||
m_engineClient = client;
|
m_engineClient = client;
|
||||||
|
|
||||||
if (m_engineClient) {
|
if (m_engineClient) {
|
||||||
connect(m_engineClient, SIGNAL(newStatus(QmlDebug::ClientStatus)),
|
connect(m_engineClient, SIGNAL(newState(QmlDebug::QmlDebugClient::State)),
|
||||||
this, SLOT(updateStatus()));
|
this, SLOT(updateState()));
|
||||||
connect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)),
|
connect(m_engineClient, SIGNAL(result(quint32,QVariant,QByteArray)),
|
||||||
this, SLOT(onResult(quint32,QVariant,QByteArray)));
|
this, SLOT(onResult(quint32,QVariant,QByteArray)));
|
||||||
connect(m_engineClient, SIGNAL(newObject(int,int,int)),
|
connect(m_engineClient, SIGNAL(newObject(int,int,int)),
|
||||||
@@ -416,7 +416,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
|
|||||||
this, SLOT(onValueChanged(int,QByteArray,QVariant)));
|
this, SLOT(onValueChanged(int,QByteArray,QVariant)));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatus();
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlInspectorAgent::displayName(int objectDebugId) const
|
QString QmlInspectorAgent::displayName(int objectDebugId) const
|
||||||
@@ -434,10 +434,10 @@ QString QmlInspectorAgent::displayName(int objectDebugId) const
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorAgent::updateStatus()
|
void QmlInspectorAgent::updateState()
|
||||||
{
|
{
|
||||||
if (m_engineClient
|
if (m_engineClient
|
||||||
&& (m_engineClient->status() == QmlDebug::Enabled)
|
&& (m_engineClient->state() == QmlDebugClient::Enabled)
|
||||||
&& debuggerCore()->boolSetting(ShowQmlObjectTree)) {
|
&& debuggerCore()->boolSetting(ShowQmlObjectTree)) {
|
||||||
reloadEngines();
|
reloadEngines();
|
||||||
} else {
|
} else {
|
||||||
@@ -870,7 +870,7 @@ void QmlInspectorAgent::log(QmlInspectorAgent::LogDirection direction,
|
|||||||
bool QmlInspectorAgent::isConnected() const
|
bool QmlInspectorAgent::isConnected() const
|
||||||
{
|
{
|
||||||
return m_engineClient
|
return m_engineClient
|
||||||
&& (m_engineClient->status() == QmlDebug::Enabled);
|
&& (m_engineClient->state() == QmlDebugClient::Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorAgent::clearObjectTree()
|
void QmlInspectorAgent::clearObjectTree()
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ signals:
|
|||||||
void jumpToObjectDefinition(const QmlDebug::FileReference &objSource, int debugId);
|
void jumpToObjectDefinition(const QmlDebug::FileReference &objSource, int debugId);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateStatus();
|
void updateState();
|
||||||
void onResult(quint32 queryId, const QVariant &value, const QByteArray &type);
|
void onResult(quint32 queryId, const QVariant &value, const QByteArray &type);
|
||||||
void newObject(int engineId, int objectId, int parentId);
|
void newObject(int engineId, int objectId, int parentId);
|
||||||
void onValueChanged(int debugId, const QByteArray &propertyName, const QVariant &value);
|
void onValueChanged(int debugId, const QByteArray &propertyName, const QVariant &value);
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void QmlProfilerClientManager::connectClient(quint16 port)
|
|||||||
delete d->connection;
|
delete d->connection;
|
||||||
d->connection = new QmlDebugConnection;
|
d->connection = new QmlDebugConnection;
|
||||||
enableServices();
|
enableServices();
|
||||||
connect(d->connection, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
connect(d->connection, SIGNAL(socketStateChanged(QAbstractSocket::SocketState)),
|
||||||
this, SLOT(connectionStateChanged()));
|
this, SLOT(connectionStateChanged()));
|
||||||
d->connectionTimer.start();
|
d->connectionTimer.start();
|
||||||
d->tcpPort = port;
|
d->tcpPort = port;
|
||||||
@@ -237,7 +237,7 @@ void QmlProfilerClientManager::disconnectClientSignals()
|
|||||||
|
|
||||||
void QmlProfilerClientManager::connectToClient()
|
void QmlProfilerClientManager::connectToClient()
|
||||||
{
|
{
|
||||||
if (!d->connection || d->connection->state() != QAbstractSocket::UnconnectedState)
|
if (!d->connection || d->connection->socketState() != QAbstractSocket::UnconnectedState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d->connection->connectToHost(d->tcpHost, d->tcpPort);
|
d->connection->connectToHost(d->tcpHost, d->tcpPort);
|
||||||
@@ -293,7 +293,7 @@ void QmlProfilerClientManager::connectionStateChanged()
|
|||||||
{
|
{
|
||||||
if (!d->connection)
|
if (!d->connection)
|
||||||
return;
|
return;
|
||||||
switch (d->connection->state()) {
|
switch (d->connection->socketState()) {
|
||||||
case QAbstractSocket::UnconnectedState:
|
case QAbstractSocket::UnconnectedState:
|
||||||
{
|
{
|
||||||
if (QmlProfilerPlugin::debugOutput)
|
if (QmlProfilerPlugin::debugOutput)
|
||||||
@@ -359,7 +359,9 @@ void QmlProfilerClientManager::qmlComplete(qint64 maximumTime)
|
|||||||
if (maximumTime > d->modelManager->traceTime()->endTime())
|
if (maximumTime > d->modelManager->traceTime()->endTime())
|
||||||
d->modelManager->traceTime()->setEndTime(maximumTime);
|
d->modelManager->traceTime()->setEndTime(maximumTime);
|
||||||
d->qmlDataReady = true;
|
d->qmlDataReady = true;
|
||||||
if (!d->v8clientplugin || d->v8clientplugin.data()->status() != QmlDebug::Enabled || d->v8DataReady) {
|
if (!d->v8clientplugin ||
|
||||||
|
d->v8clientplugin.data()->state() != QmlDebug::QmlDebugClient::Enabled ||
|
||||||
|
d->v8DataReady) {
|
||||||
emit dataReadyForProcessing();
|
emit dataReadyForProcessing();
|
||||||
// once complete is sent, reset the flags
|
// once complete is sent, reset the flags
|
||||||
d->qmlDataReady = false;
|
d->qmlDataReady = false;
|
||||||
@@ -370,7 +372,9 @@ void QmlProfilerClientManager::qmlComplete(qint64 maximumTime)
|
|||||||
void QmlProfilerClientManager::v8Complete()
|
void QmlProfilerClientManager::v8Complete()
|
||||||
{
|
{
|
||||||
d->v8DataReady = true;
|
d->v8DataReady = true;
|
||||||
if (!d->qmlclientplugin || d->qmlclientplugin.data()->status() != QmlDebug::Enabled || d->qmlDataReady) {
|
if (!d->qmlclientplugin ||
|
||||||
|
d->qmlclientplugin.data()->state() != QmlDebug::QmlDebugClient::Enabled ||
|
||||||
|
d->qmlDataReady) {
|
||||||
emit dataReadyForProcessing();
|
emit dataReadyForProcessing();
|
||||||
// once complete is sent, reset the flags
|
// once complete is sent, reset the flags
|
||||||
d->v8DataReady = false;
|
d->v8DataReady = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user