diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.cpp b/src/plugins/qmljsinspector/qmljsclientproxy.cpp index 3e2836f3d7a1c65370be4dcfaf10c7a5c9f92f75..7d419d55b180de0442340b760f564e605938f359 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.cpp +++ b/src/plugins/qmljsinspector/qmljsclientproxy.cpp @@ -26,11 +26,16 @@ ** contact the sales department at http://qt.nokia.com/contact. ** **************************************************************************/ + #include "qmljsclientproxy.h" #include "qmljsdebuggerclient.h" #include "qmljsprivateapi.h" #include "qmljsdesigndebugclient.h" +#include <debugger/debuggerplugin.h> +#include <debugger/debuggerrunner.h> +#include <debugger/qml/qmlengine.h> +#include <extensionsystem/pluginmanager.h> #include <utils/qtcassert.h> #include <QUrl> @@ -240,8 +245,7 @@ void ClientProxy::connectionStateChanged() SLOT(refreshObjectTree())); } - (void) new DebuggerClient(m_conn); - + createDebuggerClient(); reloadEngines(); break; @@ -255,6 +259,38 @@ void ClientProxy::connectionStateChanged() } } +void ClientProxy::createDebuggerClient() +{ + DebuggerClient *debuggerClient = new DebuggerClient(m_conn); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + const QList<Debugger::DebuggerRunControlFactory *> factories = + pm->getObjects<Debugger::DebuggerRunControlFactory>(); + ProjectExplorer::RunControl *runControl = 0; + + Debugger::DebuggerStartParameters sp; + sp.startMode = Debugger::StartExternal; + sp.executable = "qmlviewer"; //FIXME + runControl = factories.first()->create(sp); + Debugger::DebuggerRunControl* debuggerRunControl = + qobject_cast<Debugger::DebuggerRunControl *>(runControl); + + QTC_ASSERT(debuggerRunControl, return); + Debugger::Internal::QmlEngine *engine = + qobject_cast<Debugger::Internal::QmlEngine *>(debuggerRunControl->engine()); + QTC_ASSERT(engine, return); + + engine->Debugger::Internal::DebuggerEngine::startDebugger(debuggerRunControl); + + connect(engine, SIGNAL(sendMessage(QByteArray)), + debuggerClient, SLOT(slotSendMessage(QByteArray))); + connect(debuggerClient, SIGNAL(messageWasReceived(QByteArray)), + engine, SLOT(messageReceived(QByteArray))); + connect(m_conn, SIGNAL(disconnected()), + engine, SLOT(disconnected())); + + //engine->startSuccessful(); // FIXME: AAA: port to new debugger states +} + bool ClientProxy::isConnected() const { return m_conn && m_client && m_conn->state() == QAbstractSocket::ConnectedState; diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.h b/src/plugins/qmljsinspector/qmljsclientproxy.h index 95264f27bfeaf60241dd65d5505c568ede16affc..04f1bb6a5fa46a339eb2645801f2c3ce28cb6514 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.h +++ b/src/plugins/qmljsinspector/qmljsclientproxy.h @@ -123,6 +123,7 @@ private slots: private: bool isDesignClientConnected() const; void reloadEngines(); + void createDebuggerClient(); QList<QDeclarativeDebugObjectReference> objectReferences(const QUrl &url, const QDeclarativeDebugObjectReference &objectRef) const; QDeclarativeDebugObjectReference objectReferenceForId(int debugId, const QDeclarativeDebugObjectReference &ref) const; diff --git a/src/plugins/qmljsinspector/qmljsdebuggerclient.cpp b/src/plugins/qmljsinspector/qmljsdebuggerclient.cpp index 36dac9a7a31d36c9441c61db2ddcf46afe580414..27450482660b072229974957097b6c91ba4a2965 100644 --- a/src/plugins/qmljsinspector/qmljsdebuggerclient.cpp +++ b/src/plugins/qmljsinspector/qmljsdebuggerclient.cpp @@ -35,27 +35,7 @@ using namespace QmlJSInspector::Internal; DebuggerClient::DebuggerClient(QDeclarativeDebugConnection* client) : QDeclarativeDebugClient(QLatin1String("JSDebugger"), client) - , connection(client) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - const QList<Debugger::DebuggerRunControlFactory *> factories = pm->getObjects<Debugger::DebuggerRunControlFactory>(); - ProjectExplorer::RunControl *runControl = 0; - - Debugger::DebuggerStartParameters sp; - sp.startMode = Debugger::StartExternal; - sp.executable = "qmlviewer"; //FIXME - runControl = factories.first()->create(sp); - Debugger::DebuggerRunControl* debuggerRunControl = qobject_cast<Debugger::DebuggerRunControl *>(runControl); - - QTC_ASSERT(debuggerRunControl, return ); - engine = qobject_cast<Debugger::Internal::QmlEngine *>(debuggerRunControl->engine()); - QTC_ASSERT(engine, return ); - - engine->Debugger::Internal::DebuggerEngine::startDebugger(debuggerRunControl); - //engine->startSuccessful(); // FIXME: AAA: port to new debugger states - - connect(engine, SIGNAL(sendMessage(QByteArray)), this, SLOT(slotSendMessage(QByteArray))); - connect(connection, SIGNAL(disconnected()), engine, SLOT(disconnected())); setEnabled(true); } @@ -65,7 +45,7 @@ DebuggerClient::~DebuggerClient() void DebuggerClient::messageReceived(const QByteArray &data) { - engine->messageReceived(data); + emit messageWasReceived(data); } void DebuggerClient::slotSendMessage(const QByteArray &message) diff --git a/src/plugins/qmljsinspector/qmljsdebuggerclient.h b/src/plugins/qmljsinspector/qmljsdebuggerclient.h index cfdaead5f96ac3bbf5287b9687d5a8f1629d059c..4daf16fe6e47ebc791fd4cf44526c0821cb923d4 100644 --- a/src/plugins/qmljsinspector/qmljsdebuggerclient.h +++ b/src/plugins/qmljsinspector/qmljsdebuggerclient.h @@ -26,14 +26,11 @@ ** contact the sales department at http://qt.nokia.com/contact. ** **************************************************************************/ + #ifndef QMLJSDEBUGGERCLIENT_H #define QMLJSDEBUGGERCLIENT_H #include "qmljsprivateapi.h" -#include <debugger/qml/qmlengine.h> -#include <debugger/stackframe.h> -#include <debugger/stackhandler.h> -#include <debugger/debuggerrunner.h> namespace QmlJSInspector { namespace Internal { @@ -46,9 +43,8 @@ public: DebuggerClient(QDeclarativeDebugConnection *client); virtual ~DebuggerClient(); -public: // attributes - QDeclarativeDebugConnection *connection; - Debugger::Internal::QmlEngine *engine; +signals: + void messageWasReceived(const QByteArray &data); private Q_SLOTS: void slotSendMessage(const QByteArray &message);