Commit 87c66405 authored by Simjees Abraham's avatar Simjees Abraham Committed by Kai Koehne

Debugger: Apply on Save only when Engine client is connected

Creation of the Text previews are done only when the engine client
is connected and they are deleted once the engine client changes
from the connected state.

Change-Id: I325d0d1a281b9e8fab4ddf9ff8ea4f5e60d4ac2a
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent 69530f76
......@@ -98,6 +98,7 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
, m_inspectorToolsContext("Debugger.QmlInspector")
, m_selectAction(new QAction(this))
, m_zoomAction(new QAction(this))
, m_engineClientConnected(false)
{
connect(m_agent, SIGNAL(objectFetched(QmlDebug::ObjectReference)),
SLOT(onObjectFetched(QmlDebug::ObjectReference)));
......@@ -260,13 +261,17 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status
void QmlInspectorAdapter::engineClientStatusChanged(QmlDebug::ClientStatus status)
{
if (status != QmlDebug::Enabled)
return;
BaseEngineDebugClient *client
= qobject_cast<BaseEngineDebugClient*>(sender());
QTC_ASSERT(client, return);
setActiveEngineClient(client);
if (status == QmlDebug::Enabled) {
QTC_ASSERT(client, return);
setActiveEngineClient(client);
} else if (m_engineClientConnected &&
(client == m_engineClient)) {
m_engineClientConnected = false;
deletePreviews();
}
}
void QmlInspectorAdapter::selectObjectsFromEditor(const QList<int> &debugIds)
......@@ -332,6 +337,9 @@ void QmlInspectorAdapter::onObjectTreeUpdated()
void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
{
if (!m_engineClientConnected)
return;
if (newEditor && newEditor->id()
!= QmlJSEditor::Constants::C_QMLJSEDITOR_ID)
return;
......@@ -455,7 +463,7 @@ void QmlInspectorAdapter::setActiveEngineClient(BaseEngineDebugClient *client)
m_engineClient = client;
m_agent->setEngineClient(m_engineClient);
m_engineClientConnected = true;
if (m_engineClient &&
m_engineClient->status() == QmlDebug::Enabled) {
......@@ -609,6 +617,12 @@ void QmlInspectorAdapter::selectObject(const ObjectReference &obj,
emit selectionChanged();
}
void QmlInspectorAdapter::deletePreviews()
{
foreach (const QString &key, m_textPreviews.keys())
delete m_textPreviews.take(key);
}
void QmlInspectorAdapter::onReload()
{
QHash<QString, QByteArray> changesHash;
......
......@@ -114,6 +114,7 @@ private:
void selectObject(
const QmlDebug::ObjectReference &objectReference,
SelectionTarget target);
void deletePreviews();
QmlAdapter *m_debugAdapter;
......@@ -142,6 +143,8 @@ private:
Core::Context m_inspectorToolsContext;
QAction *m_selectAction;
QAction *m_zoomAction;
bool m_engineClientConnected;
};
} // namespace Internal
......
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