Commit 6bbd8014 authored by Aurindam Jana's avatar Aurindam Jana

QML/JS Console: Update context

Update context from QML object tree or the stack frame
depending upon debugger engine state.

Change-Id: I4e6affba37acc016513ad95cd278a400aaa18c49
Reviewed-by: default avatarChristiaan Janssen <christiaan.janssen@digia.com>
parent e53b4a9c
......@@ -93,8 +93,7 @@ QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp, QString *errorMess
{
setObjectName(QLatin1String("QmlCppEngine"));
d = new QmlCppEnginePrivate;
d->m_qmlEngine = new QmlEngine(sp);
d->m_qmlEngine->setMasterEngine(this);
d->m_qmlEngine = new QmlEngine(sp, this);
d->m_cppEngine = DebuggerRunControlFactory::createEngine(sp.firstSlaveEngineType, sp, errorMessage);
d->m_cppEngine->setMasterEngine(this);
if (!d->m_cppEngine) {
......
......@@ -265,7 +265,7 @@ public:
//
///////////////////////////////////////////////////////////////////////
QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters)
QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters, DebuggerEngine *masterEngine)
: DebuggerEngine(startParameters)
, m_adapter(this)
, m_inspectorAdapter(&m_adapter, this)
......@@ -273,9 +273,11 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters)
, m_automaticConnect(false)
{
setObjectName(QLatin1String("QmlEngine"));
ExtensionSystem::PluginManager::addObject(this);
if (masterEngine)
setMasterEngine(masterEngine);
connect(&m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),
SLOT(connectionError(QAbstractSocket::SocketError)));
connect(&m_adapter, SIGNAL(serviceConnectionError(QString)),
......@@ -285,9 +287,9 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters)
connect(&m_adapter, SIGNAL(connectionStartupFailed()),
SLOT(connectionStartupFailed()));
connect(this, SIGNAL(stateChanged(Debugger::DebuggerState)),
connect(stackHandler(), SIGNAL(stackChanged()),
SLOT(updateCurrentContext()));
connect(this->stackHandler(), SIGNAL(currentIndexChanged()),
connect(stackHandler(), SIGNAL(currentIndexChanged()),
SLOT(updateCurrentContext()));
connect(&m_inspectorAdapter, SIGNAL(selectionChanged()),
SLOT(updateCurrentContext()));
......
......@@ -59,7 +59,8 @@ class QmlEngine : public DebuggerEngine
Q_OBJECT
public:
explicit QmlEngine(const DebuggerStartParameters &startParameters);
explicit QmlEngine(const DebuggerStartParameters &startParameters,
DebuggerEngine *masterEngine = 0);
~QmlEngine();
void notifyEngineRemoteSetupDone(int gdbServerPort, int qmlPort);
......
......@@ -79,8 +79,8 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
{
connect(m_agent, SIGNAL(objectFetched(QmlDebug::ObjectReference)),
SLOT(onObjectFetched(QmlDebug::ObjectReference)));
connect(m_agent, SIGNAL(jumpToObjectDefinition(QmlDebug::FileReference)),
SLOT(jumpToObjectDefinitionInEditor(QmlDebug::FileReference)));
connect(m_agent, SIGNAL(jumpToObjectDefinition(QmlDebug::FileReference,int)),
SLOT(jumpToObjectDefinitionInEditor(QmlDebug::FileReference,int)));
QmlDebugConnection *connection = m_debugAdapter->connection();
DeclarativeEngineDebugClient *engineClient1
......@@ -453,7 +453,7 @@ void QmlInspectorAdapter::showConnectionStatusMessage(const QString &message)
}
void QmlInspectorAdapter::jumpToObjectDefinitionInEditor(
const FileReference &objSource)
const FileReference &objSource, int debugId)
{
const QString fileName = m_engine->toFileInProject(objSource.url());
......@@ -467,6 +467,12 @@ void QmlInspectorAdapter::jumpToObjectDefinitionInEditor(
textEditor->gotoLine(objSource.lineNumber());
textEditor->widget()->setFocus();
}
if (debugId != -1 && debugId != m_currentSelectedDebugId) {
m_currentSelectedDebugId = debugId;
m_currentSelectedDebugName = agent()->displayName(debugId);
emit selectionChanged();
}
}
void QmlInspectorAdapter::selectObject(const ObjectReference &obj,
......
......@@ -96,7 +96,7 @@ private slots:
void onReload();
void onReloaded();
void onDestroyedObject(int);
void jumpToObjectDefinitionInEditor(const QmlDebug::FileReference &objSource);
void jumpToObjectDefinitionInEditor(const QmlDebug::FileReference &objSource, int debugId = -1);
private:
void setActiveEngineClient(QmlDebug::BaseEngineDebugClient *client);
......
......@@ -128,7 +128,7 @@ void QmlInspectorAgent::watchDataSelected(const WatchData *data)
if (data->id) {
QTC_ASSERT(m_debugIdLocations.keys().contains(data->id), return);
emit jumpToObjectDefinition(m_debugIdLocations.value(data->id));
emit jumpToObjectDefinition(m_debugIdLocations.value(data->id), data->id);
}
}
......
......@@ -102,7 +102,7 @@ signals:
void propertyChanged(int debugId, const QByteArray &propertyName,
const QVariant &propertyValue);
void automaticUpdateFailed();
void jumpToObjectDefinition(const QmlDebug::FileReference &objSource);
void jumpToObjectDefinition(const QmlDebug::FileReference &objSource, int debugId);
private slots:
void updateStatus();
......
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