From 96b18db8546ac5d18deff8cb8ad9dc148dc4154c Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 20 Aug 2014 15:14:35 +0200 Subject: [PATCH] QmakeProjectManager: Move .pro editor over to new construction scheme Change-Id: I1894e6ae622cb43ef6974aac82505c1f9912ff7b Reviewed-by: Christian Stenger --- .../qmakeprojectmanager/profileeditor.cpp | 20 +++++++------------ .../qmakeprojectmanager/profileeditor.h | 2 -- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp index 772ccae5ca4..01250add012 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -54,18 +55,13 @@ namespace Internal { ProFileEditor::ProFileEditor() { - setContext(Core::Context(Constants::C_PROFILEEDITOR, - TextEditor::Constants::C_TEXTEDITOR)); + addContext(Constants::C_PROFILEEDITOR); setDuplicateSupported(true); setCommentStyle(Utils::CommentDefinition::HashStyle); setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject()); -} - -Core::IEditor *ProFileEditor::duplicate() -{ - ProFileEditorWidget *ret = new ProFileEditorWidget; - ret->setTextDocument(editorWidget()->textDocumentPtr()); - return ret->editor(); + setEditorCreator([]() { return new ProFileEditor; }); + setDocumentCreator([]() { return new ProFileDocument; }); + setWidgetCreator([]() { return new ProFileEditorWidget; }); } // @@ -165,7 +161,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur TextEditor::BaseTextEditor *ProFileEditorWidget::createEditor() { - return new ProFileEditor; + QTC_ASSERT("should not happen anymore" && false, return 0); } void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e) @@ -222,9 +218,7 @@ ProFileEditorFactory::ProFileEditorFactory() Core::IEditor *ProFileEditorFactory::createEditor() { - ProFileEditorWidget *editor = new ProFileEditorWidget; - editor->setTextDocument(TextEditor::BaseTextDocumentPtr(new ProFileDocument)); - return editor->editor(); + return new ProFileEditor; } } // namespace Internal diff --git a/src/plugins/qmakeprojectmanager/profileeditor.h b/src/plugins/qmakeprojectmanager/profileeditor.h index ff9b212d403..f7ef92ba5d0 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.h +++ b/src/plugins/qmakeprojectmanager/profileeditor.h @@ -43,8 +43,6 @@ class ProFileEditor : public TextEditor::BaseTextEditor public: ProFileEditor(); - - Core::IEditor *duplicate(); }; class ProFileEditorWidget : public TextEditor::BaseTextEditorWidget