summaryrefslogtreecommitdiff
path: root/src/plugins/debugger
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-16 17:29:17 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-19 11:32:46 +0000
commit81eea72d44531107ace4ae4a3c525ff6b9cd23cc (patch)
treef0de5d2423709e264adf188b4a519bce45c363d5 /src/plugins/debugger
parent47317eff60619d762c54f9dc7e472431b2a86c2a (diff)
downloadqt-creator-81eea72d44531107ace4ae4a3c525ff6b9cd23cc.tar.gz
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>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp22
-rw-r--r--src/plugins/debugger/qml/qmlengine.h6
2 files changed, 13 insertions, 15 deletions
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index a8ac02e147..9d290e8c2c 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -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)
{
diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h
index 479dddb746..24942b8feb 100644
--- a/src/plugins/debugger/qml/qmlengine.h
+++ b/src/plugins/debugger/qml/qmlengine.h
@@ -34,7 +34,6 @@
#include <debugger/debuggerengine.h>
#include <qmldebug/qdebugmessageclient.h>
-#include <qmldebug/qmldebugclient.h>
#include <qmldebug/qmloutputparser.h>
#include <qmljs/iscriptevaluator.h>
#include <qmljs/qmljsdocument.h>
@@ -142,11 +141,12 @@ private:
void startApplicationLauncher();
void stopApplicationLauncher();
- void connectionErrorOccurred(QDebugSupport::Error socketError);
+ void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
+ void connectionStateChanged(QAbstractSocket::SocketState socketState);
+
void clientStateChanged(QmlDebug::QmlDebugClient::State state);
void checkConnectionState();
void showConnectionStateMessage(const QString &message);
- void showConnectionErrorMessage(const QString &message);
bool isConnected() const;
private: