Commit 289acee7 authored by Kai Koehne's avatar Kai Koehne

QmlDbg: Fix behavior when re-running the same run control

Change-Id: Icb405b4751fc885d8b96d1daec3653236b564ef0
Reviewed-on: http://codereview.qt.nokia.com/2352Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarChristiaan Janssen <christiaan.janssen@nokia.com>
parent 4453554c
......@@ -237,6 +237,11 @@ void QDeclarativeDebugConnection::close()
QIODevice::close();
d->device->close();
emit stateChanged(QAbstractSocket::UnconnectedState);
QHash<QString, QDeclarativeDebugClient*>::iterator iter = d->plugins.begin();
for (; iter != d->plugins.end(); ++iter) {
iter.value()->statusChanged(QDeclarativeDebugClient::NotConnected);
}
}
}
......@@ -283,6 +288,7 @@ void QDeclarativeDebugConnection::connectToHost(const QString &hostName, quint16
QTcpSocket *socket = new QTcpSocket(d);
d->device = socket;
d->connectDeviceSignals();
d->gotHello = false;
connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
......@@ -297,6 +303,7 @@ void QDeclarativeDebugConnection::connectToOst(const QString &port)
ost->setParent(d);
d->device = ost;
d->connectDeviceSignals();
d->gotHello = false;
QIODevice::open(ReadWrite | Unbuffered);
emit stateChanged(QAbstractSocket::ConnectedState);
emit connected();
......
......@@ -38,11 +38,12 @@
#include "debuggerengine.h"
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <QtCore/QTimer>
#include <QtCore/QDebug>
#include <utils/qtcassert.h>
namespace Debugger {
namespace Internal {
......@@ -81,10 +82,19 @@ QmlAdapter::QmlAdapter(DebuggerEngine *engine, QObject *parent)
connect(d->m_conn, SIGNAL(error(QAbstractSocket::SocketError)),
SLOT(connectionErrorOccurred(QAbstractSocket::SocketError)));
ExtensionSystem::PluginManager *pluginManager =
ExtensionSystem::PluginManager::instance();
pluginManager->addObject(this);
}
QmlAdapter::~QmlAdapter()
{
ExtensionSystem::PluginManager *pluginManager =
ExtensionSystem::PluginManager::instance();
if (pluginManager->allObjects().contains(this)) {
pluginManager->removeObject(this);
}
}
void QmlAdapter::beginConnection()
......@@ -191,7 +201,8 @@ void QmlAdapter::connectionStateChanged()
{
showConnectionStatusMessage(tr("connected.\n"));
createDebuggerClient();
if (!d->m_qmlClient)
createDebuggerClient();
//reloadEngines();
emit connected();
break;
......@@ -226,9 +237,6 @@ bool QmlAdapter::isConnected() const
QDeclarativeDebugConnection *QmlAdapter::connection() const
{
if (!isConnected())
return 0;
return d->m_conn;
}
......
......@@ -183,10 +183,37 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
d(new QmlEnginePrivate(this))
{
setObjectName(QLatin1String("QmlEngine"));
ExtensionSystem::PluginManager *pluginManager =
ExtensionSystem::PluginManager::instance();
pluginManager->addObject(this);
connect(&d->m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),
SLOT(connectionError(QAbstractSocket::SocketError)));
connect(&d->m_adapter, SIGNAL(serviceConnectionError(QString)),
SLOT(serviceConnectionError(QString)));
connect(&d->m_adapter, SIGNAL(connected()),
SLOT(connectionEstablished()));
connect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
SLOT(connectionStartupFailed()));
connect(&d->m_applicationLauncher,
SIGNAL(processExited(int)),
SLOT(disconnected()));
connect(&d->m_applicationLauncher,
SIGNAL(appendMessage(QString,Utils::OutputFormat)),
SLOT(appendMessage(QString,Utils::OutputFormat)));
}
QmlEngine::~QmlEngine()
{}
{
ExtensionSystem::PluginManager *pluginManager =
ExtensionSystem::PluginManager::instance();
if (pluginManager->allObjects().contains(this)) {
pluginManager->removeObject(this);
}
}
void QmlEngine::setupInferior()
{
......@@ -198,17 +225,6 @@ void QmlEngine::setupInferior()
else
emit requestRemoteSetup();
} else {
connect(&d->m_applicationLauncher,
SIGNAL(processExited(int)),
SLOT(disconnected()));
connect(&d->m_applicationLauncher,
SIGNAL(appendMessage(QString,Utils::OutputFormat)),
SLOT(appendMessage(QString,Utils::OutputFormat)));
connect(&d->m_applicationLauncher,
SIGNAL(bringToForegroundRequested(qint64)),
runControl(),
SLOT(bringApplicationToForeground(qint64)));
d->m_applicationLauncher.setEnvironment(startParameters().environment);
d->m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
......@@ -225,11 +241,6 @@ void QmlEngine::connectionEstablished()
{
attemptBreakpointSynchronization();
ExtensionSystem::PluginManager *pluginManager =
ExtensionSystem::PluginManager::instance();
pluginManager->addObject(&d->m_adapter);
pluginManager->addObject(this);
showMessage(tr("QML Debugger connected."), StatusBar);
if (!watchHandler()->watcherNames().isEmpty()) {
......@@ -238,7 +249,6 @@ void QmlEngine::connectionEstablished()
connect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
notifyEngineRunAndInferiorRunOk();
}
void QmlEngine::connectionStartupFailed()
......@@ -366,17 +376,7 @@ bool QmlEngine::acceptsWatchesWhileRunning() const
void QmlEngine::closeConnection()
{
disconnect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
disconnect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
this, SLOT(connectionStartupFailed()));
d->m_adapter.closeConnection();
ExtensionSystem::PluginManager *pluginManager =
ExtensionSystem::PluginManager::instance();
if (pluginManager->allObjects().contains(this)) {
pluginManager->removeObject(&d->m_adapter);
pluginManager->removeObject(this);
}
}
void QmlEngine::runEngine()
......@@ -448,14 +448,10 @@ void QmlEngine::shutdownEngine()
void QmlEngine::setupEngine()
{
d->m_ping = 0;
connect(&d->m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),
SLOT(connectionError(QAbstractSocket::SocketError)));
connect(&d->m_adapter, SIGNAL(serviceConnectionError(QString)),
SLOT(serviceConnectionError(QString)));
connect(&d->m_adapter, SIGNAL(connected()),
SLOT(connectionEstablished()));
connect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
SLOT(connectionStartupFailed()));
connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
runControl(), SLOT(bringApplicationToForeground(qint64)),
Qt::UniqueConnection);
notifyEngineSetupOk();
}
......
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