Commit 6a52868c authored by hjk's avatar hjk
Browse files

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