forked from qt-creator/qt-creator
texteditor: merge ITextEditable into ITextEditor
rename BastTextEditor->BaseTextEditorWidget, BaseTextEditorEditable->BaseTextEditor
rename BaseTextEditor{,Widget} subclasses
rename editableInterface->editorInterface
rename createEditableInterface->createEditor
minor cleanups after renamings
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
class SnippetEditor;
|
||||
class SnippetEditorWidget;
|
||||
|
||||
class TEXTEDITOR_EXPORT ISnippetProvider : public QObject
|
||||
{
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
virtual QString groupId() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
virtual void decorateEditor(SnippetEditor *editor) const = 0;
|
||||
virtual void decorateEditor(SnippetEditorWidget *editor) const = 0;
|
||||
|
||||
protected:
|
||||
ISnippetProvider();
|
||||
|
||||
@@ -57,5 +57,5 @@ QString PlainTextSnippetProvider::displayName() const
|
||||
return QCoreApplication::translate("TextEditor::Internal::PlainTextSnippetProvider", "Text");
|
||||
}
|
||||
|
||||
void PlainTextSnippetProvider::decorateEditor(TextEditor::SnippetEditor *) const
|
||||
void PlainTextSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *) const
|
||||
{}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
public:
|
||||
virtual QString groupId() const;
|
||||
virtual QString displayName() const;
|
||||
virtual void decorateEditor(TextEditor::SnippetEditor *editor) const;
|
||||
virtual void decorateEditor(TextEditor::SnippetEditorWidget *editor) const;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
||||
@@ -42,20 +42,20 @@
|
||||
|
||||
using namespace TextEditor;
|
||||
|
||||
SnippetEditorEditable::SnippetEditorEditable(SnippetEditor *editor) :
|
||||
BaseTextEditorEditable(editor),
|
||||
SnippetEditor::SnippetEditor(SnippetEditorWidget *editor) :
|
||||
BaseTextEditor(editor),
|
||||
m_context(Constants::SNIPPET_EDITOR_ID, Constants::C_TEXTEDITOR)
|
||||
{}
|
||||
|
||||
SnippetEditorEditable::~SnippetEditorEditable()
|
||||
SnippetEditor::~SnippetEditor()
|
||||
{}
|
||||
|
||||
QString SnippetEditorEditable::id() const
|
||||
QString SnippetEditor::id() const
|
||||
{
|
||||
return Constants::SNIPPET_EDITOR_ID;
|
||||
}
|
||||
|
||||
SnippetEditor::SnippetEditor(QWidget *parent) : BaseTextEditor(parent)
|
||||
SnippetEditorWidget::SnippetEditorWidget(QWidget *parent) : BaseTextEditorWidget(parent)
|
||||
{
|
||||
setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
|
||||
setHighlightCurrentLine(false);
|
||||
@@ -63,15 +63,15 @@ SnippetEditor::SnippetEditor(QWidget *parent) : BaseTextEditor(parent)
|
||||
setParenthesesMatchingEnabled(true);
|
||||
}
|
||||
|
||||
SnippetEditor::~SnippetEditor()
|
||||
SnippetEditorWidget::~SnippetEditorWidget()
|
||||
{}
|
||||
|
||||
void SnippetEditor::setSyntaxHighlighter(TextEditor::SyntaxHighlighter *highlighter)
|
||||
void SnippetEditorWidget::setSyntaxHighlighter(TextEditor::SyntaxHighlighter *highlighter)
|
||||
{
|
||||
baseTextDocument()->setSyntaxHighlighter(highlighter);
|
||||
}
|
||||
|
||||
void SnippetEditor::focusOutEvent(QFocusEvent *event)
|
||||
void SnippetEditorWidget::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
if (event->reason() != Qt::ActiveWindowFocusReason && document()->isModified()) {
|
||||
document()->setModified(false);
|
||||
@@ -79,7 +79,7 @@ void SnippetEditor::focusOutEvent(QFocusEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
BaseTextEditorEditable *SnippetEditor::createEditableInterface()
|
||||
BaseTextEditor *SnippetEditorWidget::createEditor()
|
||||
{
|
||||
return new SnippetEditorEditable(this);
|
||||
return new SnippetEditor(this);
|
||||
}
|
||||
|
||||
@@ -43,18 +43,19 @@ QT_FORWARD_DECLARE_CLASS(QFocusEvent)
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
class SnippetEditor;
|
||||
class SnippetEditorWidget;
|
||||
class SyntaxHighlighter;
|
||||
class Indenter;
|
||||
|
||||
// Should not be necessary in this case, but the base text editor assumes a
|
||||
// valid editable interface.
|
||||
class TEXTEDITOR_EXPORT SnippetEditorEditable : public BaseTextEditorEditable
|
||||
class TEXTEDITOR_EXPORT SnippetEditor : public BaseTextEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SnippetEditorEditable(SnippetEditor *editor);
|
||||
virtual ~SnippetEditorEditable();
|
||||
SnippetEditor(SnippetEditorWidget *editorWidget);
|
||||
virtual ~SnippetEditor();
|
||||
|
||||
Core::Context context() const { return m_context; }
|
||||
|
||||
@@ -67,12 +68,13 @@ private:
|
||||
const Core::Context m_context;
|
||||
};
|
||||
|
||||
class TEXTEDITOR_EXPORT SnippetEditor : public BaseTextEditor
|
||||
class TEXTEDITOR_EXPORT SnippetEditorWidget : public BaseTextEditorWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SnippetEditor(QWidget *parent);
|
||||
virtual ~SnippetEditor();
|
||||
SnippetEditorWidget(QWidget *parent);
|
||||
virtual ~SnippetEditorWidget();
|
||||
|
||||
void setSyntaxHighlighter(SyntaxHighlighter *highlighter);
|
||||
|
||||
@@ -83,7 +85,7 @@ protected:
|
||||
virtual void focusOutEvent(QFocusEvent *event);
|
||||
|
||||
virtual int extraAreaWidth(int * /* markWidthPtr */ = 0) const { return 0; }
|
||||
virtual BaseTextEditorEditable *createEditableInterface();
|
||||
virtual BaseTextEditor *createEditor();
|
||||
};
|
||||
|
||||
} // TextEditor
|
||||
|
||||
@@ -292,8 +292,8 @@ private slots:
|
||||
void updateCurrentSnippetDependent(const QModelIndex &modelIndex = QModelIndex());
|
||||
|
||||
private:
|
||||
SnippetEditor *currentEditor() const;
|
||||
SnippetEditor *editorAt(int i) const;
|
||||
SnippetEditorWidget *currentEditor() const;
|
||||
SnippetEditorWidget *editorAt(int i) const;
|
||||
|
||||
void loadSettings();
|
||||
bool settingsChanged() const;
|
||||
@@ -317,14 +317,14 @@ SnippetsSettingsPagePrivate::SnippetsSettingsPagePrivate(const QString &id) :
|
||||
m_snippetsCollectionChanged(false)
|
||||
{}
|
||||
|
||||
SnippetEditor *SnippetsSettingsPagePrivate::currentEditor() const
|
||||
SnippetEditorWidget *SnippetsSettingsPagePrivate::currentEditor() const
|
||||
{
|
||||
return editorAt(m_ui.snippetsEditorStack->currentIndex());
|
||||
}
|
||||
|
||||
SnippetEditor *SnippetsSettingsPagePrivate::editorAt(int i) const
|
||||
SnippetEditorWidget *SnippetsSettingsPagePrivate::editorAt(int i) const
|
||||
{
|
||||
return static_cast<SnippetEditor *>(m_ui.snippetsEditorStack->widget(i));
|
||||
return static_cast<SnippetEditorWidget *>(m_ui.snippetsEditorStack->widget(i));
|
||||
}
|
||||
|
||||
void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
|
||||
@@ -335,7 +335,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
|
||||
ExtensionSystem::PluginManager::instance()->getObjects<ISnippetProvider>();
|
||||
foreach (ISnippetProvider *provider, providers) {
|
||||
m_ui.groupCombo->addItem(provider->displayName(), provider->groupId());
|
||||
SnippetEditor *snippetEditor = new SnippetEditor(w);
|
||||
SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w);
|
||||
provider->decorateEditor(snippetEditor);
|
||||
m_ui.snippetsEditorStack->insertWidget(m_ui.groupCombo->count() - 1, snippetEditor);
|
||||
connect(snippetEditor, SIGNAL(snippetContentChanged()), this, SLOT(setSnippetContent()));
|
||||
|
||||
Reference in New Issue
Block a user