forked from qt-creator/qt-creator
Debugger: Fix for Apply on Save.
The difference check/comparison to saved document by preview is done only if the file was changed in the editor. Change-Id: I086fa5f5948a15a449d25ea85921551766f7b62a Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
committed by
Aurindam Jana
parent
bf9bc9914b
commit
946ca0b358
@@ -354,6 +354,7 @@ QmlLiveTextPreview::QmlLiveTextPreview(const QmlJS::Document::Ptr &doc,
|
|||||||
, m_nodeForOffset(0)
|
, m_nodeForOffset(0)
|
||||||
, m_updateNodeForOffset(false)
|
, m_updateNodeForOffset(false)
|
||||||
, m_changesUnsynchronizable(false)
|
, m_changesUnsynchronizable(false)
|
||||||
|
, m_contentsChanged(false)
|
||||||
{
|
{
|
||||||
QTC_CHECK(doc->fileName() == initDoc->fileName());
|
QTC_CHECK(doc->fileName() == initDoc->fileName());
|
||||||
|
|
||||||
@@ -385,13 +386,15 @@ void QmlLiveTextPreview::associateEditor(Core::IEditor *editor)
|
|||||||
|
|
||||||
if (!m_editors.contains(editWidget)) {
|
if (!m_editors.contains(editWidget)) {
|
||||||
m_editors << editWidget;
|
m_editors << editWidget;
|
||||||
if (m_inspectorAdapter)
|
if (m_inspectorAdapter) {
|
||||||
|
connect(editWidget, SIGNAL(changed()), SLOT(editorContentsChanged()));
|
||||||
connect(editWidget,
|
connect(editWidget,
|
||||||
SIGNAL(selectedElementsChanged(QList<QmlJS::AST::UiObjectMember*>,QString)),
|
SIGNAL(selectedElementsChanged(QList<QmlJS::AST::UiObjectMember*>,QString)),
|
||||||
SLOT(changeSelectedElements(QList<QmlJS::AST::UiObjectMember*>,QString)));
|
SLOT(changeSelectedElements(QList<QmlJS::AST::UiObjectMember*>,QString)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QmlLiveTextPreview::unassociateEditor(Core::IEditor *oldEditor)
|
void QmlLiveTextPreview::unassociateEditor(Core::IEditor *oldEditor)
|
||||||
{
|
{
|
||||||
@@ -589,6 +592,12 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
|
|||||||
if (doc->fileName() != m_previousDoc->fileName())
|
if (doc->fileName() != m_previousDoc->fileName())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Changes to be applied when changes were made from the editor.
|
||||||
|
// m_contentsChanged ensures that the changes were made by the user in
|
||||||
|
// the editor before starting with the comparisons.
|
||||||
|
if (!m_contentsChanged)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_applyChangesToQmlInspector) {
|
if (m_applyChangesToQmlInspector) {
|
||||||
m_docWithUnappliedChanges.clear();
|
m_docWithUnappliedChanges.clear();
|
||||||
|
|
||||||
@@ -626,6 +635,12 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
|
|||||||
} else {
|
} else {
|
||||||
m_docWithUnappliedChanges = doc;
|
m_docWithUnappliedChanges = doc;
|
||||||
}
|
}
|
||||||
|
m_contentsChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlLiveTextPreview::editorContentsChanged()
|
||||||
|
{
|
||||||
|
m_contentsChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> QmlLiveTextPreview::objectReferencesForOffset(quint32 offset)
|
QList<int> QmlLiveTextPreview::objectReferencesForOffset(quint32 offset)
|
||||||
|
@@ -83,6 +83,7 @@ private slots:
|
|||||||
void changeSelectedElements(const QList<QmlJS::AST::UiObjectMember *> offsets,
|
void changeSelectedElements(const QList<QmlJS::AST::UiObjectMember *> offsets,
|
||||||
const QString &wordAtCursor);
|
const QString &wordAtCursor);
|
||||||
void documentChanged(QmlJS::Document::Ptr doc);
|
void documentChanged(QmlJS::Document::Ptr doc);
|
||||||
|
void editorContentsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum UnsyncronizableChangeType {
|
enum UnsyncronizableChangeType {
|
||||||
@@ -115,6 +116,7 @@ private:
|
|||||||
QmlJS::AST::UiObjectMember *m_nodeForOffset;
|
QmlJS::AST::UiObjectMember *m_nodeForOffset;
|
||||||
bool m_updateNodeForOffset;
|
bool m_updateNodeForOffset;
|
||||||
bool m_changesUnsynchronizable;
|
bool m_changesUnsynchronizable;
|
||||||
|
bool m_contentsChanged;
|
||||||
|
|
||||||
friend class UpdateInspector;
|
friend class UpdateInspector;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user