Commit ccc4fe54 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Delete debug connection on error or if params change

Now that we don't recreate the debug connection anymore when (re)trying
to connect, we have to do it explicitly when changing the connection
parameters or when a connection attempt fails and we need to cancel the
"Connecting" state.

Change-Id: Ib2b6b4fb1e39e64fe3c9f2bf90b6e43043d05a9e
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
parent b85d8290
...@@ -105,6 +105,7 @@ void QmlProfilerClientManager::setTcpConnection(QString host, quint64 port) ...@@ -105,6 +105,7 @@ void QmlProfilerClientManager::setTcpConnection(QString host, quint64 port)
{ {
d->tcpHost = host; d->tcpHost = host;
d->tcpPort = port; d->tcpPort = port;
disconnectClient();
} }
void QmlProfilerClientManager::clearBufferedData() void QmlProfilerClientManager::clearBufferedData()
...@@ -135,6 +136,8 @@ void QmlProfilerClientManager::connectClient(quint16 port) ...@@ -135,6 +136,8 @@ void QmlProfilerClientManager::connectClient(quint16 port)
connect(d->connection, SIGNAL(errorMessage(QString)), this, SLOT(logState(QString))); connect(d->connection, SIGNAL(errorMessage(QString)), this, SLOT(logState(QString)));
connect(d->connection, SIGNAL(opened()), this, SLOT(qmlDebugConnectionOpened())); connect(d->connection, SIGNAL(opened()), this, SLOT(qmlDebugConnectionOpened()));
connect(d->connection, SIGNAL(closed()), this, SLOT(qmlDebugConnectionClosed())); connect(d->connection, SIGNAL(closed()), this, SLOT(qmlDebugConnectionClosed()));
connect(d->connection, &QmlDebugConnection::error,
this, &QmlProfilerClientManager::qmlDebugConnectionError);
d->connectionTimer.start(); d->connectionTimer.start();
d->tcpPort = port; d->tcpPort = port;
} }
...@@ -276,6 +279,17 @@ void QmlProfilerClientManager::qmlDebugConnectionClosed() ...@@ -276,6 +279,17 @@ void QmlProfilerClientManager::qmlDebugConnectionClosed()
emit connectionClosed(); emit connectionClosed();
} }
void QmlProfilerClientManager::qmlDebugConnectionError(QDebugSupport::Error error)
{
logState(tr("Debug connection error %1").arg(error));
if (d->connection->isOpen()) {
disconnectClient();
emit connectionClosed();
} else {
disconnectClient();
}
}
void QmlProfilerClientManager::logState(const QString &msg) void QmlProfilerClientManager::logState(const QString &msg)
{ {
QString state = QLatin1String("QML Profiler: ") + msg; QString state = QLatin1String("QML Profiler: ") + msg;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "qmlprofilerstatemanager.h" #include "qmlprofilerstatemanager.h"
#include <qmldebug/qmlprofilereventlocation.h> #include <qmldebug/qmlprofilereventlocation.h>
#include <qmldebug/qmldebugclient.h>
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
...@@ -71,6 +72,7 @@ private slots: ...@@ -71,6 +72,7 @@ private slots:
void tryToConnect(); void tryToConnect();
void qmlDebugConnectionOpened(); void qmlDebugConnectionOpened();
void qmlDebugConnectionClosed(); void qmlDebugConnectionClosed();
void qmlDebugConnectionError(QDebugSupport::Error error);
void logState(const QString &); void logState(const QString &);
void retryMessageBoxFinished(int result); void retryMessageBoxFinished(int result);
......
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