forked from qt-creator/qt-creator
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:
@@ -289,10 +289,13 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
|
||||
connect(&d->connectionTimer, &QTimer::timeout,
|
||||
this, &QmlEngine::checkConnectionState);
|
||||
|
||||
connect(d->connection, &QmlDebugConnection::socketStateChanged,
|
||||
this, &QmlEngine::connectionStateChanged);
|
||||
connect(d->connection, &QmlDebugConnection::socketError,
|
||||
this, &QmlEngine::connectionErrorOccurred);
|
||||
connect(d->connection, &QmlDebugConnection::logStateChange,
|
||||
this, &QmlEngine::showConnectionStateMessage);
|
||||
connect(d->connection, &QmlDebugConnection::logError, this,
|
||||
[this](const QString &error) { showMessage("QML Debugger: " + error, StatusBar); });
|
||||
|
||||
connect(d->connection, &QmlDebugConnection::connectionFailed,
|
||||
this, &QmlEngine::connectionFailed);
|
||||
connect(d->connection, &QmlDebugConnection::connected,
|
||||
&d->connectionTimer, &QTimer::stop);
|
||||
connect(d->connection, &QmlDebugConnection::connected,
|
||||
@@ -1200,13 +1203,10 @@ bool QmlEnginePrivate::canEvaluateScript(const QString &script)
|
||||
return interpreter.canEvaluate();
|
||||
}
|
||||
|
||||
void QmlEngine::connectionErrorOccurred(QAbstractSocket::SocketError error)
|
||||
void QmlEngine::connectionFailed()
|
||||
{
|
||||
// this is only an error if we are already connected and something goes wrong.
|
||||
if (isConnected()) {
|
||||
if (error == QAbstractSocket::RemoteHostClosedError)
|
||||
showMessage(tr("QML Debugger: Remote host closed connection."), StatusBar);
|
||||
|
||||
if (!isSlaveEngine()) { // normal flow for slave engine when gdb exits
|
||||
notifyInferiorSpontaneousStop();
|
||||
notifyInferiorIll();
|
||||
@@ -1217,11 +1217,6 @@ void QmlEngine::connectionErrorOccurred(QAbstractSocket::SocketError error)
|
||||
}
|
||||
}
|
||||
|
||||
void QmlEngine::connectionStateChanged(QAbstractSocket::SocketState socketState)
|
||||
{
|
||||
showConnectionStateMessage(QmlDebugConnection::socketStateToString(socketState));
|
||||
}
|
||||
|
||||
void QmlEngine::checkConnectionState()
|
||||
{
|
||||
if (!isConnected()) {
|
||||
|
||||
Reference in New Issue
Block a user