Commit 6a52868c authored by hjk's avatar hjk

TextEditor: Update tab settings for all tab changes

Not just for selected documents. This also removes the need for
the separate setupAsPlainTextDocument function.

Change-Id: I51a04eebbad37a7598068ce6e157a53c1519464f
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 1924fdb9
......@@ -41,7 +41,6 @@ using namespace Android::Internal;
AndroidManifestDocument::AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget)
: m_editorWidget(editorWidget)
{
setupAsPlainTextDocument();
setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
connect(editorWidget, SIGNAL(guiChanged()),
......
......@@ -103,7 +103,6 @@ public:
// Open file
auto textDocument = new TextEditor::BaseTextDocument;
textDocument->setupAsPlainTextDocument();
textDocument->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
TextEditor::BaseTextEditorWidget editorWidget(textDocument);
editorWidget.setupAsPlainEditor();
......
......@@ -56,7 +56,6 @@ FormWindowFile::FormWindowFile(QDesignerFormWindowInterface *form, QObject *pare
m_formWindow(form),
m_isModified(false)
{
setupAsPlainTextDocument();
setMimeType(QLatin1String(Designer::Constants::FORM_MIMETYPE));
setParent(parent);
setId(Core::Id(Designer::Constants::K_DESIGNER_XML_EDITOR_ID));
......
......@@ -169,7 +169,6 @@ void BarDescriptorEditorWidget::initAssetsPage()
void BarDescriptorEditorWidget::initSourcePage()
{
auto doc = new TextEditor::BaseTextDocument;
doc->setupAsPlainTextDocument();
doc->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID); // FIXME: This looks odd.
doc->setIndenter(new TextEditor::NormalIndenter);
......
......@@ -82,7 +82,6 @@ public:
public slots:
void onModificationChanged(bool modified);
void updateTabSettings();
public:
QString m_defaultPath;
......@@ -200,13 +199,6 @@ void BaseTextDocumentPrivate::onModificationChanged(bool modified)
updateRevisions();
}
void BaseTextDocumentPrivate::updateTabSettings()
{
if (Highlighter *highlighter = qobject_cast<Highlighter *>(m_highlighter))
highlighter->setTabSettings(m_tabSettings);
}
///////////////////////////////////////////////////////////////////////
//
// BaseTextDocument
......@@ -304,6 +296,10 @@ void BaseTextDocument::setTabSettings(const TextEditor::TabSettings &tabSettings
if (tabSettings == d->m_tabSettings)
return;
d->m_tabSettings = tabSettings;
if (Highlighter *highlighter = qobject_cast<Highlighter *>(d->m_highlighter))
highlighter->setTabSettings(tabSettings);
emit tabSettingsChanged();
}
......@@ -327,11 +323,6 @@ void BaseTextDocument::triggerPendingUpdates()
applyFontSettings();
}
void BaseTextDocument::setupAsPlainTextDocument()
{
connect(this, SIGNAL(tabSettingsChanged()), d, SLOT(updateTabSettings()));
}
void BaseTextDocument::applyFontSettings()
{
d->m_fontSettingsNeedsApply = false;
......
......@@ -128,8 +128,6 @@ public:
virtual void triggerPendingUpdates();
void setupAsPlainTextDocument();
public slots:
void setTabSettings(const TextEditor::TabSettings &tabSettings);
void setFontSettings(const TextEditor::FontSettings &fontSettings);
......
......@@ -62,7 +62,6 @@ PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
Core::IEditor *PlainTextEditorFactory::createEditor()
{
auto doc = new BaseTextDocument;
doc->setupAsPlainTextDocument();
doc->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
doc->setIndenter(new NormalIndenter);
auto widget = new BaseTextEditorWidget(doc);
......
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