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() ...@@ -99,7 +99,7 @@ bool QmlAdapter::connectToViewer()
connect(m_conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)), connect(m_conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
SLOT(connectionStateChanged())); SLOT(connectionStateChanged()));
connect(m_conn, SIGNAL(error(QAbstractSocket::SocketError)), connect(m_conn, SIGNAL(error(QAbstractSocket::SocketError)),
SLOT(connectionErrorOccurred())); SLOT(connectionErrorOccurred(QAbstractSocket::SocketError)));
QString address = m_engine.data()->startParameters().qmlServerAddress; QString address = m_engine.data()->startParameters().qmlServerAddress;
QString port = QString::number(m_engine.data()->startParameters().qmlServerPort); QString port = QString::number(m_engine.data()->startParameters().qmlServerPort);
...@@ -114,14 +114,14 @@ bool QmlAdapter::connectToViewer() ...@@ -114,14 +114,14 @@ bool QmlAdapter::connectToViewer()
return true; return true;
} }
void QmlAdapter::connectionErrorOccurred() void QmlAdapter::connectionErrorOccurred(QAbstractSocket::SocketError socketError)
{ {
showConnectionErrorMessage(tr("Error: (%1) %2", "%1=error code, %2=error message") showConnectionErrorMessage(tr("Error: (%1) %2", "%1=error code, %2=error message")
.arg(m_conn->error()).arg(m_conn->errorString())); .arg(m_conn->error()).arg(m_conn->errorString()));
// this is only an error if we are already connected and something goes wrong. // this is only an error if we are already connected and something goes wrong.
if (isConnected()) if (isConnected())
emit connectionError(); emit connectionError(socketError);
} }
void QmlAdapter::connectionStateChanged() void QmlAdapter::connectionStateChanged()
......
...@@ -67,10 +67,10 @@ signals: ...@@ -67,10 +67,10 @@ signals:
void connected(); void connected();
void disconnected(); void disconnected();
void connectionStartupFailed(); void connectionStartupFailed();
void connectionError(); void connectionError(QAbstractSocket::SocketError socketError);
private slots: private slots:
void connectionErrorOccurred(); void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
void connectionStateChanged(); void connectionStateChanged();
void pollInferior(); void pollInferior();
......
...@@ -166,9 +166,10 @@ void QmlEngine::connectionStartupFailed() ...@@ -166,9 +166,10 @@ void QmlEngine::connectionStartupFailed()
notifyEngineRunFailed(); 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() void QmlEngine::runEngine()
...@@ -251,13 +252,15 @@ void QmlEngine::shutdownEngine() ...@@ -251,13 +252,15 @@ void QmlEngine::shutdownEngine()
shutdownEngineAsSlave(); shutdownEngineAsSlave();
notifyEngineShutdownOk(); notifyEngineShutdownOk();
plugin()->showMessage(QString(), StatusBar);
} }
void QmlEngine::setupEngine() void QmlEngine::setupEngine()
{ {
m_adapter->setMaxConnectionAttempts(MaxConnectionAttempts); m_adapter->setMaxConnectionAttempts(MaxConnectionAttempts);
m_adapter->setConnectionAttemptInterval(ConnectionAttemptDefaultInterval); 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(connected()), SLOT(connectionEstablished()));
connect(m_adapter, SIGNAL(connectionStartupFailed()), SLOT(connectionStartupFailed())); connect(m_adapter, SIGNAL(connectionStartupFailed()), SLOT(connectionStartupFailed()));
......
...@@ -122,7 +122,7 @@ signals: ...@@ -122,7 +122,7 @@ signals:
private slots: private slots:
void connectionEstablished(); void connectionEstablished();
void connectionStartupFailed(); void connectionStartupFailed();
void connectionError(); void connectionError(QAbstractSocket::SocketError error);
void slotMessage(QString, bool); void slotMessage(QString, bool);
void slotAddToOutputWindow(QString, bool); void slotAddToOutputWindow(QString, bool);
......
Supports Markdown
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