diff options
author | Eike Ziller <eike.ziller@digia.com> | 2013-07-17 09:42:44 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2013-07-18 14:51:03 +0200 |
commit | bc88c0b89e8f61a50ba62c8319114330211337da (patch) | |
tree | 9d7a826815d4cca67335f8fd9bfe52e1f16c4226 /src | |
parent | c97e894a248b5e63df0d7146fc321da984779b8e (diff) | |
download | qt-creator-bc88c0b89e8f61a50ba62c8319114330211337da.tar.gz |
VCS: Use documents instead of editors a bit more.
This patch mostly gets rid of EditorManager::openedEditors usage. The
VCS editors should have a better widget<>document separation, also to
make it possible to split/duplicate them, but that's for another time.
Change-Id: Idd92a6a4884ff69fba4f4793d182aa7ff68d79e4
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/git/gitclient.cpp | 6 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbaseclient.cpp | 6 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbaseeditor.cpp | 15 |
3 files changed, 12 insertions, 15 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 70cd8a6655..16a15aab49 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -739,9 +739,9 @@ private: Core::IEditor *locateEditor(const char *property, const QString &entry) { - foreach (Core::IEditor *ed, Core::ICore::editorManager()->openedEditors()) - if (ed->document()->property(property).toString() == entry) - return ed; + foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) + if (document->property(property).toString() == entry) + return Core::EditorManager::documentModel()->editorsForDocument(document).first(); return 0; } diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 14778f13ca..1bf4cfc296 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -67,9 +67,9 @@ Q_DECLARE_METATYPE(QVariant) inline Core::IEditor *locateEditor(const char *property, const QString &entry) { - foreach (Core::IEditor *ed, Core::ICore::editorManager()->openedEditors()) - if (ed->document()->property(property).toString() == entry) - return ed; + foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) + if (document->property(property).toString() == entry) + return Core::EditorManager::documentModel()->editorsForDocument(document).first(); return 0; } diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 153e83e6e1..c7a35604d8 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -1560,20 +1560,17 @@ static const char tagPropertyC[] = "_q_VcsBaseEditorTag"; void VcsBaseEditorWidget::tagEditor(Core::IEditor *e, const QString &tag) { - e->setProperty(tagPropertyC, QVariant(tag)); + e->document()->setProperty(tagPropertyC, QVariant(tag)); } Core::IEditor* VcsBaseEditorWidget::locateEditorByTag(const QString &tag) { - Core::IEditor *rc = 0; - foreach (Core::IEditor *ed, Core::EditorManager::instance()->openedEditors()) { - const QVariant tagPropertyValue = ed->property(tagPropertyC); - if (tagPropertyValue.type() == QVariant::String && tagPropertyValue.toString() == tag) { - rc = ed; - break; - } + foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) { + const QVariant tagPropertyValue = document->property(tagPropertyC); + if (tagPropertyValue.type() == QVariant::String && tagPropertyValue.toString() == tag) + return Core::EditorManager::documentModel()->editorsForDocument(document).first(); } - return rc; + return 0; } } // namespace VcsBase |