summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-07-30 10:53:51 +0200
committerhjk <hjk121@nokiamail.com>2014-07-30 14:21:23 +0200
commitce6f3477b5ee65e1cb9f7f5f11cc0123aacc2073 (patch)
tree2885b415059b1941cea066ac1441a3059df28b43
parent01822144d18548cdaa2208e08f2d36ecf3e4571c (diff)
downloadqt-creator-ce6f3477b5ee65e1cb9f7f5f11cc0123aacc2073.tar.gz
TextEditor: Move remaining PlainTextEditorWidget functions to Base
Change-Id: Ib10d938fce352f59bcd40f1c6aa493794fe90f8d Reviewed-by: Christian Stenger <christian.stenger@digia.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r--src/plugins/designer/designerxmleditorwidget.cpp2
-rw-r--r--src/plugins/qnx/bardescriptoreditorwidget.cpp2
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp21
-rw-r--r--src/plugins/texteditor/basetexteditor.h6
-rw-r--r--src/plugins/texteditor/plaintexteditor.cpp24
-rw-r--r--src/plugins/texteditor/plaintexteditor.h6
-rw-r--r--src/plugins/texteditor/plaintexteditorfactory.cpp2
7 files changed, 32 insertions, 31 deletions
diff --git a/src/plugins/designer/designerxmleditorwidget.cpp b/src/plugins/designer/designerxmleditorwidget.cpp
index 62f8c8b144..f5ea3d4e73 100644
--- a/src/plugins/designer/designerxmleditorwidget.cpp
+++ b/src/plugins/designer/designerxmleditorwidget.cpp
@@ -43,7 +43,7 @@ DesignerXmlEditorWidget::DesignerXmlEditorWidget(QDesignerFormWindowInterface *f
m_designerEditor(new FormWindowEditor(this))
{
setReadOnly(true);
- configure(baseTextDocument()->mimeType());
+ configureMimeType(baseTextDocument()->mimeType());
}
TextEditor::BaseTextEditor *DesignerXmlEditorWidget::createEditor()
diff --git a/src/plugins/qnx/bardescriptoreditorwidget.cpp b/src/plugins/qnx/bardescriptoreditorwidget.cpp
index 70ed497716..4553b6c5c0 100644
--- a/src/plugins/qnx/bardescriptoreditorwidget.cpp
+++ b/src/plugins/qnx/bardescriptoreditorwidget.cpp
@@ -172,7 +172,7 @@ void BarDescriptorEditorWidget::initSourcePage()
addWidget(m_xmlSourceWidget);
TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget);
- m_xmlSourceWidget->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
+ m_xmlSourceWidget->configureMimeType(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
}
void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget)
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index e75fdb554b..faab7a196f 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -6933,6 +6933,11 @@ BaseTextEditorWidget *BaseTextEditor::editorWidget() const
return d->m_editorWidget;
}
+void BaseTextEditorWidget::configureMimeType(const QString &mimeType)
+{
+ configureMimeType(MimeDatabase::findByType(mimeType));
+}
+
void BaseTextEditorWidget::configureMimeType(const MimeType &mimeType)
{
Highlighter *highlighter = new Highlighter();
@@ -6981,6 +6986,22 @@ bool BaseTextEditorWidget::isMissingSyntaxDefinition() const
return d->m_isMissingSyntaxDefinition;
}
+void BaseTextEditorWidget::acceptMissingSyntaxDefinitionInfo()
+{
+ ICore::showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
+ Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS,
+ this);
+}
+
+void BaseTextEditorWidget::configureMimeType()
+{
+ MimeType mimeType;
+ if (baseTextDocument())
+ mimeType = MimeDatabase::findByFile(baseTextDocument()->filePath());
+ configureMimeType(mimeType);
+}
+
+
} // namespace TextEditor
#include "basetexteditor.moc"
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index dc47e72cf1..ebcc3329e8 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -463,6 +463,10 @@ public slots:
/// Abort code assistant if it is running.
void abortAssist();
+
+ void acceptMissingSyntaxDefinitionInfo();
+
+ void configureMimeType(const QString &mimeType);
void configureMimeType(const Core::MimeType &mimeType);
signals:
@@ -581,6 +585,8 @@ protected slots:
virtual void slotUpdateBlockNotify(const QTextBlock &);
virtual void slotCodeStyleSettingsChanged(const QVariant &);
+ void configureMimeType();
+
private slots:
void updateTabStops();
void applyFontSettingsDelayed();
diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp
index 5ed412f212..b1f90cf490 100644
--- a/src/plugins/texteditor/plaintexteditor.cpp
+++ b/src/plugins/texteditor/plaintexteditor.cpp
@@ -87,8 +87,8 @@ void PlainTextEditorWidget::ctor()
baseTextDocument()->setMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
connect(baseTextDocument(), SIGNAL(filePathChanged(QString,QString)),
- this, SLOT(configure()));
- connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure()));
+ this, SLOT(configureMimeType()));
+ connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configureMimeType()));
}
IEditor *PlainTextEditor::duplicate()
@@ -99,26 +99,6 @@ IEditor *PlainTextEditor::duplicate()
return newWidget->editor();
}
-void PlainTextEditorWidget::configure()
-{
- MimeType mimeType;
- if (baseTextDocument())
- mimeType = MimeDatabase::findByFile(baseTextDocument()->filePath());
- configureMimeType(mimeType);
-}
-
-void PlainTextEditorWidget::configure(const QString &mimeType)
-{
- configureMimeType(MimeDatabase::findByType(mimeType));
-}
-
-void PlainTextEditorWidget::acceptMissingSyntaxDefinitionInfo()
-{
- ICore::showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
- Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS,
- this);
-}
-
PlainTextDocument::PlainTextDocument()
{
setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
diff --git a/src/plugins/texteditor/plaintexteditor.h b/src/plugins/texteditor/plaintexteditor.h
index c2db546ca5..a6bdd4ae06 100644
--- a/src/plugins/texteditor/plaintexteditor.h
+++ b/src/plugins/texteditor/plaintexteditor.h
@@ -62,12 +62,6 @@ public:
PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent = 0);
PlainTextEditorWidget(PlainTextEditorWidget *other);
- void configure(const QString& mimeType);
-
-private slots:
- void configure();
- void acceptMissingSyntaxDefinitionInfo();
-
protected:
virtual BaseTextEditor *createEditor() { return new PlainTextEditor(this); }
diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp
index 69b5ca1ad8..4bc7d9c85a 100644
--- a/src/plugins/texteditor/plaintexteditorfactory.cpp
+++ b/src/plugins/texteditor/plaintexteditorfactory.cpp
@@ -82,7 +82,7 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
BaseTextDocument *file = qobject_cast<BaseTextDocument *>(editor->document());
if (!file)
return;
- PlainTextEditorWidget *textEditor = static_cast<PlainTextEditorWidget *>(editorEditable->editorWidget());
+ BaseTextEditorWidget *textEditor = editorEditable->editorWidget();
Core::Id infoSyntaxDefinition(Constants::INFO_SYNTAX_DEFINITION);
Core::InfoBar *infoBar = file->infoBar();
if (!textEditor->isMissingSyntaxDefinition()) {