forked from qt-creator/qt-creator
Qml Live Preview: lazily create QmlJSLiveTextPreview
This commit is contained in:
@@ -262,6 +262,12 @@ QDeclarativeDebugObjectReference ClientProxy::objectReferenceForId(int debugId)
|
|||||||
return objectReferenceForId(debugId, m_rootObject);
|
return objectReferenceForId(debugId, m_rootObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDeclarativeDebugObjectReference QmlJSInspector::Internal::ClientProxy::rootObjectReference() const
|
||||||
|
{
|
||||||
|
return m_rootObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QDeclarativeDebugObjectReference ClientProxy::objectReferenceForId(int debugId,
|
QDeclarativeDebugObjectReference ClientProxy::objectReferenceForId(int debugId,
|
||||||
const QDeclarativeDebugObjectReference &objectRef) const
|
const QDeclarativeDebugObjectReference &objectRef) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public:
|
|||||||
// returns the object references for the given url.
|
// returns the object references for the given url.
|
||||||
QList<QDeclarativeDebugObjectReference> objectReferences(const QUrl &url = QUrl()) const;
|
QList<QDeclarativeDebugObjectReference> objectReferences(const QUrl &url = QUrl()) const;
|
||||||
QDeclarativeDebugObjectReference objectReferenceForId(int debugId) const;
|
QDeclarativeDebugObjectReference objectReferenceForId(int debugId) const;
|
||||||
|
QDeclarativeDebugObjectReference rootObjectReference() const;
|
||||||
void refreshObjectTree();
|
void refreshObjectTree();
|
||||||
|
|
||||||
bool isConnected() const;
|
bool isConnected() const;
|
||||||
|
|||||||
@@ -231,19 +231,9 @@ void Inspector::initializeDocuments()
|
|||||||
connect(em, SIGNAL(editorOpened(Core::IEditor*)), SLOT(createPreviewForEditor(Core::IEditor*)));
|
connect(em, SIGNAL(editorOpened(Core::IEditor*)), SLOT(createPreviewForEditor(Core::IEditor*)));
|
||||||
|
|
||||||
// initial update
|
// initial update
|
||||||
#if 0
|
|
||||||
foreach (Core::IEditor *editor, em->openedEditors()) {
|
foreach (Core::IEditor *editor, em->openedEditors()) {
|
||||||
createPreviewForEditor(editor);
|
createPreviewForEditor(editor);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
foreach (QmlJS::Document::Ptr doc, m_loadedSnapshot) {
|
|
||||||
QmlJSLiveTextPreview *preview = new QmlJSLiveTextPreview(doc, doc, this);
|
|
||||||
connect(preview,
|
|
||||||
SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)),
|
|
||||||
SLOT(changeSelectedItems(QList<QDeclarativeDebugObjectReference>)));
|
|
||||||
m_textPreviews.insert(doc->fileName(), preview);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::serverReloaded()
|
void Inspector::serverReloaded()
|
||||||
@@ -286,6 +276,7 @@ void Inspector::createPreviewForEditor(Core::IEditor *newEditor)
|
|||||||
SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)),
|
SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)),
|
||||||
SLOT(changeSelectedItems(QList<QDeclarativeDebugObjectReference>)));
|
SLOT(changeSelectedItems(QList<QDeclarativeDebugObjectReference>)));
|
||||||
m_textPreviews.insert(newEditor->file()->fileName(), preview);
|
m_textPreviews.insert(newEditor->file()->fileName(), preview);
|
||||||
|
preview->updateDebugIds(m_clientProxy->rootObjectReference());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,12 +144,6 @@ QmlJSLiveTextPreview::QmlJSLiveTextPreview(const QmlJS::Document::Ptr &doc, cons
|
|||||||
connect(clientProxy,
|
connect(clientProxy,
|
||||||
SIGNAL(objectTreeUpdated(QDeclarativeDebugObjectReference)),
|
SIGNAL(objectTreeUpdated(QDeclarativeDebugObjectReference)),
|
||||||
SLOT(updateDebugIds(QDeclarativeDebugObjectReference)));
|
SLOT(updateDebugIds(QDeclarativeDebugObjectReference)));
|
||||||
|
|
||||||
Core::EditorManager *em = Core::EditorManager::instance();
|
|
||||||
QList<Core::IEditor *> editors = em->editorsForFileName(m_filename);
|
|
||||||
|
|
||||||
foreach(Core::IEditor *editor, editors)
|
|
||||||
associateEditor(editor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSLiveTextPreview::resetInitialDoc(const QmlJS::Document::Ptr &doc)
|
void QmlJSLiveTextPreview::resetInitialDoc(const QmlJS::Document::Ptr &doc)
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ signals:
|
|||||||
private slots:
|
private slots:
|
||||||
void changeSelectedElements(QList<int> offsets, const QString &wordAtCursor);
|
void changeSelectedElements(QList<int> offsets, const QString &wordAtCursor);
|
||||||
void documentChanged(QmlJS::Document::Ptr doc);
|
void documentChanged(QmlJS::Document::Ptr doc);
|
||||||
|
public slots:
|
||||||
void updateDebugIds(const QDeclarativeDebugObjectReference &rootReference);
|
void updateDebugIds(const QDeclarativeDebugObjectReference &rootReference);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user