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:
Ulf Hermann
2014-05-05 16:11:43 +02:00
parent 7018a375c6
commit e6792d33c3
22 changed files with 157 additions and 157 deletions

View File

@@ -150,10 +150,10 @@ void QmlDebugConnectionPrivate::readyRead()
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
for (; iter != plugins.end(); ++iter) {
ClientStatus newStatus = Unavailable;
QmlDebugClient::State newState = QmlDebugClient::Unavailable;
if (serverPlugins.contains(iter.key()))
newStatus = Enabled;
iter.value()->statusChanged(newStatus);
newState = QmlDebugClient::Enabled;
iter.value()->stateChanged(newState);
}
}
@@ -189,13 +189,13 @@ void QmlDebugConnectionPrivate::readyRead()
QHash<QString, QmlDebugClient *>::Iterator iter = plugins.begin();
for (; iter != plugins.end(); ++iter) {
const QString pluginName = iter.key();
ClientStatus newStatus = Unavailable;
QmlDebugClient::State newState = QmlDebugClient::Unavailable;
if (serverPlugins.contains(pluginName))
newStatus = Enabled;
newState = QmlDebugClient::Enabled;
if (oldServerPlugins.contains(pluginName)
!= serverPlugins.contains(pluginName)) {
iter.value()->statusChanged(newStatus);
iter.value()->stateChanged(newState);
}
}
} else {
@@ -225,24 +225,24 @@ 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(NotConnected);
iter.value()->stateChanged(QmlDebugClient::NotConnected);
}
}
bool QmlDebugConnection::isConnected() const
{
return state() == QAbstractSocket::ConnectedState;
return socketState() == QAbstractSocket::ConnectedState;
}
void QmlDebugConnection::close()
{
if (d->device->isOpen()) {
d->device->close();
emit stateChanged(QAbstractSocket::UnconnectedState);
emit socketStateChanged(QAbstractSocket::UnconnectedState);
QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin();
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
// 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);
if (socket)
@@ -280,7 +280,7 @@ void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
d->protocol = new QPacketProtocol(d->device, this);
connect(d->protocol, SIGNAL(readyRead()), d, SLOT(readyRead()));
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(connected()), this, SIGNAL(connected()));
socket->connectToHost(hostName, port);
@@ -336,7 +336,7 @@ float QmlDebugClient::serviceVersion() const
return -1;
}
ClientStatus QmlDebugClient::status() const
QmlDebugClient::State QmlDebugClient::state() const
{
Q_D(const QmlDebugClient);
if (!d->connection
@@ -353,7 +353,7 @@ ClientStatus QmlDebugClient::status() const
void QmlDebugClient::sendMessage(const QByteArray &message)
{
Q_D(QmlDebugClient);
if (status() != Enabled)
if (state() != Enabled)
return;
QPacket pack;
@@ -362,7 +362,7 @@ void QmlDebugClient::sendMessage(const QByteArray &message)
d->connection->flush();
}
void QmlDebugClient::statusChanged(ClientStatus)
void QmlDebugClient::stateChanged(State)
{
}