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