summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@digia.com>2012-11-27 17:16:57 +0100
committerAurindam Jana <aurindam.jana@digia.com>2012-11-27 17:32:11 +0100
commit6bbd80143b69f64036c794041275267431333efc (patch)
treeed0129451794762fe5ac217d11d813ff6463ff35 /src
parente53b4a9c7699bfacd8877b4ad524df2f2ac20a8b (diff)
downloadqt-creator-6bbd80143b69f64036c794041275267431333efc.tar.gz
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: Christiaan Janssen <christiaan.janssen@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/qml/qmlcppengine.cpp3
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp10
-rw-r--r--src/plugins/debugger/qml/qmlengine.h3
-rw-r--r--src/plugins/debugger/qml/qmlinspectoradapter.cpp12
-rw-r--r--src/plugins/debugger/qml/qmlinspectoradapter.h2
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp2
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.h2
7 files changed, 21 insertions, 13 deletions
diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp
index 0e3ff39346..15bebbdcf8 100644
--- a/src/plugins/debugger/qml/qmlcppengine.cpp
+++ b/src/plugins/debugger/qml/qmlcppengine.cpp
@@ -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) {
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index e823507442..40030a54df 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -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()));
diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h
index d46285498d..7be04377b3 100644
--- a/src/plugins/debugger/qml/qmlengine.h
+++ b/src/plugins/debugger/qml/qmlengine.h
@@ -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);
diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
index c7f6db9743..e6c3ec0cf9 100644
--- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
@@ -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,
diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.h b/src/plugins/debugger/qml/qmlinspectoradapter.h
index 885e4bbb2b..e6c5d4d195 100644
--- a/src/plugins/debugger/qml/qmlinspectoradapter.h
+++ b/src/plugins/debugger/qml/qmlinspectoradapter.h
@@ -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);
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index 3b952020d4..4854325fd4 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -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);
}
}
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.h b/src/plugins/debugger/qml/qmlinspectoragent.h
index 2bc2f1ba64..63ce282ede 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.h
+++ b/src/plugins/debugger/qml/qmlinspectoragent.h
@@ -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();