forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -739,9 +739,9 @@ private:
|
|||||||
|
|
||||||
Core::IEditor *locateEditor(const char *property, const QString &entry)
|
Core::IEditor *locateEditor(const char *property, const QString &entry)
|
||||||
{
|
{
|
||||||
foreach (Core::IEditor *ed, Core::ICore::editorManager()->openedEditors())
|
foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments())
|
||||||
if (ed->document()->property(property).toString() == entry)
|
if (document->property(property).toString() == entry)
|
||||||
return ed;
|
return Core::EditorManager::documentModel()->editorsForDocument(document).first();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -67,9 +67,9 @@ Q_DECLARE_METATYPE(QVariant)
|
|||||||
|
|
||||||
inline Core::IEditor *locateEditor(const char *property, const QString &entry)
|
inline Core::IEditor *locateEditor(const char *property, const QString &entry)
|
||||||
{
|
{
|
||||||
foreach (Core::IEditor *ed, Core::ICore::editorManager()->openedEditors())
|
foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments())
|
||||||
if (ed->document()->property(property).toString() == entry)
|
if (document->property(property).toString() == entry)
|
||||||
return ed;
|
return Core::EditorManager::documentModel()->editorsForDocument(document).first();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1560,20 +1560,17 @@ static const char tagPropertyC[] = "_q_VcsBaseEditorTag";
|
|||||||
|
|
||||||
void VcsBaseEditorWidget::tagEditor(Core::IEditor *e, const QString &tag)
|
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* VcsBaseEditorWidget::locateEditorByTag(const QString &tag)
|
||||||
{
|
{
|
||||||
Core::IEditor *rc = 0;
|
foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) {
|
||||||
foreach (Core::IEditor *ed, Core::EditorManager::instance()->openedEditors()) {
|
const QVariant tagPropertyValue = document->property(tagPropertyC);
|
||||||
const QVariant tagPropertyValue = ed->property(tagPropertyC);
|
if (tagPropertyValue.type() == QVariant::String && tagPropertyValue.toString() == tag)
|
||||||
if (tagPropertyValue.type() == QVariant::String && tagPropertyValue.toString() == tag) {
|
return Core::EditorManager::documentModel()->editorsForDocument(document).first();
|
||||||
rc = ed;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
return 0;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VcsBase
|
} // namespace VcsBase
|
||||||
|
Reference in New Issue
Block a user