Commit 877bf3b3 authored by hjk's avatar hjk

TextEditor: Remove some refactoring glue

Change-Id: I2f771b4f944c7f23ad43f780ec98937593e400ea
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 37a1e8d2
......@@ -43,7 +43,6 @@ DesignerXmlEditorWidget::DesignerXmlEditorWidget(QDesignerFormWindowInterface *f
TextEditor::BaseTextDocumentPtr doc(new FormWindowFile(form));
setTextDocument(doc);
m_editor = new FormWindowEditor(this);
m_editor->setEditorWidget(this);
setupAsPlainEditor();
setReadOnly(true);
configureMimeType(doc->mimeType());
......
......@@ -45,9 +45,9 @@
namespace Designer {
FormWindowEditor::FormWindowEditor(Internal::DesignerXmlEditorWidget *editor)
FormWindowEditor::FormWindowEditor(TextEditor::BaseTextEditorWidget *widget)
{
setEditorWidget(editor);
setWidget(widget);
setDuplicateSupported(false);
setContext(Core::Context(Designer::Constants::K_DESIGNER_XML_EDITOR_ID,
Designer::Constants::C_DESIGNER_XML_EDITOR));
......
......@@ -41,7 +41,6 @@ QT_END_NAMESPACE
namespace Designer {
namespace Internal {
class DesignerXmlEditorWidget;
class FormWindowFile;
}
......@@ -57,7 +56,7 @@ class DESIGNER_EXPORT FormWindowEditor : public TextEditor::BaseTextEditor
Q_PROPERTY(QString contents READ contents)
Q_OBJECT
public:
explicit FormWindowEditor(Internal::DesignerXmlEditorWidget *editor);
explicit FormWindowEditor(TextEditor::BaseTextEditorWidget *widget);
virtual ~FormWindowEditor();
// IEditor
......
......@@ -6557,11 +6557,6 @@ BaseTextEditor::BaseTextEditor()
setDuplicateSupported(true);
}
void BaseTextEditor::setEditorWidget(BaseTextEditorWidget *widget)
{
setWidget(widget);
}
BaseTextEditor::~BaseTextEditor()
{
delete m_widget;
......@@ -6570,8 +6565,9 @@ BaseTextEditor::~BaseTextEditor()
BaseTextDocument *BaseTextEditor::textDocument() const
{
ensureDocument();
return editorWidget()->textDocument();
BaseTextEditorWidget *widget = editorWidget();
QTC_CHECK(!widget->d->m_document.isNull());
return widget->d->m_document.data();
}
void BaseTextEditor::addContext(Id id)
......@@ -7188,25 +7184,6 @@ IEditor *BaseTextEditor::duplicate()
return 0;
}
QWidget *BaseTextEditor::widget() const
{
return ensureWidget();
}
BaseTextEditorWidget *BaseTextEditor::ensureWidget() const
{
return editorWidget();
}
BaseTextDocumentPtr BaseTextEditor::ensureDocument() const
{
BaseTextEditorWidget *widget = ensureWidget();
if (widget->d->m_document.isNull()) {
QTC_ASSERT(!d->m_origin, return BaseTextDocumentPtr()); // New style always sets it.
}
return widget->textDocumentPtr();
}
//
// BaseTextEditorFactory
......
......@@ -129,8 +129,6 @@ public:
virtual void finalizeInitialization() {}
void setEditorWidget(BaseTextEditorWidget *editorWidget);
enum MarkRequestKind {
BreakpointRequest,
BookmarkRequest,
......@@ -139,9 +137,6 @@ public:
static BaseTextEditor *currentTextEditor();
BaseTextEditorWidget *ensureWidget() const;
BaseTextDocumentPtr ensureDocument() const;
BaseTextEditorWidget *editorWidget() const;
BaseTextDocument *textDocument() const;
......@@ -159,7 +154,6 @@ public:
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
IEditor *duplicate();
QWidget *widget() const;
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
......@@ -215,9 +209,7 @@ signals:
void contextHelpIdRequested(TextEditor::BaseTextEditor *editor, int position);
private:
friend class Internal::BaseTextEditorWidgetPrivate;
friend class BaseTextEditorFactory;
friend class BaseTextEditorWidget;
Internal::BaseTextEditorPrivate *d;
};
......
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