Commit cc5d0459 authored by Olivier Goffart's avatar Olivier Goffart
Browse files

QmlJSInspector::DebuggerClient: move the code around

parent ea6775d1
......@@ -31,7 +31,6 @@
#include "qmljsprivateapi.h"
#include <utils/qtcassert.h>
#include <extensionsystem/pluginmanager.h>
#include <QUrl>
#include <QAbstractSocket>
......@@ -47,8 +46,7 @@ ClientProxy::ClientProxy(QObject *parent) :
m_client(0),
m_engineQuery(0),
m_contextQuery(0),
m_objectTreeQuery(0),
m_debuggerRunControl(0)
m_objectTreeQuery(0)
{
Q_ASSERT(! m_instance);
m_instance = this;
......@@ -157,24 +155,7 @@ void ClientProxy::connectionStateChanged()
#endif
}
{
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);
m_debuggerRunControl = qobject_cast<Debugger::DebuggerRunControl *>(runControl);
QTC_ASSERT(m_debuggerRunControl, return );
Debugger::Internal::QmlEngine *engine = qobject_cast<Debugger::Internal::QmlEngine *>(m_debuggerRunControl->engine());
QTC_ASSERT(engine, return );
(void) new DebuggerClient(m_conn, engine);
engine->Debugger::Internal::DebuggerEngine::startDebugger(m_debuggerRunControl);
engine->startSuccessful();
}
(void) new DebuggerClient(m_conn);
reloadEngines();
......
......@@ -117,7 +117,6 @@ private:
QDeclarativeDebugObjectReference m_rootObject;
QList<QDeclarativeDebugEngineReference> m_engines;
Debugger::DebuggerRunControl *m_debuggerRunControl;
friend class QmlJSInspector::Internal::InspectorPlugin;
};
......
......@@ -28,12 +28,32 @@
**************************************************************************/
#include "qmljsdebuggerclient.h"
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
using namespace QmlJSInspector::Internal;
DebuggerClient::DebuggerClient(QDeclarativeDebugConnection *client, Debugger::Internal::QmlEngine *engine)
DebuggerClient::DebuggerClient(QDeclarativeDebugConnection* client)
: QDeclarativeDebugClient(QLatin1String("Debugger"), client)
, connection(client), engine(engine)
, 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();
connect(engine, SIGNAL(sendMessage(QByteArray)), this, SLOT(slotSendMessage(QByteArray)));
setEnabled(true);
}
......
......@@ -43,7 +43,7 @@ class DebuggerClient : public QDeclarativeDebugClient
Q_OBJECT
public:
DebuggerClient(QDeclarativeDebugConnection *client, Debugger::Internal::QmlEngine *engine);
DebuggerClient(QDeclarativeDebugConnection *client);
virtual ~DebuggerClient();
public: // attributes
......
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