aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmldebug
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-01-04 19:13:29 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-01-05 09:32:50 +0000
commit48570a754ed28871445a8aadcca041f01ec50e16 (patch)
tree8928de7442ec908dec5ca42073545a35407b848b /src/libs/qmldebug
parent348b5ec8c5a5fac185f29b0da29b4c8259d9873c (diff)
QmlDebug: Use the original names for connection states and errors
The way to extract them from Qt is somewhat funny, but this leads to clearer messages in the debugger log and other places. Change-Id: Ib458d5ec796a2e69a6543d405593be8e54016946 Task-number: QTCREATORBUG-17492 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/libs/qmldebug')
-rw-r--r--src/libs/qmldebug/qmldebugclient.cpp31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/libs/qmldebug/qmldebugclient.cpp b/src/libs/qmldebug/qmldebugclient.cpp
index ab3869b538..a1ac4ecddf 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() :