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