Commit 306ca6fc authored by hjk's avatar hjk

TextEditor: Remove parts of old editor creation sequence

Not used anymore.

Change-Id: Iee0f6340097341bd584ae559e3f40f0c1364cba3
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 2db0f875
......@@ -230,10 +230,6 @@ class BaseTextEditorPrivate
public:
BaseTextEditorPrivate() {}
BaseTextDocumentCreator m_documentCreator;
BaseTextEditorWidgetCreator m_editorWidgetCreator;
BaseTextEditorCreator m_editorCreator;
CommentDefinition m_commentDefinition;
std::function<CompletionAssistProvider *()> m_completionAssistProvider;
......@@ -6594,21 +6590,6 @@ BaseTextEditor::~BaseTextEditor()
delete d;
}
void BaseTextEditor::setEditorCreator(const BaseTextEditorCreator &creator)
{
d->m_editorCreator = creator;
}
void BaseTextEditor::setDocumentCreator(const BaseTextDocumentCreator &creator)
{
d->m_documentCreator = creator;
}
void BaseTextEditor::setWidgetCreator(const BaseTextEditorWidgetCreator &creator)
{
d->m_editorWidgetCreator = creator;
}
BaseTextDocument *BaseTextEditor::textDocument()
{
ensureDocument();
......@@ -7190,15 +7171,6 @@ IEditor *BaseTextEditor::duplicate()
if (d->m_origin)
return d->m_origin->duplicateTextEditor(this);
// Use old setup if that's available.
if (d->m_editorCreator) {
BaseTextEditor *editor = d->m_editorCreator();
BaseTextEditorWidget *widget = editor->ensureWidget();
widget->setTextDocument(editorWidget()->textDocumentPtr());
m_widget = widget;
return editor;
}
// If neither is sufficient, you need to implement 'YourEditor::duplicate'.
QTC_CHECK(false);
return 0;
......@@ -7211,15 +7183,6 @@ QWidget *BaseTextEditor::widget() const
BaseTextEditorWidget *BaseTextEditor::ensureWidget() const
{
if (m_widget.isNull()) {
QTC_ASSERT(!d->m_origin, return 0); // New style always sets it.
QTC_ASSERT(d->m_editorWidgetCreator, return 0);
BaseTextEditorWidget *widget = d->m_editorWidgetCreator();
auto that = const_cast<BaseTextEditor *>(this);
widget->d->m_editor = that;
that->m_widget = widget;
widget->d->m_codeAssistant.configure(that);
}
return editorWidget();
}
......@@ -7228,8 +7191,6 @@ BaseTextDocumentPtr BaseTextEditor::ensureDocument()
BaseTextEditorWidget *widget = ensureWidget();
if (widget->d->m_document.isNull()) {
QTC_ASSERT(!d->m_origin, return BaseTextDocumentPtr()); // New style always sets it.
QTC_ASSERT(d->m_documentCreator, return BaseTextDocumentPtr());
widget->setTextDocument(BaseTextDocumentPtr(d->m_documentCreator()));
}
return widget->textDocumentPtr();
}
......@@ -7246,17 +7207,17 @@ BaseTextEditorFactory::BaseTextEditorFactory(QObject *parent)
m_widgetCreator = []() { return new BaseTextEditorWidget; };
}
void BaseTextEditorFactory::setDocumentCreator(const BaseTextDocumentCreator &creator)
void BaseTextEditorFactory::setDocumentCreator(const DocumentCreator &creator)
{
m_documentCreator = creator;
}
void BaseTextEditorFactory::setEditorWidgetCreator(const BaseTextEditorWidgetCreator &creator)
void BaseTextEditorFactory::setEditorWidgetCreator(const EditorWidgetCreator &creator)
{
m_widgetCreator = creator;
}
void BaseTextEditorFactory::setEditorCreator(const BaseTextEditorCreator &creator)
void BaseTextEditorFactory::setEditorCreator(const EditorCreator &creator)
{
m_editorCreator = creator;
}
......
......@@ -109,10 +109,6 @@ private:
int _last;
};
typedef std::function<BaseTextEditor *()> BaseTextEditorCreator;
typedef std::function<BaseTextDocument *()> BaseTextDocumentCreator;
typedef std::function<BaseTextEditorWidget *()> BaseTextEditorWidgetCreator;
class TEXTEDITOR_EXPORT BaseTextEditor : public Core::IEditor
{
Q_OBJECT
......@@ -131,10 +127,6 @@ public:
virtual void finalizeInitialization() {}
void setEditorCreator(const BaseTextEditorCreator &creator);
void setDocumentCreator(const BaseTextDocumentCreator &creator);
void setWidgetCreator(const BaseTextEditorWidgetCreator &creator);
void setEditorWidget(BaseTextEditorWidget *editorWidget);
enum MarkRequestKind {
......@@ -628,13 +620,16 @@ class TEXTEDITOR_EXPORT BaseTextEditorFactory : public Core::IEditorFactory
public:
BaseTextEditorFactory(QObject *parent = 0);
typedef std::function<BaseTextEditor *()> EditorCreator;
typedef std::function<BaseTextDocument *()> DocumentCreator;
typedef std::function<BaseTextEditorWidget *()> EditorWidgetCreator;
typedef std::function<SyntaxHighlighter *()> SyntaxHighLighterCreator;
typedef std::function<Indenter *()> IndenterCreator;
typedef std::function<AutoCompleter *()> AutoCompleterCreator;
void setDocumentCreator(const BaseTextDocumentCreator &creator);
void setEditorWidgetCreator(const BaseTextEditorWidgetCreator &creator);
void setEditorCreator(const BaseTextEditorCreator &creator);
void setDocumentCreator(const DocumentCreator &creator);
void setEditorWidgetCreator(const EditorWidgetCreator &creator);
void setEditorCreator(const EditorCreator &creator);
void setIndenterCreator(const IndenterCreator &creator);
void setSyntaxHighlighterCreator(const SyntaxHighLighterCreator &creator);
void setGenericSyntaxHighlighter(const QString &mimeType);
......@@ -650,9 +645,9 @@ private:
BaseTextEditor *createEditorHelper(const BaseTextDocumentPtr &doc);
BaseTextEditor *duplicateTextEditor(BaseTextEditor *);
BaseTextDocumentCreator m_documentCreator;
BaseTextEditorWidgetCreator m_widgetCreator;
BaseTextEditorCreator m_editorCreator;
DocumentCreator m_documentCreator;
EditorWidgetCreator m_widgetCreator;
EditorCreator m_editorCreator;
AutoCompleterCreator m_autoCompleterCreator;
IndenterCreator m_indenterCreator;
SyntaxHighLighterCreator m_syntaxHighlighterCreator;
......
......@@ -57,13 +57,13 @@ public:
const VcsBaseEditorParameters *m_parameters;
QObject *m_describeReceiver;
const char *m_describeSlot;
BaseTextEditorWidgetCreator m_widgetCreator;
BaseTextEditorFactory::EditorWidgetCreator m_widgetCreator;
};
} // namespace Internal
VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
const BaseTextEditorWidgetCreator &creator,
const BaseTextEditorFactory::EditorWidgetCreator &creator,
QObject *describeReceiver, const char *describeSlot)
: d(new Internal::BaseVcsEditorFactoryPrivate)
{
......
......@@ -45,7 +45,7 @@ class VCSBASE_EXPORT VcsEditorFactory : public Core::IEditorFactory
public:
VcsEditorFactory(const VcsBaseEditorParameters *type,
const TextEditor::BaseTextEditorWidgetCreator &creator,
const TextEditor::BaseTextEditorFactory::EditorWidgetCreator &creator,
QObject *describeReceiver,
const char *describeSlot);
~VcsEditorFactory();
......
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