diff --git a/src/libs/qmldebug/qmldebugclient.cpp b/src/libs/qmldebug/qmldebugclient.cpp index ab3869b5382..a1ac4ecddf2 100644 --- a/src/libs/qmldebug/qmldebugclient.cpp +++ b/src/libs/qmldebug/qmldebugclient.cpp @@ -70,35 +70,16 @@ public: static QString socketStateToString(QAbstractSocket::SocketState state) { - switch (state) { - case QAbstractSocket::UnconnectedState: - return QmlDebugConnection::tr("Network connection dropped"); - case QAbstractSocket::HostLookupState: - return QmlDebugConnection::tr("Resolving host"); - case QAbstractSocket::ConnectingState: - return QmlDebugConnection::tr("Establishing network connection..."); - case QAbstractSocket::ConnectedState: - return QmlDebugConnection::tr("Network connection established"); - case QAbstractSocket::ClosingState: - return QmlDebugConnection::tr("Network connection closing"); - case QAbstractSocket::BoundState: - return QmlDebugConnection::tr("Socket state changed to BoundState. " - "This should not happen."); - case QAbstractSocket::ListeningState: - return QmlDebugConnection::tr("Socket state changed to ListeningState. " - "This should not happen."); - default: - return QmlDebugConnection::tr("Unknown state %1").arg(state); - } + QString stateString; + QDebug(&stateString) << state; + return QmlDebugConnection::tr("Socket state changed to %1").arg(stateString); } static QString socketErrorToString(QAbstractSocket::SocketError error) { - if (error == QAbstractSocket::RemoteHostClosedError) { - return QmlDebugConnection::tr("Error: Remote host closed the connection"); - } else { - return QmlDebugConnection::tr("Error: Unknown socket error %1").arg(error); - } + QString errorString; + QDebug(&errorString) << error; + return QmlDebugConnection::tr("Error: %1").arg(errorString); } QmlDebugConnectionPrivate::QmlDebugConnectionPrivate() :