QmlDebug: Decouple log messages from connection failures

A socket error is not the only possible reason for a connection failure
and exposing socket error codes to the upper layers is unnecessary.

Change-Id: I27e9f21160ecea5b0d811b83b7ab0ab9071cacff
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2016-07-15 13:09:38 +02:00
parent 60bc2ccc95
commit ba9825625d
6 changed files with 53 additions and 51 deletions

View File

@@ -179,10 +179,13 @@ void QmlProfilerClientManager::createConnection()
this, &QmlProfilerClientManager::qmlDebugConnectionOpened);
connect(d->connection, &QmlDebug::QmlDebugConnection::disconnected,
this, &QmlProfilerClientManager::qmlDebugConnectionClosed);
connect(d->connection, &QmlDebug::QmlDebugConnection::socketError,
this, &QmlProfilerClientManager::qmlDebugConnectionError);
connect(d->connection, &QmlDebug::QmlDebugConnection::socketStateChanged,
this, &QmlProfilerClientManager::qmlDebugConnectionStateChanged);
connect(d->connection, &QmlDebug::QmlDebugConnection::connectionFailed,
this, &QmlProfilerClientManager::qmlDebugConnectionFailed);
connect(d->connection, &QmlDebug::QmlDebugConnection::logError,
this, &QmlProfilerClientManager::logState);
connect(d->connection, &QmlDebug::QmlDebugConnection::logStateChange,
this, &QmlProfilerClientManager::logState);
}
void QmlProfilerClientManager::retryConnect()
@@ -294,9 +297,8 @@ void QmlProfilerClientManager::qmlDebugConnectionClosed()
emit connectionClosed();
}
void QmlProfilerClientManager::qmlDebugConnectionError(QAbstractSocket::SocketError error)
void QmlProfilerClientManager::qmlDebugConnectionFailed()
{
logState(QmlDebug::QmlDebugConnection::socketErrorToString(error));
if (d->connection->isConnected()) {
disconnectClient();
emit connectionClosed();
@@ -305,11 +307,6 @@ void QmlProfilerClientManager::qmlDebugConnectionError(QAbstractSocket::SocketEr
}
}
void QmlProfilerClientManager::qmlDebugConnectionStateChanged(QAbstractSocket::SocketState state)
{
logState(QmlDebug::QmlDebugConnection::socketStateToString(state));
}
void QmlProfilerClientManager::logState(const QString &msg)
{
QmlProfilerTool::logState(QLatin1String("QML Profiler: ") + msg);