Commit 31c8b444 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

QML Debugger: Show error messages when connection is lost

Related to Qt commit bd521ed56f8e4be7117dc3534c6fded68f7a70c5
parent 1f1dcfde
......@@ -99,7 +99,7 @@ bool QmlAdapter::connectToViewer()
connect(m_conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
SLOT(connectionStateChanged()));
connect(m_conn, SIGNAL(error(QAbstractSocket::SocketError)),
SLOT(connectionErrorOccurred()));
SLOT(connectionErrorOccurred(QAbstractSocket::SocketError)));
QString address = m_engine.data()->startParameters().qmlServerAddress;
QString port = QString::number(m_engine.data()->startParameters().qmlServerPort);
......@@ -114,14 +114,14 @@ bool QmlAdapter::connectToViewer()
return true;
}
void QmlAdapter::connectionErrorOccurred()
void QmlAdapter::connectionErrorOccurred(QAbstractSocket::SocketError socketError)
{
showConnectionErrorMessage(tr("Error: (%1) %2", "%1=error code, %2=error message")
.arg(m_conn->error()).arg(m_conn->errorString()));
// this is only an error if we are already connected and something goes wrong.
if (isConnected())
emit connectionError();
emit connectionError(socketError);
}
void QmlAdapter::connectionStateChanged()
......
......@@ -67,10 +67,10 @@ signals:
void connected();
void disconnected();
void connectionStartupFailed();
void connectionError();
void connectionError(QAbstractSocket::SocketError socketError);
private slots:
void connectionErrorOccurred();
void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
void connectionStateChanged();
void pollInferior();
......
......@@ -166,9 +166,10 @@ void QmlEngine::connectionStartupFailed()
notifyEngineRunFailed();
}
void QmlEngine::connectionError()
void QmlEngine::connectionError(QAbstractSocket::SocketError socketError)
{
// do nothing for now - only exit the debugger when inferior exits.
if (socketError ==QAbstractSocket::RemoteHostClosedError)
plugin()->showMessage(tr("QML Debugger: Remote host closed connection."), StatusBar);
}
void QmlEngine::runEngine()
......@@ -251,13 +252,15 @@ void QmlEngine::shutdownEngine()
shutdownEngineAsSlave();
notifyEngineShutdownOk();
plugin()->showMessage(QString(), StatusBar);
}
void QmlEngine::setupEngine()
{
m_adapter->setMaxConnectionAttempts(MaxConnectionAttempts);
m_adapter->setConnectionAttemptInterval(ConnectionAttemptDefaultInterval);
connect(m_adapter, SIGNAL(connectionError()), SLOT(connectionError()));
connect(m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),
SLOT(connectionError(QAbstractSocket::SocketError)));
connect(m_adapter, SIGNAL(connected()), SLOT(connectionEstablished()));
connect(m_adapter, SIGNAL(connectionStartupFailed()), SLOT(connectionStartupFailed()));
......
......@@ -122,7 +122,7 @@ signals:
private slots:
void connectionEstablished();
void connectionStartupFailed();
void connectionError();
void connectionError(QAbstractSocket::SocketError error);
void slotMessage(QString, bool);
void slotAddToOutputWindow(QString, bool);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment