TextEditor: Centralize settings connections setup

All editors did that manually, with varying approaches. Connect once
when the document is made known to the EditorWidget instead.

Change-Id: Ib0828b08158539859f6f89c8080435a027aa06ed
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-08-19 12:12:45 +02:00
parent b25c575b22
commit cb35594800
30 changed files with 73 additions and 144 deletions

View File

@@ -61,15 +61,13 @@ PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
Core::IEditor *PlainTextEditorFactory::createEditor()
{
BaseTextDocumentPtr doc(new BaseTextDocument);
doc->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
BaseTextDocumentPtr doc(new BaseTextDocument(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID));
doc->setIndenter(new NormalIndenter);
auto widget = new BaseTextEditorWidget(0);
auto widget = new BaseTextEditorWidget;
widget->setTextDocument(doc);
widget->setupAsPlainEditor();
TextEditorSettings::initializeEditor(widget);
connect(widget, SIGNAL(configured(Core::IEditor*)),
this, SLOT(updateEditorInfoBar(Core::IEditor*)));
connect(widget, &BaseTextEditorWidget::configured,
this, &PlainTextEditorFactory::updateEditorInfoBar);
updateEditorInfoBar(widget->editor());
return widget->editor();
}