QmlDebug: Simplify error and state signaling

There is no point in sending two signals for every state change and
error. Also, the signals only reflect events in the socket, not in the
logical connection.

Change-Id: I617a925c69164aa1a02a7781b9da7dca55daa304
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-11-16 17:29:17 +01:00
parent 47317eff60
commit 81eea72d44
6 changed files with 64 additions and 80 deletions

View File

@@ -291,11 +291,9 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
connect(&d->connectionTimer, &QTimer::timeout,
this, &QmlEngine::checkConnectionState);
connect(d->connection, &QmlDebugConnection::stateMessage,
this, &QmlEngine::showConnectionStateMessage);
connect(d->connection, &QmlDebugConnection::errorMessage,
this, &QmlEngine::showConnectionErrorMessage);
connect(d->connection, &QmlDebugConnection::error,
connect(d->connection, &QmlDebugConnection::socketStateChanged,
this, &QmlEngine::connectionStateChanged);
connect(d->connection, &QmlDebugConnection::socketError,
this, &QmlEngine::connectionErrorOccurred);
connect(d->connection, &QmlDebugConnection::connected,
&d->connectionTimer, &QTimer::stop);
@@ -1213,11 +1211,11 @@ bool QmlEnginePrivate::canEvaluateScript(const QString &script)
return interpreter.canEvaluate();
}
void QmlEngine::connectionErrorOccurred(QDebugSupport::Error error)
void QmlEngine::connectionErrorOccurred(QAbstractSocket::SocketError error)
{
// this is only an error if we are already connected and something goes wrong.
if (isConnected()) {
if (error == QDebugSupport::RemoteClosedConnectionError)
if (error == QAbstractSocket::RemoteHostClosedError)
showMessage(tr("QML Debugger: Remote host closed connection."), StatusBar);
if (!isSlaveEngine()) { // normal flow for slave engine when gdb exits
@@ -1230,6 +1228,11 @@ void QmlEngine::connectionErrorOccurred(QDebugSupport::Error error)
}
}
void QmlEngine::connectionStateChanged(QAbstractSocket::SocketState socketState)
{
showConnectionStateMessage(QmlDebugConnection::socketStateToString(socketState));
}
void QmlEngine::clientStateChanged(QmlDebugClient::State state)
{
QString serviceName;
@@ -1260,11 +1263,6 @@ void QmlEngine::showConnectionStateMessage(const QString &message)
showMessage(_("QML Debugger: ") + message, LogStatus);
}
void QmlEngine::showConnectionErrorMessage(const QString &message)
{
showMessage(_("QML Debugger: ") + message, LogError);
}
void QmlEngine::logServiceStateChange(const QString &service, float version,
QmlDebugClient::State newState)
{