forked from qt-creator/qt-creator
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user