Commit 5710fed5 authored by hjk's avatar hjk

texteditor, designerxmleditor: code cosmetics (editable->editor)

parent f576ad9f
......@@ -53,7 +53,7 @@ TextEditor::BaseTextEditor *DesignerXmlEditor::createEditor()
{
if (Designer::Constants::Internal::debug)
qDebug() << "DesignerXmlEditor::createEditableInterface()";
return m_designerEditor->textEditable();
return m_designerEditor->textEditor();
}
FormWindowEditor *DesignerXmlEditor::designerEditor() const
......@@ -61,6 +61,6 @@ FormWindowEditor *DesignerXmlEditor::designerEditor() const
return m_designerEditor;
}
}
} // namespace Internal
} // namespace Designer
......@@ -62,31 +62,31 @@ struct FormWindowEditorPrivate
explicit FormWindowEditorPrivate(Internal::DesignerXmlEditor *editor,
QDesignerFormWindowInterface *form);
TextEditor::PlainTextEditor m_textEditable;
TextEditor::PlainTextEditor m_textEditor;
Internal::FormWindowFile m_file;
Core::Context m_context;
};
FormWindowEditorPrivate::FormWindowEditorPrivate(Internal::DesignerXmlEditor *editor,
QDesignerFormWindowInterface *form) :
m_textEditable(editor), m_file(form)
m_textEditor(editor), m_file(form)
{
}
FormWindowEditor::FormWindowEditor(Internal::DesignerXmlEditor *editor,
QDesignerFormWindowInterface *form,
QObject *parent) :
QDesignerFormWindowInterface *form,
QObject *parent) :
Core::IEditor(parent),
d(new FormWindowEditorPrivate(editor, form))
{
d->m_context.add(Designer::Constants::K_DESIGNER_XML_EDITOR_ID);
d->m_context.add(Designer::Constants::C_DESIGNER_XML_EDITOR);
connect(form, SIGNAL(changed()), this, SIGNAL(changed()));
// Revert to saved/load externally modified files
connect(&(d->m_file), SIGNAL(reload(QString)), this, SLOT(slotOpen(QString)));
// Revert to saved/load externally modified files.
connect(&d->m_file, SIGNAL(reload(QString)), this, SLOT(slotOpen(QString)));
// Force update of open editors model.
connect(&(d->m_file), SIGNAL(saved()), this, SIGNAL(changed()));
connect(&(d->m_file), SIGNAL(changed()), this, SIGNAL(changed()));
connect(&d->m_file, SIGNAL(saved()), this, SIGNAL(changed()));
connect(&d->m_file, SIGNAL(changed()), this, SIGNAL(changed()));
connect(this, SIGNAL(changed()), this, SLOT(configureXmlEditor()));
}
......@@ -186,7 +186,7 @@ void FormWindowEditor::syncXmlEditor()
void FormWindowEditor::configureXmlEditor() const
{
TextEditor::PlainTextEditorWidget *editor =
qobject_cast<TextEditor::PlainTextEditorWidget *>(d->m_textEditable.editorWidget());
qobject_cast<TextEditor::PlainTextEditorWidget *>(d->m_textEditor.editorWidget());
if (editor)
editor->configure(Core::ICore::instance()->mimeDatabase()->findByFile(
d->m_file.fileName()));
......@@ -194,8 +194,8 @@ void FormWindowEditor::configureXmlEditor() const
void FormWindowEditor::syncXmlEditor(const QString &contents)
{
d->m_textEditable.editorWidget()->setPlainText(contents);
d->m_textEditable.editorWidget()->setReadOnly(true);
d->m_textEditor.editorWidget()->setPlainText(contents);
d->m_textEditor.editorWidget()->setReadOnly(true);
}
Core::IFile *FormWindowEditor::file()
......@@ -210,12 +210,12 @@ QString FormWindowEditor::id() const
QString FormWindowEditor::displayName() const
{
return d->m_textEditable.displayName();
return d->m_textEditor.displayName();
}
void FormWindowEditor::setDisplayName(const QString &title)
{
d->m_textEditable.setDisplayName(title);
d->m_textEditor.setDisplayName(title);
emit changed();
}
......@@ -231,12 +231,12 @@ Core::IEditor *FormWindowEditor::duplicate(QWidget *)
QByteArray FormWindowEditor::saveState() const
{
return d->m_textEditable.saveState();
return d->m_textEditor.saveState();
}
bool FormWindowEditor::restoreState(const QByteArray &state)
{
return d->m_textEditable.restoreState(state);
return d->m_textEditor.restoreState(state);
}
Core::Context FormWindowEditor::context() const
......@@ -246,7 +246,7 @@ Core::Context FormWindowEditor::context() const
QWidget *FormWindowEditor::widget()
{
return d->m_textEditable.widget();
return d->m_textEditor.widget();
}
bool FormWindowEditor::isTemporary() const
......@@ -268,12 +268,12 @@ QString FormWindowEditor::contents() const
TextEditor::BaseTextDocument *FormWindowEditor::textDocument()
{
return qobject_cast<TextEditor::BaseTextDocument*>(d->m_textEditable.file());
return qobject_cast<TextEditor::BaseTextDocument*>(d->m_textEditor.file());
}
TextEditor::PlainTextEditor *FormWindowEditor::textEditable()
TextEditor::PlainTextEditor *FormWindowEditor::textEditor()
{
return &d->m_textEditable;
return &d->m_textEditor;
}
QString FormWindowEditor::preferredModeType() const
......
......@@ -102,7 +102,7 @@ public:
QString contents() const;
TextEditor::BaseTextDocument *textDocument();
TextEditor::PlainTextEditor *textEditable();
TextEditor::PlainTextEditor *textEditor();
public slots:
void syncXmlEditor();
......
......@@ -545,41 +545,38 @@ private slots:
class TEXTEDITOR_EXPORT BaseTextEditor : public ITextEditor
{
Q_OBJECT
friend class BaseTextEditorWidget;
public:
BaseTextEditor(BaseTextEditorWidget *editorWidget);
~BaseTextEditor();
inline BaseTextEditorWidget *editorWidget() const { return e; }
friend class BaseTextEditorWidget;
BaseTextEditorWidget *editorWidget() const { return e; }
// EditorInterface
inline QWidget *widget() { return e; }
inline Core::IFile * file() { return e->file(); }
inline bool createNew(const QString &contents) { return e->createNew(contents); }
inline bool open(const QString &fileName = QString())
{
return e->open(fileName);
}
inline QString displayName() const { return e->displayName(); }
inline void setDisplayName(const QString &title) { e->setDisplayName(title); emit changed(); }
QWidget *widget() { return e; }
Core::IFile * file() { return e->file(); }
bool createNew(const QString &contents) { return e->createNew(contents); }
bool open(const QString &fileName = QString()) { return e->open(fileName); }
QString displayName() const { return e->displayName(); }
void setDisplayName(const QString &title) { e->setDisplayName(title); emit changed(); }
inline QByteArray saveState() const { return e->saveState(); }
inline bool restoreState(const QByteArray &state) { return e->restoreState(state); }
virtual QWidget *toolBar();
QByteArray saveState() const { return e->saveState(); }
bool restoreState(const QByteArray &state) { return e->restoreState(state); }
QWidget *toolBar();
// ITextEditor
int find(const QString &string) const;
int currentLine() const;
int currentColumn() const;
void gotoLine(int line, int column = 0) { e->gotoLine(line, column); }
int columnCount() const;
int rowCount() const;
inline int position(
ITextEditor::PositionOperation posOp = ITextEditor::Current
, int at = -1) const { return e->position(posOp, at); }
inline void convertPosition(int pos, int *line, int *column) const { e->convertPosition(pos, line, column); }
int position(PositionOperation posOp = Current, int at = -1) const
{ return e->position(posOp, at); }
void convertPosition(int pos, int *line, int *column) const
{ e->convertPosition(pos, line, column); }
QRect cursorRect(int pos = -1) const;
QString contents() const;
......
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