Commit 01822144 authored by hjk's avatar hjk

TextEditor: Remove indenter construction from PlainTextEditorWidget

Do it in the users "that know" and remove the special constructor case.

Change-Id: I9298c8d13118068adc7958c0894dccb7af4d7855
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent fde176e5
......@@ -101,7 +101,7 @@ public:
// Open file
QScopedPointer<TextEditor::BaseTextEditorWidget> editorWidget(
new TextEditor::PlainTextEditorWidget);
new TextEditor::PlainTextEditorWidget(new TextEditor::PlainTextDocument));
QString error;
editorWidget->open(&error, document->fileName(), document->fileName());
QVERIFY(error.isEmpty());
......
......@@ -49,6 +49,7 @@
#include <texteditor/plaintexteditor.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/normalindenter.h>
#include <utils/qtcassert.h>
using namespace Qnx;
......@@ -165,7 +166,9 @@ void BarDescriptorEditorWidget::initAssetsPage()
void BarDescriptorEditorWidget::initSourcePage()
{
m_xmlSourceWidget = new TextEditor::PlainTextEditorWidget(this);
auto doc = new TextEditor::PlainTextDocument;
doc->setIndenter(new TextEditor::NormalIndenter);
m_xmlSourceWidget = new TextEditor::PlainTextEditorWidget(doc, this);
addWidget(m_xmlSourceWidget);
TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget);
......
......@@ -66,14 +66,6 @@ PlainTextEditor::PlainTextEditor(PlainTextEditorWidget *editor)
setDuplicateSupported(true);
}
PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent)
: BaseTextEditorWidget(new PlainTextDocument(), parent)
{
// Currently only "normal" indentation is supported.
baseTextDocument()->setIndenter(new NormalIndenter);
ctor();
}
PlainTextEditorWidget::PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent)
: BaseTextEditorWidget(doc, parent)
{
......
......@@ -59,7 +59,6 @@ class TEXTEDITOR_EXPORT PlainTextEditorWidget : public BaseTextEditorWidget
Q_OBJECT
public:
PlainTextEditorWidget(QWidget *parent = 0);
PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent = 0);
PlainTextEditorWidget(PlainTextEditorWidget *other);
......
......@@ -30,6 +30,7 @@
#include "plaintexteditorfactory.h"
#include "plaintexteditor.h"
#include "basetextdocument.h"
#include "normalindenter.h"
#include "texteditoractionhandler.h"
#include "texteditorconstants.h"
#include "texteditorplugin.h"
......@@ -60,12 +61,14 @@ PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
Core::IEditor *PlainTextEditorFactory::createEditor()
{
PlainTextEditorWidget *rc = new PlainTextEditorWidget();
TextEditorSettings::initializeEditor(rc);
connect(rc, SIGNAL(configured(Core::IEditor*)),
auto doc = new PlainTextDocument;
doc->setIndenter(new NormalIndenter);
auto widget = new PlainTextEditorWidget(doc);
TextEditorSettings::initializeEditor(widget);
connect(widget, SIGNAL(configured(Core::IEditor*)),
this, SLOT(updateEditorInfoBar(Core::IEditor*)));
updateEditorInfoBar(rc->editor());
return rc->editor();
updateEditorInfoBar(widget->editor());
return widget->editor();
}
/*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment