From f576ad9f2c169bfa4d336ba2b3b1918f03df6916 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 21 Feb 2011 16:02:26 +0100 Subject: texteditor: merge ITextEditable into ITextEditor rename BastTextEditor->BaseTextEditorWidget, BaseTextEditorEditable->BaseTextEditor rename BaseTextEditor{,Widget} subclasses rename editableInterface->editorInterface rename createEditableInterface->createEditor minor cleanups after renamings --- src/plugins/bookmarks/bookmarkmanager.cpp | 2 +- src/plugins/classview/classviewmanager.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakeeditor.cpp | 32 +- src/plugins/cmakeprojectmanager/cmakeeditor.h | 19 +- .../cmakeprojectmanager/cmakeeditorfactory.cpp | 4 +- src/plugins/cpaster/cpasterplugin.cpp | 6 +- src/plugins/cppeditor/cppeditor.cpp | 190 ++++---- src/plugins/cppeditor/cppeditor.h | 20 +- src/plugins/cppeditor/cppelementevaluator.cpp | 12 +- src/plugins/cppeditor/cppelementevaluator.h | 12 +- src/plugins/cppeditor/cpphighlighter.h | 2 +- src/plugins/cppeditor/cpphoverhandler.cpp | 4 +- src/plugins/cppeditor/cppoutline.cpp | 12 +- src/plugins/cppeditor/cppoutline.h | 4 +- src/plugins/cppeditor/cppplugin.cpp | 30 +- src/plugins/cppeditor/cppplugin.h | 10 +- src/plugins/cppeditor/cppqtstyleindenter.cpp | 4 +- src/plugins/cppeditor/cppqtstyleindenter.h | 4 +- src/plugins/cppeditor/cppquickfix.cpp | 2 +- src/plugins/cppeditor/cppquickfix.h | 2 +- src/plugins/cppeditor/cppquickfixcollector.cpp | 6 +- src/plugins/cppeditor/cppquickfixcollector.h | 4 +- src/plugins/cppeditor/cppquickfixes.cpp | 6 +- src/plugins/cppeditor/cppsemanticinfo.h | 2 +- src/plugins/cppeditor/cppsnippetprovider.cpp | 4 +- src/plugins/cppeditor/cppsnippetprovider.h | 2 +- src/plugins/cppeditor/cpptypehierarchy.cpp | 12 +- src/plugins/cppeditor/cpptypehierarchy.h | 4 +- src/plugins/cpptools/cppcodecompletion.cpp | 34 +- src/plugins/cpptools/cppcodecompletion.h | 18 +- src/plugins/cpptools/cppcurrentdocumentfilter.cpp | 2 +- src/plugins/cpptools/cppfindreferences.cpp | 2 +- src/plugins/cpptools/cpplocatorfilter.cpp | 2 +- src/plugins/cpptools/cppmodelmanager.cpp | 10 +- src/plugins/cpptools/cppmodelmanager.h | 4 +- src/plugins/cpptools/cpprefactoringchanges.cpp | 4 +- src/plugins/cpptools/cpprefactoringchanges.h | 4 +- src/plugins/cpptools/cpptoolseditorsupport.cpp | 4 +- src/plugins/cpptools/symbolsfindfilter.cpp | 2 +- src/plugins/cvs/cvseditor.cpp | 2 +- src/plugins/cvs/cvseditor.h | 2 +- src/plugins/cvs/cvsplugin.cpp | 34 +- src/plugins/debugger/debuggertooltipmanager.cpp | 4 +- src/plugins/debugger/disassembleragent.cpp | 8 +- src/plugins/debugger/sourceagent.cpp | 4 +- src/plugins/designer/designerxmleditor.cpp | 4 +- src/plugins/designer/designerxmleditor.h | 4 +- src/plugins/designer/formeditorw.cpp | 2 +- src/plugins/designer/formwindoweditor.cpp | 12 +- src/plugins/designer/formwindoweditor.h | 4 +- src/plugins/designer/qtcreatorintegration.cpp | 13 +- src/plugins/fakevim/fakevimplugin.cpp | 36 +- .../genericprojectfileseditor.cpp | 38 +- .../genericprojectfileseditor.h | 16 +- src/plugins/git/gitclient.cpp | 52 +-- src/plugins/git/gitclient.h | 10 +- src/plugins/git/giteditor.cpp | 2 +- src/plugins/git/giteditor.h | 2 +- src/plugins/git/gitplugin.cpp | 4 +- src/plugins/glsleditor/glslcodecompletion.cpp | 14 +- src/plugins/glsleditor/glslcodecompletion.h | 12 +- src/plugins/glsleditor/glsleditor.cpp | 44 +- src/plugins/glsleditor/glsleditor.h | 12 +- src/plugins/glsleditor/glsleditoreditable.cpp | 4 +- src/plugins/glsleditor/glsleditoreditable.h | 6 +- src/plugins/glsleditor/glsleditorfactory.cpp | 4 +- src/plugins/glsleditor/glsleditorplugin.cpp | 2 +- src/plugins/glsleditor/glsleditorplugin.h | 8 +- src/plugins/glsleditor/glslhighlighter.cpp | 2 +- src/plugins/glsleditor/glslhighlighter.h | 6 +- src/plugins/glsleditor/glslhoverhandler.cpp | 2 +- src/plugins/glsleditor/glslindenter.cpp | 4 +- src/plugins/glsleditor/glslindenter.h | 4 +- src/plugins/mercurial/mercurialclient.cpp | 34 +- src/plugins/mercurial/mercurialclient.h | 4 +- src/plugins/mercurial/mercurialeditor.cpp | 2 +- src/plugins/mercurial/mercurialeditor.h | 2 +- src/plugins/mercurial/mercurialjobrunner.cpp | 4 +- src/plugins/mercurial/mercurialjobrunner.h | 8 +- src/plugins/mercurial/mercurialplugin.cpp | 2 +- src/plugins/perforce/perforceeditor.cpp | 2 +- src/plugins/perforce/perforceeditor.h | 2 +- src/plugins/perforce/perforceplugin.cpp | 34 +- .../projectexplorer/editorconfiguration.cpp | 10 +- src/plugins/projectexplorer/editorconfiguration.h | 8 +- .../projectexplorer/showineditortaskhandler.cpp | 2 +- .../integration/designdocumentcontroller.cpp | 2 +- .../designercore/include/basetexteditmodifier.h | 2 +- .../designercore/model/basetexteditmodifier.cpp | 8 +- src/plugins/qmljseditor/qmljscodecompletion.cpp | 20 +- src/plugins/qmljseditor/qmljscodecompletion.h | 14 +- src/plugins/qmljseditor/qmljseditor.cpp | 142 +++--- src/plugins/qmljseditor/qmljseditor.h | 10 +- src/plugins/qmljseditor/qmljseditoreditable.cpp | 8 +- src/plugins/qmljseditor/qmljseditoreditable.h | 6 +- src/plugins/qmljseditor/qmljseditorfactory.cpp | 4 +- src/plugins/qmljseditor/qmljseditorplugin.cpp | 16 +- src/plugins/qmljseditor/qmljseditorplugin.h | 10 +- src/plugins/qmljseditor/qmljsfindreferences.cpp | 2 +- src/plugins/qmljseditor/qmljshoverhandler.cpp | 6 +- src/plugins/qmljseditor/qmljshoverhandler.h | 4 +- src/plugins/qmljseditor/qmljsindenter.cpp | 2 +- src/plugins/qmljseditor/qmljsindenter.h | 2 +- src/plugins/qmljseditor/qmljsoutline.cpp | 4 +- src/plugins/qmljseditor/qmljsoutline.h | 4 +- src/plugins/qmljseditor/qmljsquickfix.cpp | 10 +- src/plugins/qmljseditor/qmljsquickfix.h | 6 +- src/plugins/qmljseditor/qmljssnippetprovider.cpp | 4 +- src/plugins/qmljseditor/qmljssnippetprovider.h | 2 +- src/plugins/qmljseditor/qmloutlinemodel.cpp | 2 +- src/plugins/qmljseditor/qmloutlinemodel.h | 4 +- src/plugins/qmljseditor/quicktoolbar.cpp | 28 +- src/plugins/qmljseditor/quicktoolbar.h | 8 +- src/plugins/qmljsinspector/qmljsinspector.cpp | 8 +- .../qmljsinspector/qmljslivetextpreview.cpp | 8 +- src/plugins/qmljsinspector/qmljslivetextpreview.h | 4 +- src/plugins/qmljstools/qmljsfunctionfilter.cpp | 2 +- src/plugins/qmljstools/qmljsmodelmanager.cpp | 2 +- src/plugins/qmljstools/qmljsrefactoringchanges.cpp | 4 +- src/plugins/qmljstools/qmljsrefactoringchanges.h | 4 +- .../qt4projectmanager/profilecompletion.cpp | 14 +- src/plugins/qt4projectmanager/profilecompletion.h | 10 +- src/plugins/qt4projectmanager/profileeditor.cpp | 46 +- src/plugins/qt4projectmanager/profileeditor.h | 14 +- .../qt4projectmanager/profileeditorfactory.cpp | 4 +- src/plugins/qt4projectmanager/qt4projectmanager.h | 2 +- .../qt4projectmanager/qt4projectmanagerplugin.cpp | 4 +- .../qt4projectmanager/qtoutputformatter.cpp | 6 +- src/plugins/subversion/subversioneditor.cpp | 2 +- src/plugins/subversion/subversioneditor.h | 2 +- src/plugins/subversion/subversionplugin.cpp | 30 +- src/plugins/texteditor/basefilefind.cpp | 6 +- src/plugins/texteditor/basehoverhandler.cpp | 10 +- src/plugins/texteditor/basehoverhandler.h | 4 +- src/plugins/texteditor/basetextdocument.cpp | 4 +- src/plugins/texteditor/basetexteditor.cpp | 520 ++++++++++----------- src/plugins/texteditor/basetexteditor.h | 35 +- src/plugins/texteditor/basetexteditor_p.h | 8 +- src/plugins/texteditor/completionsupport.cpp | 10 +- src/plugins/texteditor/completionsupport.h | 4 +- src/plugins/texteditor/completionwidget.cpp | 8 +- src/plugins/texteditor/completionwidget.h | 10 +- src/plugins/texteditor/icompletioncollector.cpp | 9 +- src/plugins/texteditor/icompletioncollector.h | 14 +- src/plugins/texteditor/indenter.cpp | 6 +- src/plugins/texteditor/indenter.h | 8 +- src/plugins/texteditor/itexteditable.h | 65 --- src/plugins/texteditor/itexteditor.h | 11 + src/plugins/texteditor/normalindenter.cpp | 2 +- src/plugins/texteditor/normalindenter.h | 2 +- src/plugins/texteditor/plaintexteditor.cpp | 50 +- src/plugins/texteditor/plaintexteditor.h | 14 +- src/plugins/texteditor/plaintexteditorfactory.cpp | 8 +- src/plugins/texteditor/quickfix.cpp | 34 +- src/plugins/texteditor/quickfix.h | 22 +- src/plugins/texteditor/refactoringchanges.cpp | 14 +- src/plugins/texteditor/refactoringchanges.h | 10 +- src/plugins/texteditor/refactoroverlay.cpp | 2 +- src/plugins/texteditor/refactoroverlay.h | 6 +- src/plugins/texteditor/snippets/isnippetprovider.h | 4 +- .../snippets/plaintextsnippetprovider.cpp | 2 +- .../texteditor/snippets/plaintextsnippetprovider.h | 2 +- src/plugins/texteditor/snippets/snippeteditor.cpp | 20 +- src/plugins/texteditor/snippets/snippeteditor.h | 18 +- .../texteditor/snippets/snippetssettingspage.cpp | 12 +- src/plugins/texteditor/texteditor.pro | 1 - src/plugins/texteditor/texteditoractionhandler.cpp | 6 +- src/plugins/texteditor/texteditoractionhandler.h | 8 +- src/plugins/texteditor/texteditoroverlay.cpp | 2 +- src/plugins/texteditor/texteditoroverlay.h | 6 +- src/plugins/texteditor/texteditorplugin.cpp | 6 +- src/plugins/texteditor/texteditorplugin.h | 4 +- src/plugins/texteditor/texteditorsettings.cpp | 2 +- src/plugins/texteditor/texteditorsettings.h | 4 +- src/plugins/vcsbase/basevcseditorfactory.cpp | 4 +- src/plugins/vcsbase/basevcseditorfactory.h | 8 +- src/plugins/vcsbase/vcsbaseeditor.cpp | 190 ++++---- src/plugins/vcsbase/vcsbaseeditor.h | 18 +- 178 files changed, 1322 insertions(+), 1377 deletions(-) delete mode 100644 src/plugins/texteditor/itexteditable.h (limited to 'src/plugins') diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index c650085e41..ac0491c0a2 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -497,7 +497,7 @@ Bookmark *BookmarkManager::bookmarkForIndex(QModelIndex index) bool BookmarkManager::gotoBookmark(Bookmark* bookmark) { using namespace TextEditor; - if (ITextEditor *editor = BaseTextEditor::openEditorAt(bookmark->filePath(), bookmark->lineNumber())) + if (ITextEditor *editor = BaseTextEditorWidget::openEditorAt(bookmark->filePath(), bookmark->lineNumber())) return (editor->currentLine() == bookmark->lineNumber()); return false; } diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp index 0bf8164f40..7cfa3c573c 100644 --- a/src/plugins/classview/classviewmanager.cpp +++ b/src/plugins/classview/classviewmanager.cpp @@ -299,7 +299,7 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc) void Manager::gotoLocation(const QString &fileName, int line, int column) { bool newEditor = false; - TextEditor::BaseTextEditor::openEditorAt(fileName, line, column, QString(), + TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, column, QString(), Core::EditorManager::IgnoreNavigationHistory, &newEditor); } diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index cdbf5a3fdb..1d9ebbef28 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -51,27 +51,27 @@ using namespace CMakeProjectManager::Internal; // ProFileEditorEditable // -CMakeEditorEditable::CMakeEditorEditable(CMakeEditor *editor) - : BaseTextEditorEditable(editor), +CMakeEditor::CMakeEditor(CMakeEditorWidget *editor) + : BaseTextEditor(editor), m_context(CMakeProjectManager::Constants::C_CMAKEEDITOR, TextEditor::Constants::C_TEXTEDITOR) { } -Core::Context CMakeEditorEditable::context() const +Core::Context CMakeEditor::context() const { return m_context; } -Core::IEditor *CMakeEditorEditable::duplicate(QWidget *parent) +Core::IEditor *CMakeEditor::duplicate(QWidget *parent) { - CMakeEditor *ret = new CMakeEditor(parent, qobject_cast(editor())->factory(), - qobject_cast(editor())->actionHandler()); - ret->duplicateFrom(editor()); + CMakeEditorWidget *w = qobject_cast(editorWidget()); + CMakeEditorWidget *ret = new CMakeEditorWidget(parent, w->factory(), w->actionHandler()); + ret->duplicateFrom(w); TextEditor::TextEditorSettings::instance()->initializeEditor(ret); - return ret->editableInterface(); + return ret->editor(); } -QString CMakeEditorEditable::id() const +QString CMakeEditor::id() const { return QLatin1String(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); } @@ -80,8 +80,8 @@ QString CMakeEditorEditable::id() const // CMakeEditor // -CMakeEditor::CMakeEditor(QWidget *parent, CMakeEditorFactory *factory, TextEditor::TextEditorActionHandler *ah) - : BaseTextEditor(parent), m_factory(factory), m_ah(ah) +CMakeEditorWidget::CMakeEditorWidget(QWidget *parent, CMakeEditorFactory *factory, TextEditor::TextEditorActionHandler *ah) + : BaseTextEditorWidget(parent), m_factory(factory), m_ah(ah) { CMakeDocument *doc = new CMakeDocument(); doc->setMimeType(QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE)); @@ -92,18 +92,18 @@ CMakeEditor::CMakeEditor(QWidget *parent, CMakeEditorFactory *factory, TextEdito baseTextDocument()->setSyntaxHighlighter(new CMakeHighlighter); } -CMakeEditor::~CMakeEditor() +CMakeEditorWidget::~CMakeEditorWidget() { } -TextEditor::BaseTextEditorEditable *CMakeEditor::createEditableInterface() +TextEditor::BaseTextEditor *CMakeEditorWidget::createEditor() { - return new CMakeEditorEditable(this); + return new CMakeEditor(this); } -void CMakeEditor::setFontSettings(const TextEditor::FontSettings &fs) +void CMakeEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { - TextEditor::BaseTextEditor::setFontSettings(fs); + TextEditor::BaseTextEditorWidget::setFontSettings(fs); CMakeHighlighter *highlighter = qobject_cast(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.h b/src/plugins/cmakeprojectmanager/cmakeeditor.h index b296eca77f..460f90eb81 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.h +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.h @@ -45,18 +45,16 @@ class FontSettings; } namespace CMakeProjectManager { - namespace Internal { -class CMakeManager; +class CMakeEditorWidget; class CMakeHighlighter; +class CMakeManager; -class CMakeEditor; - -class CMakeEditorEditable : public TextEditor::BaseTextEditorEditable +class CMakeEditor : public TextEditor::BaseTextEditor { public: - CMakeEditorEditable(CMakeEditor *); + CMakeEditor(CMakeEditorWidget *); Core::Context context() const; bool duplicateSupported() const { return true; } @@ -67,20 +65,21 @@ private: const Core::Context m_context; }; -class CMakeEditor : public TextEditor::BaseTextEditor +class CMakeEditorWidget : public TextEditor::BaseTextEditorWidget { Q_OBJECT public: - CMakeEditor(QWidget *parent, CMakeEditorFactory *factory, TextEditor::TextEditorActionHandler *ah); - ~CMakeEditor(); + CMakeEditorWidget(QWidget *parent, CMakeEditorFactory *factory, TextEditor::TextEditorActionHandler *ah); + ~CMakeEditorWidget(); bool save(const QString &fileName = QString()); CMakeEditorFactory *factory() { return m_factory; } TextEditor::TextEditorActionHandler *actionHandler() const { return m_ah; } + protected: - TextEditor::BaseTextEditorEditable *createEditableInterface(); + TextEditor::BaseTextEditor *createEditor(); public slots: virtual void setFontSettings(const TextEditor::FontSettings &); diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp index f07f62d9ca..d4e0cdceff 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp @@ -71,9 +71,9 @@ Core::IFile *CMakeEditorFactory::open(const QString &fileName) Core::IEditor *CMakeEditorFactory::createEditor(QWidget *parent) { - CMakeEditor *rc = new CMakeEditor(parent, this, m_actionHandler); + CMakeEditorWidget *rc = new CMakeEditorWidget(parent, this, m_actionHandler); TextEditor::TextEditorSettings::instance()->initializeEditor(rc); - return rc->editableInterface(); + return rc->editor(); } QStringList CMakeEditorFactory::mimeTypes() const diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index e8f691b1d2..ee4ba260fb 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -166,14 +166,14 @@ ExtensionSystem::IPlugin::ShutdownFlag CodepasterPlugin::aboutToShutdown() void CodepasterPlugin::updateActions() { const IEditor* editor = EditorManager::instance()->currentEditor(); - const BaseTextEditorEditable *textEditor = qobject_cast(editor); + const BaseTextEditor *textEditor = qobject_cast(editor); m_postEditorAction->setEnabled(textEditor != 0); } void CodepasterPlugin::postEditor() { const IEditor* editor = EditorManager::instance()->currentEditor(); - const BaseTextEditorEditable *textEditor = qobject_cast(editor); + const BaseTextEditor *textEditor = qobject_cast(editor); if (!textEditor) return; @@ -181,7 +181,7 @@ void CodepasterPlugin::postEditor() if (data.isEmpty()) data = textEditor->contents(); if (!data.isEmpty()) - post(data, textEditor->editor()->mimeType()); + post(data, textEditor->editorWidget()->mimeType()); } void CodepasterPlugin::postClipboard() diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index ed9fc8ebee..8f943baf80 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -285,11 +285,11 @@ protected: struct CanonicalSymbol { - CPPEditor *editor; + CPPEditorWidget *editor; TypeOfExpression typeOfExpression; SemanticInfo info; - CanonicalSymbol(CPPEditor *editor, const SemanticInfo &info) + CanonicalSymbol(CPPEditorWidget *editor, const SemanticInfo &info) : editor(editor), info(info) { typeOfExpression.init(info.doc, info.snapshot); @@ -310,7 +310,7 @@ struct CanonicalSymbol return getScopeAndExpression(editor, info, cursor, code); } - static Scope *getScopeAndExpression(CPPEditor *editor, const SemanticInfo &info, + static Scope *getScopeAndExpression(CPPEditorWidget *editor, const SemanticInfo &info, const QTextCursor &cursor, QString *code) { @@ -396,16 +396,16 @@ int numberOfClosedEditors = 0; } // end of anonymous namespace -CPPEditorEditable::CPPEditorEditable(CPPEditor *editor) - : BaseTextEditorEditable(editor) +CPPEditor::CPPEditor(CPPEditorWidget *editor) + : BaseTextEditor(editor) { m_context.add(CppEditor::Constants::C_CPPEDITOR); m_context.add(ProjectExplorer::Constants::LANG_CXX); m_context.add(TextEditor::Constants::C_TEXTEDITOR); } -CPPEditor::CPPEditor(QWidget *parent) - : TextEditor::BaseTextEditor(parent) +CPPEditorWidget::CPPEditorWidget(QWidget *parent) + : TextEditor::BaseTextEditorWidget(parent) , m_currentRenameSelection(NoCurrentRenameSelection) , m_inRename(false) , m_inRenameChanged(false) @@ -443,7 +443,7 @@ CPPEditor::CPPEditor(QWidget *parent) connect(&m_referencesWatcher, SIGNAL(finished()), SLOT(markSymbolsNow())); } -CPPEditor::~CPPEditor() +CPPEditorWidget::~CPPEditorWidget() { if (Core::EditorManager *em = Core::EditorManager::instance()) em->hideEditorInfoBar(QLatin1String("CppEditor.Rename")); @@ -458,14 +458,14 @@ CPPEditor::~CPPEditor() } } -TextEditor::BaseTextEditorEditable *CPPEditor::createEditableInterface() +TextEditor::BaseTextEditor *CPPEditorWidget::createEditor() { - CPPEditorEditable *editable = new CPPEditorEditable(this); + CPPEditor *editable = new CPPEditor(this); createToolBar(editable); return editable; } -void CPPEditor::createToolBar(CPPEditorEditable *editable) +void CPPEditorWidget::createToolBar(CPPEditor *editable) { m_outlineCombo = new QComboBox; m_outlineCombo->setMinimumContentsLength(22); @@ -534,55 +534,55 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable) static_cast(w->layout())->insertWidget(0, m_outlineCombo, 1); } -void CPPEditor::paste() +void CPPEditorWidget::paste() { if (m_currentRenameSelection == NoCurrentRenameSelection) { - BaseTextEditor::paste(); + BaseTextEditorWidget::paste(); return; } startRename(); - BaseTextEditor::paste(); + BaseTextEditorWidget::paste(); finishRename(); } -void CPPEditor::cut() +void CPPEditorWidget::cut() { if (m_currentRenameSelection == NoCurrentRenameSelection) { - BaseTextEditor::cut(); + BaseTextEditorWidget::cut(); return; } startRename(); - BaseTextEditor::cut(); + BaseTextEditorWidget::cut(); finishRename(); } -CppModelManagerInterface *CPPEditor::modelManager() const +CppModelManagerInterface *CPPEditorWidget::modelManager() const { return m_modelManager; } -void CPPEditor::setMimeType(const QString &mt) +void CPPEditorWidget::setMimeType(const QString &mt) { - BaseTextEditor::setMimeType(mt); + BaseTextEditorWidget::setMimeType(mt); setObjCEnabled(mt == CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE); } -void CPPEditor::setObjCEnabled(bool onoff) +void CPPEditorWidget::setObjCEnabled(bool onoff) { m_objcEnabled = onoff; } -bool CPPEditor::isObjCEnabled() const +bool CPPEditorWidget::isObjCEnabled() const { return m_objcEnabled; } -void CPPEditor::startRename() +void CPPEditorWidget::startRename() { m_inRenameChanged = false; } -void CPPEditor::finishRename() +void CPPEditorWidget::finishRename() { if (!m_inRenameChanged) return; @@ -613,7 +613,7 @@ void CPPEditor::finishRename() m_inRename = false; } -void CPPEditor::abortRename() +void CPPEditorWidget::abortRename() { if (m_currentRenameSelection <= NoCurrentRenameSelection) return; @@ -624,13 +624,13 @@ void CPPEditor::abortRename() setExtraSelections(CodeSemanticsSelection, m_renameSelections); } -void CPPEditor::rehighlight(bool force) +void CPPEditorWidget::rehighlight(bool force) { const SemanticHighlighter::Source source = currentSource(force); m_semanticHighlighter->rehighlight(source); } -void CPPEditor::onDocumentUpdated(Document::Ptr doc) +void CPPEditorWidget::onDocumentUpdated(Document::Ptr doc) { if (doc->fileName() != file()->fileName()) return; @@ -646,7 +646,7 @@ void CPPEditor::onDocumentUpdated(Document::Ptr doc) m_updateOutlineTimer->start(); } -const Macro *CPPEditor::findCanonicalMacro(const QTextCursor &cursor, Document::Ptr doc) const +const Macro *CPPEditorWidget::findCanonicalMacro(const QTextCursor &cursor, Document::Ptr doc) const { if (! doc) return 0; @@ -663,7 +663,7 @@ const Macro *CPPEditor::findCanonicalMacro(const QTextCursor &cursor, Document:: return 0; } -void CPPEditor::findUsages() +void CPPEditorWidget::findUsages() { SemanticInfo info = m_lastSemanticInfo; info.snapshot = CppModelManagerInterface::instance()->snapshot(); @@ -679,7 +679,7 @@ void CPPEditor::findUsages() } -void CPPEditor::renameUsagesNow(const QString &replacement) +void CPPEditorWidget::renameUsagesNow(const QString &replacement) { SemanticInfo info = m_lastSemanticInfo; info.snapshot = CppModelManagerInterface::instance()->snapshot(); @@ -700,12 +700,12 @@ void CPPEditor::renameUsagesNow(const QString &replacement) } } -void CPPEditor::renameUsages() +void CPPEditorWidget::renameUsages() { renameUsagesNow(); } -bool CPPEditor::showWarningMessage() const +bool CPPEditorWidget::showWarningMessage() const { // Restore settings QSettings *settings = Core::ICore::instance()->settings(); @@ -717,7 +717,7 @@ bool CPPEditor::showWarningMessage() const return showWarningMessage; } -void CPPEditor::setShowWarningMessage(bool showWarningMessage) +void CPPEditorWidget::setShowWarningMessage(bool showWarningMessage) { // Restore settings QSettings *settings = Core::ICore::instance()->settings(); @@ -728,13 +728,13 @@ void CPPEditor::setShowWarningMessage(bool showWarningMessage) settings->endGroup(); } -void CPPEditor::hideRenameNotification() +void CPPEditorWidget::hideRenameNotification() { setShowWarningMessage(false); Core::EditorManager::instance()->hideEditorInfoBar(QLatin1String("CppEditor.Rename")); } -void CPPEditor::markSymbolsNow() +void CPPEditorWidget::markSymbolsNow() { if (m_references.isCanceled()) return; @@ -783,7 +783,7 @@ static QList lazyFindReferences(Scope *scope, QString code, Document::Ptr d return QList(); } -void CPPEditor::markSymbols(const QTextCursor &tc, const SemanticInfo &info) +void CPPEditorWidget::markSymbols(const QTextCursor &tc, const SemanticInfo &info) { abortRename(); @@ -806,7 +806,7 @@ void CPPEditor::markSymbols(const QTextCursor &tc, const SemanticInfo &info) } } -void CPPEditor::renameSymbolUnderCursor() +void CPPEditorWidget::renameSymbolUnderCursor() { updateSemanticInfo(m_semanticHighlighter->semanticInfo(currentSource())); abortRename(); @@ -833,7 +833,7 @@ void CPPEditor::renameSymbolUnderCursor() renameUsages(); } -void CPPEditor::onContentsChanged(int position, int charsRemoved, int charsAdded) +void CPPEditorWidget::onContentsChanged(int position, int charsRemoved, int charsAdded) { Q_UNUSED(position) @@ -857,10 +857,10 @@ void CPPEditor::onContentsChanged(int position, int charsRemoved, int charsAdded updateUses(); } -void CPPEditor::updateFileName() +void CPPEditorWidget::updateFileName() { } -void CPPEditor::jumpToOutlineElement(int) +void CPPEditorWidget::jumpToOutlineElement(int) { QModelIndex index = m_proxyModel->mapToSource(m_outlineCombo->view()->currentIndex()); Symbol *symbol = m_outlineModel->symbolFromIndex(index); @@ -870,7 +870,7 @@ void CPPEditor::jumpToOutlineElement(int) openCppEditorAt(linkToSymbol(symbol)); } -void CPPEditor::setSortedOutline(bool sort) +void CPPEditorWidget::setSortedOutline(bool sort) { if (sort != sortedOutline()) { if (sort) @@ -884,12 +884,12 @@ void CPPEditor::setSortedOutline(bool sort) } } -bool CPPEditor::sortedOutline() const +bool CPPEditorWidget::sortedOutline() const { return (m_proxyModel->sortColumn() == 0); } -void CPPEditor::updateOutlineNow() +void CPPEditorWidget::updateOutlineNow() { const Snapshot snapshot = m_modelManager->snapshot(); Document::Ptr document = snapshot.document(file()->fileName()); @@ -909,12 +909,12 @@ void CPPEditor::updateOutlineNow() updateOutlineIndexNow(); } -void CPPEditor::updateOutlineIndex() +void CPPEditorWidget::updateOutlineIndex() { m_updateOutlineIndexTimer->start(); } -void CPPEditor::highlightUses(const QList &uses, +void CPPEditorWidget::highlightUses(const QList &uses, const SemanticInfo &semanticInfo, QList *selections) { @@ -950,7 +950,7 @@ void CPPEditor::highlightUses(const QList &uses, } } -void CPPEditor::updateOutlineIndexNow() +void CPPEditorWidget::updateOutlineIndexNow() { if (!m_outlineModel->document()) return; @@ -980,19 +980,19 @@ void CPPEditor::updateOutlineIndexNow() } } -void CPPEditor::updateOutlineToolTip() +void CPPEditorWidget::updateOutlineToolTip() { m_outlineCombo->setToolTip(m_outlineCombo->currentText()); } -void CPPEditor::updateUses() +void CPPEditorWidget::updateUses() { if (editorRevision() != m_highlightRevision) m_highlighter.cancel(); m_updateUsesTimer->start(); } -void CPPEditor::updateUsesNow() +void CPPEditorWidget::updateUsesNow() { if (m_currentRenameSelection != NoCurrentRenameSelection) return; @@ -1000,7 +1000,7 @@ void CPPEditor::updateUsesNow() semanticRehighlight(); } -void CPPEditor::highlightSymbolUsages(int from, int to) +void CPPEditorWidget::highlightSymbolUsages(int from, int to) { if (editorRevision() != m_highlightRevision) return; // outdated @@ -1072,7 +1072,7 @@ void CPPEditor::highlightSymbolUsages(int from, int to) } } -void CPPEditor::finishHighlightSymbolUsages() +void CPPEditorWidget::finishHighlightSymbolUsages() { if (editorRevision() != m_highlightRevision) return; // outdated @@ -1097,7 +1097,7 @@ void CPPEditor::finishHighlightSymbolUsages() } -void CPPEditor::switchDeclarationDefinition() +void CPPEditorWidget::switchDeclarationDefinition() { if (! m_modelManager) return; @@ -1258,7 +1258,7 @@ QList findMatchingDeclaration(const LookupContext &context, } // end of anonymous namespace -CPPEditor::Link CPPEditor::attemptFuncDeclDef(const QTextCursor &cursor, const Document::Ptr &doc, Snapshot snapshot) const +CPPEditorWidget::Link CPPEditorWidget::attemptFuncDeclDef(const QTextCursor &cursor, const Document::Ptr &doc, Snapshot snapshot) const { snapshot.insert(doc); @@ -1327,7 +1327,7 @@ CPPEditor::Link CPPEditor::attemptFuncDeclDef(const QTextCursor &cursor, const D return result; } -CPPEditor::Link CPPEditor::findMacroLink(const QByteArray &name) const +CPPEditorWidget::Link CPPEditorWidget::findMacroLink(const QByteArray &name) const { if (! name.isEmpty()) { if (Document::Ptr doc = m_lastSemanticInfo.doc) { @@ -1340,7 +1340,7 @@ CPPEditor::Link CPPEditor::findMacroLink(const QByteArray &name) const return Link(); } -CPPEditor::Link CPPEditor::findMacroLink(const QByteArray &name, +CPPEditorWidget::Link CPPEditorWidget::findMacroLink(const QByteArray &name, Document::Ptr doc, const Snapshot &snapshot, QSet *processed) const @@ -1369,14 +1369,14 @@ CPPEditor::Link CPPEditor::findMacroLink(const QByteArray &name, return Link(); } -QString CPPEditor::identifierUnderCursor(QTextCursor *macroCursor) const +QString CPPEditorWidget::identifierUnderCursor(QTextCursor *macroCursor) const { macroCursor->movePosition(QTextCursor::StartOfWord); macroCursor->movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); return macroCursor->selectedText(); } -CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor, +CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, bool resolveTarget) { Link link; @@ -1575,12 +1575,12 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor, return Link(); } -void CPPEditor::jumpToDefinition() +void CPPEditorWidget::jumpToDefinition() { openLink(findLinkAt(textCursor())); } -Symbol *CPPEditor::findDefinition(Symbol *symbol, const Snapshot &snapshot) const +Symbol *CPPEditorWidget::findDefinition(Symbol *symbol, const Snapshot &snapshot) const { if (symbol->isFunction()) return 0; // symbol is a function definition. @@ -1591,12 +1591,12 @@ Symbol *CPPEditor::findDefinition(Symbol *symbol, const Snapshot &snapshot) cons return snapshot.findMatchingDefinition(symbol); } -unsigned CPPEditor::editorRevision() const +unsigned CPPEditorWidget::editorRevision() const { return document()->revision(); } -bool CPPEditor::isOutdated() const +bool CPPEditorWidget::isOutdated() const { if (m_lastSemanticInfo.revision != editorRevision()) return true; @@ -1604,17 +1604,17 @@ bool CPPEditor::isOutdated() const return false; } -SemanticInfo CPPEditor::semanticInfo() const +SemanticInfo CPPEditorWidget::semanticInfo() const { return m_lastSemanticInfo; } -CPlusPlus::OverviewModel *CPPEditor::outlineModel() const +CPlusPlus::OverviewModel *CPPEditorWidget::outlineModel() const { return m_outlineModel; } -QModelIndex CPPEditor::outlineModelIndex() +QModelIndex CPPEditorWidget::outlineModelIndex() { if (!m_outlineModelIndex.isValid()) { int line = 0, column = 0; @@ -1626,7 +1626,7 @@ QModelIndex CPPEditor::outlineModelIndex() return m_outlineModelIndex; } -bool CPPEditor::event(QEvent *e) +bool CPPEditorWidget::event(QEvent *e) { switch (e->type()) { case QEvent::ShortcutOverride: @@ -1639,16 +1639,16 @@ bool CPPEditor::event(QEvent *e) break; } - return BaseTextEditor::event(e); + return BaseTextEditorWidget::event(e); } -void CPPEditor::performQuickFix(int index) +void CPPEditorWidget::performQuickFix(int index) { TextEditor::QuickFixOperation::Ptr op = m_quickFixes.at(index); op->perform(); } -void CPPEditor::contextMenuEvent(QContextMenuEvent *e) +void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e) { // ### enable // updateSemanticInfo(m_semanticHighlighter->semanticInfo(currentSource())); @@ -1667,7 +1667,7 @@ void CPPEditor::contextMenuEvent(QContextMenuEvent *e) connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int))); if (! isOutdated()) { - if (quickFixCollector->startCompletion(editableInterface()) != -1) { + if (quickFixCollector->startCompletion(editor()) != -1) { m_quickFixes = quickFixCollector->quickFixes(); if (! m_quickFixes.isEmpty()) @@ -1696,10 +1696,10 @@ void CPPEditor::contextMenuEvent(QContextMenuEvent *e) delete menu; } -void CPPEditor::keyPressEvent(QKeyEvent *e) +void CPPEditorWidget::keyPressEvent(QKeyEvent *e) { if (m_currentRenameSelection == NoCurrentRenameSelection) { - TextEditor::BaseTextEditor::keyPressEvent(e); + TextEditor::BaseTextEditorWidget::keyPressEvent(e); return; } @@ -1772,40 +1772,40 @@ void CPPEditor::keyPressEvent(QKeyEvent *e) cursor.joinPreviousEditBlock(); m_firstRenameChange = false; } - TextEditor::BaseTextEditor::keyPressEvent(e); + TextEditor::BaseTextEditorWidget::keyPressEvent(e); if (wantEditBlock) cursor.endEditBlock(); finishRename(); } -Core::Context CPPEditorEditable::context() const +Core::Context CPPEditor::context() const { return m_context; } -Core::IEditor *CPPEditorEditable::duplicate(QWidget *parent) +Core::IEditor *CPPEditor::duplicate(QWidget *parent) { - CPPEditor *newEditor = new CPPEditor(parent); - newEditor->duplicateFrom(editor()); + CPPEditorWidget *newEditor = new CPPEditorWidget(parent); + newEditor->duplicateFrom(editorWidget()); CppPlugin::instance()->initializeEditor(newEditor); - return newEditor->editableInterface(); + return newEditor->editor(); } -QString CPPEditorEditable::id() const +QString CPPEditor::id() const { return QLatin1String(CppEditor::Constants::CPPEDITOR_ID); } -bool CPPEditorEditable::open(const QString & fileName) +bool CPPEditor::open(const QString & fileName) { - bool b = TextEditor::BaseTextEditorEditable::open(fileName); - editor()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); + bool b = TextEditor::BaseTextEditor::open(fileName); + editorWidget()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); return b; } -void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs) +void CPPEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { - TextEditor::BaseTextEditor::setFontSettings(fs); + TextEditor::BaseTextEditorWidget::setFontSettings(fs); CppHighlighter *highlighter = qobject_cast(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; @@ -1842,20 +1842,20 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs) highlighter->rehighlight(); } -void CPPEditor::setTabSettings(const TextEditor::TabSettings &ts) +void CPPEditorWidget::setTabSettings(const TextEditor::TabSettings &ts) { CppTools::QtStyleCodeFormatter formatter; formatter.invalidateCache(document()); - TextEditor::BaseTextEditor::setTabSettings(ts); + TextEditor::BaseTextEditorWidget::setTabSettings(ts); } -void CPPEditor::unCommentSelection() +void CPPEditorWidget::unCommentSelection() { Utils::unCommentSelection(this); } -CPPEditor::Link CPPEditor::linkToSymbol(CPlusPlus::Symbol *symbol) +CPPEditorWidget::Link CPPEditorWidget::linkToSymbol(CPlusPlus::Symbol *symbol) { if (!symbol) return Link(); @@ -1874,7 +1874,7 @@ CPPEditor::Link CPPEditor::linkToSymbol(CPlusPlus::Symbol *symbol) return Link(fileName, line, column); } -bool CPPEditor::openCppEditorAt(const Link &link) +bool CPPEditorWidget::openCppEditorAt(const Link &link) { if (link.fileName.isEmpty()) return false; @@ -1888,18 +1888,18 @@ bool CPPEditor::openCppEditorAt(const Link &link) return true; } - return TextEditor::BaseTextEditor::openEditorAt(link.fileName, + return TextEditor::BaseTextEditorWidget::openEditorAt(link.fileName, link.line, link.column, Constants::CPPEDITOR_ID); } -void CPPEditor::semanticRehighlight() +void CPPEditorWidget::semanticRehighlight() { m_semanticHighlighter->rehighlight(currentSource()); } -void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) +void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo) { if (semanticInfo.revision != editorRevision()) { // got outdated semantic info @@ -1953,7 +1953,7 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) m_highlighter.cancel(); if (! semanticHighlighterDisabled && semanticInfo.doc) { - if (Core::EditorManager::instance()->currentEditor() == editableInterface()) { + if (Core::EditorManager::instance()->currentEditor() == editor()) { LookupContext context(semanticInfo.doc, semanticInfo.snapshot); CheckSymbols::Future f = CheckSymbols::go(semanticInfo.doc, context); m_highlighter = f; @@ -2076,7 +2076,7 @@ private: } // anonymous namespace -SemanticHighlighter::Source CPPEditor::currentSource(bool force) +SemanticHighlighter::Source CPPEditorWidget::currentSource(bool force) { int line = 0, column = 0; convertPosition(position(), &line, &column); @@ -2215,7 +2215,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source) return semanticInfo; } -QModelIndex CPPEditor::indexForPosition(int line, int column, const QModelIndex &rootIndex) const +QModelIndex CPPEditorWidget::indexForPosition(int line, int column, const QModelIndex &rootIndex) const { QModelIndex lastIndex = rootIndex; @@ -2236,7 +2236,7 @@ QModelIndex CPPEditor::indexForPosition(int line, int column, const QModelIndex return lastIndex; } -QVector CPPEditor::highlighterFormatCategories() +QVector CPPEditorWidget::highlighterFormatCategories() { static QVector categories; if (categories.isEmpty()) { diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index d8fd7a6c61..11634168fd 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -71,7 +71,7 @@ class FontSettings; namespace CppEditor { namespace Internal { -class CPPEditor; +class CPPEditorWidget; class SemanticHighlighter: public QThread, CPlusPlus::TopLevelDeclarationProcessor { @@ -142,11 +142,11 @@ private: SemanticInfo m_lastSemanticInfo; }; -class CPPEditorEditable : public TextEditor::BaseTextEditorEditable +class CPPEditor : public TextEditor::BaseTextEditor { Q_OBJECT public: - CPPEditorEditable(CPPEditor *); + CPPEditor(CPPEditorWidget *); Core::Context context() const; bool duplicateSupported() const { return true; } @@ -160,15 +160,15 @@ private: Core::Context m_context; }; -class CPPEditor : public TextEditor::BaseTextEditor +class CPPEditorWidget : public TextEditor::BaseTextEditorWidget { Q_OBJECT public: typedef TextEditor::TabSettings TabSettings; - CPPEditor(QWidget *parent); - ~CPPEditor(); + CPPEditorWidget(QWidget *parent); + ~CPPEditorWidget(); void unCommentSelection(); unsigned editorRevision() const; @@ -178,8 +178,8 @@ public: CPlusPlus::OverviewModel *outlineModel() const; QModelIndex outlineModelIndex(); - virtual void paste(); // reimplemented from BaseTextEditor - virtual void cut(); // reimplemented from BaseTextEditor + virtual void paste(); // reimplemented from BaseTextEditorWidget + virtual void cut(); // reimplemented from BaseTextEditorWidget CPlusPlus::CppModelManagerInterface *modelManager() const; @@ -215,7 +215,7 @@ protected: void contextMenuEvent(QContextMenuEvent *); void keyPressEvent(QKeyEvent *); - TextEditor::BaseTextEditorEditable *createEditableInterface(); + TextEditor::BaseTextEditor *createEditor(); const CPlusPlus::Macro *findCanonicalMacro(const QTextCursor &cursor, CPlusPlus::Document::Ptr doc) const; @@ -258,7 +258,7 @@ private: const SemanticInfo &semanticInfo, QList *selections); - void createToolBar(CPPEditorEditable *editable); + void createToolBar(CPPEditor *editable); void startRename(); void finishRename(); diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp index 5e10193c45..0b08626ffe 100644 --- a/src/plugins/cppeditor/cppelementevaluator.cpp +++ b/src/plugins/cppeditor/cppelementevaluator.cpp @@ -84,7 +84,7 @@ namespace { } } -CppElementEvaluator::CppElementEvaluator(CPPEditor *editor) : +CppElementEvaluator::CppElementEvaluator(CPPEditorWidget *editor) : m_editor(editor), m_modelManager(CppModelManagerInterface::instance()), m_tc(editor->textCursor()), @@ -264,10 +264,10 @@ void CppElement::setHelpMark(const QString &mark) const QString &CppElement::helpMark() const { return m_helpMark; } -void CppElement::setLink(const CPPEditor::Link &link) +void CppElement::setLink(const CPPEditorWidget::Link &link) { m_link = link; } -const CPPEditor::Link &CppElement::link() const +const CPPEditorWidget::Link &CppElement::link() const { return m_link; } void CppElement::setTooltip(const QString &tooltip) @@ -301,7 +301,7 @@ CppInclude::CppInclude(const Document::Include &includeFile) : setHelpCategory(TextEditor::HelpItem::Brief); setHelpIdCandidates(QStringList(m_fileName)); setHelpMark(m_fileName); - setLink(CPPEditor::Link(m_path)); + setLink(CPPEditorWidget::Link(m_path)); setTooltip(m_path); } @@ -317,7 +317,7 @@ CppMacro::CppMacro(const Macro ¯o) : CppElement() setHelpCategory(TextEditor::HelpItem::Macro); setHelpIdCandidates(QStringList(macro.name())); setHelpMark(macro.name()); - setLink(CPPEditor::Link(macro.fileName(), macro.line())); + setLink(CPPEditorWidget::Link(macro.fileName(), macro.line())); setTooltip(macro.toString()); } @@ -344,7 +344,7 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration) : CppElement() } setTooltip(overview.prettyType(declaration->type(), m_qualifiedName)); - setLink(CPPEditor::linkToSymbol(declaration)); + setLink(CPPEditorWidget::linkToSymbol(declaration)); setHelpMark(m_name); } diff --git a/src/plugins/cppeditor/cppelementevaluator.h b/src/plugins/cppeditor/cppelementevaluator.h index 62bf80eb0a..94c20ed74a 100644 --- a/src/plugins/cppeditor/cppelementevaluator.h +++ b/src/plugins/cppeditor/cppelementevaluator.h @@ -59,13 +59,13 @@ class CppModelManagerInterface; namespace CppEditor { namespace Internal { -class CPPEditor; +class CPPEditorWidget; class CppElement; class CppElementEvaluator { public: - CppElementEvaluator(CPPEditor *editor); + CppElementEvaluator(CPPEditorWidget *editor); void setTextCursor(const QTextCursor &tc); void setLookupBaseClasses(const bool lookup); @@ -85,7 +85,7 @@ private: const CPlusPlus::LookupItem &lookupItem, const CPlusPlus::LookupContext &lookupContext); - CPPEditor *m_editor; + CPPEditorWidget *m_editor; CPlusPlus::CppModelManagerInterface *m_modelManager; QTextCursor m_tc; bool m_lookupBaseClasses; @@ -101,14 +101,14 @@ public: const TextEditor::HelpItem::Category &helpCategory() const; const QStringList &helpIdCandidates() const; const QString &helpMark() const; - const CPPEditor::Link &link() const; + const CPPEditorWidget::Link &link() const; const QString &tooltip() const; protected: CppElement(); void setHelpCategory(const TextEditor::HelpItem::Category &category); - void setLink(const CPPEditor::Link &link); + void setLink(const CPPEditorWidget::Link &link); void setTooltip(const QString &tooltip); void setHelpIdCandidates(const QStringList &candidates); void addHelpIdCandidate(const QString &candidate); @@ -118,7 +118,7 @@ private: TextEditor::HelpItem::Category m_helpCategory; QStringList m_helpIdCandidates; QString m_helpMark; - CPPEditor::Link m_link; + CPPEditorWidget::Link m_link; QString m_tooltip; }; diff --git a/src/plugins/cppeditor/cpphighlighter.h b/src/plugins/cppeditor/cpphighlighter.h index bcd58c9492..a8fc85aa9f 100644 --- a/src/plugins/cppeditor/cpphighlighter.h +++ b/src/plugins/cppeditor/cpphighlighter.h @@ -43,7 +43,7 @@ namespace CppEditor { namespace Internal { -class CPPEditor; +class CPPEditorWidget; class CppHighlighter : public TextEditor::SyntaxHighlighter { diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp index eb136cc9b0..8c8b3c89f2 100644 --- a/src/plugins/cppeditor/cpphoverhandler.cpp +++ b/src/plugins/cppeditor/cpphoverhandler.cpp @@ -58,7 +58,7 @@ CppHoverHandler::~CppHoverHandler() bool CppHoverHandler::acceptEditor(IEditor *editor) { - CPPEditorEditable *cppEditor = qobject_cast(editor); + CPPEditor *cppEditor = qobject_cast(editor); if (cppEditor) return true; return false; @@ -66,7 +66,7 @@ bool CppHoverHandler::acceptEditor(IEditor *editor) void CppHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) { - CPPEditor *cppEditor = qobject_cast(editor->widget()); + CPPEditorWidget *cppEditor = qobject_cast(editor->widget()); if (!cppEditor) return; diff --git a/src/plugins/cppeditor/cppoutline.cpp b/src/plugins/cppeditor/cppoutline.cpp index ed13d7c1ca..43af007188 100644 --- a/src/plugins/cppeditor/cppoutline.cpp +++ b/src/plugins/cppeditor/cppoutline.cpp @@ -98,7 +98,7 @@ bool CppOutlineFilterModel::filterAcceptsRow(int sourceRow, } -CppOutlineWidget::CppOutlineWidget(CPPEditor *editor) : +CppOutlineWidget::CppOutlineWidget(CPPEditorWidget *editor) : TextEditor::IOutlineWidget(), m_editor(editor), m_treeView(new CppOutlineTreeView(this)), @@ -197,18 +197,18 @@ bool CppOutlineWidget::syncCursor() bool CppOutlineWidgetFactory::supportsEditor(Core::IEditor *editor) const { - if (qobject_cast(editor)) + if (qobject_cast(editor)) return true; return false; } TextEditor::IOutlineWidget *CppOutlineWidgetFactory::createWidget(Core::IEditor *editor) { - CPPEditorEditable *cppEditable = qobject_cast(editor); - CPPEditor *cppEditor = qobject_cast(cppEditable->widget()); - Q_ASSERT(cppEditor); + CPPEditor *cppEditor = qobject_cast(editor); + CPPEditorWidget *cppEditorWidget = qobject_cast(cppEditor->widget()); + Q_ASSERT(cppEditorWidget); - CppOutlineWidget *widget = new CppOutlineWidget(cppEditor); + CppOutlineWidget *widget = new CppOutlineWidget(cppEditorWidget); return widget; } diff --git a/src/plugins/cppeditor/cppoutline.h b/src/plugins/cppeditor/cppoutline.h index 2be7b78747..b57ebe091c 100644 --- a/src/plugins/cppeditor/cppoutline.h +++ b/src/plugins/cppeditor/cppoutline.h @@ -70,7 +70,7 @@ class CppOutlineWidget : public TextEditor::IOutlineWidget { Q_OBJECT public: - CppOutlineWidget(CPPEditor *editor); + CppOutlineWidget(CPPEditorWidget *editor); // IOutlineWidget virtual QList filterMenuActions() const; @@ -86,7 +86,7 @@ private: bool syncCursor(); private: - CPPEditor *m_editor; + CPPEditorWidget *m_editor; CppOutlineTreeView *m_treeView; CPlusPlus::OverviewModel *m_model; CppOutlineFilterModel *m_proxyModel; diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 212350b07e..c45ac20d8a 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -118,10 +118,10 @@ Core::IFile *CppEditorFactory::open(const QString &fileName) Core::IEditor *CppEditorFactory::createEditor(QWidget *parent) { - CPPEditor *editor = new CPPEditor(parent); + CPPEditorWidget *editor = new CPPEditorWidget(parent); editor->setRevisionsVisible(true); m_owner->initializeEditor(editor); - return editor->editableInterface(); + return editor->editor(); } QStringList CppEditorFactory::mimeTypes() const @@ -172,7 +172,7 @@ CppPlugin *CppPlugin::instance() return m_instance; } -void CppPlugin::initializeEditor(CPPEditor *editor) +void CppPlugin::initializeEditor(CPPEditorWidget *editor) { m_actionHandler->setupActions(editor); @@ -352,7 +352,7 @@ ExtensionSystem::IPlugin::ShutdownFlag CppPlugin::aboutToShutdown() void CppPlugin::switchDeclarationDefinition() { Core::EditorManager *em = Core::EditorManager::instance(); - CPPEditor *editor = qobject_cast(em->currentEditor()->widget()); + CPPEditorWidget *editor = qobject_cast(em->currentEditor()->widget()); if (editor) editor->switchDeclarationDefinition(); } @@ -360,7 +360,7 @@ void CppPlugin::switchDeclarationDefinition() void CppPlugin::jumpToDefinition() { Core::EditorManager *em = Core::EditorManager::instance(); - CPPEditor *editor = qobject_cast(em->currentEditor()->widget()); + CPPEditorWidget *editor = qobject_cast(em->currentEditor()->widget()); if (editor) editor->jumpToDefinition(); } @@ -368,7 +368,7 @@ void CppPlugin::jumpToDefinition() void CppPlugin::renameSymbolUnderCursor() { Core::EditorManager *em = Core::EditorManager::instance(); - CPPEditor *editor = qobject_cast(em->currentEditor()->widget()); + CPPEditorWidget *editor = qobject_cast(em->currentEditor()->widget()); if (editor) editor->renameSymbolUnderCursor(); } @@ -376,32 +376,32 @@ void CppPlugin::renameSymbolUnderCursor() void CppPlugin::findUsages() { Core::EditorManager *em = Core::EditorManager::instance(); - CPPEditor *editor = qobject_cast(em->currentEditor()->widget()); + CPPEditorWidget *editor = qobject_cast(em->currentEditor()->widget()); if (editor) editor->findUsages(); } -void CppPlugin::quickFix(TextEditor::ITextEditable *editable) +void CppPlugin::quickFix(TextEditor::ITextEditor *editor) { - m_currentTextEditable = editable; + m_currentEditor = editor; quickFixNow(); } void CppPlugin::quickFixNow() { - if (! m_currentTextEditable) + if (! m_currentEditor) return; Core::EditorManager *em = Core::EditorManager::instance(); - CPPEditor *currentEditor = qobject_cast(em->currentEditor()->widget()); + CPPEditorWidget *currentEditor = qobject_cast(em->currentEditor()->widget()); - if (CPPEditor *editor = qobject_cast(m_currentTextEditable->widget())) { + if (CPPEditorWidget *editor = qobject_cast(m_currentEditor->widget())) { if (currentEditor == editor) { if (editor->isOutdated()) m_quickFixTimer->start(QUICKFIX_INTERVAL); else TextEditor::CompletionSupport::instance()-> - complete(m_currentTextEditable, TextEditor::QuickFixCompletion, true); + complete(m_currentEditor, TextEditor::QuickFixCompletion, true); } } } @@ -431,7 +431,7 @@ void CppPlugin::currentEditorChanged(Core::IEditor *editor) if (! editor) return; - else if (CPPEditor *textEditor = qobject_cast(editor->widget())) { + else if (CPPEditorWidget *textEditor = qobject_cast(editor->widget())) { textEditor->rehighlight(/*force = */ true); } } @@ -439,7 +439,7 @@ void CppPlugin::currentEditorChanged(Core::IEditor *editor) void CppPlugin::openTypeHierarchy() { Core::EditorManager *em = Core::EditorManager::instance(); - CPPEditor *editor = qobject_cast(em->currentEditor()->widget()); + CPPEditorWidget *editor = qobject_cast(em->currentEditor()->widget()); if (editor) { Core::NavigationWidget *navigation = Core::NavigationWidget::instance(); navigation->activateSubWidget(QLatin1String(Constants::TYPE_HIERARCHY_ID)); diff --git a/src/plugins/cppeditor/cppplugin.h b/src/plugins/cppeditor/cppplugin.h index ae9cfbd2b2..364afd29ae 100644 --- a/src/plugins/cppeditor/cppplugin.h +++ b/src/plugins/cppeditor/cppplugin.h @@ -43,13 +43,13 @@ namespace TextEditor { class TextEditorActionHandler; -class ITextEditable; +class ITextEditor; } // namespace TextEditor namespace CppEditor { namespace Internal { -class CPPEditor; +class CPPEditorWidget; class CppQuickFixCollector; class CppPlugin : public ExtensionSystem::IPlugin @@ -67,7 +67,7 @@ public: ShutdownFlag aboutToShutdown(); // Connect editor to settings changed signals. - void initializeEditor(CPPEditor *editor); + void initializeEditor(CPPEditorWidget *editor); bool sortedOutline() const; @@ -87,7 +87,7 @@ private slots: void onTaskStarted(const QString &type); void onAllTasksFinished(const QString &type); void findUsages(); - void quickFix(TextEditor::ITextEditable *editable); + void quickFix(TextEditor::ITextEditor *editable); void quickFixNow(); void currentEditorChanged(Core::IEditor *editor); void openTypeHierarchy(); @@ -109,7 +109,7 @@ private: CppQuickFixCollector *m_quickFixCollector; QTimer *m_quickFixTimer; - QPointer m_currentTextEditable; + QPointer m_currentEditor; }; class CppEditorFactory : public Core::IEditorFactory diff --git a/src/plugins/cppeditor/cppqtstyleindenter.cpp b/src/plugins/cppeditor/cppqtstyleindenter.cpp index e97879430a..bf736c26c5 100644 --- a/src/plugins/cppeditor/cppqtstyleindenter.cpp +++ b/src/plugins/cppeditor/cppqtstyleindenter.cpp @@ -85,7 +85,7 @@ static bool colonIsElectric(const QString &text) void CppQtStyleIndenter::indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - TextEditor::BaseTextEditor *editor) + TextEditor::BaseTextEditorWidget *editor) { Q_UNUSED(doc) @@ -117,7 +117,7 @@ void CppQtStyleIndenter::indentBlock(QTextDocument *doc, void CppQtStyleIndenter::indent(QTextDocument *doc, const QTextCursor &cursor, const QChar &typedChar, - TextEditor::BaseTextEditor *editor) + TextEditor::BaseTextEditorWidget *editor) { if (cursor.hasSelection()) { QTextBlock block = doc->findBlock(cursor.selectionStart()); diff --git a/src/plugins/cppeditor/cppqtstyleindenter.h b/src/plugins/cppeditor/cppqtstyleindenter.h index 46089dd831..ce3a453ff8 100644 --- a/src/plugins/cppeditor/cppqtstyleindenter.h +++ b/src/plugins/cppeditor/cppqtstyleindenter.h @@ -49,12 +49,12 @@ public: virtual void indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - TextEditor::BaseTextEditor *editor); + TextEditor::BaseTextEditorWidget *editor); virtual void indent(QTextDocument *doc, const QTextCursor &cursor, const QChar &typedChar, - TextEditor::BaseTextEditor *editor); + TextEditor::BaseTextEditorWidget *editor); }; } // Internal diff --git a/src/plugins/cppeditor/cppquickfix.cpp b/src/plugins/cppeditor/cppquickfix.cpp index 5b633d39fb..9392ed10b6 100644 --- a/src/plugins/cppeditor/cppquickfix.cpp +++ b/src/plugins/cppeditor/cppquickfix.cpp @@ -59,7 +59,7 @@ using namespace TextEditor; using namespace CPlusPlus; using namespace Utils; -CppQuickFixState::CppQuickFixState(TextEditor::BaseTextEditor *editor) +CppQuickFixState::CppQuickFixState(TextEditor::BaseTextEditorWidget *editor) : QuickFixState(editor) {} diff --git a/src/plugins/cppeditor/cppquickfix.h b/src/plugins/cppeditor/cppquickfix.h index e9c5aa28fd..00815668a8 100644 --- a/src/plugins/cppeditor/cppquickfix.h +++ b/src/plugins/cppeditor/cppquickfix.h @@ -62,7 +62,7 @@ class CPPEDITOR_EXPORT CppQuickFixState: public TextEditor::QuickFixState friend class Internal::CppQuickFixCollector; public: - CppQuickFixState(TextEditor::BaseTextEditor *editor); + CppQuickFixState(TextEditor::BaseTextEditorWidget *editor); const QList &path() const; CPlusPlus::Snapshot snapshot() const; diff --git a/src/plugins/cppeditor/cppquickfixcollector.cpp b/src/plugins/cppeditor/cppquickfixcollector.cpp index 7c28157c79..8b8b97c60e 100644 --- a/src/plugins/cppeditor/cppquickfixcollector.cpp +++ b/src/plugins/cppeditor/cppquickfixcollector.cpp @@ -54,14 +54,14 @@ CppQuickFixCollector::~CppQuickFixCollector() { } -bool CppQuickFixCollector::supportsEditor(TextEditor::ITextEditable *editor) const +bool CppQuickFixCollector::supportsEditor(TextEditor::ITextEditor *editor) const { return CPlusPlus::CppModelManagerInterface::instance()->isCppEditor(editor); } -TextEditor::QuickFixState *CppQuickFixCollector::initializeCompletion(TextEditor::BaseTextEditor *editor) +TextEditor::QuickFixState *CppQuickFixCollector::initializeCompletion(TextEditor::BaseTextEditorWidget *editor) { - if (CPPEditor *cppEditor = qobject_cast(editor)) { + if (CPPEditorWidget *cppEditor = qobject_cast(editor)) { const SemanticInfo info = cppEditor->semanticInfo(); if (info.revision != cppEditor->editorRevision()) { diff --git a/src/plugins/cppeditor/cppquickfixcollector.h b/src/plugins/cppeditor/cppquickfixcollector.h index 9f1160a1f8..ab4a149598 100644 --- a/src/plugins/cppeditor/cppquickfixcollector.h +++ b/src/plugins/cppeditor/cppquickfixcollector.h @@ -54,8 +54,8 @@ public: CppQuickFixCollector(); virtual ~CppQuickFixCollector(); - virtual bool supportsEditor(TextEditor::ITextEditable *editor) const; - virtual TextEditor::QuickFixState *initializeCompletion(TextEditor::BaseTextEditor *editor); + virtual bool supportsEditor(TextEditor::ITextEditor *editor) const; + virtual TextEditor::QuickFixState *initializeCompletion(TextEditor::BaseTextEditorWidget *editor); virtual QList quickFixFactories() const; diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 5549b723f1..f12297c196 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -634,7 +634,7 @@ private: ASTMatcher matcher; ASTPatternBuilder mk; - CPPEditor *editor; + CPPEditorWidget *editor; ConditionAST *condition; IfStatementAST *pattern; CoreDeclaratorAST *core; @@ -721,7 +721,7 @@ private: ASTMatcher matcher; ASTPatternBuilder mk; - CPPEditor *editor; + CPPEditorWidget *editor; ConditionAST *condition; WhileStatementAST *pattern; CoreDeclaratorAST *core; @@ -1628,7 +1628,7 @@ private: m_name[i] = m_name.at(i).toUpper(); } } - static_cast(state().editor())->renameUsagesNow(m_name); + static_cast(state().editor())->renameUsagesNow(m_name); } static bool isConvertibleUnderscore(const QString &name, int pos) diff --git a/src/plugins/cppeditor/cppsemanticinfo.h b/src/plugins/cppeditor/cppsemanticinfo.h index fdda30eb61..92a7098234 100644 --- a/src/plugins/cppeditor/cppsemanticinfo.h +++ b/src/plugins/cppeditor/cppsemanticinfo.h @@ -41,7 +41,7 @@ namespace CppEditor { namespace Internal { -class CPPEditor; +class CPPEditorWidget; class SemanticInfo { diff --git a/src/plugins/cppeditor/cppsnippetprovider.cpp b/src/plugins/cppeditor/cppsnippetprovider.cpp index efa8371f04..3b969e0b66 100644 --- a/src/plugins/cppeditor/cppsnippetprovider.cpp +++ b/src/plugins/cppeditor/cppsnippetprovider.cpp @@ -66,12 +66,12 @@ QString CppSnippetProvider::displayName() const return QCoreApplication::translate("CppEditor::Internal::CppSnippetProvider", "C++"); } -void CppSnippetProvider::decorateEditor(TextEditor::SnippetEditor *editor) const +void CppSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *editor) const { CppHighlighter *highlighter = new CppHighlighter; const TextEditor::FontSettings &fs = TextEditor::TextEditorSettings::instance()->fontSettings(); const QVector &formats = - fs.toTextCharFormats(CPPEditor::highlighterFormatCategories()); + fs.toTextCharFormats(CPPEditorWidget::highlighterFormatCategories()); highlighter->setFormats(formats.constBegin(), formats.constEnd()); editor->setSyntaxHighlighter(highlighter); editor->setIndenter(new CppQtStyleIndenter); diff --git a/src/plugins/cppeditor/cppsnippetprovider.h b/src/plugins/cppeditor/cppsnippetprovider.h index 03d947695b..e94f99910e 100644 --- a/src/plugins/cppeditor/cppsnippetprovider.h +++ b/src/plugins/cppeditor/cppsnippetprovider.h @@ -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 diff --git a/src/plugins/cppeditor/cpptypehierarchy.cpp b/src/plugins/cppeditor/cpptypehierarchy.cpp index 4a0c920e70..66117d2fda 100644 --- a/src/plugins/cppeditor/cpptypehierarchy.cpp +++ b/src/plugins/cppeditor/cpptypehierarchy.cpp @@ -65,8 +65,8 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget(Core::IEditor *editor) : layout->setMargin(0); layout->setSpacing(0); - if (CPPEditorEditable *cppEditable = qobject_cast(editor)) { - m_cppEditor = static_cast(cppEditable->widget()); + if (CPPEditor *cppEditor = qobject_cast(editor)) { + m_cppEditor = static_cast(cppEditor->widget()); m_model = new QStandardItemModel; m_treeView = new Utils::NavigationTreeView; @@ -98,9 +98,9 @@ CppTypeHierarchyWidget::~CppTypeHierarchyWidget() bool CppTypeHierarchyWidget::handleEditorChange(Core::IEditor *editor) { - if (CPPEditorEditable *cppEditable = qobject_cast(editor)) { + if (CPPEditor *cppEditor = qobject_cast(editor)) { if (m_cppEditor) { - m_cppEditor = static_cast(cppEditable->widget()); + m_cppEditor = static_cast(cppEditor->widget()); return true; } } else if (!m_cppEditor) { @@ -137,7 +137,7 @@ void CppTypeHierarchyWidget::buildModel(const CppClass &cppClass, QStandardItem m_model->setData(m_model->indexFromItem(item), cppClass.qualifiedName(), AnnotationRole); m_model->setData(m_model->indexFromItem(item), cppClass.icon(), Qt::DecorationRole); QVariant link; - link.setValue(CPPEditor::Link(cppClass.link())); + link.setValue(CPPEditorWidget::Link(cppClass.link())); m_model->setData(m_model->indexFromItem(item), link, LinkRole); foreach (const CppClass &cppBase, cppClass.bases()) @@ -148,7 +148,7 @@ void CppTypeHierarchyWidget::buildModel(const CppClass &cppClass, QStandardItem void CppTypeHierarchyWidget::onItemClicked(const QModelIndex &index) { - m_cppEditor->openLink(index.data(LinkRole).value()); + m_cppEditor->openLink(index.data(LinkRole).value()); } // CppTypeHierarchyStackedWidget diff --git a/src/plugins/cppeditor/cpptypehierarchy.h b/src/plugins/cppeditor/cpptypehierarchy.h index 2dd760eae0..885c6dac8d 100644 --- a/src/plugins/cppeditor/cpptypehierarchy.h +++ b/src/plugins/cppeditor/cpptypehierarchy.h @@ -60,7 +60,7 @@ class AnnotatedItemDelegate; namespace CppEditor { namespace Internal { -class CPPEditor; +class CPPEditorWidget; class CppTypeHierarchyWidget : public QWidget { @@ -85,7 +85,7 @@ private: void buildModel(const CppClass &cppClass, QStandardItem *item); - CPPEditor *m_cppEditor; + CPPEditorWidget *m_cppEditor; Utils::NavigationTreeView *m_treeView; QStandardItemModel *m_model; Utils::AnnotatedItemDelegate *m_delegate; diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 2ce354debe..a743569b55 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -62,8 +62,6 @@ #include #include #include -#include -#include #include #include #include @@ -482,7 +480,7 @@ QIcon CppCodeCompletion::iconForSymbol(Symbol *symbol) const /* Searches backwards for an access operator. */ -static int startOfOperator(TextEditor::ITextEditable *editor, +static int startOfOperator(TextEditor::ITextEditor *editor, int pos, unsigned *kind, bool wantFunctionCall) { @@ -559,7 +557,7 @@ static int startOfOperator(TextEditor::ITextEditable *editor, if (start == pos) return start; - TextEditor::BaseTextEditor *edit = qobject_cast(editor->widget()); + TextEditor::BaseTextEditorWidget *edit = qobject_cast(editor->widget()); QTextCursor tc(edit->textCursor()); tc.setPosition(pos); @@ -658,12 +656,12 @@ bool CppCodeCompletion::supportsPolicy(TextEditor::CompletionPolicy policy) cons return policy == TextEditor::SemanticCompletion; } -bool CppCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor) const +bool CppCodeCompletion::supportsEditor(TextEditor::ITextEditor *editor) const { return m_manager->isCppEditor(editor); } -TextEditor::ITextEditable *CppCodeCompletion::editor() const +TextEditor::ITextEditor *CppCodeCompletion::editor() const { return m_editor; } int CppCodeCompletion::startPosition() const @@ -672,7 +670,7 @@ int CppCodeCompletion::startPosition() const bool CppCodeCompletion::shouldRestartCompletion() { return m_shouldRestartCompletion; } -bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) +bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditor *editor) { m_editor = editor; m_automaticCompletion = false; @@ -698,7 +696,7 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) const QChar firstCharacter = editor->characterAt(startOfName); if (firstCharacter.isLetter() || firstCharacter == QLatin1Char('_')) { // Finally check that we're not inside a comment or string (code copied from startOfOperator) - TextEditor::BaseTextEditor *edit = qobject_cast(editor->widget()); + TextEditor::BaseTextEditorWidget *edit = qobject_cast(editor->widget()); QTextCursor tc(edit->textCursor()); tc.setPosition(pos); @@ -722,7 +720,7 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) return false; } -int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) +int CppCodeCompletion::startCompletion(TextEditor::ITextEditor *editor) { int index = startCompletionHelper(editor); if (index != -1) { @@ -815,7 +813,7 @@ void CppCodeCompletion::completeObjCMsgSend(ClassOrNamespace *binding, } } -bool CppCodeCompletion::tryObjCCompletion(TextEditor::BaseTextEditor *edit) +bool CppCodeCompletion::tryObjCCompletion(TextEditor::BaseTextEditorWidget *edit) { Q_ASSERT(edit); @@ -877,9 +875,9 @@ bool CppCodeCompletion::tryObjCCompletion(TextEditor::BaseTextEditor *edit) return true; } -int CppCodeCompletion::startCompletionHelper(TextEditor::ITextEditable *editor) +int CppCodeCompletion::startCompletionHelper(TextEditor::ITextEditor *editor) { - TextEditor::BaseTextEditor *edit = qobject_cast(editor->widget()); + TextEditor::BaseTextEditorWidget *edit = qobject_cast(editor->widget()); if (! edit) return -1; @@ -988,7 +986,7 @@ int CppCodeCompletion::startCompletionHelper(TextEditor::ITextEditable *editor) return startCompletionInternal(edit, fileName, line, column, expression, endOfExpression); } -int CppCodeCompletion::startCompletionInternal(TextEditor::BaseTextEditor *edit, +int CppCodeCompletion::startCompletionInternal(TextEditor::BaseTextEditorWidget *edit, const QString fileName, unsigned line, unsigned column, const QString &expr, @@ -1304,7 +1302,7 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList &r // so get the current location's enclosing scope. // get current line and column - TextEditor::BaseTextEditor *edit = qobject_cast(m_editor->widget()); + TextEditor::BaseTextEditorWidget *edit = qobject_cast(m_editor->widget()); int lineSigned = 0, columnSigned = 0; edit->convertPosition(m_editor->position(), &lineSigned, &columnSigned); unsigned line = lineSigned, column = columnSigned; @@ -1411,7 +1409,7 @@ bool CppCodeCompletion::completeMember(const QList &baseResults) if (replacedDotOperator && binding) { // Replace . with -> int length = m_editor->position() - m_startPosition + 1; - m_editor->setCurPos(m_startPosition - 1); + m_editor->setCursorPosition(m_startPosition - 1); m_editor->replace(length, QLatin1String("->")); ++m_startPosition; } @@ -1919,7 +1917,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item, QChar t if (item.data.isValid()) { if (item.data.canConvert()) { - TextEditor::BaseTextEditor *edit = qobject_cast(m_editor->widget()); + TextEditor::BaseTextEditorWidget *edit = qobject_cast(m_editor->widget()); QTextCursor tc = edit->textCursor(); tc.setPosition(m_startPosition, QTextCursor::KeepAnchor); edit->insertCodeSnippet(tc, item.data.toString()); @@ -2062,10 +2060,10 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item, QChar t // Insert the remainder of the name int length = m_editor->position() - m_startPosition + extraLength; - m_editor->setCurPos(m_startPosition); + m_editor->setCursorPosition(m_startPosition); m_editor->replace(length, toInsert); if (cursorOffset) - m_editor->setCurPos(m_editor->position() + cursorOffset); + m_editor->setCursorPosition(m_editor->position() + cursorOffset); } bool CppCodeCompletion::partiallyComplete(const QList &completionItems) diff --git a/src/plugins/cpptools/cppcodecompletion.h b/src/plugins/cpptools/cppcodecompletion.h index 4817e24e97..0bb4ae765b 100644 --- a/src/plugins/cpptools/cppcodecompletion.h +++ b/src/plugins/cpptools/cppcodecompletion.h @@ -52,7 +52,7 @@ QT_END_NAMESPACE namespace TextEditor { class ITextEditor; -class BaseTextEditor; +class BaseTextEditorWidget; } namespace CPlusPlus { @@ -75,14 +75,14 @@ public: void setObjcEnabled(bool objcEnabled) { m_objcEnabled = objcEnabled; } - TextEditor::ITextEditable *editor() const; + TextEditor::ITextEditor *editor() const; int startPosition() const; bool shouldRestartCompletion(); QList getCompletions(); - bool supportsEditor(TextEditor::ITextEditable *editor) const; + bool supportsEditor(TextEditor::ITextEditor *editor) const; bool supportsPolicy(TextEditor::CompletionPolicy policy) const; - bool triggersCompletion(TextEditor::ITextEditable *editor); - int startCompletion(TextEditor::ITextEditable *editor); + bool triggersCompletion(TextEditor::ITextEditor *editor); + int startCompletion(TextEditor::ITextEditor *editor); void completions(QList *completions); bool typedCharCompletes(const TextEditor::CompletionItem &item, QChar typedChar); @@ -131,9 +131,9 @@ private: int findStartOfName(int pos = -1) const; - int startCompletionHelper(TextEditor::ITextEditable *editor); + int startCompletionHelper(TextEditor::ITextEditor *editor); - int startCompletionInternal(TextEditor::BaseTextEditor *edit, + int startCompletionInternal(TextEditor::BaseTextEditorWidget *edit, const QString fileName, unsigned line, unsigned column, const QString &expression, @@ -144,13 +144,13 @@ private: private: void completeObjCMsgSend(CPlusPlus::ClassOrNamespace *binding, bool staticClassAccess); - bool tryObjCCompletion(TextEditor::BaseTextEditor *edit); + bool tryObjCCompletion(TextEditor::BaseTextEditorWidget *edit); bool objcKeywordsWanted() const; static QStringList preprocessorCompletions; CppModelManager *m_manager; - TextEditor::ITextEditable *m_editor; + TextEditor::ITextEditor *m_editor; int m_startPosition; // Position of the cursor from which completion started bool m_shouldRestartCompletion; diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index f1051c8cd3..2cfe966e19 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -113,7 +113,7 @@ QList CppCurrentDocumentFilter::matchesFor(QFutureInterfac void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const { ModelItemInfo info = qvariant_cast(selection.internalData); - TextEditor::BaseTextEditor::openEditorAt(info.fileName, info.line, info.column, + TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, info.line, info.column, QString(), Core::EditorManager::ModeSwitch); } diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 479f55c354..907e165320 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -309,7 +309,7 @@ void CppFindReferences::searchFinished() void CppFindReferences::openEditor(const Find::SearchResultItem &item) { if (item.path.size() > 0) { - TextEditor::BaseTextEditor::openEditorAt(item.path.first(), item.lineNumber, item.textMarkPos, + TextEditor::BaseTextEditorWidget::openEditorAt(item.path.first(), item.lineNumber, item.textMarkPos, QString(), Core::EditorManager::ModeSwitch); } else { diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index 51e2b73a98..1ed334a63f 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -131,7 +131,7 @@ QList CppLocatorFilter::matchesFor(QFutureInterface(selection.internalData); - TextEditor::BaseTextEditor::openEditorAt(info.fileName, info.line, info.column, + TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, info.line, info.column, QString(), Core::EditorManager::ModeSwitch); } diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index fc6c55896f..0caa309cab 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -1006,14 +1006,14 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc) if (! textEditor) continue; - TextEditor::BaseTextEditor *ed = qobject_cast(textEditor->widget()); + TextEditor::BaseTextEditorWidget *ed = qobject_cast(textEditor->widget()); if (! ed) continue; - QList blockRanges; + QList blockRanges; foreach (const Document::Block &block, doc->skippedBlocks()) { - blockRanges.append(TextEditor::BaseTextEditor::BlockRange(block.begin(), block.end())); + blockRanges.append(TextEditor::BaseTextEditorWidget::BlockRange(block.begin(), block.end())); } QList selections; @@ -1149,14 +1149,14 @@ void CppModelManager::updateEditorSelections() continue; TextEditor::ITextEditor *textEditor = ed.textEditor; - TextEditor::BaseTextEditor *editor = qobject_cast(textEditor->widget()); + TextEditor::BaseTextEditorWidget *editor = qobject_cast(textEditor->widget()); if (! editor) continue; else if (editor->document()->revision() != ed.revision) continue; // outdated - editor->setExtraSelections(TextEditor::BaseTextEditor::CodeWarningsSelection, + editor->setExtraSelections(TextEditor::BaseTextEditorWidget::CodeWarningsSelection, ed.selections); editor->setIfdefedOutBlocks(ed.ifdefedOutBlocks); diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 93863f1aa1..43d0a85568 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -64,7 +64,7 @@ class IEditor; namespace TextEditor { class ITextEditor; -class BaseTextEditor; +class BaseTextEditorWidget; } namespace ProjectExplorer { @@ -231,7 +231,7 @@ private: int revision; QPointer textEditor; QList selections; - QList ifdefedOutBlocks; + QList ifdefedOutBlocks; }; QList m_todo; diff --git a/src/plugins/cpptools/cpprefactoringchanges.cpp b/src/plugins/cpptools/cpprefactoringchanges.cpp index e7e8b2c229..b745b23367 100644 --- a/src/plugins/cpptools/cpprefactoringchanges.cpp +++ b/src/plugins/cpptools/cpprefactoringchanges.cpp @@ -67,7 +67,7 @@ CppRefactoringFile CppRefactoringChanges::file(const QString &fileName) void CppRefactoringChanges::indentSelection(const QTextCursor &selection, const QString &fileName, - const TextEditor::BaseTextEditor *textEditor) const + const TextEditor::BaseTextEditorWidget *textEditor) const { // ### shares code with CPPEditor::indent() QTextDocument *doc = selection.document(); @@ -106,7 +106,7 @@ CppRefactoringFile::CppRefactoringFile(const QString &fileName, CppRefactoringCh m_cppDocument = snapshot.document(fileName); } -CppRefactoringFile::CppRefactoringFile(TextEditor::BaseTextEditor *editor, CPlusPlus::Document::Ptr document) +CppRefactoringFile::CppRefactoringFile(TextEditor::BaseTextEditorWidget *editor, CPlusPlus::Document::Ptr document) : RefactoringFile() , m_cppDocument(document) { diff --git a/src/plugins/cpptools/cpprefactoringchanges.h b/src/plugins/cpptools/cpprefactoringchanges.h index d59cd9ef5c..85a8f084eb 100644 --- a/src/plugins/cpptools/cpprefactoringchanges.h +++ b/src/plugins/cpptools/cpprefactoringchanges.h @@ -52,7 +52,7 @@ class CPPTOOLS_EXPORT CppRefactoringFile: public TextEditor::RefactoringFile public: CppRefactoringFile(); CppRefactoringFile(const QString &fileName, CppRefactoringChanges *refactoringChanges); - CppRefactoringFile(TextEditor::BaseTextEditor *editor, CPlusPlus::Document::Ptr document); + CppRefactoringFile(TextEditor::BaseTextEditorWidget *editor, CPlusPlus::Document::Ptr document); CPlusPlus::Document::Ptr cppDocument() const; @@ -94,7 +94,7 @@ public: private: virtual void indentSelection(const QTextCursor &selection, const QString &fileName, - const TextEditor::BaseTextEditor *textEditor) const; + const TextEditor::BaseTextEditorWidget *textEditor) const; virtual void fileChanged(const QString &fileName); private: diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index c5d88c9f1e..c90bd5d62c 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.cpp +++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp @@ -92,7 +92,7 @@ QString CppEditorSupport::contents() unsigned CppEditorSupport::editorRevision() const { if (_textEditor) { - if (TextEditor::BaseTextEditor *ed = qobject_cast(_textEditor->widget())) + if (TextEditor::BaseTextEditorWidget *ed = qobject_cast(_textEditor->widget())) return ed->document()->revision(); } @@ -109,7 +109,7 @@ void CppEditorSupport::updateDocument() { _revision = editorRevision(); - if (qobject_cast(_textEditor->widget()) != 0) { + if (qobject_cast(_textEditor->widget()) != 0) { _modelManager->stopEditorSelectionsUpdate(); } diff --git a/src/plugins/cpptools/symbolsfindfilter.cpp b/src/plugins/cpptools/symbolsfindfilter.cpp index 3925964a36..2112e8a2bd 100644 --- a/src/plugins/cpptools/symbolsfindfilter.cpp +++ b/src/plugins/cpptools/symbolsfindfilter.cpp @@ -200,7 +200,7 @@ void SymbolsFindFilter::openEditor(const Find::SearchResultItem &item) if (!item.userData.canConvert()) return; ModelItemInfo info = item.userData.value(); - TextEditor::BaseTextEditor::openEditorAt(info.fileName, + TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, info.line, info.column); } diff --git a/src/plugins/cvs/cvseditor.cpp b/src/plugins/cvs/cvseditor.cpp index 16f05befa6..74bca3afc2 100644 --- a/src/plugins/cvs/cvseditor.cpp +++ b/src/plugins/cvs/cvseditor.cpp @@ -53,7 +53,7 @@ namespace Internal { CVSEditor::CVSEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent) : - VCSBase::VCSBaseEditor(type, parent), + VCSBase::VCSBaseEditorWidget(type, parent), m_revisionAnnotationPattern(QLatin1String(CVS_REVISION_AT_START_PATTERN".*$")), m_revisionLogPattern(QLatin1String("^revision *("CVS_REVISION_PATTERN")$")) { diff --git a/src/plugins/cvs/cvseditor.h b/src/plugins/cvs/cvseditor.h index 96f7b25228..e67125ce3b 100644 --- a/src/plugins/cvs/cvseditor.h +++ b/src/plugins/cvs/cvseditor.h @@ -41,7 +41,7 @@ namespace CVS { namespace Internal { -class CVSEditor : public VCSBase::VCSBaseEditor +class CVSEditor : public VCSBase::VCSBaseEditorWidget { Q_OBJECT diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index db104849ec..32731d8aab 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -145,7 +145,7 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = { static inline const VCSBase::VCSBaseEditorParameters *findType(int ie) { const VCSBase::EditorContentType et = static_cast(ie); - return VCSBase::VCSBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); + return VCSBase::VCSBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); } static inline QString debugCodec(const QTextCodec *c) @@ -525,7 +525,7 @@ void CVSPlugin::diffCommitFiles(const QStringList &files) static inline void setDiffBaseDirectory(Core::IEditor *editor, const QString &db) { - if (VCSBase::VCSBaseEditor *ve = qobject_cast(editor->widget())) + if (VCSBase::VCSBaseEditorWidget *ve = qobject_cast(editor->widget())) ve->setDiffBaseDirectory(db); } @@ -533,9 +533,9 @@ void CVSPlugin::cvsDiff(const QString &workingDir, const QStringList &files) { if (CVS::Constants::debug) qDebug() << Q_FUNC_INFO << files; - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files); - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, files); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(workingDir, files); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir, files); QStringList args(QLatin1String("diff")); args << m_settings.cvsDiffOptions; @@ -808,10 +808,10 @@ void CVSPlugin::filelog(const QString &workingDir, const QStringList &files, bool enableAnnotationContextMenu) { - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(workingDir, files); // no need for temp file - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files); - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir, files); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, files); QStringList args; args << QLatin1String("log"); args.append(files); @@ -831,7 +831,7 @@ void CVSPlugin::filelog(const QString &workingDir, Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::LogOutput, source, codec); newEditor->setProperty("logFileName", id); if (enableAnnotationContextMenu) - VCSBase::VCSBaseEditor::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true); + VCSBase::VCSBaseEditorWidget::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true); } } @@ -945,9 +945,9 @@ void CVSPlugin::annotate(const QString &workingDir, const QString &file, int lineNumber /* = -1 */) { const QStringList files(file); - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files); - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files, revision); - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, file); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(workingDir, files); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir, files, revision); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, file); QStringList args; args << QLatin1String("annotate"); if (!revision.isEmpty()) @@ -962,17 +962,17 @@ void CVSPlugin::annotate(const QString &workingDir, const QString &file, // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file if (lineNumber < 1) - lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(file); + lineNumber = VCSBase::VCSBaseEditorWidget::lineNumberOfCurrentEditor(file); if (Core::IEditor *editor = locateEditor("annotateFileName", id)) { editor->createNew(response.stdOut); - VCSBase::VCSBaseEditor::gotoLineOfEditor(editor, lineNumber); + VCSBase::VCSBaseEditorWidget::gotoLineOfEditor(editor, lineNumber); Core::EditorManager::instance()->activateEditor(editor, Core::EditorManager::ModeSwitch); } else { const QString title = QString::fromLatin1("cvs annotate %1").arg(id); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, source, codec); newEditor->setProperty("annotateFileName", id); - VCSBase::VCSBaseEditor::gotoLineOfEditor(newEditor, lineNumber); + VCSBase::VCSBaseEditorWidget::gotoLineOfEditor(newEditor, lineNumber); } } @@ -1118,7 +1118,7 @@ bool CVSPlugin::describe(const QString &repositoryPath, for (QList::iterator it = entries.begin(); it != lend; ++it) { // Before fiddling file names, try to find codec if (!codec) - codec = VCSBase::VCSBaseEditor::getCodec(repositoryPath, QStringList(it->file)); + codec = VCSBase::VCSBaseEditorWidget::getCodec(repositoryPath, QStringList(it->file)); // Run log QStringList args(QLatin1String("log")); args << (QLatin1String("-r") + it->revisions.front().revision) << it->file; @@ -1246,7 +1246,7 @@ Core::IEditor * CVSPlugin::showOutputInEditor(const QString& title, const QStrin e->setSource(source); if (codec) e->setCodec(codec); - Core::IEditor *ie = e->editableInterface(); + Core::IEditor *ie = e->editor(); Core::EditorManager::instance()->activateEditor(ie, Core::EditorManager::ModeSwitch); return ie; } diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index 1941e0de5d..c5c869367a 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -151,7 +151,7 @@ public: static DebuggerToolTipEditor currentToolTipEditor(); TextEditor::ITextEditor *textEditor; - TextEditor::BaseTextEditor *baseTextEditor; + TextEditor::BaseTextEditorWidget *baseTextEditor; Core::IFile *file; }; @@ -160,7 +160,7 @@ DebuggerToolTipEditor::DebuggerToolTipEditor(Core::IEditor *ie) : { if (ie && ie->file() && isEditorDebuggable(ie)) { if (TextEditor::ITextEditor *te = qobject_cast(ie)) { - if (TextEditor::BaseTextEditor *pe = qobject_cast(ie->widget())) { + if (TextEditor::BaseTextEditorWidget *pe = qobject_cast(ie->widget())) { textEditor = te; baseTextEditor = pe; file = ie->file(); diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp index ff98b6aa42..a308ccba53 100644 --- a/src/plugins/debugger/disassembleragent.cpp +++ b/src/plugins/debugger/disassembleragent.cpp @@ -212,8 +212,8 @@ void DisassemblerAgentPrivate::configureMimeType() QTC_ASSERT(doc, return); doc->setMimeType(mimeType); - TextEditor::PlainTextEditor *pe = - qobject_cast(editor->widget()); + TextEditor::PlainTextEditorWidget *pe = + qobject_cast(editor->widget()); QTC_ASSERT(pe, return); MimeType mtype = ICore::instance()->mimeDatabase()->findByType(mimeType); @@ -255,8 +255,8 @@ void DisassemblerAgent::setContents(const DisassemblerLines &contents) d->editor->setProperty(Debugger::Constants::OPENED_WITH_DISASSEMBLY, true); d->configureMimeType(); - BaseTextEditor *baseTextEdit = - qobject_cast(d->editor->widget()); + BaseTextEditorWidget *baseTextEdit = + qobject_cast(d->editor->widget()); if (baseTextEdit) baseTextEdit->setRequestMarkEnabled(true); } diff --git a/src/plugins/debugger/sourceagent.cpp b/src/plugins/debugger/sourceagent.cpp index 632c6ed4bb..338fe55261 100644 --- a/src/plugins/debugger/sourceagent.cpp +++ b/src/plugins/debugger/sourceagent.cpp @@ -153,8 +153,8 @@ void SourceAgent::setContent(const QString &filePath, const QString &content) QTC_ASSERT(d->editor, return); d->editor->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, true); - BaseTextEditor *baseTextEdit = - qobject_cast(d->editor->widget()); + BaseTextEditorWidget *baseTextEdit = + qobject_cast(d->editor->widget()); if (baseTextEdit) baseTextEdit->setRequestMarkEnabled(true); } diff --git a/src/plugins/designer/designerxmleditor.cpp b/src/plugins/designer/designerxmleditor.cpp index 9208348692..3e048b43da 100644 --- a/src/plugins/designer/designerxmleditor.cpp +++ b/src/plugins/designer/designerxmleditor.cpp @@ -43,13 +43,13 @@ namespace Internal { DesignerXmlEditor::DesignerXmlEditor(QDesignerFormWindowInterface *form, QWidget *parent) : - TextEditor::PlainTextEditor(parent), + TextEditor::PlainTextEditorWidget(parent), m_designerEditor(new FormWindowEditor(this, form)) { setReadOnly(true); } -TextEditor::BaseTextEditorEditable *DesignerXmlEditor::createEditableInterface() +TextEditor::BaseTextEditor *DesignerXmlEditor::createEditor() { if (Designer::Constants::Internal::debug) qDebug() << "DesignerXmlEditor::createEditableInterface()"; diff --git a/src/plugins/designer/designerxmleditor.h b/src/plugins/designer/designerxmleditor.h index 92faf876a4..748ffea6ed 100644 --- a/src/plugins/designer/designerxmleditor.h +++ b/src/plugins/designer/designerxmleditor.h @@ -53,7 +53,7 @@ namespace Internal { * Internally manages a FormWindowEditor and uses the plain text * editable embedded in it. */ -class DesignerXmlEditor : public TextEditor::PlainTextEditor +class DesignerXmlEditor : public TextEditor::PlainTextEditorWidget { Q_OBJECT public: @@ -63,7 +63,7 @@ public: FormWindowEditor *designerEditor() const; protected: - virtual TextEditor::BaseTextEditorEditable *createEditableInterface(); + virtual TextEditor::BaseTextEditor *createEditor(); private: FormWindowEditor *m_designerEditor; diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index f90006c1fa..f67b26f170 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -723,7 +723,7 @@ EditorData FormEditorW::createEditor(QWidget *parent) resourceHandler, SLOT(updateResources())); m_editorWidget->add(data); - m_toolBar->addEditor(xmlEditor->editableInterface()); + m_toolBar->addEditor(xmlEditor->editor()); return data; } diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp index 2d0ffca66a..af56d2083f 100644 --- a/src/plugins/designer/formwindoweditor.cpp +++ b/src/plugins/designer/formwindoweditor.cpp @@ -62,7 +62,7 @@ struct FormWindowEditorPrivate explicit FormWindowEditorPrivate(Internal::DesignerXmlEditor *editor, QDesignerFormWindowInterface *form); - TextEditor::PlainTextEditorEditable m_textEditable; + TextEditor::PlainTextEditor m_textEditable; Internal::FormWindowFile m_file; Core::Context m_context; }; @@ -185,8 +185,8 @@ void FormWindowEditor::syncXmlEditor() void FormWindowEditor::configureXmlEditor() const { - TextEditor::PlainTextEditor *editor = - qobject_cast(d->m_textEditable.editor()); + TextEditor::PlainTextEditorWidget *editor = + qobject_cast(d->m_textEditable.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.editor()->setPlainText(contents); - d->m_textEditable.editor()->setReadOnly(true); + d->m_textEditable.editorWidget()->setPlainText(contents); + d->m_textEditable.editorWidget()->setReadOnly(true); } Core::IFile *FormWindowEditor::file() @@ -271,7 +271,7 @@ TextEditor::BaseTextDocument *FormWindowEditor::textDocument() return qobject_cast(d->m_textEditable.file()); } -TextEditor::PlainTextEditorEditable *FormWindowEditor::textEditable() +TextEditor::PlainTextEditor *FormWindowEditor::textEditable() { return &d->m_textEditable; } diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h index 7dcc5e21da..585927a7e4 100644 --- a/src/plugins/designer/formwindoweditor.h +++ b/src/plugins/designer/formwindoweditor.h @@ -47,7 +47,7 @@ namespace Core { namespace TextEditor { class BaseTextDocument; - class PlainTextEditorEditable; + class PlainTextEditor; } namespace Designer { @@ -102,7 +102,7 @@ public: QString contents() const; TextEditor::BaseTextDocument *textDocument(); - TextEditor::PlainTextEditorEditable *textEditable(); + TextEditor::PlainTextEditor *textEditable(); public slots: void syncXmlEditor(); diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index 7c8d647c59..c932309393 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include @@ -267,9 +266,9 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line) return Document::Ptr(); } -static inline ITextEditable *editableAt(const QString &fileName, int line, int column) +static inline ITextEditor *editableAt(const QString &fileName, int line, int column) { - return qobject_cast(TextEditor::BaseTextEditor::openEditorAt(fileName, line, column)); + return qobject_cast(TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, column)); } static void addDeclaration(const Snapshot &snapshot, @@ -290,8 +289,8 @@ static void addDeclaration(const Snapshot &snapshot, //! \todo change this to use the Refactoring changes. // - if (ITextEditable *editable = editableAt(fileName, loc.line(), loc.column() - 1)) { - BaseTextEditor *editor = qobject_cast(editable->widget()); + if (ITextEditor *editable = editableAt(fileName, loc.line(), loc.column() - 1)) { + BaseTextEditorWidget *editor = qobject_cast(editable->widget()); if (editor) { QTextCursor tc = editor->textCursor(); int pos = tc.position(); @@ -333,7 +332,7 @@ static Document::Ptr addDefinition(const CPlusPlus::Snapshot &docTable, //! \todo change this to use the Refactoring changes. // - if (ITextEditable *editable = editableAt(doc->fileName(), 0, 0)) { + if (ITextEditor *editable = editableAt(doc->fileName(), 0, 0)) { // //! \todo use the InsertionPointLocator to insert at the correct place. @@ -616,7 +615,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, } // jump to function definition, position within code - TextEditor::BaseTextEditor::openEditorAt(sourceDoc->fileName(), line + 2, indentation); + TextEditor::BaseTextEditorWidget::openEditorAt(sourceDoc->fileName(), line + 2, indentation); return true; } diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index c819b723db..d43c9f90b7 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -498,7 +498,7 @@ public: return false; } - virtual ITextEditable *editor() const + virtual ITextEditor *editor() const { //qDebug() << "NO EDITOR?"; return m_editable; @@ -509,7 +509,7 @@ public: return m_startPosition; } - virtual bool supportsEditor(ITextEditable *) const + virtual bool supportsEditor(ITextEditor *) const { return true; } @@ -519,14 +519,14 @@ public: return policy == TextCompletion; } - virtual bool triggersCompletion(ITextEditable *editable) + virtual bool triggersCompletion(ITextEditor *editable) { //qDebug() << "TRIGGERS?"; QTC_ASSERT(m_editable == editable, /**/); return true; } - virtual int startCompletion(ITextEditable *editable) + virtual int startCompletion(ITextEditor *editable) { //qDebug() << "START COMPLETION"; QTC_ASSERT(m_editor, return -1); @@ -540,12 +540,12 @@ public: m_handler = handler; if (!m_handler) return; - m_editor = qobject_cast(handler->widget()); + m_editor = qobject_cast(handler->widget()); if (!m_editor) return; //qDebug() << "ACTIVATE: " << needle << forward; m_needle = needle; - m_editable = m_editor->editableInterface(); + m_editable = m_editor->editor(); m_startPosition = m_editor->textCursor().position() - needle.size(); CompletionSupport::instance()->complete(m_editable, TextCompletion, false); @@ -622,8 +622,8 @@ private: bool isInComment() const; FakeVimHandler *m_handler; - BaseTextEditor *m_editor; - ITextEditable *m_editable; + BaseTextEditorWidget *m_editor; + ITextEditor *m_editable; QString m_needle; QString m_currentPrefix; QList m_items; @@ -1170,8 +1170,8 @@ void FakeVimPluginPrivate::setUseFakeVim(const QVariant &value) // Core::Context(FAKEVIM_CONTEXT)); showCommandBuffer(QString()); foreach (Core::IEditor *editor, m_editorToHandler.keys()) { - if (TextEditor::BaseTextEditor *textEditor = - qobject_cast(editor->widget())) { + if (TextEditor::BaseTextEditorWidget *textEditor = + qobject_cast(editor->widget())) { m_editorToHandler[editor]->restoreWidget(textEditor->tabSettings().m_tabSize); } } @@ -1183,9 +1183,9 @@ void FakeVimPluginPrivate::triggerCompletions() FakeVimHandler *handler = qobject_cast(sender()); if (!handler) return; - if (BaseTextEditor *editor = qobject_cast(handler->widget())) + if (BaseTextEditorWidget *editor = qobject_cast(handler->widget())) CompletionSupport::instance()-> - complete(editor->editableInterface(), TextCompletion, false); + complete(editor->editor(), TextCompletion, false); // editor->triggerCompletions(); } @@ -1201,7 +1201,7 @@ void FakeVimPluginPrivate::setBlockSelection(bool on) FakeVimHandler *handler = qobject_cast(sender()); if (!handler) return; - if (BaseTextEditor *bt = qobject_cast(handler->widget())) + if (BaseTextEditorWidget *bt = qobject_cast(handler->widget())) bt->setBlockSelection(on); } @@ -1210,7 +1210,7 @@ void FakeVimPluginPrivate::hasBlockSelection(bool *on) FakeVimHandler *handler = qobject_cast(sender()); if (!handler) return; - if (BaseTextEditor *bt = qobject_cast(handler->widget())) + if (BaseTextEditorWidget *bt = qobject_cast(handler->widget())) *on = bt->hasBlockSelection(); } @@ -1219,7 +1219,7 @@ void FakeVimPluginPrivate::checkForElectricCharacter(bool *result, QChar c) FakeVimHandler *handler = qobject_cast(sender()); if (!handler) return; - if (BaseTextEditor *bt = qobject_cast(handler->widget())) + if (BaseTextEditorWidget *bt = qobject_cast(handler->widget())) *result = bt->indenter()->isElectricCharacter(c); } @@ -1390,7 +1390,7 @@ void FakeVimPluginPrivate::indentRegion(int beginLine, int endLine, if (!handler) return; - BaseTextEditor *bt = qobject_cast(handler->widget()); + BaseTextEditorWidget *bt = qobject_cast(handler->widget()); if (!bt) return; @@ -1447,8 +1447,8 @@ void FakeVimPluginPrivate::changeSelection (const QList &selection) { if (FakeVimHandler *handler = qobject_cast(sender())) - if (BaseTextEditor *bt = qobject_cast(handler->widget())) - bt->setExtraSelections(BaseTextEditor::FakeVimSelection, selection); + if (BaseTextEditorWidget *bt = qobject_cast(handler->widget())) + bt->setExtraSelections(BaseTextEditorWidget::FakeVimSelection, selection); } int FakeVimPluginPrivate::currentFile() const diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp index 3bc04f9ae1..9561547d04 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp @@ -70,9 +70,9 @@ Manager *ProjectFilesFactory::manager() const Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent) { - ProjectFilesEditor *ed = new ProjectFilesEditor(parent, this, m_actionHandler); + ProjectFilesEditorWidget *ed = new ProjectFilesEditorWidget(parent, this, m_actionHandler); TextEditor::TextEditorSettings::instance()->initializeEditor(ed); - return ed->editableInterface(); + return ed->editor(); } QStringList ProjectFilesFactory::mimeTypes() const @@ -104,46 +104,46 @@ Core::IFile *ProjectFilesFactory::open(const QString &fileName) // ProjectFilesEditable //////////////////////////////////////////////////////////////////////////////////////// -ProjectFilesEditable::ProjectFilesEditable(ProjectFilesEditor *editor) - : TextEditor::BaseTextEditorEditable(editor), +ProjectFilesEditor::ProjectFilesEditor(ProjectFilesEditorWidget *editor) + : TextEditor::BaseTextEditor(editor), m_context(Constants::C_FILESEDITOR) { } -ProjectFilesEditable::~ProjectFilesEditable() +ProjectFilesEditor::~ProjectFilesEditor() { } -Core::Context ProjectFilesEditable::context() const +Core::Context ProjectFilesEditor::context() const { return m_context; } -QString ProjectFilesEditable::id() const +QString ProjectFilesEditor::id() const { return QLatin1String(Constants::FILES_EDITOR_ID); } -bool ProjectFilesEditable::duplicateSupported() const +bool ProjectFilesEditor::duplicateSupported() const { return true; } -Core::IEditor *ProjectFilesEditable::duplicate(QWidget *parent) +Core::IEditor *ProjectFilesEditor::duplicate(QWidget *parent) { - ProjectFilesEditor *parentEditor = qobject_cast(editor()); - ProjectFilesEditor *editor = new ProjectFilesEditor(parent, + ProjectFilesEditorWidget *parentEditor = qobject_cast(editorWidget()); + ProjectFilesEditorWidget *editor = new ProjectFilesEditorWidget(parent, parentEditor->factory(), parentEditor->actionHandler()); TextEditor::TextEditorSettings::instance()->initializeEditor(editor); - return editor->editableInterface(); + return editor->editor(); } //////////////////////////////////////////////////////////////////////////////////////// // ProjectFilesEditor //////////////////////////////////////////////////////////////////////////////////////// -ProjectFilesEditor::ProjectFilesEditor(QWidget *parent, ProjectFilesFactory *factory, +ProjectFilesEditorWidget::ProjectFilesEditorWidget(QWidget *parent, ProjectFilesFactory *factory, TextEditor::TextEditorActionHandler *handler) - : TextEditor::BaseTextEditor(parent), + : TextEditor::BaseTextEditorWidget(parent), m_factory(factory), m_actionHandler(handler) { @@ -154,22 +154,22 @@ ProjectFilesEditor::ProjectFilesEditor(QWidget *parent, ProjectFilesFactory *fac handler->setupActions(this); } -ProjectFilesEditor::~ProjectFilesEditor() +ProjectFilesEditorWidget::~ProjectFilesEditorWidget() { } -ProjectFilesFactory *ProjectFilesEditor::factory() const +ProjectFilesFactory *ProjectFilesEditorWidget::factory() const { return m_factory; } -TextEditor::TextEditorActionHandler *ProjectFilesEditor::actionHandler() const +TextEditor::TextEditorActionHandler *ProjectFilesEditorWidget::actionHandler() const { return m_actionHandler; } -TextEditor::BaseTextEditorEditable *ProjectFilesEditor::createEditableInterface() +TextEditor::BaseTextEditor *ProjectFilesEditorWidget::createEditor() { - return new ProjectFilesEditable(this); + return new ProjectFilesEditor(this); } //////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.h b/src/plugins/genericprojectmanager/genericprojectfileseditor.h index f7158106ca..f4737413c5 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.h +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.h @@ -47,8 +47,8 @@ namespace GenericProjectManager { namespace Internal { class Manager; -class ProjectFilesEditable; class ProjectFilesEditor; +class ProjectFilesEditorWidget; class ProjectFilesDocument; class ProjectFilesFactory; @@ -75,13 +75,13 @@ private: QStringList m_mimeTypes; }; -class ProjectFilesEditable: public TextEditor::BaseTextEditorEditable +class ProjectFilesEditor : public TextEditor::BaseTextEditor { Q_OBJECT public: - ProjectFilesEditable(ProjectFilesEditor *editor); - virtual ~ProjectFilesEditable(); + ProjectFilesEditor(ProjectFilesEditorWidget *editorWidget); + virtual ~ProjectFilesEditor(); virtual Core::Context context() const; virtual QString id() const; @@ -95,19 +95,19 @@ private: Core::Context m_context; }; -class ProjectFilesEditor: public TextEditor::BaseTextEditor +class ProjectFilesEditorWidget : public TextEditor::BaseTextEditorWidget { Q_OBJECT public: - ProjectFilesEditor(QWidget *parent, ProjectFilesFactory *factory, + ProjectFilesEditorWidget(QWidget *parent, ProjectFilesFactory *factory, TextEditor::TextEditorActionHandler *handler); - virtual ~ProjectFilesEditor(); + virtual ~ProjectFilesEditorWidget(); ProjectFilesFactory *factory() const; TextEditor::TextEditorActionHandler *actionHandler() const; - virtual TextEditor::BaseTextEditorEditable *createEditableInterface(); + virtual TextEditor::BaseTextEditor *createEditor(); private: ProjectFilesFactory *m_factory; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 61c5b64d4c..23ac1abc23 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -326,7 +326,7 @@ public: connect(m_ignoreSpaces, SIGNAL(toggled(bool)), this, SLOT(testForArgumentsChanged())); } - void setEditor(VCSBase::VCSBaseEditor *editor) + void setEditor(VCSBase::VCSBaseEditorWidget *editor) { Q_ASSERT(editor); m_editor = editor; @@ -361,7 +361,7 @@ public: private: QToolButton *m_omitDate; QToolButton *m_ignoreSpaces; - VCSBase::VCSBaseEditor *m_editor; + VCSBase::VCSBaseEditorWidget *m_editor; QString m_revision; QString m_fileName; }; @@ -440,10 +440,10 @@ QString GitClient::findRepositoryForDirectory(const QString &dir) return VCSBase::VCSBasePlugin::findRepositoryForDirectory(dir, checkFile); } -VCSBase::VCSBaseEditor *GitClient::findExistingVCSEditor(const char *registerDynamicProperty, +VCSBase::VCSBaseEditorWidget *GitClient::findExistingVCSEditor(const char *registerDynamicProperty, const QString &dynamicPropertyValue) const { - VCSBase::VCSBaseEditor *rc = 0; + VCSBase::VCSBaseEditorWidget *rc = 0; Core::IEditor *outputEditor = locateEditor(m_core, registerDynamicProperty, dynamicPropertyValue); if (!outputEditor) return 0; @@ -451,7 +451,7 @@ VCSBase::VCSBaseEditor *GitClient::findExistingVCSEditor(const char *registerDyn // Exists already Core::EditorManager::instance()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch); outputEditor->createNew(m_msgWait); - rc = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor); + rc = VCSBase::VCSBaseEditorWidget::getVcsBaseEditor(outputEditor); return rc; } @@ -461,7 +461,7 @@ VCSBase::VCSBaseEditor *GitClient::findExistingVCSEditor(const char *registerDyn * (using the file's codec). Makes use of a dynamic property to find an * existing instance and to reuse it (in case, say, 'git diff foo' is * already open). */ -VCSBase::VCSBaseEditor *GitClient::createVCSEditor(const QString &id, +VCSBase::VCSBaseEditorWidget *GitClient::createVCSEditor(const QString &id, QString title, // Source file or directory const QString &source, @@ -471,19 +471,19 @@ VCSBase::VCSBaseEditor *GitClient::createVCSEditor(const QString &id, const QString &dynamicPropertyValue, QWidget *configWidget) const { - VCSBase::VCSBaseEditor *rc = 0; + VCSBase::VCSBaseEditorWidget *rc = 0; Q_ASSERT(!findExistingVCSEditor(registerDynamicProperty, dynamicPropertyValue)); // Create new, set wait message, set up with source and codec Core::IEditor *outputEditor = m_core->editorManager()->openEditorWithContents(id, &title, m_msgWait); outputEditor->file()->setProperty(registerDynamicProperty, dynamicPropertyValue); - rc = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor); + rc = VCSBase::VCSBaseEditorWidget::getVcsBaseEditor(outputEditor); connect(rc, SIGNAL(annotateRevisionRequested(QString,QString,int)), this, SLOT(slotBlameRevisionRequested(QString,QString,int))); QTC_ASSERT(rc, return 0); rc->setSource(source); if (setSourceCodec) - rc->setCodec(VCSBase::VCSBaseEditor::getCodec(source)); + rc->setCodec(VCSBase::VCSBaseEditorWidget::getCodec(source)); m_core->editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch); rc->setForceReadOnly(true); @@ -508,7 +508,7 @@ void GitClient::diff(const QString &workingDirectory, const QString title = tr("Git Diff"); QStringList userDiffArgs = diffArgs; - VCSBase::VCSBaseEditor *editor = findExistingVCSEditor("originalFileName", workingDirectory); + VCSBase::VCSBaseEditorWidget *editor = findExistingVCSEditor("originalFileName", workingDirectory); if (!editor) { GitCommitDiffArgumentsWidget *argWidget = new GitCommitDiffArgumentsWidget(&m_settings, this, workingDirectory, diffArgs, @@ -560,10 +560,10 @@ void GitClient::diff(const QString &workingDirectory, { const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID); const QString title = tr("Git Diff %1").arg(fileName); - const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileName); + const QString sourceFile = VCSBase::VCSBaseEditorWidget::getSource(workingDirectory, fileName); QStringList userDiffArgs = diffArgs; - VCSBase::VCSBaseEditor *editor = findExistingVCSEditor("originalFileName", sourceFile); + VCSBase::VCSBaseEditorWidget *editor = findExistingVCSEditor("originalFileName", sourceFile); if (!editor) { GitFileDiffArgumentsWidget *argWidget = new GitFileDiffArgumentsWidget(&m_settings, this, workingDirectory, @@ -591,10 +591,10 @@ void GitClient::diffBranch(const QString &workingDirectory, const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID); const QString title = tr("Git Diff Branch %1").arg(branchName); - const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, QStringList()); + const QString sourceFile = VCSBase::VCSBaseEditorWidget::getSource(workingDirectory, QStringList()); QStringList userDiffArgs = diffArgs; - VCSBase::VCSBaseEditor *editor = findExistingVCSEditor("BranchName", branchName); + VCSBase::VCSBaseEditorWidget *editor = findExistingVCSEditor("BranchName", branchName); if (!editor) { GitBranchDiffArgumentsWidget *argWidget = new GitBranchDiffArgumentsWidget(&m_settings, this, workingDirectory, @@ -647,8 +647,8 @@ void GitClient::graphLog(const QString &workingDirectory, const QString & branch arguments << branch; } const QString editorId = QLatin1String(Git::Constants::GIT_LOG_EDITOR_ID); - const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, QStringList()); - VCSBase::VCSBaseEditor *editor = findExistingVCSEditor("logFileName", sourceFile); + const QString sourceFile = VCSBase::VCSBaseEditorWidget::getSource(workingDirectory, QStringList()); + VCSBase::VCSBaseEditorWidget *editor = findExistingVCSEditor("logFileName", sourceFile); if (!editor) editor = createVCSEditor(editorId, title, sourceFile, false, "logFileName", sourceFile, 0); executeGit(workingDirectory, arguments, editor); @@ -672,8 +672,8 @@ void GitClient::log(const QString &workingDirectory, const QStringList &fileName fileNames.join(QString(", ")); const QString title = tr("Git Log %1").arg(msgArg); const QString editorId = QLatin1String(Git::Constants::GIT_LOG_EDITOR_ID); - const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileNames); - VCSBase::VCSBaseEditor *editor = findExistingVCSEditor("logFileName", sourceFile); + const QString sourceFile = VCSBase::VCSBaseEditorWidget::getSource(workingDirectory, fileNames); + VCSBase::VCSBaseEditorWidget *editor = findExistingVCSEditor("logFileName", sourceFile); if (!editor) editor = createVCSEditor(editorId, title, sourceFile, false, "logFileName", sourceFile, 0); editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); @@ -707,7 +707,7 @@ void GitClient::show(const QString &source, const QString &id, const QStringList QStringList userArgs = args; const QString title = tr("Git Show %1").arg(id); const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID); - VCSBase::VCSBaseEditor *editor = findExistingVCSEditor("show", id); + VCSBase::VCSBaseEditorWidget *editor = findExistingVCSEditor("show", id); if (!editor) { GitShowArgumentsWidget *argWidget = new GitShowArgumentsWidget(&m_settings, this, source, @@ -747,12 +747,12 @@ void GitClient::blame(const QString &workingDirectory, qDebug() << "blame" << workingDirectory << fileName << lineNumber << args; const QString editorId = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_ID); - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDirectory, QStringList(fileName), revision); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDirectory, QStringList(fileName), revision); const QString title = tr("Git Blame %1").arg(id); - const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileName); + const QString sourceFile = VCSBase::VCSBaseEditorWidget::getSource(workingDirectory, fileName); QStringList userBlameArgs = args; - VCSBase::VCSBaseEditor *editor = findExistingVCSEditor("blameFileName", id); + VCSBase::VCSBaseEditorWidget *editor = findExistingVCSEditor("blameFileName", id); if (!editor) { GitBlameArgumentsWidget *argWidget = new GitBlameArgumentsWidget(&m_settings, this, workingDirectory, userBlameArgs, @@ -1400,7 +1400,7 @@ bool GitClient::synchronousApplyPatch(const QString &workingDirectory, // Factory function to create an asynchronous command GitCommand *GitClient::createCommand(const QString &workingDirectory, - VCSBase::VCSBaseEditor* editor, + VCSBase::VCSBaseEditorWidget* editor, bool outputToWindow, int editorLineNumber) { @@ -1430,7 +1430,7 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory, // Execute a single command GitCommand *GitClient::executeGit(const QString &workingDirectory, const QStringList &arguments, - VCSBase::VCSBaseEditor* editor, + VCSBase::VCSBaseEditorWidget* editor, bool outputToWindow, GitCommand::TerminationReportMode tm, int editorLineNumber, @@ -2143,8 +2143,8 @@ void GitClient::subversionLog(const QString &workingDirectory) // Create a command editor, no highlighting or interaction. const QString title = tr("Git SVN Log"); const QString editorId = QLatin1String(Git::Constants::C_GIT_COMMAND_LOG_EDITOR); - const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, QStringList()); - VCSBase::VCSBaseEditor *editor = findExistingVCSEditor("svnLog", sourceFile); + const QString sourceFile = VCSBase::VCSBaseEditorWidget::getSource(workingDirectory, QStringList()); + VCSBase::VCSBaseEditorWidget *editor = findExistingVCSEditor("svnLog", sourceFile); if (!editor) editor = createVCSEditor(editorId, title, sourceFile, false, "svnLog", sourceFile, 0); executeGit(workingDirectory, arguments, editor); diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 9d86850b26..b6aef5f2da 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -56,7 +56,7 @@ namespace Core { } namespace VCSBase { - class VCSBaseEditor; + class VCSBaseEditorWidget; } namespace Utils { @@ -235,9 +235,9 @@ private slots: void slotBlameRevisionRequested(const QString &source, QString change, int lineNumber); private: - VCSBase::VCSBaseEditor *findExistingVCSEditor(const char *registerDynamicProperty, + VCSBase::VCSBaseEditorWidget *findExistingVCSEditor(const char *registerDynamicProperty, const QString &dynamicPropertyValue) const; - VCSBase::VCSBaseEditor *createVCSEditor(const QString &kind, + VCSBase::VCSBaseEditorWidget *createVCSEditor(const QString &kind, QString title, const QString &source, bool setSourceCodec, @@ -246,13 +246,13 @@ private: QWidget *configWidget) const; GitCommand *createCommand(const QString &workingDirectory, - VCSBase::VCSBaseEditor* editor = 0, + VCSBase::VCSBaseEditorWidget* editor = 0, bool outputToWindow = false, int editorLineNumber = -1); GitCommand *executeGit(const QString &workingDirectory, const QStringList &arguments, - VCSBase::VCSBaseEditor* editor = 0, + VCSBase::VCSBaseEditorWidget* editor = 0, bool outputToWindow = false, GitCommand::TerminationReportMode tm = GitCommand::NoReport, int editorLineNumber = -1, diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index f9882bd4f8..64ad23fbc1 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -64,7 +64,7 @@ namespace Internal { // ------------ GitEditor GitEditor::GitEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent) : - VCSBase::VCSBaseEditor(type, parent), + VCSBase::VCSBaseEditorWidget(type, parent), m_changeNumberPattern8(QLatin1String(CHANGE_PATTERN_8C)), m_changeNumberPattern40(QLatin1String(CHANGE_PATTERN_40C)) { diff --git a/src/plugins/git/giteditor.h b/src/plugins/git/giteditor.h index ed0ea4eba6..69a2625f7b 100644 --- a/src/plugins/git/giteditor.h +++ b/src/plugins/git/giteditor.h @@ -45,7 +45,7 @@ QT_END_NAMESPACE namespace Git { namespace Internal { -class GitEditor : public VCSBase::VCSBaseEditor +class GitEditor : public VCSBase::VCSBaseEditorWidget { Q_OBJECT diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 571e3deb87..cabd4acf4b 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -110,7 +110,7 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = { static inline const VCSBase::VCSBaseEditorParameters *findType(int ie) { const VCSBase::EditorContentType et = static_cast(ie); - return VCSBase::VCSBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); + return VCSBase::VCSBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); } Q_DECLARE_METATYPE(Git::Internal::GitClientMemberFunc) @@ -599,7 +599,7 @@ void GitPlugin::blameFile() { const VCSBase::VCSBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return) - const int lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(state.currentFile()); + const int lineNumber = VCSBase::VCSBaseEditorWidget::lineNumberOfCurrentEditor(state.currentFile()); m_gitClient->blame(state.currentFileTopLevel(), QStringList(), state.relativeCurrentFile(), QString(), lineNumber); } diff --git a/src/plugins/glsleditor/glslcodecompletion.cpp b/src/plugins/glsleditor/glslcodecompletion.cpp index b8cc4fef48..b9603884a7 100644 --- a/src/plugins/glsleditor/glslcodecompletion.cpp +++ b/src/plugins/glsleditor/glslcodecompletion.cpp @@ -385,7 +385,7 @@ CodeCompletion::~CodeCompletion() { } -TextEditor::ITextEditable *CodeCompletion::editor() const +TextEditor::ITextEditor *CodeCompletion::editor() const { return m_editor; } @@ -395,9 +395,9 @@ int CodeCompletion::startPosition() const return m_startPosition; } -bool CodeCompletion::supportsEditor(TextEditor::ITextEditable *editor) const +bool CodeCompletion::supportsEditor(TextEditor::ITextEditor *editor) const { - return qobject_cast(editor->widget()) != 0; + return qobject_cast(editor->widget()) != 0; } bool CodeCompletion::supportsPolicy(TextEditor::CompletionPolicy policy) const @@ -405,7 +405,7 @@ bool CodeCompletion::supportsPolicy(TextEditor::CompletionPolicy policy) const return policy == TextEditor::SemanticCompletion; } -bool CodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) +bool CodeCompletion::triggersCompletion(TextEditor::ITextEditor *editor) { const int cursorPosition = editor->position(); const QChar ch = editor->characterAt(cursorPosition - 1); @@ -440,7 +440,7 @@ bool CodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) return false; } -int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor) +int CodeCompletion::startCompletion(TextEditor::ITextEditor *editor) { m_editor = editor; @@ -450,7 +450,7 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor) ch = editor->characterAt(--pos); CPlusPlus::ExpressionUnderCursor expressionUnderCursor; - GLSLTextEditor *edit = qobject_cast(editor->widget()); + GLSLTextEditorWidget *edit = qobject_cast(editor->widget()); QList members; QStringList specialMembers; @@ -673,7 +673,7 @@ void CodeCompletion::complete(const TextEditor::CompletionItem &item, QChar type QString toInsert = item.text; const int length = m_editor->position() - m_startPosition; - m_editor->setCurPos(m_startPosition); + m_editor->setCursorPosition(m_startPosition); m_editor->replace(length, toInsert); if (toInsert.endsWith(QLatin1Char('.')) || toInsert.endsWith(QLatin1Char('('))) diff --git a/src/plugins/glsleditor/glslcodecompletion.h b/src/plugins/glsleditor/glslcodecompletion.h index 620a01ea42..16a143963a 100644 --- a/src/plugins/glsleditor/glslcodecompletion.h +++ b/src/plugins/glsleditor/glslcodecompletion.h @@ -49,14 +49,14 @@ public: CodeCompletion(QObject *parent = 0); virtual ~CodeCompletion(); - /* Returns the current active ITextEditable */ - virtual TextEditor::ITextEditable *editor() const; + /* Returns the current active ITextEditor */ + virtual TextEditor::ITextEditor *editor() const; virtual int startPosition() const; /* * Returns true if this completion collector can be used with the given editor. */ - virtual bool supportsEditor(TextEditor::ITextEditable *editor) const; + virtual bool supportsEditor(TextEditor::ITextEditor *editor) const; /* * Returns true if this completion collector supports the given completion policy. @@ -67,10 +67,10 @@ public: * trigger an autocomplete. It will be called each time a character is typed in * the text editor. */ - virtual bool triggersCompletion(TextEditor::ITextEditable *editor); + virtual bool triggersCompletion(TextEditor::ITextEditor *editor); // returns starting position - virtual int startCompletion(TextEditor::ITextEditable *editor); + virtual int startCompletion(TextEditor::ITextEditor *editor); /* This method should add all the completions it wants to show into the list, * based on the given cursor position. @@ -109,7 +109,7 @@ public: private: QList m_completions; QList m_keywordCompletions; - TextEditor::ITextEditable *m_editor; + TextEditor::ITextEditor *m_editor; int m_startPosition; bool m_restartCompletion; QPointer m_functionArgumentWidget; diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp index a0c8b8b218..52cec9789b 100644 --- a/src/plugins/glsleditor/glsleditor.cpp +++ b/src/plugins/glsleditor/glsleditor.cpp @@ -146,8 +146,8 @@ void Document::addRange(const QTextCursor &cursor, GLSL::Scope *scope) _cursors.append(c); } -GLSLTextEditor::GLSLTextEditor(QWidget *parent) : - TextEditor::BaseTextEditor(parent), +GLSLTextEditorWidget::GLSLTextEditorWidget(QWidget *parent) : + TextEditor::BaseTextEditorWidget(parent), m_outlineCombo(0) { setParenthesesMatchingEnabled(true); @@ -175,17 +175,17 @@ GLSLTextEditor::GLSLTextEditor(QWidget *parent) : // } } -GLSLTextEditor::~GLSLTextEditor() +GLSLTextEditorWidget::~GLSLTextEditorWidget() { } -int GLSLTextEditor::editorRevision() const +int GLSLTextEditorWidget::editorRevision() const { //return document()->revision(); return 0; } -bool GLSLTextEditor::isOutdated() const +bool GLSLTextEditorWidget::isOutdated() const { // if (m_semanticInfo.revision() != editorRevision()) // return true; @@ -195,10 +195,10 @@ bool GLSLTextEditor::isOutdated() const Core::IEditor *GLSLEditorEditable::duplicate(QWidget *parent) { - GLSLTextEditor *newEditor = new GLSLTextEditor(parent); - newEditor->duplicateFrom(editor()); + GLSLTextEditorWidget *newEditor = new GLSLTextEditorWidget(parent); + newEditor->duplicateFrom(editorWidget()); GLSLEditorPlugin::instance()->initializeEditor(newEditor); - return newEditor->editableInterface(); + return newEditor->editor(); } QString GLSLEditorEditable::id() const @@ -208,8 +208,8 @@ QString GLSLEditorEditable::id() const bool GLSLEditorEditable::open(const QString &fileName) { - editor()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); - bool b = TextEditor::BaseTextEditorEditable::open(fileName); + editorWidget()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); + bool b = TextEditor::BaseTextEditor::open(fileName); return b; } @@ -218,9 +218,9 @@ Core::Context GLSLEditorEditable::context() const return m_context; } -void GLSLTextEditor::setFontSettings(const TextEditor::FontSettings &fs) +void GLSLTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { - TextEditor::BaseTextEditor::setFontSettings(fs); + TextEditor::BaseTextEditorWidget::setFontSettings(fs); Highlighter *highlighter = qobject_cast(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; @@ -254,7 +254,7 @@ void GLSLTextEditor::setFontSettings(const TextEditor::FontSettings &fs) highlighter->rehighlight(); } -QString GLSLTextEditor::wordUnderCursor() const +QString GLSLTextEditorWidget::wordUnderCursor() const { QTextCursor tc = textCursor(); const QChar ch = characterAt(tc.position() - 1); @@ -267,14 +267,14 @@ QString GLSLTextEditor::wordUnderCursor() const return word; } -TextEditor::BaseTextEditorEditable *GLSLTextEditor::createEditableInterface() +TextEditor::BaseTextEditor *GLSLTextEditorWidget::createEditor() { GLSLEditorEditable *editable = new GLSLEditorEditable(this); createToolBar(editable); return editable; } -void GLSLTextEditor::createToolBar(GLSLEditorEditable *editable) +void GLSLTextEditorWidget::createToolBar(GLSLEditorEditable *editable) { m_outlineCombo = new QComboBox; m_outlineCombo->setMinimumContentsLength(22); @@ -301,22 +301,22 @@ void GLSLTextEditor::createToolBar(GLSLEditorEditable *editable) toolBar->insertWidget(actions.first(), m_outlineCombo); } -bool GLSLTextEditor::event(QEvent *e) +bool GLSLTextEditorWidget::event(QEvent *e) { - return BaseTextEditor::event(e); + return BaseTextEditorWidget::event(e); } -void GLSLTextEditor::unCommentSelection() +void GLSLTextEditorWidget::unCommentSelection() { Utils::unCommentSelection(this); } -void GLSLTextEditor::updateDocument() +void GLSLTextEditorWidget::updateDocument() { m_updateDocumentTimer->start(); } -void GLSLTextEditor::updateDocumentNow() +void GLSLTextEditorWidget::updateDocumentNow() { m_updateDocumentTimer->stop(); @@ -379,7 +379,7 @@ void GLSLTextEditor::updateDocumentNow() } } -int GLSLTextEditor::languageVariant() const +int GLSLTextEditorWidget::languageVariant() const { int variant = 0; QString type = mimeType(); @@ -417,7 +417,7 @@ int GLSLTextEditor::languageVariant() const return variant; } -Document::Ptr GLSLTextEditor::glslDocument() const +Document::Ptr GLSLTextEditorWidget::glslDocument() const { return m_glslDocument; } diff --git a/src/plugins/glsleditor/glsleditor.h b/src/plugins/glsleditor/glsleditor.h index 88de4177a0..f50821a4d0 100644 --- a/src/plugins/glsleditor/glsleditor.h +++ b/src/plugins/glsleditor/glsleditor.h @@ -55,7 +55,7 @@ class ICore; } namespace GLSLEditor { -class GLSLTextEditor; +class GLSLTextEditorWidget; class GLSLEDITOR_EXPORT Document { @@ -83,16 +83,16 @@ private: GLSL::Scope *_globalScope; QList _cursors; - friend class GLSLTextEditor; + friend class GLSLTextEditorWidget; }; -class GLSLEDITOR_EXPORT GLSLTextEditor : public TextEditor::BaseTextEditor +class GLSLEDITOR_EXPORT GLSLTextEditorWidget : public TextEditor::BaseTextEditorWidget { Q_OBJECT public: - GLSLTextEditor(QWidget *parent = 0); - ~GLSLTextEditor(); + GLSLTextEditorWidget(QWidget *parent = 0); + ~GLSLTextEditorWidget(); virtual void unCommentSelection(); @@ -114,7 +114,7 @@ private slots: protected: bool event(QEvent *e); - TextEditor::BaseTextEditorEditable *createEditableInterface(); + TextEditor::BaseTextEditor *createEditor(); void createToolBar(Internal::GLSLEditorEditable *editable); private: diff --git a/src/plugins/glsleditor/glsleditoreditable.cpp b/src/plugins/glsleditor/glsleditoreditable.cpp index 06aae24cde..304f76902e 100644 --- a/src/plugins/glsleditor/glsleditoreditable.cpp +++ b/src/plugins/glsleditor/glsleditoreditable.cpp @@ -47,8 +47,8 @@ namespace GLSLEditor { namespace Internal { -GLSLEditorEditable::GLSLEditorEditable(GLSLTextEditor *editor) - : BaseTextEditorEditable(editor) +GLSLEditorEditable::GLSLEditorEditable(GLSLTextEditorWidget *editor) + : BaseTextEditor(editor) { m_context.add(GLSLEditor::Constants::C_GLSLEDITOR_ID); m_context.add(TextEditor::Constants::C_TEXTEDITOR); diff --git a/src/plugins/glsleditor/glsleditoreditable.h b/src/plugins/glsleditor/glsleditoreditable.h index 3f50a11fa5..a3455d1ad6 100644 --- a/src/plugins/glsleditor/glsleditoreditable.h +++ b/src/plugins/glsleditor/glsleditoreditable.h @@ -37,16 +37,16 @@ #include namespace GLSLEditor { -class GLSLTextEditor; +class GLSLTextEditorWidget; namespace Internal { -class GLSLEditorEditable : public TextEditor::BaseTextEditorEditable +class GLSLEditorEditable : public TextEditor::BaseTextEditor { Q_OBJECT public: - explicit GLSLEditorEditable(GLSLTextEditor *); + explicit GLSLEditorEditable(GLSLTextEditorWidget *); Core::Context context() const; bool duplicateSupported() const { return true; } diff --git a/src/plugins/glsleditor/glsleditorfactory.cpp b/src/plugins/glsleditor/glsleditorfactory.cpp index 38663a049e..802efade31 100644 --- a/src/plugins/glsleditor/glsleditorfactory.cpp +++ b/src/plugins/glsleditor/glsleditorfactory.cpp @@ -93,9 +93,9 @@ Core::IFile *GLSLEditorFactory::open(const QString &fileName) Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent) { - GLSLEditor::GLSLTextEditor *rc = new GLSLEditor::GLSLTextEditor(parent); + GLSLEditor::GLSLTextEditorWidget *rc = new GLSLEditor::GLSLTextEditorWidget(parent); GLSLEditorPlugin::instance()->initializeEditor(rc); - return rc->editableInterface(); + return rc->editor(); } QStringList GLSLEditorFactory::mimeTypes() const diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp index 19ffecec5d..cea366977b 100644 --- a/src/plugins/glsleditor/glsleditorplugin.cpp +++ b/src/plugins/glsleditor/glsleditorplugin.cpp @@ -242,7 +242,7 @@ ExtensionSystem::IPlugin::ShutdownFlag GLSLEditorPlugin::aboutToShutdown() return IPlugin::aboutToShutdown(); } -void GLSLEditorPlugin::initializeEditor(GLSLEditor::GLSLTextEditor *editor) +void GLSLEditorPlugin::initializeEditor(GLSLEditor::GLSLTextEditorWidget *editor) { QTC_ASSERT(m_instance, /**/); diff --git a/src/plugins/glsleditor/glsleditorplugin.h b/src/plugins/glsleditor/glsleditorplugin.h index e974935bbe..f4ee6adf8c 100644 --- a/src/plugins/glsleditor/glsleditorplugin.h +++ b/src/plugins/glsleditor/glsleditorplugin.h @@ -53,7 +53,7 @@ class ActionManager; } namespace TextEditor { -class ITextEditable; +class ITextEditor; } namespace GLSL { @@ -62,7 +62,7 @@ class ModelManagerInterface; namespace GLSLEditor { -class GLSLTextEditor; +class GLSLTextEditorWidget; namespace Internal { @@ -86,7 +86,7 @@ public: static GLSLEditorPlugin *instance() { return m_instance; } - void initializeEditor(GLSLEditor::GLSLTextEditor *editor); + void initializeEditor(GLSLEditor::GLSLTextEditorWidget *editor); struct InitFile { GLSL::Engine *engine; @@ -114,7 +114,7 @@ private: GLSLEditorFactory *m_editor; TextEditor::TextEditorActionHandler *m_actionHandler; - QPointer m_currentTextEditable; + QPointer m_currentTextEditable; InitFile m_glsl_120_frag; InitFile m_glsl_120_vert; diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp index bbf1ca7627..3a4a6afddf 100644 --- a/src/plugins/glsleditor/glslhighlighter.cpp +++ b/src/plugins/glsleditor/glslhighlighter.cpp @@ -42,7 +42,7 @@ using namespace GLSLEditor; using namespace GLSLEditor::Internal; using namespace TextEditor; -Highlighter::Highlighter(GLSLTextEditor *editor, QTextDocument *parent) +Highlighter::Highlighter(GLSLTextEditorWidget *editor, QTextDocument *parent) : TextEditor::SyntaxHighlighter(parent), m_editor(editor) { } diff --git a/src/plugins/glsleditor/glslhighlighter.h b/src/plugins/glsleditor/glslhighlighter.h index 8ff179e430..215e44b23c 100644 --- a/src/plugins/glsleditor/glslhighlighter.h +++ b/src/plugins/glsleditor/glslhighlighter.h @@ -36,7 +36,7 @@ #include namespace GLSLEditor { -class GLSLTextEditor; +class GLSLTextEditorWidget; namespace Internal { @@ -61,7 +61,7 @@ public: NumGLSLFormats }; - explicit Highlighter(GLSLTextEditor *editor, QTextDocument *parent); + explicit Highlighter(GLSLTextEditorWidget *editor, QTextDocument *parent); virtual ~Highlighter(); void setFormats(const QVector &formats); @@ -73,7 +73,7 @@ protected: private: QTextCharFormat m_formats[NumGLSLFormats]; - GLSLTextEditor *m_editor; + GLSLTextEditorWidget *m_editor; }; } // namespace Internal diff --git a/src/plugins/glsleditor/glslhoverhandler.cpp b/src/plugins/glsleditor/glslhoverhandler.cpp index 18682afd12..36ff186af9 100644 --- a/src/plugins/glsleditor/glslhoverhandler.cpp +++ b/src/plugins/glsleditor/glslhoverhandler.cpp @@ -63,7 +63,7 @@ bool GLSLHoverHandler::acceptEditor(IEditor *editor) void GLSLHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) { - if (GLSLTextEditor *glslEditor = qobject_cast(editor->widget())) { + if (GLSLTextEditorWidget *glslEditor = qobject_cast(editor->widget())) { if (! glslEditor->extraSelectionTooltip(pos).isEmpty()) { setToolTip(glslEditor->extraSelectionTooltip(pos)); } diff --git a/src/plugins/glsleditor/glslindenter.cpp b/src/plugins/glsleditor/glslindenter.cpp index 7937be013d..c6bc2f537d 100644 --- a/src/plugins/glsleditor/glslindenter.cpp +++ b/src/plugins/glsleditor/glslindenter.cpp @@ -65,7 +65,7 @@ bool GLSLIndenter::isElectricCharacter(const QChar &ch) const void GLSLIndenter::indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - TextEditor::BaseTextEditor *editor) + TextEditor::BaseTextEditorWidget *editor) { Q_UNUSED(doc) @@ -93,7 +93,7 @@ void GLSLIndenter::indentBlock(QTextDocument *doc, void GLSLIndenter::indent(QTextDocument *doc, const QTextCursor &cursor, const QChar &typedChar, - TextEditor::BaseTextEditor *editor) + TextEditor::BaseTextEditorWidget *editor) { if (cursor.hasSelection()) { QTextBlock block = doc->findBlock(cursor.selectionStart()); diff --git a/src/plugins/glsleditor/glslindenter.h b/src/plugins/glsleditor/glslindenter.h index 77cd6c5b56..fc50f72be6 100644 --- a/src/plugins/glsleditor/glslindenter.h +++ b/src/plugins/glsleditor/glslindenter.h @@ -49,12 +49,12 @@ public: virtual void indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - TextEditor::BaseTextEditor *editor); + TextEditor::BaseTextEditorWidget *editor); virtual void indent(QTextDocument *doc, const QTextCursor &cursor, const QChar &typedChar, - TextEditor::BaseTextEditor *editor); + TextEditor::BaseTextEditorWidget *editor); }; } // Internal diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp index eb1b70901a..e8b8c7561f 100644 --- a/src/plugins/mercurial/mercurialclient.cpp +++ b/src/plugins/mercurial/mercurialclient.cpp @@ -315,11 +315,11 @@ void MercurialClient::annotate(const QString &workingDir, const QString &file, args << QLatin1String("-r") << revision; args << file; const QString kind = QLatin1String(Constants::ANNOTATELOG); - const QString id = VCSBase::VCSBaseEditor::getSource(workingDir, QStringList(file)); + const QString id = VCSBase::VCSBaseEditorWidget::getSource(workingDir, QStringList(file)); const QString title = tr("Hg Annotate %1").arg(id); - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, file); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, file); - VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, source, true, + VCSBase::VCSBaseEditorWidget *editor = createVCSEditor(kind, title, source, true, "annotate", id); QSharedPointer job(new HgTask(workingDir, args, editor)); @@ -335,10 +335,10 @@ void MercurialClient::diff(const QString &workingDir, const QStringList &files) args.append(files); const QString kind = QLatin1String(Constants::DIFFLOG); - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir,files); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir,files); const QString title = tr("Hg diff %1").arg(id); - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); - VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, source, true, + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, files); + VCSBase::VCSBaseEditorWidget *editor = createVCSEditor(kind, title, source, true, "diff", id); editor->setDiffBaseDirectory(workingDir); @@ -355,11 +355,11 @@ void MercurialClient::log(const QString &workingDir, const QStringList &files, args.append(files); const QString kind = QLatin1String(Constants::FILELOG); - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir,files); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir,files); const QString title = tr("Hg log %1").arg(id); - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, files); - VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, workingDir, true, + VCSBase::VCSBaseEditorWidget *editor = createVCSEditor(kind, title, workingDir, true, "log", id); editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); @@ -575,7 +575,7 @@ void MercurialClient::incoming(const QString &repositoryRoot, const QString &rep const QString kind = QLatin1String(Constants::DIFFLOG); const QString title = tr("Hg incoming %1").arg(id); - VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, repositoryRoot, + VCSBase::VCSBaseEditorWidget *editor = createVCSEditor(kind, title, repositoryRoot, true, "incoming", id); QSharedPointer job(new HgTask(repositoryRoot, args, editor)); @@ -594,7 +594,7 @@ void MercurialClient::outgoing(const QString &repositoryRoot) const QString title = tr("Hg outgoing %1"). arg(QDir::toNativeSeparators(repositoryRoot)); - VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, repositoryRoot, true, + VCSBase::VCSBaseEditorWidget *editor = createVCSEditor(kind, title, repositoryRoot, true, "outgoing", repositoryRoot); QSharedPointer job(new HgTask(repositoryRoot, args, editor)); @@ -612,7 +612,7 @@ void MercurialClient::view(const QString &source, const QString &id) const QString kind = QLatin1String(Constants::DIFFLOG); const QString title = tr("Hg log %1").arg(id); - VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, source, + VCSBase::VCSBaseEditorWidget *editor = createVCSEditor(kind, title, source, true, "view", id); QSharedPointer job(new HgTask(source, args, editor)); @@ -665,29 +665,29 @@ void MercurialClient::settingsChanged() jobManager->restart(); } -VCSBase::VCSBaseEditor *MercurialClient::createVCSEditor(const QString &kind, QString title, +VCSBase::VCSBaseEditorWidget *MercurialClient::createVCSEditor(const QString &kind, QString title, const QString &source, bool setSourceCodec, const char *registerDynamicProperty, const QString &dynamicPropertyValue) const { - VCSBase::VCSBaseEditor *baseEditor = 0; + VCSBase::VCSBaseEditorWidget *baseEditor = 0; Core::IEditor* outputEditor = locateEditor(core, registerDynamicProperty, dynamicPropertyValue); const QString progressMsg = tr("Working..."); if (outputEditor) { // Exists already outputEditor->createNew(progressMsg); - baseEditor = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor); + baseEditor = VCSBase::VCSBaseEditorWidget::getVcsBaseEditor(outputEditor); QTC_ASSERT(baseEditor, return 0); } else { outputEditor = core->editorManager()->openEditorWithContents(kind, &title, progressMsg); outputEditor->file()->setProperty(registerDynamicProperty, dynamicPropertyValue); - baseEditor = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor); + baseEditor = VCSBase::VCSBaseEditorWidget::getVcsBaseEditor(outputEditor); connect(baseEditor, SIGNAL(annotateRevisionRequested(QString,QString,int)), this, SLOT(slotAnnotateRevisionRequested(QString,QString,int))); QTC_ASSERT(baseEditor, return 0); baseEditor->setSource(source); if (setSourceCodec) - baseEditor->setCodec(VCSBase::VCSBaseEditor::getCodec(source)); + baseEditor->setCodec(VCSBase::VCSBaseEditorWidget::getCodec(source)); } core->editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch); diff --git a/src/plugins/mercurial/mercurialclient.h b/src/plugins/mercurial/mercurialclient.h index f7f94a47a0..ca5a58b45c 100644 --- a/src/plugins/mercurial/mercurialclient.h +++ b/src/plugins/mercurial/mercurialclient.h @@ -49,7 +49,7 @@ class ICore; } namespace VCSBase{ -class VCSBaseEditor; +class VCSBaseEditorWidget; } namespace Utils { @@ -140,7 +140,7 @@ private: MercurialJobRunner *jobManager; Core::ICore *core; - VCSBase::VCSBaseEditor *createVCSEditor(const QString &kind, QString title, + VCSBase::VCSBaseEditorWidget *createVCSEditor(const QString &kind, QString title, const QString &source, bool setSourceCodec, const char *registerDynamicProperty, const QString &dynamicPropertyValue) const; diff --git a/src/plugins/mercurial/mercurialeditor.cpp b/src/plugins/mercurial/mercurialeditor.cpp index ba039da4cc..3c5a94152f 100644 --- a/src/plugins/mercurial/mercurialeditor.cpp +++ b/src/plugins/mercurial/mercurialeditor.cpp @@ -51,7 +51,7 @@ using namespace Mercurial::Internal; using namespace Mercurial; MercurialEditor::MercurialEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent) - : VCSBase::VCSBaseEditor(type, parent), + : VCSBase::VCSBaseEditorWidget(type, parent), exactIdentifier12(QLatin1String(Constants::CHANGEIDEXACT12)), exactIdentifier40(QLatin1String(Constants::CHANGEIDEXACT40)), changesetIdentifier12(QLatin1String(Constants::CHANGESETID12)), diff --git a/src/plugins/mercurial/mercurialeditor.h b/src/plugins/mercurial/mercurialeditor.h index 18f9b22ae9..2846283926 100644 --- a/src/plugins/mercurial/mercurialeditor.h +++ b/src/plugins/mercurial/mercurialeditor.h @@ -41,7 +41,7 @@ namespace Mercurial { namespace Internal { -class MercurialEditor : public VCSBase::VCSBaseEditor +class MercurialEditor : public VCSBase::VCSBaseEditorWidget { Q_OBJECT public: diff --git a/src/plugins/mercurial/mercurialjobrunner.cpp b/src/plugins/mercurial/mercurialjobrunner.cpp index a081f194fa..9dd572c56f 100644 --- a/src/plugins/mercurial/mercurialjobrunner.cpp +++ b/src/plugins/mercurial/mercurialjobrunner.cpp @@ -65,7 +65,7 @@ HgTask::HgTask(const QString &repositoryRoot, HgTask::HgTask(const QString &repositoryRoot, const QStringList &arguments, - VCSBase::VCSBaseEditor *editor, + VCSBase::VCSBaseEditorWidget *editor, const QVariant &cookie) : m_repositoryRoot(repositoryRoot), arguments(arguments), @@ -76,7 +76,7 @@ HgTask::HgTask(const QString &repositoryRoot, { } -VCSBase::VCSBaseEditor* HgTask::displayEditor() const +VCSBase::VCSBaseEditorWidget* HgTask::displayEditor() const { return editor; } diff --git a/src/plugins/mercurial/mercurialjobrunner.h b/src/plugins/mercurial/mercurialjobrunner.h index ccaf3cecc2..f3b36a6f1b 100644 --- a/src/plugins/mercurial/mercurialjobrunner.h +++ b/src/plugins/mercurial/mercurialjobrunner.h @@ -49,7 +49,7 @@ class QProcess; QT_END_NAMESPACE namespace VCSBase { -class VCSBaseEditor; +class VCSBaseEditorWidget; } namespace Mercurial { @@ -66,11 +66,11 @@ public: bool emitRaw=false, const QVariant &cookie = QVariant()); explicit HgTask(const QString &workingDir, const QStringList &arguments, - VCSBase::VCSBaseEditor *editor, + VCSBase::VCSBaseEditorWidget *editor, const QVariant &cookie = QVariant()); bool shouldEmit() const { return emitRaw; } - VCSBase::VCSBaseEditor* displayEditor() const; + VCSBase::VCSBaseEditorWidget* displayEditor() const; QStringList args() const { return arguments; } QString repositoryRoot() const { return m_repositoryRoot; } @@ -90,7 +90,7 @@ private: const QStringList arguments; const bool emitRaw; const QVariant m_cookie; - QPointer editor; // User might close it. + QPointer editor; // User might close it. bool m_unixTerminalDisabled; }; diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index b764fdfdcd..7d733d1e88 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -120,7 +120,7 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitEditorParameters = { static inline const VCSBase::VCSBaseEditorParameters *findType(int ie) { const VCSBase::EditorContentType et = static_cast(ie); - return VCSBase::VCSBaseEditor::findType(editorParameters, + return VCSBase::VCSBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); } diff --git a/src/plugins/perforce/perforceeditor.cpp b/src/plugins/perforce/perforceeditor.cpp index a42d066091..56f14fc96b 100644 --- a/src/plugins/perforce/perforceeditor.cpp +++ b/src/plugins/perforce/perforceeditor.cpp @@ -62,7 +62,7 @@ namespace Internal { // ------------ PerforceEditor PerforceEditor::PerforceEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent) : - VCSBase::VCSBaseEditor(type, parent), + VCSBase::VCSBaseEditorWidget(type, parent), m_changeNumberPattern(QLatin1String("^\\d+$")), m_plugin(PerforcePlugin::perforcePluginInstance()) { diff --git a/src/plugins/perforce/perforceeditor.h b/src/plugins/perforce/perforceeditor.h index 6a2d1d4226..e7c95ad45a 100644 --- a/src/plugins/perforce/perforceeditor.h +++ b/src/plugins/perforce/perforceeditor.h @@ -43,7 +43,7 @@ namespace Internal { class PerforcePlugin; -class PerforceEditor : public VCSBase::VCSBaseEditor +class PerforceEditor : public VCSBase::VCSBaseEditorWidget { Q_OBJECT diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 9937dc1803..39b1c74361 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -106,7 +106,7 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = { static inline const VCSBase::VCSBaseEditorParameters *findType(int ie) { const VCSBase::EditorContentType et = static_cast(ie); - return VCSBase::VCSBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); + return VCSBase::VCSBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); } static inline QString debugCodec(const QTextCodec *c) @@ -480,7 +480,7 @@ void PerforcePlugin::revertCurrentFile() const VCSBase::VCSBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return) - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(state.currentFile()); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(state.currentFile()); QStringList args; args << QLatin1String("diff") << QLatin1String("-sa") << state.relativeCurrentFile(); PerforceResponse result = runP4Cmd(state.currentFileTopLevel(), args, @@ -737,9 +737,9 @@ void PerforcePlugin::annotate(const QString &workingDir, int lineNumber /* = -1 */) { const QStringList files = QStringList(fileName); - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files); - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files, changeList); - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(workingDir, files); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir, files, changeList); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, files); QStringList args; args << QLatin1String("annotate") << QLatin1String("-cqi"); if (changeList.isEmpty()) { @@ -752,12 +752,12 @@ void PerforcePlugin::annotate(const QString &workingDir, QStringList(), QByteArray(), codec); if (!result.error) { if (lineNumber < 1) - lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(); + lineNumber = VCSBase::VCSBaseEditorWidget::lineNumberOfCurrentEditor(); const QFileInfo fi(fileName); Core::IEditor *ed = showOutputInEditor(tr("p4 annotate %1").arg(id), result.stdOut, VCSBase::AnnotateOutput, source, codec); - VCSBase::VCSBaseEditor::gotoLineOfEditor(ed, lineNumber); + VCSBase::VCSBaseEditorWidget::gotoLineOfEditor(ed, lineNumber); } } @@ -794,8 +794,8 @@ void PerforcePlugin::logRepository() void PerforcePlugin::filelog(const QString &workingDir, const QStringList &fileNames, bool enableAnnotationContextMenu) { - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, fileNames); - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, fileNames); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir, fileNames); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(workingDir, fileNames); QStringList args; args << QLatin1String("filelog") << QLatin1String("-li"); if (m_settings.logCount() > 0) @@ -805,11 +805,11 @@ void PerforcePlugin::filelog(const QString &workingDir, const QStringList &fileN CommandToWindow|StdErrToWindow|ErrorToWindow, QStringList(), QByteArray(), codec); if (!result.error) { - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, fileNames); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, fileNames); Core::IEditor *editor = showOutputInEditor(tr("p4 filelog %1").arg(id), result.stdOut, VCSBase::LogOutput, source, codec); if (enableAnnotationContextMenu) - VCSBase::VCSBaseEditor::getVcsBaseEditor(editor)->setFileLogAnnotateEnabled(true); + VCSBase::VCSBaseEditorWidget::getVcsBaseEditor(editor)->setFileLogAnnotateEnabled(true); } } @@ -1203,7 +1203,7 @@ Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const Q e->setSuggestedFileName(s); if (codec) e->setCodec(codec); - Core::IEditor *ie = e->editableInterface(); + Core::IEditor *ie = e->editor(); Core::EditorManager::instance()->activateEditor(ie, Core::EditorManager::ModeSwitch); return ie; } @@ -1217,9 +1217,9 @@ void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files) { Core::IEditor *existingEditor = 0; - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files); - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files); - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(workingDir, files); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir, files); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, files); // Reuse existing editors for that id foreach (Core::IEditor *ed, Core::EditorManager::instance()->openedEditors()) { @@ -1248,7 +1248,7 @@ void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files) Core::EditorManager::instance()->activateEditor(existingEditor, Core::EditorManager::ModeSwitch); } else { Core::IEditor *editor = showOutputInEditor(tr("p4 diff %1").arg(id), result.stdOut, VCSBase::DiffOutput, - VCSBase::VCSBaseEditor::getSource(workingDir, files), + VCSBase::VCSBaseEditorWidget::getSource(workingDir, files), codec); editor->file()->setProperty("originalFileName", id); } @@ -1256,7 +1256,7 @@ void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files) void PerforcePlugin::describe(const QString & source, const QString &n) { - QTextCodec *codec = source.isEmpty() ? static_cast(0) : VCSBase::VCSBaseEditor::getCodec(source); + QTextCodec *codec = source.isEmpty() ? static_cast(0) : VCSBase::VCSBaseEditorWidget::getCodec(source); QStringList args; args << QLatin1String("describe") << QLatin1String("-du") << n; const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow, diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp index 0cc7cc8138..0af381884f 100644 --- a/src/plugins/projectexplorer/editorconfiguration.cpp +++ b/src/plugins/projectexplorer/editorconfiguration.cpp @@ -161,7 +161,7 @@ void EditorConfiguration::apply(ITextEditor *textEditor) const { if (!m_d->m_useGlobal) { textEditor->setTextCodec(m_d->m_textCodec, ITextEditor::TextCodecFromProjectSetting); - if (BaseTextEditor *baseTextEditor = qobject_cast(textEditor->widget())) + if (BaseTextEditorWidget *baseTextEditor = qobject_cast(textEditor->widget())) switchSettings(baseTextEditor); } } @@ -172,7 +172,7 @@ void EditorConfiguration::setUseGlobalSettings(bool use) const SessionManager *session = ProjectExplorerPlugin::instance()->session(); QList opened = Core::EditorManager::instance()->openedEditors(); foreach (Core::IEditor *editor, opened) { - if (BaseTextEditor *baseTextEditor = qobject_cast(editor->widget())) { + if (BaseTextEditorWidget *baseTextEditor = qobject_cast(editor->widget())) { Project *project = session->projectForFile(editor->file()->fileName()); if (project && project->editorConfiguration() == this) switchSettings(baseTextEditor); @@ -180,7 +180,7 @@ void EditorConfiguration::setUseGlobalSettings(bool use) } } -void EditorConfiguration::switchSettings(BaseTextEditor *baseTextEditor) const +void EditorConfiguration::switchSettings(BaseTextEditorWidget *baseTextEditor) const { if (m_d->m_useGlobal) switchSettings_helper(TextEditorSettings::instance(), this, baseTextEditor); @@ -191,7 +191,7 @@ void EditorConfiguration::switchSettings(BaseTextEditor *baseTextEditor) const template void EditorConfiguration::switchSettings_helper(const NewSenderT *newSender, const OldSenderT *oldSender, - BaseTextEditor *baseTextEditor) const + BaseTextEditorWidget *baseTextEditor) const { baseTextEditor->setTabSettings(newSender->tabSettings()); baseTextEditor->setStorageSettings(newSender->storageSettings()); @@ -339,7 +339,7 @@ void EditorConfiguration::emitExtraEncodingSettingsChanged() emit extraEncodingSettingsChanged(m_d->m_extraEncodingSettings); } -const TabSettings &actualTabSettings(const QString &fileName, const BaseTextEditor *baseTextEditor) +const TabSettings &actualTabSettings(const QString &fileName, const BaseTextEditorWidget *baseTextEditor) { if (baseTextEditor) { return baseTextEditor->tabSettings(); diff --git a/src/plugins/projectexplorer/editorconfiguration.h b/src/plugins/projectexplorer/editorconfiguration.h index d6e5bdbce8..75d7e54d41 100644 --- a/src/plugins/projectexplorer/editorconfiguration.h +++ b/src/plugins/projectexplorer/editorconfiguration.h @@ -42,7 +42,7 @@ namespace TextEditor { class ITextEditor; -class BaseTextEditor; +class BaseTextEditorWidget; class TabSettings; class StorageSettings; class BehaviorSettings; @@ -109,11 +109,11 @@ private slots: void setTextCodec(QTextCodec *textCodec); private: - void switchSettings(TextEditor::BaseTextEditor *baseTextEditor) const; + void switchSettings(TextEditor::BaseTextEditorWidget *baseTextEditor) const; template void switchSettings_helper(const NewSenderT *newSender, const OldSenderT *oldSender, - TextEditor::BaseTextEditor *baseTextEditor) const; + TextEditor::BaseTextEditorWidget *baseTextEditor) const; void emitTabSettingsChanged(); void emitStorageSettingsChanged(); @@ -127,7 +127,7 @@ private: // the file belongs to and return the project settings. If the file doesn't belong to any // project return the global settings. PROJECTEXPLORER_EXPORT const TextEditor::TabSettings &actualTabSettings( - const QString &fileName, const TextEditor::BaseTextEditor *baseTextEditor); + const QString &fileName, const TextEditor::BaseTextEditorWidget *baseTextEditor); } // ProjectExplorer diff --git a/src/plugins/projectexplorer/showineditortaskhandler.cpp b/src/plugins/projectexplorer/showineditortaskhandler.cpp index 83a55dfda4..0225853118 100644 --- a/src/plugins/projectexplorer/showineditortaskhandler.cpp +++ b/src/plugins/projectexplorer/showineditortaskhandler.cpp @@ -58,7 +58,7 @@ bool ShowInEditorTaskHandler::canHandle(const ProjectExplorer::Task &task) void ShowInEditorTaskHandler::handle(const ProjectExplorer::Task &task) { QFileInfo fi(task.file); - TextEditor::BaseTextEditor::openEditorAt(fi.canonicalFilePath(), task.line); + TextEditor::BaseTextEditorWidget::openEditorAt(fi.canonicalFilePath(), task.line); } QAction *ShowInEditorTaskHandler::createAction(QObject *parent) diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp index 34c04b9b1e..357cb65fa8 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp @@ -269,7 +269,7 @@ QList DesignDocumentController::loadMaster(QPlainTextEdit * connect(edit, SIGNAL(modificationChanged(bool)), this, SIGNAL(dirtyStateChanged(bool))); - m_d->textModifier = new BaseTextEditModifier(dynamic_cast(m_d->textEdit.data())); + m_d->textModifier = new BaseTextEditModifier(dynamic_cast(m_d->textEdit.data())); m_d->componentTextModifier = 0; diff --git a/src/plugins/qmldesigner/designercore/include/basetexteditmodifier.h b/src/plugins/qmldesigner/designercore/include/basetexteditmodifier.h index c25f32dffc..7b97ab1cc9 100644 --- a/src/plugins/qmldesigner/designercore/include/basetexteditmodifier.h +++ b/src/plugins/qmldesigner/designercore/include/basetexteditmodifier.h @@ -51,7 +51,7 @@ namespace QmlDesigner { class CORESHARED_EXPORT BaseTextEditModifier: public PlainTextEditModifier { public: - BaseTextEditModifier(TextEditor::BaseTextEditor *textEdit); + BaseTextEditModifier(TextEditor::BaseTextEditorWidget *textEdit); virtual void indent(int offset, int length); diff --git a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp index 13ec4d1cbc..0f6b34de32 100644 --- a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp +++ b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp @@ -41,7 +41,7 @@ using namespace QmlDesigner; -BaseTextEditModifier::BaseTextEditModifier(TextEditor::BaseTextEditor *textEdit): +BaseTextEditModifier::BaseTextEditModifier(TextEditor::BaseTextEditorWidget *textEdit): PlainTextEditModifier(textEdit) { } @@ -51,7 +51,7 @@ void BaseTextEditModifier::indent(int offset, int length) if (length == 0 || offset < 0 || offset + length >= text().length()) return; - if (TextEditor::BaseTextEditor *bte = qobject_cast(plainTextEdit())) { + if (TextEditor::BaseTextEditorWidget *bte = qobject_cast(plainTextEdit())) { // find the applicable block: QTextDocument *doc = bte->document(); QTextCursor tc(doc); @@ -65,7 +65,7 @@ void BaseTextEditModifier::indent(int offset, int length) int BaseTextEditModifier::indentDepth() const { - if (TextEditor::BaseTextEditor *bte = qobject_cast(plainTextEdit())) { + if (TextEditor::BaseTextEditorWidget *bte = qobject_cast(plainTextEdit())) { return bte->tabSettings().m_indentSize; } else { return 0; @@ -74,7 +74,7 @@ int BaseTextEditModifier::indentDepth() const bool BaseTextEditModifier::renameId(const QString &oldId, const QString &newId) { - if (QmlJSEditor::QmlJSTextEditor *qmljse = qobject_cast(plainTextEdit())) { + if (QmlJSEditor::QmlJSTextEditorWidget *qmljse = qobject_cast(plainTextEdit())) { qmljse->renameId(oldId, newId); return true; } else { diff --git a/src/plugins/qmljseditor/qmljscodecompletion.cpp b/src/plugins/qmljseditor/qmljscodecompletion.cpp index 7da80f8e93..f4b41c5008 100644 --- a/src/plugins/qmljseditor/qmljscodecompletion.cpp +++ b/src/plugins/qmljseditor/qmljscodecompletion.cpp @@ -501,7 +501,7 @@ CodeCompletion::CodeCompletion(ModelManagerInterface *modelManager, QObject *par CodeCompletion::~CodeCompletion() { } -TextEditor::ITextEditable *CodeCompletion::editor() const +TextEditor::ITextEditor *CodeCompletion::editor() const { return m_editor; } int CodeCompletion::startPosition() const @@ -510,9 +510,9 @@ int CodeCompletion::startPosition() const bool CodeCompletion::shouldRestartCompletion() { return m_restartCompletion; } -bool CodeCompletion::supportsEditor(TextEditor::ITextEditable *editor) const +bool CodeCompletion::supportsEditor(TextEditor::ITextEditor *editor) const { - if (qobject_cast(editor->widget())) + if (qobject_cast(editor->widget())) return true; return false; @@ -523,12 +523,12 @@ bool CodeCompletion::supportsPolicy(TextEditor::CompletionPolicy policy) const return policy == TextEditor::SemanticCompletion; } -bool CodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) +bool CodeCompletion::triggersCompletion(TextEditor::ITextEditor *editor) { if (maybeTriggersCompletion(editor)) { // check the token under cursor - if (QmlJSTextEditor *ed = qobject_cast(editor->widget())) { + if (QmlJSTextEditorWidget *ed = qobject_cast(editor->widget())) { QTextCursor tc = ed->textCursor(); QTextBlock block = tc.block(); @@ -557,7 +557,7 @@ bool CodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) return false; } -bool CodeCompletion::maybeTriggersCompletion(TextEditor::ITextEditable *editor) +bool CodeCompletion::maybeTriggersCompletion(TextEditor::ITextEditor *editor) { const int cursorPosition = editor->position(); const QChar ch = editor->characterAt(cursorPosition - 1); @@ -744,13 +744,13 @@ static const Interpreter::Value *getPropertyValue( return value; } -int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor) +int CodeCompletion::startCompletion(TextEditor::ITextEditor *editor) { m_restartCompletion = false; m_editor = editor; - QmlJSTextEditor *edit = qobject_cast(m_editor->widget()); + QmlJSTextEditorWidget *edit = qobject_cast(m_editor->widget()); if (! edit) return -1; @@ -1028,7 +1028,7 @@ void CodeCompletion::complete(const TextEditor::CompletionItem &item, QChar type QString toInsert = item.text; - if (QmlJSTextEditor *edit = qobject_cast(m_editor->widget())) { + if (QmlJSTextEditorWidget *edit = qobject_cast(m_editor->widget())) { if (item.data.isValid()) { QTextCursor tc = edit->textCursor(); tc.setPosition(m_startPosition, QTextCursor::KeepAnchor); @@ -1057,7 +1057,7 @@ void CodeCompletion::complete(const TextEditor::CompletionItem &item, QChar type } const int length = m_editor->position() - m_startPosition + replacedLength; - m_editor->setCurPos(m_startPosition); + m_editor->setCursorPosition(m_startPosition); m_editor->replace(length, toInsert); if (toInsert.endsWith(QLatin1Char('.'))) diff --git a/src/plugins/qmljseditor/qmljscodecompletion.h b/src/plugins/qmljseditor/qmljscodecompletion.h index ee4d8d0664..de9d75546d 100644 --- a/src/plugins/qmljseditor/qmljscodecompletion.h +++ b/src/plugins/qmljseditor/qmljscodecompletion.h @@ -41,7 +41,7 @@ #include namespace TextEditor { -class ITextEditable; +class ITextEditor; } namespace QmlJS { @@ -66,13 +66,13 @@ public: explicit CodeCompletion(QmlJS::ModelManagerInterface *modelManager, QObject *parent = 0); virtual ~CodeCompletion(); - virtual TextEditor::ITextEditable *editor() const; + virtual TextEditor::ITextEditor *editor() const; virtual int startPosition() const; virtual bool shouldRestartCompletion(); - virtual bool supportsEditor(TextEditor::ITextEditable *editor) const; + virtual bool supportsEditor(TextEditor::ITextEditor *editor) const; virtual bool supportsPolicy(TextEditor::CompletionPolicy policy) const; - virtual bool triggersCompletion(TextEditor::ITextEditable *editor); - virtual int startCompletion(TextEditor::ITextEditable *editor); + virtual bool triggersCompletion(TextEditor::ITextEditor *editor); + virtual int startCompletion(TextEditor::ITextEditor *editor); virtual void completions(QList *completions); virtual bool typedCharCompletes(const TextEditor::CompletionItem &item, QChar typedChar); virtual void complete(const TextEditor::CompletionItem &item, QChar typedChar); @@ -84,7 +84,7 @@ public: private: - bool maybeTriggersCompletion(TextEditor::ITextEditable *editor); + bool maybeTriggersCompletion(TextEditor::ITextEditor *editor); bool isDelimiter(QChar ch) const; bool completeUrl(const QString &relativeBasePath, const QString &urlString); @@ -100,7 +100,7 @@ private: const QIcon &icon, int relevance, bool afterOn); QmlJS::ModelManagerInterface *m_modelManager; - TextEditor::ITextEditable *m_editor; + TextEditor::ITextEditor *m_editor; int m_startPosition; bool m_restartCompletion; TextEditor::SnippetCollector m_snippetProvider; diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 0eac867b7e..cb06d4d250 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -603,8 +603,8 @@ int SemanticInfo::revision() const return 0; } -QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : - TextEditor::BaseTextEditor(parent), +QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) : + TextEditor::BaseTextEditorWidget(parent), m_outlineCombo(0), m_outlineModel(new QmlOutlineModel(this)), m_modelManager(0), @@ -689,23 +689,23 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : setRequestMarkEnabled(true); } -QmlJSTextEditor::~QmlJSTextEditor() +QmlJSTextEditorWidget::~QmlJSTextEditorWidget() { m_semanticHighlighter->abort(); m_semanticHighlighter->wait(); } -SemanticInfo QmlJSTextEditor::semanticInfo() const +SemanticInfo QmlJSTextEditorWidget::semanticInfo() const { return m_semanticInfo; } -int QmlJSTextEditor::editorRevision() const +int QmlJSTextEditorWidget::editorRevision() const { return document()->revision(); } -bool QmlJSTextEditor::isOutdated() const +bool QmlJSTextEditorWidget::isOutdated() const { if (m_semanticInfo.revision() != editorRevision()) return true; @@ -713,12 +713,12 @@ bool QmlJSTextEditor::isOutdated() const return false; } -QmlOutlineModel *QmlJSTextEditor::outlineModel() const +QmlOutlineModel *QmlJSTextEditorWidget::outlineModel() const { return m_outlineModel; } -QModelIndex QmlJSTextEditor::outlineModelIndex() +QModelIndex QmlJSTextEditorWidget::outlineModelIndex() { if (!m_outlineModelIndex.isValid()) { m_outlineModelIndex = indexForPosition(position()); @@ -729,10 +729,10 @@ QModelIndex QmlJSTextEditor::outlineModelIndex() Core::IEditor *QmlJSEditorEditable::duplicate(QWidget *parent) { - QmlJSTextEditor *newEditor = new QmlJSTextEditor(parent); - newEditor->duplicateFrom(editor()); + QmlJSTextEditorWidget *newEditor = new QmlJSTextEditorWidget(parent); + newEditor->duplicateFrom(editorWidget()); QmlJSEditorPlugin::instance()->initializeEditor(newEditor); - return newEditor->editableInterface(); + return newEditor->editor(); } QString QmlJSEditorEditable::id() const @@ -742,8 +742,8 @@ QString QmlJSEditorEditable::id() const bool QmlJSEditorEditable::open(const QString &fileName) { - bool b = TextEditor::BaseTextEditorEditable::open(fileName); - editor()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); + bool b = TextEditor::BaseTextEditor::open(fileName); + editorWidget()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); return b; } @@ -752,12 +752,12 @@ Core::Context QmlJSEditorEditable::context() const return m_context; } -void QmlJSTextEditor::updateDocument() +void QmlJSTextEditorWidget::updateDocument() { m_updateDocumentTimer->start(UPDATE_DOCUMENT_DEFAULT_INTERVAL); } -void QmlJSTextEditor::updateDocumentNow() +void QmlJSTextEditorWidget::updateDocumentNow() { // ### move in the parser thread. @@ -804,7 +804,7 @@ static void appendExtraSelectionsForMessages( } } -void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc) +void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc) { if (file()->fileName() != doc->fileName() || doc->editorRevision() != document()->revision()) { @@ -824,13 +824,13 @@ void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc) } } -void QmlJSTextEditor::modificationChanged(bool changed) +void QmlJSTextEditorWidget::modificationChanged(bool changed) { if (!changed && m_modelManager) m_modelManager->fileChangedOnDisk(file()->fileName()); } -void QmlJSTextEditor::jumpToOutlineElement(int /*index*/) +void QmlJSTextEditorWidget::jumpToOutlineElement(int /*index*/) { QModelIndex index = m_outlineCombo->view()->currentIndex(); AST::SourceLocation location = m_outlineModel->sourceLocation(index); @@ -849,7 +849,7 @@ void QmlJSTextEditor::jumpToOutlineElement(int /*index*/) setFocus(); } -void QmlJSTextEditor::updateOutlineNow() +void QmlJSTextEditorWidget::updateOutlineNow() { if (!m_semanticInfo.document) return; @@ -867,7 +867,7 @@ void QmlJSTextEditor::updateOutlineNow() updateOutlineIndexNow(); } -void QmlJSTextEditor::updateOutlineIndexNow() +void QmlJSTextEditorWidget::updateOutlineIndexNow() { if (m_updateOutlineTimer->isActive()) return; // updateOutlineNow will call this function soon anyway @@ -904,7 +904,7 @@ static UiQualifiedId *qualifiedTypeNameId(Node *m) return 0; } -void QmlJSTextEditor::updateCursorPositionNow() +void QmlJSTextEditorWidget::updateCursorPositionNow() { if (m_contextPane && document() && semanticInfo().isValid() && document()->revision() == semanticInfo().document->editorRevision()) @@ -912,8 +912,8 @@ void QmlJSTextEditor::updateCursorPositionNow() Node *oldNode = m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition); Node *newNode = m_semanticInfo.declaringMemberNoProperties(position()); if (oldNode != newNode && m_oldCursorPosition != -1) - m_contextPane->apply(editableInterface(), semanticInfo().document, LookupContext::Ptr(),newNode, false); - if (m_contextPane->isAvailable(editableInterface(), semanticInfo().document, newNode) && + m_contextPane->apply(editor(), semanticInfo().document, LookupContext::Ptr(),newNode, false); + if (m_contextPane->isAvailable(editor(), semanticInfo().document, newNode) && !m_contextPane->widget()->isVisible()) { QList markers; if (UiObjectMember *m = newNode->uiObjectMemberCast()) { @@ -946,28 +946,28 @@ void QmlJSTextEditor::updateCursorPositionNow() } } -void QmlJSTextEditor::showTextMarker() +void QmlJSTextEditorWidget::showTextMarker() { m_oldCursorPosition = -1; updateCursorPositionNow(); } -void QmlJSTextEditor::updateUses() +void QmlJSTextEditorWidget::updateUses() { m_updateUsesTimer->start(); } -bool QmlJSTextEditor::updateSelectedElements() const +bool QmlJSTextEditorWidget::updateSelectedElements() const { return m_updateSelectedElements; } -void QmlJSTextEditor::setUpdateSelectedElements(bool value) +void QmlJSTextEditorWidget::setUpdateSelectedElements(bool value) { m_updateSelectedElements = value; } -void QmlJSTextEditor::renameId(const QString &oldId, const QString &newId) +void QmlJSTextEditorWidget::renameId(const QString &oldId, const QString &newId) { Utils::ChangeSet changeSet; @@ -979,7 +979,7 @@ void QmlJSTextEditor::renameId(const QString &oldId, const QString &newId) changeSet.apply(&tc); } -void QmlJSTextEditor::updateUsesNow() +void QmlJSTextEditorWidget::updateUsesNow() { if (document()->revision() != m_semanticInfo.revision()) { updateUses(); @@ -1110,7 +1110,7 @@ protected: } }; -void QmlJSTextEditor::setSelectedElements() +void QmlJSTextEditorWidget::setSelectedElements() { if (!m_updateSelectedElements) return; @@ -1148,11 +1148,11 @@ void QmlJSTextEditor::setSelectedElements() emit selectedElementsChanged(offsets, wordAtCursor); } -void QmlJSTextEditor::updateFileName() +void QmlJSTextEditorWidget::updateFileName() { } -void QmlJSTextEditor::renameIdUnderCursor() +void QmlJSTextEditorWidget::renameIdUnderCursor() { const QString id = wordUnderCursor(); bool ok = false; @@ -1166,9 +1166,9 @@ void QmlJSTextEditor::renameIdUnderCursor() } } -void QmlJSTextEditor::setFontSettings(const TextEditor::FontSettings &fs) +void QmlJSTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { - TextEditor::BaseTextEditor::setFontSettings(fs); + TextEditor::BaseTextEditorWidget::setFontSettings(fs); Highlighter *highlighter = qobject_cast(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; @@ -1190,7 +1190,7 @@ void QmlJSTextEditor::setFontSettings(const TextEditor::FontSettings &fs) } -QString QmlJSTextEditor::wordUnderCursor() const +QString QmlJSTextEditorWidget::wordUnderCursor() const { QTextCursor tc = textCursor(); const QChar ch = characterAt(tc.position() - 1); @@ -1203,7 +1203,7 @@ QString QmlJSTextEditor::wordUnderCursor() const return word; } -bool QmlJSTextEditor::isClosingBrace(const QList &tokens) const +bool QmlJSTextEditorWidget::isClosingBrace(const QList &tokens) const { if (tokens.size() == 1) { @@ -1215,14 +1215,14 @@ bool QmlJSTextEditor::isClosingBrace(const QList &tokens) const return false; } -TextEditor::BaseTextEditorEditable *QmlJSTextEditor::createEditableInterface() +TextEditor::BaseTextEditor *QmlJSTextEditorWidget::createEditor() { QmlJSEditorEditable *editable = new QmlJSEditorEditable(this); createToolBar(editable); return editable; } -void QmlJSTextEditor::createToolBar(QmlJSEditorEditable *editable) +void QmlJSTextEditorWidget::createToolBar(QmlJSEditorEditable *editable) { m_outlineCombo = new QComboBox; m_outlineCombo->setMinimumContentsLength(22); @@ -1253,7 +1253,7 @@ void QmlJSTextEditor::createToolBar(QmlJSEditorEditable *editable) toolBar->insertWidget(actions.first(), m_outlineCombo); } -TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor &cursor, bool /*resolveTarget*/) +TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const QTextCursor &cursor, bool /*resolveTarget*/) { const SemanticInfo semanticInfo = m_semanticInfo; if (! semanticInfo.isValid()) @@ -1267,7 +1267,7 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor & // if it's a file import, link to the file foreach (const Interpreter::ImportInfo &import, semanticInfo.document->bind()->imports()) { if (import.ast() == importAst && import.type() == Interpreter::ImportInfo::FileImport) { - BaseTextEditor::Link link(import.name()); + BaseTextEditorWidget::Link link(import.name()); link.begin = importAst->firstSourceLocation().begin(); link.end = importAst->lastSourceLocation().end(); return link; @@ -1286,7 +1286,7 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor & if (! (value && value->getSourceLocation(&fileName, &line, &column))) return Link(); - BaseTextEditor::Link link; + BaseTextEditorWidget::Link link; link.fileName = fileName; link.line = line; link.column = column - 1; // adjust the column @@ -1314,34 +1314,34 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor & return Link(); } -void QmlJSTextEditor::followSymbolUnderCursor() +void QmlJSTextEditorWidget::followSymbolUnderCursor() { openLink(findLinkAt(textCursor())); } -void QmlJSTextEditor::findUsages() +void QmlJSTextEditorWidget::findUsages() { m_findReferences->findUsages(file()->fileName(), textCursor().position()); } -void QmlJSTextEditor::showContextPane() +void QmlJSTextEditorWidget::showContextPane() { if (m_contextPane && m_semanticInfo.isValid()) { Node *newNode = m_semanticInfo.declaringMemberNoProperties(position()); - m_contextPane->apply(editableInterface(), m_semanticInfo.document, m_semanticInfo.lookupContext(), newNode, false, true); + m_contextPane->apply(editor(), m_semanticInfo.document, m_semanticInfo.lookupContext(), newNode, false, true); m_oldCursorPosition = position(); QList markers; setRefactorMarkers(markers); } } -void QmlJSTextEditor::performQuickFix(int index) +void QmlJSTextEditorWidget::performQuickFix(int index) { TextEditor::QuickFixOperation::Ptr op = m_quickFixes.at(index); op->perform(); } -void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e) +void QmlJSTextEditorWidget::contextMenuEvent(QContextMenuEvent *e) { QMenu *menu = new QMenu(); @@ -1361,7 +1361,7 @@ void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e) connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int))); if (! isOutdated()) { - if (quickFixCollector->startCompletion(editableInterface()) != -1) { + if (quickFixCollector->startCompletion(editor()) != -1) { m_quickFixes = quickFixCollector->quickFixes(); for (int index = 0; index < m_quickFixes.size(); ++index) { @@ -1392,7 +1392,7 @@ void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e) m_quickFixes.clear(); } -bool QmlJSTextEditor::event(QEvent *e) +bool QmlJSTextEditorWidget::event(QEvent *e) { switch (e->type()) { case QEvent::ShortcutOverride: @@ -1407,61 +1407,61 @@ bool QmlJSTextEditor::event(QEvent *e) break; } - return BaseTextEditor::event(e); + return BaseTextEditorWidget::event(e); } -void QmlJSTextEditor::wheelEvent(QWheelEvent *event) +void QmlJSTextEditorWidget::wheelEvent(QWheelEvent *event) { bool visible = false; if (m_contextPane && m_contextPane->widget()->isVisible()) visible = true; - BaseTextEditor::wheelEvent(event); + BaseTextEditorWidget::wheelEvent(event); if (visible) { LookupContext::Ptr lookupContext; if (m_semanticInfo.isValid()) lookupContext = m_semanticInfo.lookupContext(); - m_contextPane->apply(editableInterface(), semanticInfo().document, QmlJS::LookupContext::Ptr(), m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition), false, true); + m_contextPane->apply(editor(), semanticInfo().document, QmlJS::LookupContext::Ptr(), m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition), false, true); } } -void QmlJSTextEditor::resizeEvent(QResizeEvent *event) +void QmlJSTextEditorWidget::resizeEvent(QResizeEvent *event) { - BaseTextEditor::resizeEvent(event); + BaseTextEditorWidget::resizeEvent(event); hideContextPane(); } - void QmlJSTextEditor::scrollContentsBy(int dx, int dy) + void QmlJSTextEditorWidget::scrollContentsBy(int dx, int dy) { - BaseTextEditor::scrollContentsBy(dx, dy); + BaseTextEditorWidget::scrollContentsBy(dx, dy); hideContextPane(); } -void QmlJSTextEditor::unCommentSelection() +void QmlJSTextEditorWidget::unCommentSelection() { Utils::unCommentSelection(this); } -void QmlJSTextEditor::forceSemanticRehighlight() +void QmlJSTextEditorWidget::forceSemanticRehighlight() { m_semanticHighlighter->rehighlight(currentSource(/* force = */ true)); } -void QmlJSEditor::QmlJSTextEditor::forceSemanticRehighlightIfCurrentEditor() +void QmlJSEditor::QmlJSTextEditorWidget::forceSemanticRehighlightIfCurrentEditor() { Core::EditorManager *editorManager = Core::EditorManager::instance(); - if (editorManager->currentEditor() == editableInterface()) + if (editorManager->currentEditor() == editor()) forceSemanticRehighlight(); } -void QmlJSTextEditor::semanticRehighlight() +void QmlJSTextEditorWidget::semanticRehighlight() { m_semanticHighlighter->rehighlight(currentSource()); } -void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) +void QmlJSTextEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo) { if (semanticInfo.revision() != document()->revision()) { // got outdated semantic info @@ -1486,7 +1486,7 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) if (m_contextPane) { Node *newNode = m_semanticInfo.declaringMemberNoProperties(position()); if (newNode) { - m_contextPane->apply(editableInterface(), semanticInfo.document, LookupContext::Ptr(), newNode, true); + m_contextPane->apply(editor(), semanticInfo.document, LookupContext::Ptr(), newNode, true); m_cursorPositionTimer->start(); //update text marker } } @@ -1501,17 +1501,17 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) setExtraSelections(CodeWarningsSelection, selections); } -void QmlJSTextEditor::onRefactorMarkerClicked(const TextEditor::RefactorMarker &) +void QmlJSTextEditorWidget::onRefactorMarkerClicked(const TextEditor::RefactorMarker &) { showContextPane(); } -void QmlJSTextEditor::onCursorPositionChanged() +void QmlJSTextEditorWidget::onCursorPositionChanged() { m_cursorPositionTimer->start(); } -QModelIndex QmlJSTextEditor::indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex) const +QModelIndex QmlJSTextEditorWidget::indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex) const { QModelIndex lastIndex = rootIndex; @@ -1535,16 +1535,16 @@ QModelIndex QmlJSTextEditor::indexForPosition(unsigned cursorPosition, const QMo return lastIndex; } -bool QmlJSTextEditor::hideContextPane() +bool QmlJSTextEditorWidget::hideContextPane() { bool b = (m_contextPane) && m_contextPane->widget()->isVisible(); if (b) { - m_contextPane->apply(editableInterface(), semanticInfo().document, LookupContext::Ptr(), 0, false); + m_contextPane->apply(editor(), semanticInfo().document, LookupContext::Ptr(), 0, false); } return b; } -QVector QmlJSTextEditor::highlighterFormatCategories() +QVector QmlJSTextEditorWidget::highlighterFormatCategories() { /* NumberFormat, @@ -1568,7 +1568,7 @@ QVector QmlJSTextEditor::highlighterFormatCategories() return categories; } -SemanticHighlighterSource QmlJSTextEditor::currentSource(bool force) +SemanticHighlighterSource QmlJSTextEditorWidget::currentSource(bool force) { int line = 0, column = 0; convertPosition(position(), &line, &column); diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 51e7a6fddd..7b4ed1c57d 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -137,13 +137,13 @@ private: friend class Internal::SemanticHighlighter; }; -class QMLJSEDITOR_EXPORT QmlJSTextEditor : public TextEditor::BaseTextEditor +class QMLJSEDITOR_EXPORT QmlJSTextEditorWidget : public TextEditor::BaseTextEditorWidget { Q_OBJECT public: - QmlJSTextEditor(QWidget *parent = 0); - ~QmlJSTextEditor(); + QmlJSTextEditorWidget(QWidget *parent = 0); + ~QmlJSTextEditorWidget(); virtual void unCommentSelection(); @@ -205,9 +205,9 @@ protected: void wheelEvent(QWheelEvent *event); void resizeEvent(QResizeEvent *event); void scrollContentsBy(int dx, int dy); - TextEditor::BaseTextEditorEditable *createEditableInterface(); + TextEditor::BaseTextEditor *createEditor(); void createToolBar(QmlJSEditorEditable *editable); - TextEditor::BaseTextEditor::Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true); + TextEditor::BaseTextEditorWidget::Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true); private: bool isClosingBrace(const QList &tokens) const; diff --git a/src/plugins/qmljseditor/qmljseditoreditable.cpp b/src/plugins/qmljseditor/qmljseditoreditable.cpp index 3968ecf885..5bc678dff5 100644 --- a/src/plugins/qmljseditor/qmljseditoreditable.cpp +++ b/src/plugins/qmljseditor/qmljseditoreditable.cpp @@ -47,8 +47,8 @@ namespace QmlJSEditor { -QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditor *editor) - : BaseTextEditorEditable(editor) +QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditorWidget *editor) + : BaseTextEditor(editor) { m_context.add(QmlJSEditor::Constants::C_QMLJSEDITOR_ID); m_context.add(TextEditor::Constants::C_TEXTEDITOR); @@ -87,7 +87,7 @@ QString QmlJSEditorEditable::preferredModeType() const // if we are in other mode than edit or design, use the hard-coded default. // because the editor opening decision is modal, it would be confusing to // have the user also access to this failsafe setting. - if (editor()->mimeType() == QLatin1String(QmlJSEditor::Constants::QML_MIMETYPE) + if (editorWidget()->mimeType() == QLatin1String(QmlJSEditor::Constants::QML_MIMETYPE) && openInDesignMode()) return QLatin1String(Core::Constants::MODE_DESIGN_TYPE); return QString(); @@ -97,7 +97,7 @@ void QmlJSEditorEditable::setTextCodec(QTextCodec *codec, TextCodecReason reason { if (reason != TextCodecOtherReason) // qml is defined to be utf8 return; - editor()->setTextCodec(codec); + editorWidget()->setTextCodec(codec); } } // namespace QmlJSEditor diff --git a/src/plugins/qmljseditor/qmljseditoreditable.h b/src/plugins/qmljseditor/qmljseditoreditable.h index 984512f847..7df03f7b4e 100644 --- a/src/plugins/qmljseditor/qmljseditoreditable.h +++ b/src/plugins/qmljseditor/qmljseditoreditable.h @@ -38,14 +38,14 @@ #include namespace QmlJSEditor { -class QmlJSTextEditor; +class QmlJSTextEditorWidget; -class QMLJSEDITOR_EXPORT QmlJSEditorEditable : public TextEditor::BaseTextEditorEditable +class QMLJSEDITOR_EXPORT QmlJSEditorEditable : public TextEditor::BaseTextEditor { Q_OBJECT public: - explicit QmlJSEditorEditable(QmlJSTextEditor *); + explicit QmlJSEditorEditable(QmlJSTextEditorWidget *); Core::Context context() const; bool duplicateSupported() const { return true; } diff --git a/src/plugins/qmljseditor/qmljseditorfactory.cpp b/src/plugins/qmljseditor/qmljseditorfactory.cpp index ea94012826..6689cf827f 100644 --- a/src/plugins/qmljseditor/qmljseditorfactory.cpp +++ b/src/plugins/qmljseditor/qmljseditorfactory.cpp @@ -130,9 +130,9 @@ Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent) SLOT(updateEditorInfoBar(Core::IEditor*))); } } - QmlJSEditor::QmlJSTextEditor *rc = new QmlJSEditor::QmlJSTextEditor(parent); + QmlJSEditor::QmlJSTextEditorWidget *rc = new QmlJSEditor::QmlJSTextEditorWidget(parent); QmlJSEditorPlugin::instance()->initializeEditor(rc); - return rc->editableInterface(); + return rc->editor(); } QStringList QmlJSEditorFactory::mimeTypes() const diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 875ed97fbf..11703b789c 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -264,7 +264,7 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlJSEditorPlugin::aboutToShutdown() return IPlugin::aboutToShutdown(); } -void QmlJSEditorPlugin::initializeEditor(QmlJSEditor::QmlJSTextEditor *editor) +void QmlJSEditorPlugin::initializeEditor(QmlJSEditor::QmlJSTextEditorWidget *editor) { QTC_ASSERT(m_instance, /**/); @@ -277,14 +277,14 @@ void QmlJSEditorPlugin::followSymbolUnderCursor() { Core::EditorManager *em = Core::EditorManager::instance(); - if (QmlJSTextEditor *editor = qobject_cast(em->currentEditor()->widget())) + if (QmlJSTextEditorWidget *editor = qobject_cast(em->currentEditor()->widget())) editor->followSymbolUnderCursor(); } void QmlJSEditorPlugin::findUsages() { Core::EditorManager *em = Core::EditorManager::instance(); - if (QmlJSTextEditor *editor = qobject_cast(em->currentEditor()->widget())) + if (QmlJSTextEditorWidget *editor = qobject_cast(em->currentEditor()->widget())) editor->findUsages(); } @@ -292,7 +292,7 @@ void QmlJSEditorPlugin::showContextPane() { Core::EditorManager *em = Core::EditorManager::instance(); - if (QmlJSTextEditor *editor = qobject_cast(em->currentEditor()->widget())) + if (QmlJSTextEditorWidget *editor = qobject_cast(em->currentEditor()->widget())) editor->showContextPane(); } @@ -311,7 +311,7 @@ Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a, Core::ActionManager QmlJSQuickFixCollector *QmlJSEditorPlugin::quickFixCollector() const { return m_quickFixCollector; } -void QmlJSEditorPlugin::quickFix(TextEditor::ITextEditable *editable) +void QmlJSEditorPlugin::quickFix(TextEditor::ITextEditor *editable) { m_currentTextEditable = editable; quickFixNow(); @@ -323,9 +323,9 @@ void QmlJSEditorPlugin::quickFixNow() return; Core::EditorManager *em = Core::EditorManager::instance(); - QmlJSTextEditor *currentEditor = qobject_cast(em->currentEditor()->widget()); + QmlJSTextEditorWidget *currentEditor = qobject_cast(em->currentEditor()->widget()); - if (QmlJSTextEditor *editor = qobject_cast(m_currentTextEditable->widget())) { + if (QmlJSTextEditorWidget *editor = qobject_cast(m_currentTextEditable->widget())) { if (currentEditor == editor) { if (editor->isOutdated()) { // qDebug() << "TODO: outdated document" << editor->editorRevision() << editor->semanticInfo().revision(); @@ -344,7 +344,7 @@ void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor) if (! editor) return; - else if (QmlJSTextEditor *textEditor = qobject_cast(editor->widget())) { + else if (QmlJSTextEditorWidget *textEditor = qobject_cast(editor->widget())) { textEditor->forceSemanticRehighlight(); } } diff --git a/src/plugins/qmljseditor/qmljseditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h index dfe2c39f8b..79d928e6d5 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.h +++ b/src/plugins/qmljseditor/qmljseditorplugin.h @@ -53,7 +53,7 @@ class IEditor; } namespace TextEditor { -class ITextEditable; +class ITextEditor; } namespace QmlJS { @@ -63,7 +63,7 @@ namespace QmlJS { namespace QmlJSEditor { class QmlFileWizard; -class QmlJSTextEditor; +class QmlJSTextEditorWidget; namespace Internal { @@ -90,7 +90,7 @@ public: QmlJSQuickFixCollector *quickFixCollector() const; - void initializeEditor(QmlJSEditor::QmlJSTextEditor *editor); + void initializeEditor(QmlJSEditor::QmlJSTextEditorWidget *editor); public Q_SLOTS: void followSymbolUnderCursor(); @@ -98,7 +98,7 @@ public Q_SLOTS: void showContextPane(); private Q_SLOTS: - void quickFix(TextEditor::ITextEditable *editable); + void quickFix(TextEditor::ITextEditor *editable); void quickFixNow(); void currentEditorChanged(Core::IEditor *editor); @@ -119,7 +119,7 @@ private: QmlJSQuickFixCollector *m_quickFixCollector; QTimer *m_quickFixTimer; - QPointer m_currentTextEditable; + QPointer m_currentTextEditable; QmlTaskManager *m_qmlTaskManager; }; diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index a92bcbacdb..7197666a8f 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -680,7 +680,7 @@ void FindReferences::searchFinished() void FindReferences::openEditor(const Find::SearchResultItem &item) { if (item.path.size() > 0) { - TextEditor::BaseTextEditor::openEditorAt(item.path.first(), item.lineNumber, item.textMarkPos, + TextEditor::BaseTextEditorWidget::openEditorAt(item.path.first(), item.lineNumber, item.textMarkPos, QString(), Core::EditorManager::ModeSwitch); } else { diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 96292ba8a1..fe4776dbb4 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -109,7 +109,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) if (!m_modelManager) return; - QmlJSEditor::QmlJSTextEditor *qmlEditor = qobject_cast(editor->widget()); + QmlJSEditor::QmlJSTextEditorWidget *qmlEditor = qobject_cast(editor->widget()); if (!qmlEditor) return; @@ -138,10 +138,10 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) setLastHelpItemIdentified(helpItem); } -bool HoverHandler::matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditor *qmlEditor, int pos) +bool HoverHandler::matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditorWidget *qmlEditor, int pos) { foreach (const QTextEdit::ExtraSelection &sel, - qmlEditor->extraSelections(TextEditor::BaseTextEditor::CodeWarningsSelection)) { + qmlEditor->extraSelections(TextEditor::BaseTextEditorWidget::CodeWarningsSelection)) { if (pos >= sel.cursor.selectionStart() && pos <= sel.cursor.selectionEnd()) { setToolTip(sel.format.toolTip()); return true; diff --git a/src/plugins/qmljseditor/qmljshoverhandler.h b/src/plugins/qmljseditor/qmljshoverhandler.h index 998c23500d..9c4ef1a8cc 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.h +++ b/src/plugins/qmljseditor/qmljshoverhandler.h @@ -53,7 +53,7 @@ class ITextEditor; } namespace QmlJSEditor { -class QmlJSTextEditor; +class QmlJSTextEditorWidget; namespace Internal { @@ -72,7 +72,7 @@ private: virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos); virtual void operateTooltip(TextEditor::ITextEditor *editor, const QPoint &point); - bool matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditor *qmlEditor, int pos); + bool matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditorWidget *qmlEditor, int pos); bool matchColorItem(const QmlJS::LookupContext::Ptr &lookupContext, const QmlJS::Document::Ptr &qmlDocument, const QList &astPath, diff --git a/src/plugins/qmljseditor/qmljsindenter.cpp b/src/plugins/qmljseditor/qmljsindenter.cpp index bbd0cab41c..88abfd7174 100644 --- a/src/plugins/qmljseditor/qmljsindenter.cpp +++ b/src/plugins/qmljseditor/qmljsindenter.cpp @@ -64,7 +64,7 @@ bool Indenter::isElectricCharacter(const QChar &ch) const void Indenter::indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - TextEditor::BaseTextEditor *editor) + TextEditor::BaseTextEditorWidget *editor) { Q_UNUSED(doc) Q_UNUSED(editor) diff --git a/src/plugins/qmljseditor/qmljsindenter.h b/src/plugins/qmljseditor/qmljsindenter.h index 934925f6cf..05534425fa 100644 --- a/src/plugins/qmljseditor/qmljsindenter.h +++ b/src/plugins/qmljseditor/qmljsindenter.h @@ -49,7 +49,7 @@ public: virtual void indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - TextEditor::BaseTextEditor *editor); + TextEditor::BaseTextEditorWidget *editor); }; } // Internal diff --git a/src/plugins/qmljseditor/qmljsoutline.cpp b/src/plugins/qmljseditor/qmljsoutline.cpp index 8df2830385..d81be4467b 100644 --- a/src/plugins/qmljseditor/qmljsoutline.cpp +++ b/src/plugins/qmljseditor/qmljsoutline.cpp @@ -125,7 +125,7 @@ QmlJSOutlineWidget::QmlJSOutlineWidget(QWidget *parent) : setLayout(layout); } -void QmlJSOutlineWidget::setEditor(QmlJSTextEditor *editor) +void QmlJSOutlineWidget::setEditor(QmlJSTextEditorWidget *editor) { m_editor = editor; @@ -257,7 +257,7 @@ TextEditor::IOutlineWidget *QmlJSOutlineWidgetFactory::createWidget(Core::IEdito QmlJSOutlineWidget *widget = new QmlJSOutlineWidget; QmlJSEditorEditable *qmlJSEditable = qobject_cast(editor); - QmlJSTextEditor *qmlJSEditor = qobject_cast(qmlJSEditable->widget()); + QmlJSTextEditorWidget *qmlJSEditor = qobject_cast(qmlJSEditable->widget()); Q_ASSERT(qmlJSEditor); widget->setEditor(qmlJSEditor); diff --git a/src/plugins/qmljseditor/qmljsoutline.h b/src/plugins/qmljseditor/qmljsoutline.h index 94519f78cd..d8aa37c28a 100644 --- a/src/plugins/qmljseditor/qmljsoutline.h +++ b/src/plugins/qmljseditor/qmljsoutline.h @@ -75,7 +75,7 @@ class QmlJSOutlineWidget : public TextEditor::IOutlineWidget public: QmlJSOutlineWidget(QWidget *parent = 0); - void setEditor(QmlJSTextEditor *editor); + void setEditor(QmlJSTextEditorWidget *editor); // IOutlineWidget virtual QList filterMenuActions() const; @@ -96,7 +96,7 @@ private: private: QmlJSOutlineTreeView *m_treeView; QmlJSOutlineFilterModel *m_filterModel; - QmlJSTextEditor *m_editor; + QmlJSTextEditorWidget *m_editor; QAction *m_showBindingsAction; diff --git a/src/plugins/qmljseditor/qmljsquickfix.cpp b/src/plugins/qmljseditor/qmljsquickfix.cpp index 7540ae109e..afea7550b7 100644 --- a/src/plugins/qmljseditor/qmljsquickfix.cpp +++ b/src/plugins/qmljseditor/qmljsquickfix.cpp @@ -51,7 +51,7 @@ using namespace QmlJSTools; using namespace TextEditor; using TextEditor::RefactoringChanges; -QmlJSQuickFixState::QmlJSQuickFixState(TextEditor::BaseTextEditor *editor) +QmlJSQuickFixState::QmlJSQuickFixState(TextEditor::BaseTextEditorWidget *editor) : QuickFixState(editor) { } @@ -141,9 +141,9 @@ QmlJSQuickFixCollector::~QmlJSQuickFixCollector() { } -bool QmlJSQuickFixCollector::supportsEditor(TextEditor::ITextEditable *editable) const +bool QmlJSQuickFixCollector::supportsEditor(TextEditor::ITextEditor *editable) const { - return qobject_cast(editable->widget()) != 0; + return qobject_cast(editable->widget()) != 0; } bool QmlJSQuickFixCollector::supportsPolicy(TextEditor::CompletionPolicy policy) const @@ -151,9 +151,9 @@ bool QmlJSQuickFixCollector::supportsPolicy(TextEditor::CompletionPolicy policy) return policy == TextEditor::QuickFixCompletion; } -TextEditor::QuickFixState *QmlJSQuickFixCollector::initializeCompletion(TextEditor::BaseTextEditor *editor) +TextEditor::QuickFixState *QmlJSQuickFixCollector::initializeCompletion(TextEditor::BaseTextEditorWidget *editor) { - if (QmlJSTextEditor *qmljsEditor = qobject_cast(editor)) { + if (QmlJSTextEditorWidget *qmljsEditor = qobject_cast(editor)) { const SemanticInfo info = qmljsEditor->semanticInfo(); if (! info.isValid() || qmljsEditor->isOutdated()) { diff --git a/src/plugins/qmljseditor/qmljsquickfix.h b/src/plugins/qmljseditor/qmljsquickfix.h index ffc5bb004c..ea0f596a12 100644 --- a/src/plugins/qmljseditor/qmljsquickfix.h +++ b/src/plugins/qmljseditor/qmljsquickfix.h @@ -67,7 +67,7 @@ class QmlJSQuickFixState: public TextEditor::QuickFixState public: /// Creates a new state for the given editor. - QmlJSQuickFixState(TextEditor::BaseTextEditor *editor); + QmlJSQuickFixState(TextEditor::BaseTextEditorWidget *editor); SemanticInfo semanticInfo() const; @@ -152,9 +152,9 @@ public: QmlJSQuickFixCollector(); virtual ~QmlJSQuickFixCollector(); - virtual bool supportsEditor(TextEditor::ITextEditable *editor) const; + virtual bool supportsEditor(TextEditor::ITextEditor *editor) const; virtual bool supportsPolicy(TextEditor::CompletionPolicy policy) const; - virtual TextEditor::QuickFixState *initializeCompletion(TextEditor::BaseTextEditor *editor); + virtual TextEditor::QuickFixState *initializeCompletion(TextEditor::BaseTextEditorWidget *editor); virtual QList quickFixFactories() const; diff --git a/src/plugins/qmljseditor/qmljssnippetprovider.cpp b/src/plugins/qmljseditor/qmljssnippetprovider.cpp index 96fee49d95..5369948a94 100644 --- a/src/plugins/qmljseditor/qmljssnippetprovider.cpp +++ b/src/plugins/qmljseditor/qmljssnippetprovider.cpp @@ -66,11 +66,11 @@ QString QmlJSSnippetProvider::displayName() const return QCoreApplication::translate("QmlJSEditor::Internal::QmlJSSnippetProvider", "QML"); } -void QmlJSSnippetProvider::decorateEditor(TextEditor::SnippetEditor *editor) const +void QmlJSSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *editor) const { Highlighter *highlighter = new Highlighter; const TextEditor::FontSettings &fs = TextEditor::TextEditorSettings::instance()->fontSettings(); - highlighter->setFormats(fs.toTextCharFormats(QmlJSTextEditor::highlighterFormatCategories())); + highlighter->setFormats(fs.toTextCharFormats(QmlJSTextEditorWidget::highlighterFormatCategories())); editor->setSyntaxHighlighter(highlighter); editor->setIndenter(new Indenter); editor->setAutoCompleter(new AutoCompleter); diff --git a/src/plugins/qmljseditor/qmljssnippetprovider.h b/src/plugins/qmljseditor/qmljssnippetprovider.h index 90e33ebdec..9e03c2d05c 100644 --- a/src/plugins/qmljseditor/qmljssnippetprovider.h +++ b/src/plugins/qmljseditor/qmljssnippetprovider.h @@ -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 diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp index 05a210edb7..cf0e3b7905 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.cpp +++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp @@ -273,7 +273,7 @@ private: int indent; }; -QmlOutlineModel::QmlOutlineModel(QmlJSTextEditor *editor) : +QmlOutlineModel::QmlOutlineModel(QmlJSTextEditorWidget *editor) : QStandardItemModel(editor), m_textEditor(editor) { diff --git a/src/plugins/qmljseditor/qmloutlinemodel.h b/src/plugins/qmljseditor/qmloutlinemodel.h index 7dea71d19b..e2a3e42472 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.h +++ b/src/plugins/qmljseditor/qmloutlinemodel.h @@ -88,7 +88,7 @@ public: NonElementBindingType // can be filtered out }; - QmlOutlineModel(QmlJSTextEditor *editor); + QmlOutlineModel(QmlJSTextEditorWidget *editor); // QStandardItemModel QStringList mimeTypes() const; @@ -157,7 +157,7 @@ private: QHash m_itemToIcon; QHash m_itemToNode; QHash m_itemToIdNode; - QmlJSTextEditor *m_textEditor; + QmlJSTextEditorWidget *m_textEditor; friend class QmlOutlineModelSync; diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp index 0dcd4a92f3..f302013ff7 100644 --- a/src/plugins/qmljseditor/quicktoolbar.cpp +++ b/src/plugins/qmljseditor/quicktoolbar.cpp @@ -130,7 +130,7 @@ QuickToolBar::~QuickToolBar() m_widget.clear(); } -void QuickToolBar::apply(TextEditor::BaseTextEditorEditable *editor, Document::Ptr document, LookupContext::Ptr lookupContext, AST::Node *node, bool update, bool force) +void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, LookupContext::Ptr lookupContext, AST::Node *node, bool update, bool force) { if (!QuickToolBarSettings::get().enableContextPane && !force && !update) { contextWidget()->hide(); @@ -209,7 +209,7 @@ void QuickToolBar::apply(TextEditor::BaseTextEditorEditable *editor, Document::P QRegion reg; if (line1 > -1 && line2 > -1) - reg = m_editor->editor()->translatedLineRegion(line1 - 1, line2); + reg = m_editor->editorWidget()->translatedLineRegion(line1 - 1, line2); QRect rect; rect.setHeight(widget()->height() + 10); @@ -220,15 +220,15 @@ void QuickToolBar::apply(TextEditor::BaseTextEditorEditable *editor, Document::P if (contextWidget()->acceptsType(m_prototypes)) { m_node = 0; PropertyReader propertyReader(document, initializer); - QTextCursor tc(editor->editor()->document()); + QTextCursor tc(editor->editorWidget()->document()); tc.setPosition(offset); - QPoint p1 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(editor->editor()->cursorRect(tc).topLeft()) - QPoint(0, contextWidget()->height() + 10)); + QPoint p1 = editor->editorWidget()->mapToParent(editor->editorWidget()->viewport()->mapToParent(editor->editorWidget()->cursorRect(tc).topLeft()) - QPoint(0, contextWidget()->height() + 10)); tc.setPosition(end); - QPoint p2 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(editor->editor()->cursorRect(tc).bottomLeft()) + QPoint(0, 10)); + QPoint p2 = editor->editorWidget()->mapToParent(editor->editorWidget()->viewport()->mapToParent(editor->editorWidget()->cursorRect(tc).bottomLeft()) + QPoint(0, 10)); QPoint offset = QPoint(10, 0); if (reg.boundingRect().width() < 400) offset = QPoint(400 - reg.boundingRect().width() + 10 ,0); - QPoint p3 = editor->editor()->mapToParent(editor->editor()->viewport()->mapToParent(reg.boundingRect().topRight()) + offset); + QPoint p3 = editor->editorWidget()->mapToParent(editor->editorWidget()->viewport()->mapToParent(reg.boundingRect().topRight()) + offset); p2.setX(p1.x()); contextWidget()->setType(m_prototypes); if (!update) @@ -255,7 +255,7 @@ void QuickToolBar::apply(TextEditor::BaseTextEditorEditable *editor, Document::P } -bool QuickToolBar::isAvailable(TextEditor::BaseTextEditorEditable *, Document::Ptr document, AST::Node *node) +bool QuickToolBar::isAvailable(TextEditor::BaseTextEditor *, Document::Ptr document, AST::Node *node) { if (document.isNull()) return false; @@ -330,7 +330,7 @@ void QuickToolBar::setProperty(const QString &propertyName, const QVariant &valu int changeSetPos = changeSet.operationList().last().pos1; int changeSetLength = changeSet.operationList().last().text.length(); - QTextCursor tc = m_editor->editor()->textCursor(); + QTextCursor tc = m_editor->editorWidget()->textCursor(); tc.beginEditBlock(); changeSet.apply(&tc); @@ -338,17 +338,17 @@ void QuickToolBar::setProperty(const QString &propertyName, const QVariant &valu m_editor->convertPosition(changeSetPos + changeSetLength, &endLine, &column); //get line if (line > 0) { - TextEditor::TabSettings ts = m_editor->editor()->tabSettings(); + TextEditor::TabSettings ts = m_editor->editorWidget()->tabSettings(); QmlJSIndenter indenter; indenter.setTabSize(ts.m_tabSize); indenter.setIndentSize(ts.m_indentSize); for (int i=line;i<=endLine;i++) { - QTextBlock start = m_editor->editor()->document()->findBlockByNumber(i); - QTextBlock end = m_editor->editor()->document()->findBlockByNumber(i); + QTextBlock start = m_editor->editorWidget()->document()->findBlockByNumber(i); + QTextBlock end = m_editor->editorWidget()->document()->findBlockByNumber(i); if (end.isValid()) { - const int indent = indenter.indentForBottomLine(m_editor->editor()->document()->begin(), end.next(), QChar::Null); + const int indent = indenter.indentForBottomLine(m_editor->editorWidget()->document()->begin(), end.next(), QChar::Null); ts.indentLine(start, indent); } } @@ -374,7 +374,7 @@ void QuickToolBar::removeProperty(const QString &propertyName) Utils::ChangeSet changeSet; Rewriter rewriter(m_doc->source(), &changeSet, m_propertyOrder); rewriter.removeBindingByName(initializer, propertyName); - QTextCursor tc(m_editor->editor()->document()); + QTextCursor tc(m_editor->editorWidget()->document()); changeSet.apply(&tc); } } @@ -414,7 +414,7 @@ void QuickToolBar::onPropertyRemovedAndChange(const QString &remove, const QStri if (!m_doc) return; - QTextCursor tc(m_editor->editor()->document()); + QTextCursor tc(m_editor->editorWidget()->document()); tc.beginEditBlock(); if (removeFirst) { diff --git a/src/plugins/qmljseditor/quicktoolbar.h b/src/plugins/qmljseditor/quicktoolbar.h index 4ecffcb05e..8387af365e 100644 --- a/src/plugins/qmljseditor/quicktoolbar.h +++ b/src/plugins/qmljseditor/quicktoolbar.h @@ -37,7 +37,7 @@ #include namespace TextEditor { -class BaseTextEditorEditable; +class BaseTextEditor; } namespace QmlEditorWidgets { @@ -53,8 +53,8 @@ class QuickToolBar : public QmlJS::IContextPane public: QuickToolBar(QObject *parent = 0); ~QuickToolBar(); - void apply(TextEditor::BaseTextEditorEditable *editor, QmlJS::Document::Ptr document, QmlJS::LookupContext::Ptr lookupContext, QmlJS::AST::Node *node, bool update, bool force = false); - bool isAvailable(TextEditor::BaseTextEditorEditable *editor, QmlJS::Document::Ptr document, QmlJS::AST::Node *node); + void apply(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document, QmlJS::LookupContext::Ptr lookupContext, QmlJS::AST::Node *node, bool update, bool force = false); + bool isAvailable(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document, QmlJS::AST::Node *node); void setProperty(const QString &propertyName, const QVariant &value); void removeProperty(const QString &propertyName); void setEnabled(bool); @@ -72,7 +72,7 @@ private: QWeakPointer m_widget; QmlJS::Document::Ptr m_doc; QmlJS::AST::Node *m_node; - TextEditor::BaseTextEditorEditable *m_editor; + TextEditor::BaseTextEditor *m_editor; bool m_blockWriting; QStringList m_propertyOrder; QStringList m_prototypes; diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp index 0671d6b522..45354880cf 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.cpp +++ b/src/plugins/qmljsinspector/qmljsinspector.cpp @@ -204,8 +204,8 @@ void InspectorUi::showDebuggerTooltip(const QPoint &mousePos, TextEditor::ITextE { Q_UNUSED(mousePos); if (m_clientProxy && editor->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) { - QmlJSEditor::QmlJSTextEditor *qmlEditor = - static_cast(editor->widget()); + QmlJSEditor::QmlJSTextEditorWidget *qmlEditor = + static_cast(editor->widget()); QTextCursor tc(qmlEditor->document()); tc.setPosition(cursorPos); @@ -654,8 +654,8 @@ QDeclarativeDebugObjectReference InspectorUi::objectReferenceForLocation(const Q if (textEditor && m_clientProxy && textEditor->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) { if (cursorPosition == -1) cursorPosition = textEditor->position(); - QmlJSEditor::QmlJSTextEditor *qmlEditor = - static_cast(textEditor->widget()); + QmlJSEditor::QmlJSTextEditorWidget *qmlEditor = + static_cast(textEditor->widget()); if (QmlJS::AST::Node *node = qmlEditor->semanticInfo().declaringMemberNoProperties(cursorPosition)) { diff --git a/src/plugins/qmljsinspector/qmljslivetextpreview.cpp b/src/plugins/qmljsinspector/qmljslivetextpreview.cpp index bc37ebcba9..f25e8cd2c4 100644 --- a/src/plugins/qmljsinspector/qmljslivetextpreview.cpp +++ b/src/plugins/qmljsinspector/qmljslivetextpreview.cpp @@ -143,7 +143,7 @@ QmlJS::ModelManagerInterface *QmlJSLiveTextPreview::modelManager() void QmlJSLiveTextPreview::associateEditor(Core::IEditor *editor) { if (editor->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) { - QmlJSEditor::QmlJSTextEditor* qmljsEditor = qobject_cast(editor->widget()); + QmlJSEditor::QmlJSTextEditorWidget* qmljsEditor = qobject_cast(editor->widget()); if (qmljsEditor && !m_editors.contains(qmljsEditor)) { qmljsEditor->setUpdateSelectedElements(true); m_editors << qmljsEditor; @@ -157,7 +157,7 @@ void QmlJSLiveTextPreview::associateEditor(Core::IEditor *editor) void QmlJSLiveTextPreview::unassociateEditor(Core::IEditor *oldEditor) { if (oldEditor && oldEditor->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) { - QmlJSEditor::QmlJSTextEditor* qmljsEditor = qobject_cast(oldEditor->widget()); + QmlJSEditor::QmlJSTextEditorWidget* qmljsEditor = qobject_cast(oldEditor->widget()); if (qmljsEditor && m_editors.contains(qmljsEditor)) { m_editors.removeOne(qmljsEditor); qmljsEditor->setUpdateSelectedElements(false); @@ -639,12 +639,12 @@ void QmlJSLiveTextPreview::setClientProxy(ClientProxy *clientProxy) connect(m_clientProxy.data(), SIGNAL(objectTreeUpdated()), SLOT(updateDebugIds())); - foreach(QWeakPointer qmlEditor, m_editors) { + foreach(QWeakPointer qmlEditor, m_editors) { if (qmlEditor) qmlEditor.data()->setUpdateSelectedElements(true); } } else { - foreach(QWeakPointer qmlEditor, m_editors) { + foreach(QWeakPointer qmlEditor, m_editors) { if (qmlEditor) qmlEditor.data()->setUpdateSelectedElements(false); } diff --git a/src/plugins/qmljsinspector/qmljslivetextpreview.h b/src/plugins/qmljsinspector/qmljslivetextpreview.h index cedecd617b..61610a5632 100644 --- a/src/plugins/qmljsinspector/qmljslivetextpreview.h +++ b/src/plugins/qmljsinspector/qmljslivetextpreview.h @@ -52,7 +52,7 @@ namespace QmlJS { } namespace QmlJSEditor { - class QmlJSTextEditor; + class QmlJSTextEditorWidget; } namespace QmlJSInspector { @@ -116,7 +116,7 @@ private: QmlJS::Document::Ptr m_initialDoc; //the document that was loaded by the server QString m_filename; - QList > m_editors; + QList > m_editors; bool m_applyChangesToQmlObserver; QmlJS::Document::Ptr m_docWithUnappliedChanges; diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.cpp b/src/plugins/qmljstools/qmljsfunctionfilter.cpp index 1fc9dd8f31..e6c1d29784 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.cpp +++ b/src/plugins/qmljstools/qmljsfunctionfilter.cpp @@ -114,6 +114,6 @@ QList FunctionFilter::matchesFor(QFutureInterface(selection.internalData); - TextEditor::BaseTextEditor::openEditorAt(entry.fileName, entry.line, entry.column, + TextEditor::BaseTextEditorWidget::openEditorAt(entry.fileName, entry.line, entry.column, QString(), Core::EditorManager::ModeSwitch); } diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 754f606b02..50479a17e3 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -142,7 +142,7 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const if (TextEditor::ITextEditor *textEditor = qobject_cast(editor)) { if (textEditor->context().contains(ProjectExplorer::Constants::LANG_QMLJS)) { - if (TextEditor::BaseTextEditor *ed = qobject_cast(textEditor->widget())) { + if (TextEditor::BaseTextEditorWidget *ed = qobject_cast(textEditor->widget())) { workingCopy.insert(key, ed->toPlainText(), ed->document()->revision()); } } diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp index 0b8704ab63..2492348496 100644 --- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp +++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp @@ -63,7 +63,7 @@ QmlJSRefactoringFile QmlJSRefactoringChanges::file(const QString &fileName) void QmlJSRefactoringChanges::indentSelection(const QTextCursor &selection, const QString &fileName, - const TextEditor::BaseTextEditor *textEditor) const + const TextEditor::BaseTextEditorWidget *textEditor) const { // ### shares code with QmlJSTextEditor::indent QTextDocument *doc = selection.document(); @@ -96,7 +96,7 @@ QmlJSRefactoringFile::QmlJSRefactoringFile(const QString &fileName, QmlJSRefacto : RefactoringFile(fileName, refactoringChanges) { } -QmlJSRefactoringFile::QmlJSRefactoringFile(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document) +QmlJSRefactoringFile::QmlJSRefactoringFile(TextEditor::BaseTextEditorWidget *editor, QmlJS::Document::Ptr document) : RefactoringFile() , m_qmljsDocument(document) { diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.h b/src/plugins/qmljstools/qmljsrefactoringchanges.h index f8650ce869..02e02e2858 100644 --- a/src/plugins/qmljstools/qmljsrefactoringchanges.h +++ b/src/plugins/qmljstools/qmljsrefactoringchanges.h @@ -53,7 +53,7 @@ class QMLJSTOOLS_EXPORT QmlJSRefactoringFile: public TextEditor::RefactoringFile public: QmlJSRefactoringFile(); QmlJSRefactoringFile(const QString &fileName, QmlJSRefactoringChanges *refactoringChanges); - QmlJSRefactoringFile(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document); + QmlJSRefactoringFile(TextEditor::BaseTextEditorWidget *editor, QmlJS::Document::Ptr document); QmlJS::Document::Ptr qmljsDocument() const; @@ -86,7 +86,7 @@ public: private: virtual void indentSelection(const QTextCursor &selection, const QString &fileName, - const TextEditor::BaseTextEditor *textEditor) const; + const TextEditor::BaseTextEditorWidget *textEditor) const; virtual void fileChanged(const QString &fileName); private: diff --git a/src/plugins/qt4projectmanager/profilecompletion.cpp b/src/plugins/qt4projectmanager/profilecompletion.cpp index b85cd341d6..885d025902 100644 --- a/src/plugins/qt4projectmanager/profilecompletion.cpp +++ b/src/plugins/qt4projectmanager/profilecompletion.cpp @@ -68,7 +68,7 @@ bool ProFileCompletion::shouldRestartCompletion() return false; } -TextEditor::ITextEditable *ProFileCompletion::editor() const +TextEditor::ITextEditor *ProFileCompletion::editor() const { return m_editor; } @@ -78,9 +78,9 @@ int ProFileCompletion::startPosition() const return m_startPosition; } -bool ProFileCompletion::supportsEditor(TextEditor::ITextEditable *editor) const +bool ProFileCompletion::supportsEditor(TextEditor::ITextEditor *editor) const { - return qobject_cast(editor) != 0; + return qobject_cast(editor) != 0; } bool ProFileCompletion::supportsPolicy(TextEditor::CompletionPolicy policy) const @@ -88,7 +88,7 @@ bool ProFileCompletion::supportsPolicy(TextEditor::CompletionPolicy policy) cons return policy == TextEditor::SemanticCompletion; } -bool ProFileCompletion::triggersCompletion(TextEditor::ITextEditable *editor) +bool ProFileCompletion::triggersCompletion(TextEditor::ITextEditor *editor) { m_editor = editor; const int pos = editor->position(); @@ -128,7 +128,7 @@ bool ProFileCompletion::isInComment() const return false; } -int ProFileCompletion::startCompletion(TextEditor::ITextEditable *editor) +int ProFileCompletion::startCompletion(TextEditor::ITextEditor *editor) { m_editor = editor; m_startPosition = findStartOfName(); @@ -204,10 +204,10 @@ void ProFileCompletion::complete(const TextEditor::CompletionItem &item, QChar t } } - m_editor->setCurPos(m_startPosition); + m_editor->setCursorPosition(m_startPosition); m_editor->replace(replaceLength, toInsert); if (cursorOffset) - m_editor->setCurPos(m_editor->position() + cursorOffset); + m_editor->setCursorPosition(m_editor->position() + cursorOffset); } bool ProFileCompletion::partiallyComplete(const QList &completionItems) diff --git a/src/plugins/qt4projectmanager/profilecompletion.h b/src/plugins/qt4projectmanager/profilecompletion.h index eb30684c3e..9b36df5a2c 100644 --- a/src/plugins/qt4projectmanager/profilecompletion.h +++ b/src/plugins/qt4projectmanager/profilecompletion.h @@ -51,13 +51,13 @@ public: virtual QList getCompletions(); virtual bool shouldRestartCompletion(); - virtual TextEditor::ITextEditable *editor() const; + virtual TextEditor::ITextEditor *editor() const; virtual int startPosition() const; - virtual bool supportsEditor(TextEditor::ITextEditable *editor) const; + virtual bool supportsEditor(TextEditor::ITextEditor *editor) const; virtual bool supportsPolicy(TextEditor::CompletionPolicy policy) const; - virtual bool triggersCompletion(TextEditor::ITextEditable *editor); - virtual int startCompletion(TextEditor::ITextEditable *editor); + virtual bool triggersCompletion(TextEditor::ITextEditor *editor); + virtual int startCompletion(TextEditor::ITextEditor *editor); virtual void completions(QList *completions); virtual bool typedCharCompletes(const TextEditor::CompletionItem &item, QChar typedChar); virtual void complete(const TextEditor::CompletionItem &item, QChar typedChar); @@ -67,7 +67,7 @@ private: int findStartOfName(int pos = -1) const; bool isInComment() const; - TextEditor::ITextEditable *m_editor; + TextEditor::ITextEditor *m_editor; int m_startPosition; const QIcon m_variableIcon; const QIcon m_functionIcon; diff --git a/src/plugins/qt4projectmanager/profileeditor.cpp b/src/plugins/qt4projectmanager/profileeditor.cpp index d9ec2f0e11..6bb066c122 100644 --- a/src/plugins/qt4projectmanager/profileeditor.cpp +++ b/src/plugins/qt4projectmanager/profileeditor.cpp @@ -59,29 +59,29 @@ using namespace Qt4ProjectManager::Internal; // ProFileEditorEditable // -ProFileEditorEditable::ProFileEditorEditable(ProFileEditor *editor) - : BaseTextEditorEditable(editor), +ProFileEditor::ProFileEditor(ProFileEditorWidget *editor) + : BaseTextEditor(editor), m_context(Qt4ProjectManager::Constants::C_PROFILEEDITOR, TextEditor::Constants::C_TEXTEDITOR) { // m_contexts << uidm->uniqueIdentifier(Qt4ProjectManager::Constants::PROJECT_KIND); } -Core::Context ProFileEditorEditable::context() const +Core::Context ProFileEditor::context() const { return m_context; } -Core::IEditor *ProFileEditorEditable::duplicate(QWidget *parent) +Core::IEditor *ProFileEditor::duplicate(QWidget *parent) { - ProFileEditor *ret = new ProFileEditor(parent, qobject_cast(editor())->factory(), - qobject_cast(editor())->actionHandler()); - ret->duplicateFrom(editor()); + ProFileEditorWidget *ret = new ProFileEditorWidget(parent, qobject_cast(editorWidget())->factory(), + qobject_cast(editorWidget())->actionHandler()); + ret->duplicateFrom(editorWidget()); TextEditor::TextEditorSettings::instance()->initializeEditor(ret); - return ret->editableInterface(); + return ret->editor(); } -QString ProFileEditorEditable::id() const +QString ProFileEditor::id() const { return QLatin1String(Qt4ProjectManager::Constants::PROFILE_EDITOR_ID); } @@ -90,8 +90,8 @@ QString ProFileEditorEditable::id() const // ProFileEditorEditor // -ProFileEditor::ProFileEditor(QWidget *parent, ProFileEditorFactory *factory, TextEditor::TextEditorActionHandler *ah) - : BaseTextEditor(parent), m_factory(factory), m_ah(ah) +ProFileEditorWidget::ProFileEditorWidget(QWidget *parent, ProFileEditorFactory *factory, TextEditor::TextEditorActionHandler *ah) + : BaseTextEditorWidget(parent), m_factory(factory), m_ah(ah) { ProFileDocument *doc = new ProFileDocument(); doc->setMimeType(QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE)); @@ -104,11 +104,11 @@ ProFileEditor::ProFileEditor(QWidget *parent, ProFileEditorFactory *factory, Tex m_commentDefinition.setSingleLine(QString(QLatin1Char('#'))); } -ProFileEditor::~ProFileEditor() +ProFileEditorWidget::~ProFileEditorWidget() { } -void ProFileEditor::unCommentSelection() +void ProFileEditorWidget::unCommentSelection() { Utils::unCommentSelection(this, m_commentDefinition); } @@ -125,7 +125,7 @@ static bool isValidFileNameChar(const QChar &c) return false; } -ProFileEditor::Link ProFileEditor::findLinkAt(const QTextCursor &cursor, +ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cursor, bool /* resolveTarget */) { Link link; @@ -202,12 +202,12 @@ ProFileEditor::Link ProFileEditor::findLinkAt(const QTextCursor &cursor, return link; } -TextEditor::BaseTextEditorEditable *ProFileEditor::createEditableInterface() +TextEditor::BaseTextEditor *ProFileEditorWidget::createEditor() { - return new ProFileEditorEditable(this); + return new ProFileEditor(this); } -void ProFileEditor::contextMenuEvent(QContextMenuEvent *e) +void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e) { QMenu *menu = new QMenu(); @@ -224,9 +224,9 @@ void ProFileEditor::contextMenuEvent(QContextMenuEvent *e) delete menu; } -void ProFileEditor::setFontSettings(const TextEditor::FontSettings &fs) +void ProFileEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { - TextEditor::BaseTextEditor::setFontSettings(fs); + TextEditor::BaseTextEditorWidget::setFontSettings(fs); ProFileHighlighter *highlighter = qobject_cast(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; @@ -244,15 +244,15 @@ void ProFileEditor::setFontSettings(const TextEditor::FontSettings &fs) highlighter->rehighlight(); } -void ProFileEditor::addLibrary() +void ProFileEditorWidget::addLibrary() { AddLibraryWizard wizard(file()->fileName(), this); if (wizard.exec() != QDialog::Accepted) return; - TextEditor::BaseTextEditorEditable *editable = editableInterface(); + TextEditor::BaseTextEditor *editable = editor(); const int endOfDoc = editable->position(TextEditor::ITextEditor::EndOfDoc); - editable->setCurPos(endOfDoc); + editable->setCursorPosition(endOfDoc); QString snippet = wizard.snippet(); // add extra \n in case the last line is not empty @@ -264,7 +264,7 @@ void ProFileEditor::addLibrary() editable->insert(snippet); } -void ProFileEditor::jumpToFile() +void ProFileEditorWidget::jumpToFile() { openLink(findLinkAt(textCursor())); } diff --git a/src/plugins/qt4projectmanager/profileeditor.h b/src/plugins/qt4projectmanager/profileeditor.h index e5f3d84d72..b1c9f693b7 100644 --- a/src/plugins/qt4projectmanager/profileeditor.h +++ b/src/plugins/qt4projectmanager/profileeditor.h @@ -53,14 +53,14 @@ namespace Internal { class ProFileEditorFactory; class ProFileHighlighter; -class ProFileEditor; +class ProFileEditorWidget; -class ProFileEditorEditable : public TextEditor::BaseTextEditorEditable +class ProFileEditor : public TextEditor::BaseTextEditor { Q_OBJECT public: - ProFileEditorEditable(ProFileEditor *); + ProFileEditor(ProFileEditorWidget *); Core::Context context() const; bool duplicateSupported() const { return true; } @@ -71,14 +71,14 @@ private: const Core::Context m_context; }; -class ProFileEditor : public TextEditor::BaseTextEditor +class ProFileEditorWidget : public TextEditor::BaseTextEditorWidget { Q_OBJECT public: - ProFileEditor(QWidget *parent, ProFileEditorFactory *factory, + ProFileEditorWidget(QWidget *parent, ProFileEditorFactory *factory, TextEditor::TextEditorActionHandler *ah); - ~ProFileEditor(); + ~ProFileEditorWidget(); bool save(const QString &fileName = QString()); @@ -89,7 +89,7 @@ public: void unCommentSelection(); protected: virtual Link findLinkAt(const QTextCursor &, bool resolveTarget = true); - TextEditor::BaseTextEditorEditable *createEditableInterface(); + TextEditor::BaseTextEditor *createEditor(); void contextMenuEvent(QContextMenuEvent *); public slots: diff --git a/src/plugins/qt4projectmanager/profileeditorfactory.cpp b/src/plugins/qt4projectmanager/profileeditorfactory.cpp index 0aca1e5889..38d30068f6 100644 --- a/src/plugins/qt4projectmanager/profileeditorfactory.cpp +++ b/src/plugins/qt4projectmanager/profileeditorfactory.cpp @@ -88,9 +88,9 @@ Core::IFile *ProFileEditorFactory::open(const QString &fileName) Core::IEditor *ProFileEditorFactory::createEditor(QWidget *parent) { - ProFileEditor *editor = new ProFileEditor(parent, this, m_actionHandler); + ProFileEditorWidget *editor = new ProFileEditorWidget(parent, this, m_actionHandler); TextEditor::TextEditorSettings::instance()->initializeEditor(editor); - return editor->editableInterface(); + return editor->editor(); } QStringList ProFileEditorFactory::mimeTypes() const diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.h b/src/plugins/qt4projectmanager/qt4projectmanager.h index 945717eee1..28a99547e8 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.h +++ b/src/plugins/qt4projectmanager/qt4projectmanager.h @@ -56,7 +56,7 @@ namespace Qt4ProjectManager { namespace Internal { class Qt4Builder; -class ProFileEditor; +class ProFileEditorWidget; class Qt4ProjectManagerPlugin; } diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index 5d2ffb4258..90ab7efe89 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -328,7 +328,7 @@ void Qt4ProjectManagerPlugin::buildStateChanged(ProjectExplorer::Project *pro) void Qt4ProjectManagerPlugin::addLibrary() { Core::EditorManager *em = Core::EditorManager::instance(); - ProFileEditor *editor = qobject_cast(em->currentEditor()->widget()); + ProFileEditorWidget *editor = qobject_cast(em->currentEditor()->widget()); if (editor) editor->addLibrary(); } @@ -336,7 +336,7 @@ void Qt4ProjectManagerPlugin::addLibrary() void Qt4ProjectManagerPlugin::jumpToFile() { Core::EditorManager *em = Core::EditorManager::instance(); - ProFileEditor *editor = qobject_cast(em->currentEditor()->widget()); + ProFileEditorWidget *editor = qobject_cast(em->currentEditor()->widget()); if (editor) editor->jumpToFile(); } diff --git a/src/plugins/qt4projectmanager/qtoutputformatter.cpp b/src/plugins/qt4projectmanager/qtoutputformatter.cpp index 14cba0903b..5137b0e2f7 100644 --- a/src/plugins/qt4projectmanager/qtoutputformatter.cpp +++ b/src/plugins/qt4projectmanager/qtoutputformatter.cpp @@ -196,7 +196,7 @@ void QtOutputFormatter::handleLink(const QString &href) const QString fileName = QUrl(qmlLineColumnLink.cap(1)).toLocalFile(); const int line = qmlLineColumnLink.cap(2).toInt(); const int column = qmlLineColumnLink.cap(3).toInt(); - TextEditor::BaseTextEditor::openEditorAt(m_projectFinder.findFile(fileName), line, column - 1); + TextEditor::BaseTextEditorWidget::openEditorAt(m_projectFinder.findFile(fileName), line, column - 1); return; } @@ -207,7 +207,7 @@ void QtOutputFormatter::handleLink(const QString &href) if (qmlLineLink.indexIn(href) != -1) { const QString fileName = QUrl(qmlLineLink.cap(1)).toLocalFile(); const int line = qmlLineLink.cap(2).toInt(); - TextEditor::BaseTextEditor::openEditorAt(m_projectFinder.findFile(fileName), line); + TextEditor::BaseTextEditorWidget::openEditorAt(m_projectFinder.findFile(fileName), line); return; } @@ -251,7 +251,7 @@ void QtOutputFormatter::handleLink(const QString &href) // map possible on-device path to source path fileName = m_projectFinder.findFile(fileName); } - TextEditor::BaseTextEditor::openEditorAt(fileName, line, 0); + TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, 0); return; } } diff --git a/src/plugins/subversion/subversioneditor.cpp b/src/plugins/subversion/subversioneditor.cpp index b699f57e28..deec070fa5 100644 --- a/src/plugins/subversion/subversioneditor.cpp +++ b/src/plugins/subversion/subversioneditor.cpp @@ -50,7 +50,7 @@ using namespace Subversion::Internal; SubversionEditor::SubversionEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent) : - VCSBase::VCSBaseEditor(type, parent), + VCSBase::VCSBaseEditorWidget(type, parent), m_changeNumberPattern(QLatin1String("^\\d+$")), m_revisionNumberPattern(QLatin1String("^r\\d+$")) { diff --git a/src/plugins/subversion/subversioneditor.h b/src/plugins/subversion/subversioneditor.h index 335145415b..e0879ad3d5 100644 --- a/src/plugins/subversion/subversioneditor.h +++ b/src/plugins/subversion/subversioneditor.h @@ -41,7 +41,7 @@ namespace Subversion { namespace Internal { -class SubversionEditor : public VCSBase::VCSBaseEditor +class SubversionEditor : public VCSBase::VCSBaseEditorWidget { Q_OBJECT diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 532995a89a..76eabf8f2d 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -143,7 +143,7 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = { static inline const VCSBase::VCSBaseEditorParameters *findType(int ie) { const VCSBase::EditorContentType et = static_cast(ie); - return VCSBase::VCSBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); + return VCSBase::VCSBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); } static inline QString debugCodec(const QTextCodec *c) @@ -536,7 +536,7 @@ void SubversionPlugin::diffCommitFiles(const QStringList &files) static inline void setDiffBaseDirectory(Core::IEditor *editor, const QString &db) { - if (VCSBase::VCSBaseEditor *ve = qobject_cast(editor->widget())) + if (VCSBase::VCSBaseEditorWidget *ve = qobject_cast(editor->widget())) ve->setDiffBaseDirectory(db); } @@ -544,8 +544,8 @@ void SubversionPlugin::svnDiff(const QString &workingDir, const QStringList &fil { if (Subversion::Constants::debug) qDebug() << Q_FUNC_INFO << files << diffname; - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); - QTextCodec *codec = source.isEmpty() ? static_cast(0) : VCSBase::VCSBaseEditor::getCodec(source); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, files); + QTextCodec *codec = source.isEmpty() ? static_cast(0) : VCSBase::VCSBaseEditorWidget::getCodec(source); if (files.count() == 1 && diffname.isEmpty()) diffname = QFileInfo(files.front()).fileName(); @@ -864,17 +864,17 @@ void SubversionPlugin::filelog(const QString &workingDir, // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir, files); if (Core::IEditor *editor = locateEditor("logFileName", id)) { editor->createNew(response.stdOut); Core::EditorManager::instance()->activateEditor(editor, Core::EditorManager::ModeSwitch); } else { const QString title = QString::fromLatin1("svn log %1").arg(id); - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, files); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::LogOutput, source, /*codec*/0); newEditor->setProperty("logFileName", id); if (enableAnnotationContextMenu) - VCSBase::VCSBaseEditor::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true); + VCSBase::VCSBaseEditorWidget::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true); } } @@ -917,8 +917,8 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil const QString &revision /* = QString() */, int lineNumber /* = -1 */) { - const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, file); - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(source); + const QString source = VCSBase::VCSBaseEditorWidget::getSource(workingDir, file); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(source); QStringList args(QLatin1String("annotate")); if (m_settings.spaceIgnorantAnnotation) @@ -937,19 +937,19 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file if (lineNumber <= 0) - lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(source); + lineNumber = VCSBase::VCSBaseEditorWidget::lineNumberOfCurrentEditor(source); // Determine id - const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, QStringList(file), revision); + const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDir, QStringList(file), revision); if (Core::IEditor *editor = locateEditor("annotateFileName", id)) { editor->createNew(response.stdOut); - VCSBase::VCSBaseEditor::gotoLineOfEditor(editor, lineNumber); + VCSBase::VCSBaseEditorWidget::gotoLineOfEditor(editor, lineNumber); Core::EditorManager::instance()->activateEditor(editor, Core::EditorManager::ModeSwitch); } else { const QString title = QString::fromLatin1("svn annotate %1").arg(id); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, source, codec); newEditor->setProperty("annotateFileName", id); - VCSBase::VCSBaseEditor::gotoLineOfEditor(newEditor, lineNumber); + VCSBase::VCSBaseEditorWidget::gotoLineOfEditor(newEditor, lineNumber); } } @@ -995,7 +995,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) QTextStream(&diffArg) << (number - 1) << ':' << number; args.push_back(diffArg); - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(source); + QTextCodec *codec = VCSBase::VCSBaseEditorWidget::getCodec(source); const SubversionResponse response = runSvn(topLevel, args, m_settings.timeOutMS(), SshPasswordPrompt, codec); @@ -1126,7 +1126,7 @@ Core::IEditor * SubversionPlugin::showOutputInEditor(const QString& title, const e->setSource(source); if (codec) e->setCodec(codec); - Core::IEditor *ie = e->editableInterface(); + Core::IEditor *ie = e->editor(); Core::EditorManager::instance()->activateEditor(ie, Core::EditorManager::ModeSwitch); return ie; } diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index 6688550c22..309c79d8b4 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -266,7 +266,7 @@ void BaseFileFind::updateComboEntries(QComboBox *combo, bool onTop) void BaseFileFind::openEditor(const Find::SearchResultItem &item) { if (item.path.size() > 0) { - TextEditor::BaseTextEditor::openEditorAt(QDir::fromNativeSeparators(item.path.first()), item.lineNumber, item.textMarkPos, + TextEditor::BaseTextEditorWidget::openEditorAt(QDir::fromNativeSeparators(item.path.first()), item.lineNumber, item.textMarkPos, QString(), Core::EditorManager::ModeSwitch); } else { Core::EditorManager::instance()->openEditor(item.text, QString(), Core::EditorManager::ModeSwitch); @@ -334,9 +334,9 @@ QStringList BaseFileFind::replaceAll(const QString &text, const QList changeItems = it.value(); const QList editors = editorManager->editorsForFileName(fileName); - TextEditor::BaseTextEditor *textEditor = 0; + TextEditor::BaseTextEditorWidget *textEditor = 0; foreach (Core::IEditor *editor, editors) { - textEditor = qobject_cast(editor->widget()); + textEditor = qobject_cast(editor->widget()); if (textEditor != 0) break; } diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index 9ddb832564..92193fdce4 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -62,7 +62,7 @@ BaseHoverHandler::~BaseHoverHandler() void BaseHoverHandler::editorOpened(Core::IEditor *editor) { if (acceptEditor(editor)) { - BaseTextEditorEditable *textEditor = qobject_cast(editor); + BaseTextEditor *textEditor = qobject_cast(editor); if (textEditor) { connect(textEditor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*, QPoint, int)), this, SLOT(showToolTip(TextEditor::ITextEditor*, QPoint, int))); @@ -75,7 +75,7 @@ void BaseHoverHandler::editorOpened(Core::IEditor *editor) void BaseHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint &point, int pos) { - BaseTextEditor *baseEditor = baseTextEditor(editor); + BaseTextEditorWidget *baseEditor = baseTextEditor(editor); if (!baseEditor) return; @@ -87,7 +87,7 @@ void BaseHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint void BaseHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int pos) { - BaseTextEditor *baseEditor = baseTextEditor(editor); + BaseTextEditorWidget *baseEditor = baseTextEditor(editor); if (!baseEditor) return; @@ -171,9 +171,9 @@ void BaseHoverHandler::operateTooltip(ITextEditor *editor, const QPoint &point) ToolTip::instance()->show(point, TextContent(m_toolTip), editor->widget()); } -BaseTextEditor *BaseHoverHandler::baseTextEditor(ITextEditor *editor) +BaseTextEditorWidget *BaseHoverHandler::baseTextEditor(ITextEditor *editor) { if (!editor) return 0; - return qobject_cast(editor->widget()); + return qobject_cast(editor->widget()); } diff --git a/src/plugins/texteditor/basehoverhandler.h b/src/plugins/texteditor/basehoverhandler.h index 91a3dd8e2d..49f00aa089 100644 --- a/src/plugins/texteditor/basehoverhandler.h +++ b/src/plugins/texteditor/basehoverhandler.h @@ -51,7 +51,7 @@ class IEditor; namespace TextEditor { class ITextEditor; -class BaseTextEditor; +class BaseTextEditorWidget; class TEXTEDITOR_EXPORT BaseHoverHandler : public QObject { @@ -80,7 +80,7 @@ protected: void setLastHelpItemIdentified(const HelpItem &help); const HelpItem &lastHelpItemIdentified() const; - static BaseTextEditor *baseTextEditor(ITextEditor *editor); + static BaseTextEditorWidget *baseTextEditor(ITextEditor *editor); private: void clear(); diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index e74d890a9d..e65691a06f 100644 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -343,9 +343,9 @@ bool BaseTextDocument::save(const QString &fileName) // When saving the current editor, make sure to maintain the cursor position for undo Core::IEditor *currentEditor = Core::EditorManager::instance()->currentEditor(); - if (BaseTextEditorEditable *editable = qobject_cast(currentEditor)) { + if (BaseTextEditor *editable = qobject_cast(currentEditor)) { if (editable->file() == this) - cursor.setPosition(editable->editor()->textCursor().position()); + cursor.setPosition(editable->editorWidget()->textCursor().position()); } cursor.beginEditBlock(); diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 348970d700..f40fdf22a4 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -101,9 +101,9 @@ namespace TextEditor { namespace Internal { class TextEditExtraArea : public QWidget { - BaseTextEditor *textEdit; + BaseTextEditorWidget *textEdit; public: - TextEditExtraArea(BaseTextEditor *edit):QWidget(edit) { + TextEditExtraArea(BaseTextEditorWidget *edit):QWidget(edit) { textEdit = edit; setAutoFillBackground(true); } @@ -137,7 +137,7 @@ protected: } // namespace Internal } // namespace TextEditor -ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName, int line, int column, +ITextEditor *BaseTextEditorWidget::openEditorAt(const QString &fileName, int line, int column, const QString &editorKind, Core::EditorManager::OpenEditorFlags flags, bool *newEditor) @@ -178,7 +178,7 @@ static void convertToPlainText(QString &txt) } } -BaseTextEditor::BaseTextEditor(QWidget *parent) +BaseTextEditorWidget::BaseTextEditorWidget(QWidget *parent) : QPlainTextEdit(parent) { d = new BaseTextEditorPrivate; @@ -258,23 +258,23 @@ BaseTextEditor::BaseTextEditor(QWidget *parent) d->m_moveLineUndoHack = false; } -BaseTextEditor::~BaseTextEditor() +BaseTextEditorWidget::~BaseTextEditorWidget() { delete d; d = 0; } -QString BaseTextEditor::mimeType() const +QString BaseTextEditorWidget::mimeType() const { return d->m_document->mimeType(); } -void BaseTextEditor::setMimeType(const QString &mt) +void BaseTextEditorWidget::setMimeType(const QString &mt) { d->m_document->setMimeType(mt); } -void BaseTextEditor::print(QPrinter *printer) +void BaseTextEditorWidget::print(QPrinter *printer) { const bool oldFullPage = printer->fullPage(); printer->setFullPage(true); @@ -484,27 +484,27 @@ int BaseTextEditorPrivate::visualIndent(const QTextBlock &block) const return 0; } -ITextMarkable *BaseTextEditor::markableInterface() const +ITextMarkable *BaseTextEditorWidget::markableInterface() const { return baseTextDocument()->documentMarker(); } -BaseTextEditorEditable *BaseTextEditor::editableInterface() const +BaseTextEditor *BaseTextEditorWidget::editor() const { - if (!d->m_editable) { - d->m_editable = const_cast(this)->createEditableInterface(); + if (!d->m_editor) { + d->m_editor = const_cast(this)->createEditor(); connect(this, SIGNAL(textChanged()), - d->m_editable, SIGNAL(contentsChanged())); + d->m_editor, SIGNAL(contentsChanged())); connect(this, SIGNAL(changed()), - d->m_editable, SIGNAL(changed())); + d->m_editor, SIGNAL(changed())); } - return d->m_editable; + return d->m_editor; } -void BaseTextEditor::currentEditorChanged(Core::IEditor *editor) +void BaseTextEditorWidget::currentEditorChanged(Core::IEditor *ed) { - if (editor == editableInterface()) { + if (ed == editor()) { if (d->m_document->hasDecodingError()) { Core::EditorManager::instance()->showEditorInfoBar(QLatin1String(Constants::SELECT_ENCODING), tr("Error: Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.") @@ -515,7 +515,7 @@ void BaseTextEditor::currentEditorChanged(Core::IEditor *editor) } } -void BaseTextEditor::selectEncoding() +void BaseTextEditorWidget::selectEncoding() { BaseTextDocument *doc = d->m_document; CodecSelector codecSelector(this, doc); @@ -531,30 +531,30 @@ void BaseTextEditor::selectEncoding() break; case CodecSelector::Save: doc->setCodec(codecSelector.selectedCodec()); - Core::EditorManager::instance()->saveEditor(editableInterface()); + Core::EditorManager::instance()->saveEditor(editor()); break; case CodecSelector::Cancel: break; } } -void BaseTextEditor::triggerCompletions() +void BaseTextEditorWidget::triggerCompletions() { - CompletionSupport::instance()->complete(editableInterface(), SemanticCompletion, true); + CompletionSupport::instance()->complete(editor(), SemanticCompletion, true); } -void BaseTextEditor::triggerQuickFix() +void BaseTextEditorWidget::triggerQuickFix() { - CompletionSupport::instance()->complete(editableInterface(), QuickFixCompletion, true); + CompletionSupport::instance()->complete(editor(), QuickFixCompletion, true); } -QString BaseTextEditor::msgTextTooLarge(quint64 size) +QString BaseTextEditorWidget::msgTextTooLarge(quint64 size) { return tr("The text is too large to be displayed (%1 MB)."). arg(size >> 20); } -bool BaseTextEditor::createNew(const QString &contents) +bool BaseTextEditorWidget::createNew(const QString &contents) { if (contents.size() > Core::EditorManager::maxTextFileSize()) { setPlainText(msgTextTooLarge(contents.size())); @@ -566,7 +566,7 @@ bool BaseTextEditor::createNew(const QString &contents) return true; } -bool BaseTextEditor::open(const QString &fileName) +bool BaseTextEditorWidget::open(const QString &fileName) { if (d->m_document->open(fileName)) { moveCursor(QTextCursor::Start); @@ -603,12 +603,12 @@ void BaseTextEditorPrivate::foldLicenseHeader() } } -const Utils::ChangeSet &BaseTextEditor::changeSet() const +const Utils::ChangeSet &BaseTextEditorWidget::changeSet() const { return d->m_changeSet; } -void BaseTextEditor::setChangeSet(const Utils::ChangeSet &changeSet) +void BaseTextEditorWidget::setChangeSet(const Utils::ChangeSet &changeSet) { using namespace Utils; @@ -642,12 +642,12 @@ void BaseTextEditor::setChangeSet(const Utils::ChangeSet &changeSet) } } -Core::IFile *BaseTextEditor::file() +Core::IFile *BaseTextEditorWidget::file() { return d->m_document; } -void BaseTextEditor::editorContentsChange(int position, int charsRemoved, int charsAdded) +void BaseTextEditorWidget::editorContentsChange(int position, int charsRemoved, int charsAdded) { if (d->m_animator) d->m_animator->finish(); @@ -678,10 +678,10 @@ void BaseTextEditor::editorContentsChange(int position, int charsRemoved, int ch } if (doc->isRedoAvailable()) - emit editableInterface()->contentsChangedBecauseOfUndo(); + emit editor()->contentsChangedBecauseOfUndo(); } -void BaseTextEditor::slotSelectionChanged() +void BaseTextEditorWidget::slotSelectionChanged() { if (d->m_inBlockSelectionMode && !textCursor().hasSelection()) { d->m_inBlockSelectionMode = false; @@ -696,7 +696,7 @@ void BaseTextEditor::slotSelectionChanged() clearLink(); } -void BaseTextEditor::gotoBlockStart() +void BaseTextEditorWidget::gotoBlockStart() { QTextCursor cursor = textCursor(); if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, false)) { @@ -705,7 +705,7 @@ void BaseTextEditor::gotoBlockStart() } } -void BaseTextEditor::gotoBlockEnd() +void BaseTextEditorWidget::gotoBlockEnd() { QTextCursor cursor = textCursor(); if (TextBlockUserData::findNextClosingParenthesis(&cursor, false)) { @@ -714,7 +714,7 @@ void BaseTextEditor::gotoBlockEnd() } } -void BaseTextEditor::gotoBlockStartWithSelection() +void BaseTextEditorWidget::gotoBlockStartWithSelection() { QTextCursor cursor = textCursor(); if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, true)) { @@ -723,7 +723,7 @@ void BaseTextEditor::gotoBlockStartWithSelection() } } -void BaseTextEditor::gotoBlockEndWithSelection() +void BaseTextEditorWidget::gotoBlockEndWithSelection() { QTextCursor cursor = textCursor(); if (TextBlockUserData::findNextClosingParenthesis(&cursor, true)) { @@ -733,101 +733,101 @@ void BaseTextEditor::gotoBlockEndWithSelection() } -void BaseTextEditor::gotoLineStart() +void BaseTextEditorWidget::gotoLineStart() { handleHomeKey(false); } -void BaseTextEditor::gotoLineStartWithSelection() +void BaseTextEditorWidget::gotoLineStartWithSelection() { handleHomeKey(true); } -void BaseTextEditor::gotoLineEnd() +void BaseTextEditorWidget::gotoLineEnd() { moveCursor(QTextCursor::EndOfLine); } -void BaseTextEditor::gotoLineEndWithSelection() +void BaseTextEditorWidget::gotoLineEndWithSelection() { moveCursor(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); } -void BaseTextEditor::gotoNextLine() +void BaseTextEditorWidget::gotoNextLine() { moveCursor(QTextCursor::Down); } -void BaseTextEditor::gotoNextLineWithSelection() +void BaseTextEditorWidget::gotoNextLineWithSelection() { moveCursor(QTextCursor::Down, QTextCursor::KeepAnchor); } -void BaseTextEditor::gotoPreviousLine() +void BaseTextEditorWidget::gotoPreviousLine() { moveCursor(QTextCursor::Up); } -void BaseTextEditor::gotoPreviousLineWithSelection() +void BaseTextEditorWidget::gotoPreviousLineWithSelection() { moveCursor(QTextCursor::Up, QTextCursor::KeepAnchor); } -void BaseTextEditor::gotoPreviousCharacter() +void BaseTextEditorWidget::gotoPreviousCharacter() { moveCursor(QTextCursor::PreviousCharacter); } -void BaseTextEditor::gotoPreviousCharacterWithSelection() +void BaseTextEditorWidget::gotoPreviousCharacterWithSelection() { moveCursor(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); } -void BaseTextEditor::gotoNextCharacter() +void BaseTextEditorWidget::gotoNextCharacter() { moveCursor(QTextCursor::NextCharacter); } -void BaseTextEditor::gotoNextCharacterWithSelection() +void BaseTextEditorWidget::gotoNextCharacterWithSelection() { moveCursor(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); } -void BaseTextEditor::gotoPreviousWord() +void BaseTextEditorWidget::gotoPreviousWord() { moveCursor(QTextCursor::PreviousWord); } -void BaseTextEditor::gotoPreviousWordWithSelection() +void BaseTextEditorWidget::gotoPreviousWordWithSelection() { moveCursor(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); } -void BaseTextEditor::gotoNextWord() +void BaseTextEditorWidget::gotoNextWord() { moveCursor(QTextCursor::NextWord); } -void BaseTextEditor::gotoNextWordWithSelection() +void BaseTextEditorWidget::gotoNextWordWithSelection() { moveCursor(QTextCursor::NextWord, QTextCursor::KeepAnchor); } -void BaseTextEditor::gotoPreviousWordCamelCase() +void BaseTextEditorWidget::gotoPreviousWordCamelCase() { QTextCursor c = textCursor(); camelCaseLeft(c, QTextCursor::MoveAnchor); setTextCursor(c); } -void BaseTextEditor::gotoPreviousWordCamelCaseWithSelection() +void BaseTextEditorWidget::gotoPreviousWordCamelCaseWithSelection() { QTextCursor c = textCursor(); camelCaseLeft(c, QTextCursor::KeepAnchor); setTextCursor(c); } -void BaseTextEditor::gotoNextWordCamelCase() +void BaseTextEditorWidget::gotoNextWordCamelCase() { qDebug() << Q_FUNC_INFO; QTextCursor c = textCursor(); @@ -835,7 +835,7 @@ void BaseTextEditor::gotoNextWordCamelCase() setTextCursor(c); } -void BaseTextEditor::gotoNextWordCamelCaseWithSelection() +void BaseTextEditorWidget::gotoNextWordCamelCaseWithSelection() { QTextCursor c = textCursor(); camelCaseRight(c, QTextCursor::KeepAnchor); @@ -852,7 +852,7 @@ static QTextCursor flippedCursor(const QTextCursor &cursor) return flipped; } -void BaseTextEditor::selectBlockUp() +void BaseTextEditorWidget::selectBlockUp() { QTextCursor cursor = textCursor(); if (!cursor.hasSelection()) @@ -869,7 +869,7 @@ void BaseTextEditor::selectBlockUp() _q_matchParentheses(); } -void BaseTextEditor::selectBlockDown() +void BaseTextEditorWidget::selectBlockDown() { QTextCursor tc = textCursor(); QTextCursor cursor = d->m_selectBlockAnchor; @@ -893,18 +893,18 @@ void BaseTextEditor::selectBlockDown() _q_matchParentheses(); } -void BaseTextEditor::copyLineUp() +void BaseTextEditorWidget::copyLineUp() { copyLineUpDown(true); } -void BaseTextEditor::copyLineDown() +void BaseTextEditorWidget::copyLineDown() { copyLineUpDown(false); } // @todo: Potential reuse of some code around the following functions... -void BaseTextEditor::copyLineUpDown(bool up) +void BaseTextEditorWidget::copyLineUpDown(bool up) { QTextCursor cursor = textCursor(); QTextCursor move = cursor; @@ -955,7 +955,7 @@ void BaseTextEditor::copyLineUpDown(bool up) setTextCursor(move); } -void BaseTextEditor::joinLines() +void BaseTextEditorWidget::joinLines() { QTextCursor cursor = textCursor(); QTextCursor start = cursor; @@ -989,7 +989,7 @@ void BaseTextEditor::joinLines() setTextCursor(cursor); } -void BaseTextEditor::insertLineAbove() +void BaseTextEditorWidget::insertLineAbove() { QTextCursor cursor = textCursor(); cursor.beginEditBlock(); @@ -1001,7 +1001,7 @@ void BaseTextEditor::insertLineAbove() setTextCursor(cursor); } -void BaseTextEditor::insertLineBelow() +void BaseTextEditorWidget::insertLineBelow() { QTextCursor cursor = textCursor(); cursor.beginEditBlock(); @@ -1012,17 +1012,17 @@ void BaseTextEditor::insertLineBelow() setTextCursor(cursor); } -void BaseTextEditor::moveLineUp() +void BaseTextEditorWidget::moveLineUp() { moveLineUpDown(true); } -void BaseTextEditor::moveLineDown() +void BaseTextEditorWidget::moveLineDown() { moveLineUpDown(false); } -void BaseTextEditor::moveLineUpDown(bool up) +void BaseTextEditorWidget::moveLineUpDown(bool up) { QTextCursor cursor = textCursor(); QTextCursor move = cursor; @@ -1107,7 +1107,7 @@ void BaseTextEditor::moveLineUpDown(bool up) d->m_moveLineUndoHack = true; } -void BaseTextEditor::cleanWhitespace() +void BaseTextEditorWidget::cleanWhitespace() { d->m_document->cleanWhitespace(textCursor()); } @@ -1128,7 +1128,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor) return layout->lineForTextPosition(relativePos); } -bool BaseTextEditor::camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveMode mode) +bool BaseTextEditorWidget::camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveMode mode) { int state = 0; enum Input { @@ -1238,7 +1238,7 @@ bool BaseTextEditor::camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveMode mo } } -bool BaseTextEditor::camelCaseRight(QTextCursor &cursor, QTextCursor::MoveMode mode) +bool BaseTextEditorWidget::camelCaseRight(QTextCursor &cursor, QTextCursor::MoveMode mode) { int state = 0; enum Input { @@ -1354,7 +1354,7 @@ bool BaseTextEditor::camelCaseRight(QTextCursor &cursor, QTextCursor::MoveMode m } } -bool BaseTextEditor::cursorMoveKeyEvent(QKeyEvent *e) +bool BaseTextEditorWidget::cursorMoveKeyEvent(QKeyEvent *e) { QTextCursor cursor = textCursor(); @@ -1489,7 +1489,7 @@ bool BaseTextEditor::cursorMoveKeyEvent(QKeyEvent *e) } -void BaseTextEditor::keyPressEvent(QKeyEvent *e) +void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e) { viewport()->setCursor(Qt::BlankCursor); ToolTip::instance()->hide(); @@ -1840,7 +1840,7 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e) } -void BaseTextEditor::maybeRequestAutoCompletion(const QChar &ch) +void BaseTextEditorWidget::maybeRequestAutoCompletion(const QChar &ch) { if (ch.isLetterOrNumber() || ch == QLatin1Char('_')) { if (CompletionSupport::instance()->isActive()) @@ -1852,11 +1852,11 @@ void BaseTextEditor::maybeRequestAutoCompletion(const QChar &ch) } } else { d->m_requestAutoCompletionTimer->stop(); - CompletionSupport::instance()->complete(editableInterface(), SemanticCompletion, false); + CompletionSupport::instance()->complete(editor(), SemanticCompletion, false); } } -void BaseTextEditor::_q_requestAutoCompletion() +void BaseTextEditorWidget::_q_requestAutoCompletion() { d->m_requestAutoCompletionTimer->stop(); @@ -1865,10 +1865,10 @@ void BaseTextEditor::_q_requestAutoCompletion() if (d->m_requestAutoCompletionRevision == document()->revision() && d->m_requestAutoCompletionPosition == position()) - CompletionSupport::instance()->complete(editableInterface(), SemanticCompletion, false); + CompletionSupport::instance()->complete(editor(), SemanticCompletion, false); } -void BaseTextEditor::insertCodeSnippet(const QTextCursor &cursor_arg, const QString &snippet) +void BaseTextEditorWidget::insertCodeSnippet(const QTextCursor &cursor_arg, const QString &snippet) { if ((snippet.count(Snippet::kVariableDelimiter) % 2) != 0) { qWarning() << "invalid snippet"; @@ -1936,7 +1936,7 @@ void BaseTextEditor::insertCodeSnippet(const QTextCursor &cursor_arg, const QStr indent(cursor.document(), cursor, QChar()); cursor.endEditBlock(); - setExtraSelections(BaseTextEditor::SnippetPlaceholderSelection, selections); + setExtraSelections(BaseTextEditorWidget::SnippetPlaceholderSelection, selections); if (! selections.isEmpty()) { const QTextEdit::ExtraSelection &selection = selections.first(); @@ -1953,13 +1953,13 @@ void BaseTextEditor::insertCodeSnippet(const QTextCursor &cursor_arg, const QStr } -void BaseTextEditor::universalHelper() +void BaseTextEditorWidget::universalHelper() { // Test function for development. Place your new fangled experiment here to // give it proper scrutiny before pushing it onto others. } -void BaseTextEditor::setTextCursor(const QTextCursor &cursor) +void BaseTextEditorWidget::setTextCursor(const QTextCursor &cursor) { // workaround for QTextControl bug bool selectionChange = cursor.hasSelection() || textCursor().hasSelection(); @@ -1970,7 +1970,7 @@ void BaseTextEditor::setTextCursor(const QTextCursor &cursor) slotSelectionChanged(); } -void BaseTextEditor::gotoLine(int line, int column) +void BaseTextEditorWidget::gotoLine(int line, int column) { d->m_lastCursorChangeWasInteresting = false; // avoid adding the previous position to history const int blockNumber = line - 1; @@ -1992,7 +1992,7 @@ void BaseTextEditor::gotoLine(int line, int column) saveCurrentCursorPositionForNavigation(); } -int BaseTextEditor::position(ITextEditor::PositionOperation posOp, int at) const +int BaseTextEditorWidget::position(ITextEditor::PositionOperation posOp, int at) const { QTextCursor tc = textCursor(); @@ -2023,7 +2023,7 @@ int BaseTextEditor::position(ITextEditor::PositionOperation posOp, int at) const return -1; } -void BaseTextEditor::convertPosition(int pos, int *line, int *column) const +void BaseTextEditorWidget::convertPosition(int pos, int *line, int *column) const { QTextBlock block = document()->findBlock(pos); if (!block.isValid()) { @@ -2035,12 +2035,12 @@ void BaseTextEditor::convertPosition(int pos, int *line, int *column) const } } -QChar BaseTextEditor::characterAt(int pos) const +QChar BaseTextEditorWidget::characterAt(int pos) const { return document()->characterAt(pos); } -bool BaseTextEditor::event(QEvent *e) +bool BaseTextEditorWidget::event(QEvent *e) { d->m_contentsChanged = false; switch (e->type()) { @@ -2059,35 +2059,35 @@ bool BaseTextEditor::event(QEvent *e) return QPlainTextEdit::event(e); } -void BaseTextEditor::duplicateFrom(BaseTextEditor *editor) +void BaseTextEditorWidget::duplicateFrom(BaseTextEditorWidget *widget) { - if (this == editor) + if (this == widget) return; - setDisplayName(editor->displayName()); - d->m_revisionsVisible = editor->d->m_revisionsVisible; - if (d->m_document == editor->d->m_document) + setDisplayName(widget->displayName()); + d->m_revisionsVisible = widget->d->m_revisionsVisible; + if (d->m_document == widget->d->m_document) return; - d->setupDocumentSignals(editor->d->m_document); - d->m_document = editor->d->m_document; + d->setupDocumentSignals(widget->d->m_document); + d->m_document = widget->d->m_document; } -QString BaseTextEditor::displayName() const +QString BaseTextEditorWidget::displayName() const { return d->m_displayName; } -void BaseTextEditor::setDisplayName(const QString &title) +void BaseTextEditorWidget::setDisplayName(const QString &title) { d->m_displayName = title; emit changed(); } -BaseTextDocument *BaseTextEditor::baseTextDocument() const +BaseTextDocument *BaseTextEditorWidget::baseTextDocument() const { return d->m_document; } -void BaseTextEditor::setBaseTextDocument(BaseTextDocument *doc) +void BaseTextEditorWidget::setBaseTextDocument(BaseTextDocument *doc) { if (doc) { d->setupDocumentSignals(doc); @@ -2095,7 +2095,7 @@ void BaseTextEditor::setBaseTextDocument(BaseTextDocument *doc) } } -void BaseTextEditor::documentAboutToBeReloaded() +void BaseTextEditorWidget::documentAboutToBeReloaded() { //memorize cursor position d->m_tempState = saveState(); @@ -2113,13 +2113,13 @@ void BaseTextEditor::documentAboutToBeReloaded() d->m_refactorOverlay->clear(); } -void BaseTextEditor::documentReloaded() +void BaseTextEditorWidget::documentReloaded() { // restore cursor position restoreState(d->m_tempState); } -QByteArray BaseTextEditor::saveState() const +QByteArray BaseTextEditorWidget::saveState() const { QByteArray state; QDataStream stream(&state, QIODevice::WriteOnly); @@ -2146,7 +2146,7 @@ QByteArray BaseTextEditor::saveState() const return state; } -bool BaseTextEditor::restoreState(const QByteArray &state) +bool BaseTextEditorWidget::restoreState(const QByteArray &state) { if (state.isEmpty()) { if (d->m_displaySettings.m_autoFoldFirstComment) @@ -2187,80 +2187,80 @@ bool BaseTextEditor::restoreState(const QByteArray &state) return true; } -void BaseTextEditor::setDefaultPath(const QString &defaultPath) +void BaseTextEditorWidget::setDefaultPath(const QString &defaultPath) { baseTextDocument()->setDefaultPath(defaultPath); } -void BaseTextEditor::setSuggestedFileName(const QString &suggestedFileName) +void BaseTextEditorWidget::setSuggestedFileName(const QString &suggestedFileName) { baseTextDocument()->setSuggestedFileName(suggestedFileName); } -void BaseTextEditor::setParenthesesMatchingEnabled(bool b) +void BaseTextEditorWidget::setParenthesesMatchingEnabled(bool b) { d->m_parenthesesMatchingEnabled = b; } -bool BaseTextEditor::isParenthesesMatchingEnabled() const +bool BaseTextEditorWidget::isParenthesesMatchingEnabled() const { return d->m_parenthesesMatchingEnabled; } -void BaseTextEditor::setHighlightCurrentLine(bool b) +void BaseTextEditorWidget::setHighlightCurrentLine(bool b) { d->m_highlightCurrentLine = b; updateCurrentLineHighlight(); } -bool BaseTextEditor::highlightCurrentLine() const +bool BaseTextEditorWidget::highlightCurrentLine() const { return d->m_highlightCurrentLine; } -void BaseTextEditor::setLineNumbersVisible(bool b) +void BaseTextEditorWidget::setLineNumbersVisible(bool b) { d->m_lineNumbersVisible = b; slotUpdateExtraAreaWidth(); } -bool BaseTextEditor::lineNumbersVisible() const +bool BaseTextEditorWidget::lineNumbersVisible() const { return d->m_lineNumbersVisible; } -void BaseTextEditor::setMarksVisible(bool b) +void BaseTextEditorWidget::setMarksVisible(bool b) { d->m_marksVisible = b; slotUpdateExtraAreaWidth(); } -bool BaseTextEditor::marksVisible() const +bool BaseTextEditorWidget::marksVisible() const { return d->m_marksVisible; } -void BaseTextEditor::setRequestMarkEnabled(bool b) +void BaseTextEditorWidget::setRequestMarkEnabled(bool b) { d->m_requestMarkEnabled = b; } -bool BaseTextEditor::requestMarkEnabled() const +bool BaseTextEditorWidget::requestMarkEnabled() const { return d->m_requestMarkEnabled; } -void BaseTextEditor::setLineSeparatorsAllowed(bool b) +void BaseTextEditorWidget::setLineSeparatorsAllowed(bool b) { d->m_lineSeparatorsAllowed = b; } -bool BaseTextEditor::lineSeparatorsAllowed() const +bool BaseTextEditorWidget::lineSeparatorsAllowed() const { return d->m_lineSeparatorsAllowed; } -void BaseTextEditor::updateCodeFoldingVisible() +void BaseTextEditorWidget::updateCodeFoldingVisible() { const bool visible = d->m_codeFoldingSupported && d->m_displaySettings.m_displayFoldingMarkers; if (d->m_codeFoldingVisible != visible) { @@ -2269,7 +2269,7 @@ void BaseTextEditor::updateCodeFoldingVisible() } } -bool BaseTextEditor::codeFoldingVisible() const +bool BaseTextEditorWidget::codeFoldingVisible() const { return d->m_codeFoldingVisible; } @@ -2280,60 +2280,60 @@ bool BaseTextEditor::codeFoldingVisible() const * * Needs to be called before calling setCodeFoldingVisible. */ -void BaseTextEditor::setCodeFoldingSupported(bool b) +void BaseTextEditorWidget::setCodeFoldingSupported(bool b) { d->m_codeFoldingSupported = b; updateCodeFoldingVisible(); } -bool BaseTextEditor::codeFoldingSupported() const +bool BaseTextEditorWidget::codeFoldingSupported() const { return d->m_codeFoldingSupported; } -void BaseTextEditor::setMouseNavigationEnabled(bool b) +void BaseTextEditorWidget::setMouseNavigationEnabled(bool b) { d->m_behaviorSettings.m_mouseNavigation = b; } -bool BaseTextEditor::mouseNavigationEnabled() const +bool BaseTextEditorWidget::mouseNavigationEnabled() const { return d->m_behaviorSettings.m_mouseNavigation; } -void BaseTextEditor::setScrollWheelZoomingEnabled(bool b) +void BaseTextEditorWidget::setScrollWheelZoomingEnabled(bool b) { d->m_behaviorSettings.m_scrollWheelZooming = b; } -bool BaseTextEditor::scrollWheelZoomingEnabled() const +bool BaseTextEditorWidget::scrollWheelZoomingEnabled() const { return d->m_behaviorSettings.m_scrollWheelZooming; } -void BaseTextEditor::setRevisionsVisible(bool b) +void BaseTextEditorWidget::setRevisionsVisible(bool b) { d->m_revisionsVisible = b; slotUpdateExtraAreaWidth(); } -bool BaseTextEditor::revisionsVisible() const +bool BaseTextEditorWidget::revisionsVisible() const { return d->m_revisionsVisible; } -void BaseTextEditor::setVisibleWrapColumn(int column) +void BaseTextEditorWidget::setVisibleWrapColumn(int column) { d->m_visibleWrapColumn = column; viewport()->update(); } -int BaseTextEditor::visibleWrapColumn() const +int BaseTextEditorWidget::visibleWrapColumn() const { return d->m_visibleWrapColumn; } -void BaseTextEditor::setIndenter(Indenter *indenter) +void BaseTextEditorWidget::setIndenter(Indenter *indenter) { // clear out existing code formatter data for (QTextBlock it = document()->begin(); it.isValid(); it = it.next()) { @@ -2344,17 +2344,17 @@ void BaseTextEditor::setIndenter(Indenter *indenter) d->m_indenter.reset(indenter); } -Indenter *BaseTextEditor::indenter() const +Indenter *BaseTextEditorWidget::indenter() const { return d->m_indenter.data(); } -void BaseTextEditor::setAutoCompleter(AutoCompleter *autoCompleter) +void BaseTextEditorWidget::setAutoCompleter(AutoCompleter *autoCompleter) { d->m_autoCompleter.reset(autoCompleter); } -AutoCompleter *BaseTextEditor::autoCompleter() const +AutoCompleter *BaseTextEditorWidget::autoCompleter() const { return d->m_autoCompleter.data(); } @@ -2395,7 +2395,7 @@ BaseTextEditorPrivate::BaseTextEditorPrivate() m_visibleWrapColumn(0), m_linkPressed(false), m_delayedUpdateTimer(0), - m_editable(0), + m_editor(0), m_actionHack(0), m_inBlockSelectionMode(false), m_moveLineUndoHack(false), @@ -2509,7 +2509,7 @@ void BaseTextEditorPrivate::snippetTabOrBacktab(bool forward) } // Calculate global position for a tooltip considering the left extra area. -QPoint BaseTextEditor::toolTipPosition(const QTextCursor &c) const +QPoint BaseTextEditorWidget::toolTipPosition(const QTextCursor &c) const { const QPoint cursorPos = mapToGlobal(cursorRect(c).bottomRight() + QPoint(1,1)); return cursorPos + QPoint(d->m_extraArea->width(), @@ -2521,7 +2521,7 @@ QPoint BaseTextEditor::toolTipPosition(const QTextCursor &c) const ); } -bool BaseTextEditor::viewportEvent(QEvent *event) +bool BaseTextEditorWidget::viewportEvent(QEvent *event) { d->m_contentsChanged = false; if (event->type() == QEvent::ContextMenu) { @@ -2547,17 +2547,17 @@ bool BaseTextEditor::viewportEvent(QEvent *event) const QTextCursor c = cursorForPosition(pos); const QPoint toolTipPoint = toolTipPosition(c); bool handled = false; - BaseTextEditorEditable *editable = editableInterface(); - emit editable->tooltipOverrideRequested(editable, toolTipPoint, c.position(), &handled); + BaseTextEditor *ed = editor(); + emit ed->tooltipOverrideRequested(ed, toolTipPoint, c.position(), &handled); if (!handled) - emit editable->tooltipRequested(editable, toolTipPoint, c.position()); + emit ed->tooltipRequested(ed, toolTipPoint, c.position()); return true; } return QPlainTextEdit::viewportEvent(event); } -void BaseTextEditor::resizeEvent(QResizeEvent *e) +void BaseTextEditorWidget::resizeEvent(QResizeEvent *e) { QPlainTextEdit::resizeEvent(e); QRect cr = rect(); @@ -2566,7 +2566,7 @@ void BaseTextEditor::resizeEvent(QResizeEvent *e) QRect(cr.left(), cr.top(), extraAreaWidth(), cr.height()))); } -QRect BaseTextEditor::foldBox() +QRect BaseTextEditorWidget::foldBox() { if (d->m_highlightBlocksInfo.isEmpty() || d->extraAreaHighlightFoldedBlockNumber < 0) return QRect(); @@ -2585,7 +2585,7 @@ QRect BaseTextEditor::foldBox() er.bottom() - br.top()); } -QTextBlock BaseTextEditor::foldedBlockAt(const QPoint &pos, QRect *box) const +QTextBlock BaseTextEditorWidget::foldedBlockAt(const QPoint &pos, QRect *box) const { QPointF offset(contentOffset()); QTextBlock block = firstVisibleBlock(); @@ -2828,7 +2828,7 @@ static QColor calcBlendColor(const QColor &baseColor, int level, int count) return blendColors(color80, color90, blendFactor); } -void BaseTextEditor::paintEvent(QPaintEvent *e) +void BaseTextEditorWidget::paintEvent(QPaintEvent *e) { /* Here comes an almost verbatim copy of @@ -3486,7 +3486,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) } } -void BaseTextEditor::drawCollapsedBlockPopup(QPainter &painter, +void BaseTextEditorWidget::drawCollapsedBlockPopup(QPainter &painter, const QTextBlock &block, QPointF offset, const QRect &clip) @@ -3539,12 +3539,12 @@ void BaseTextEditor::drawCollapsedBlockPopup(QPainter &painter, } } -QWidget *BaseTextEditor::extraArea() const +QWidget *BaseTextEditorWidget::extraArea() const { return d->m_extraArea; } -int BaseTextEditor::extraAreaWidth(int *markWidthPtr) const +int BaseTextEditorWidget::extraAreaWidth(int *markWidthPtr) const { BaseTextDocumentLayout *documentLayout = qobject_cast(document()->documentLayout()); if (!documentLayout) @@ -3592,7 +3592,7 @@ int BaseTextEditor::extraAreaWidth(int *markWidthPtr) const return space; } -void BaseTextEditor::slotUpdateExtraAreaWidth() +void BaseTextEditorWidget::slotUpdateExtraAreaWidth() { if (isLeftToRight()) setViewportMargins(extraAreaWidth(), 0, 0, 0); @@ -3628,7 +3628,7 @@ static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool e painter->restore(); } -void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e) +void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e) { QTextDocument *doc = document(); BaseTextDocumentLayout *documentLayout = qobject_cast(doc->documentLayout()); @@ -3805,7 +3805,7 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e) } } -void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QPalette &pal, +void BaseTextEditorWidget::drawFoldingMarker(QPainter *painter, const QPalette &pal, const QRect &rect, bool expanded, bool active, @@ -3866,7 +3866,7 @@ void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QPalette &pal, } } -void BaseTextEditor::slotModificationChanged(bool m) +void BaseTextEditorWidget::slotModificationChanged(bool m) { if (m) return; @@ -3891,7 +3891,7 @@ void BaseTextEditor::slotModificationChanged(bool m) d->m_extraArea->update(); } -void BaseTextEditor::slotUpdateRequest(const QRect &r, int dy) +void BaseTextEditorWidget::slotUpdateRequest(const QRect &r, int dy) { if (dy) d->m_extraArea->scroll(0, dy); @@ -3907,13 +3907,13 @@ void BaseTextEditor::slotUpdateRequest(const QRect &r, int dy) slotUpdateExtraAreaWidth(); } -void BaseTextEditor::saveCurrentCursorPositionForNavigation() +void BaseTextEditorWidget::saveCurrentCursorPositionForNavigation() { d->m_lastCursorChangeWasInteresting = true; d->m_tempNavigationState = saveState(); } -void BaseTextEditor::updateCurrentLineHighlight() +void BaseTextEditorWidget::updateCurrentLineHighlight() { QList extraSelections; @@ -3945,7 +3945,7 @@ void BaseTextEditor::updateCurrentLineHighlight() } -void BaseTextEditor::slotCursorPositionChanged() +void BaseTextEditorWidget::slotCursorPositionChanged() { #if 0 qDebug() << "block" << textCursor().blockNumber()+1 @@ -3953,7 +3953,7 @@ void BaseTextEditor::slotCursorPositionChanged() << "indent:" << BaseTextDocumentLayout::userData(textCursor().block())->foldingIndent(); #endif if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) { - Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(editableInterface(), d->m_tempNavigationState); + Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(editor(), d->m_tempNavigationState); d->m_lastCursorChangeWasInteresting = false; } else if (d->m_contentsChanged) { saveCurrentCursorPositionForNavigation(); @@ -3961,7 +3961,7 @@ void BaseTextEditor::slotCursorPositionChanged() updateHighlights(); } -void BaseTextEditor::updateHighlights() +void BaseTextEditorWidget::updateHighlights() { if (d->m_parenthesesMatchingEnabled && hasFocus()) { // Delay update when no matching is displayed yet, to avoid flicker @@ -3984,7 +3984,7 @@ void BaseTextEditor::updateHighlights() } } -void BaseTextEditor::slotUpdateBlockNotify(const QTextBlock &block) +void BaseTextEditorWidget::slotUpdateBlockNotify(const QTextBlock &block) { static bool blockRecursion = false; if (blockRecursion) @@ -4017,7 +4017,7 @@ void BaseTextEditor::slotUpdateBlockNotify(const QTextBlock &block) blockRecursion = false; } -void BaseTextEditor::timerEvent(QTimerEvent *e) +void BaseTextEditorWidget::timerEvent(QTimerEvent *e) { if (e->timerId() == d->autoScrollTimer.timerId()) { const QPoint globalPos = QCursor::pos(); @@ -4056,7 +4056,7 @@ void BaseTextEditorPrivate::clearVisibleFoldedBlock() } } -void BaseTextEditor::mouseMoveEvent(QMouseEvent *e) +void BaseTextEditorWidget::mouseMoveEvent(QMouseEvent *e) { updateLink(e); @@ -4119,7 +4119,7 @@ static bool handleForwardBackwardMouseButtons(QMouseEvent *e) return false; } -void BaseTextEditor::mousePressEvent(QMouseEvent *e) +void BaseTextEditorWidget::mousePressEvent(QMouseEvent *e) { if (e->button() == Qt::LeftButton) { d->clearBlockSelection(); // just in case, otherwise we might get strange drag and drop @@ -4150,7 +4150,7 @@ void BaseTextEditor::mousePressEvent(QMouseEvent *e) QPlainTextEdit::mousePressEvent(e); } -void BaseTextEditor::mouseReleaseEvent(QMouseEvent *e) +void BaseTextEditorWidget::mouseReleaseEvent(QMouseEvent *e) { if (mouseNavigationEnabled() && d->m_linkPressed @@ -4173,14 +4173,14 @@ void BaseTextEditor::mouseReleaseEvent(QMouseEvent *e) QPlainTextEdit::mouseReleaseEvent(e); } -void BaseTextEditor::leaveEvent(QEvent *e) +void BaseTextEditorWidget::leaveEvent(QEvent *e) { // Clear link emulation when the mouse leaves the editor clearLink(); QPlainTextEdit::leaveEvent(e); } -void BaseTextEditor::keyReleaseEvent(QKeyEvent *e) +void BaseTextEditorWidget::keyReleaseEvent(QKeyEvent *e) { // Clear link emulation when Ctrl is released if (e->key() == Qt::Key_Control) @@ -4189,7 +4189,7 @@ void BaseTextEditor::keyReleaseEvent(QKeyEvent *e) QPlainTextEdit::keyReleaseEvent(e); } -void BaseTextEditor::dragEnterEvent(QDragEnterEvent *e) +void BaseTextEditorWidget::dragEnterEvent(QDragEnterEvent *e) { // If the drag event contains URLs, we don't want to insert them as text if (e->mimeData()->hasUrls()) { @@ -4200,14 +4200,14 @@ void BaseTextEditor::dragEnterEvent(QDragEnterEvent *e) QPlainTextEdit::dragEnterEvent(e); } -void BaseTextEditor::extraAreaLeaveEvent(QEvent *) +void BaseTextEditorWidget::extraAreaLeaveEvent(QEvent *) { // fake missing mouse move event from Qt QMouseEvent me(QEvent::MouseMove, QPoint(-1, -1), Qt::NoButton, 0, 0); extraAreaMouseEvent(&me); } -void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e) +void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e) { QTextCursor cursor = cursorForPosition(QPoint(0, e->pos().y())); @@ -4265,7 +4265,7 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e) } } else if (d->m_marksVisible && e->button() == Qt::RightButton) { QMenu * contextMenu = new QMenu(this); - emit editableInterface()->markContextMenuRequested(editableInterface(), cursor.blockNumber() + 1, contextMenu); + emit editor()->markContextMenuRequested(editor(), cursor.blockNumber() + 1, contextMenu); if (!contextMenu->isEmpty()) contextMenu->exec(e->globalPos()); delete contextMenu; @@ -4303,13 +4303,13 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e) d->extraAreaToggleMarkBlockNumber = -1; if (cursor.blockNumber() == n) { int line = n + 1; - emit editableInterface()->markRequested(editableInterface(), line); + emit editor()->markRequested(editor(), line); } } } } -void BaseTextEditor::ensureCursorVisible() +void BaseTextEditorWidget::ensureCursorVisible() { QTextBlock block = textCursor().block(); if (!block.isVisible()) { @@ -4320,7 +4320,7 @@ void BaseTextEditor::ensureCursorVisible() QPlainTextEdit::ensureCursorVisible(); } -void BaseTextEditor::toggleBlockVisible(const QTextBlock &block) +void BaseTextEditorWidget::toggleBlockVisible(const QTextBlock &block) { BaseTextDocumentLayout *documentLayout = qobject_cast(document()->documentLayout()); QTC_ASSERT(documentLayout, return); @@ -4332,18 +4332,18 @@ void BaseTextEditor::toggleBlockVisible(const QTextBlock &block) } -const TabSettings &BaseTextEditor::tabSettings() const +const TabSettings &BaseTextEditorWidget::tabSettings() const { return d->m_document->tabSettings(); } -const DisplaySettings &BaseTextEditor::displaySettings() const +const DisplaySettings &BaseTextEditorWidget::displaySettings() const { return d->m_displaySettings; } -void BaseTextEditor::indentOrUnindent(bool doIndent) +void BaseTextEditorWidget::indentOrUnindent(bool doIndent) { const TextEditor::TabSettings &tabSettings = d->m_document->tabSettings(); @@ -4392,7 +4392,7 @@ void BaseTextEditor::indentOrUnindent(bool doIndent) } } -void BaseTextEditor::handleHomeKey(bool anchor) +void BaseTextEditorWidget::handleHomeKey(bool anchor) { QTextCursor cursor = textCursor(); QTextCursor::MoveMode mode = QTextCursor::MoveAnchor; @@ -4420,7 +4420,7 @@ void BaseTextEditor::handleHomeKey(bool anchor) setTextCursor(cursor); } -void BaseTextEditor::handleBackspaceKey() +void BaseTextEditorWidget::handleBackspaceKey() { QTextCursor cursor = textCursor(); int pos = cursor.position(); @@ -4492,7 +4492,7 @@ void BaseTextEditor::handleBackspaceKey() setTextCursor(cursor); } -void BaseTextEditor::wheelEvent(QWheelEvent *e) +void BaseTextEditorWidget::wheelEvent(QWheelEvent *e) { d->clearVisibleFoldedBlock(); if (scrollWheelZoomingEnabled() && e->modifiers() & Qt::ControlModifier) { @@ -4506,45 +4506,45 @@ void BaseTextEditor::wheelEvent(QWheelEvent *e) QPlainTextEdit::wheelEvent(e); } -void BaseTextEditor::zoomIn(int range) +void BaseTextEditorWidget::zoomIn(int range) { d->clearVisibleFoldedBlock(); emit requestFontZoom(range*10); } -void BaseTextEditor::zoomOut(int range) +void BaseTextEditorWidget::zoomOut(int range) { zoomIn(-range); } -void BaseTextEditor::zoomReset() +void BaseTextEditorWidget::zoomReset() { emit requestZoomReset(); } -void BaseTextEditor::indentInsertedText(const QTextCursor &tc) +void BaseTextEditorWidget::indentInsertedText(const QTextCursor &tc) { indent(tc.document(), tc, QChar::Null); } -void BaseTextEditor::indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar) +void BaseTextEditorWidget::indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar) { maybeClearSomeExtraSelections(cursor); d->m_indenter->indent(doc, cursor, typedChar, this); } -void BaseTextEditor::reindent(QTextDocument *doc, const QTextCursor &cursor) +void BaseTextEditorWidget::reindent(QTextDocument *doc, const QTextCursor &cursor) { maybeClearSomeExtraSelections(cursor); d->m_indenter->reindent(doc, cursor, this); } -BaseTextEditor::Link BaseTextEditor::findLinkAt(const QTextCursor &, bool) +BaseTextEditorWidget::Link BaseTextEditorWidget::findLinkAt(const QTextCursor &, bool) { return Link(); } -bool BaseTextEditor::openLink(const Link &link) +bool BaseTextEditorWidget::openLink(const Link &link) { if (link.fileName.isEmpty()) return false; @@ -4562,7 +4562,7 @@ bool BaseTextEditor::openLink(const Link &link) | Core::EditorManager::ModeSwitch); } -void BaseTextEditor::updateLink(QMouseEvent *e) +void BaseTextEditorWidget::updateLink(QMouseEvent *e) { bool linkFound = false; @@ -4590,7 +4590,7 @@ void BaseTextEditor::updateLink(QMouseEvent *e) clearLink(); } -void BaseTextEditor::showLink(const Link &link) +void BaseTextEditorWidget::showLink(const Link &link) { if (d->m_currentLink == link) return; @@ -4607,7 +4607,7 @@ void BaseTextEditor::showLink(const Link &link) d->m_linkPressed = false; } -void BaseTextEditor::clearLink() +void BaseTextEditorWidget::clearLink() { if (!d->m_currentLink.isValid()) return; @@ -4640,7 +4640,7 @@ void BaseTextEditorPrivate::updateMarksLineNumber() } } -void BaseTextEditor::markBlocksAsChanged(QList blockNumbers) +void BaseTextEditorWidget::markBlocksAsChanged(QList blockNumbers) { QTextBlock block = document()->begin(); while (block.isValid()) { @@ -4656,7 +4656,7 @@ void BaseTextEditor::markBlocksAsChanged(QList blockNumbers) } -void BaseTextEditor::highlightSearchResults(const QString &txt, Find::FindFlags findFlags) +void BaseTextEditorWidget::highlightSearchResults(const QString &txt, Find::FindFlags findFlags) { QString pattern = txt; if (pattern.size() < 2) @@ -4674,21 +4674,21 @@ void BaseTextEditor::highlightSearchResults(const QString &txt, Find::FindFlags d->m_delayedUpdateTimer->start(10); } -int BaseTextEditor::verticalBlockSelectionFirstColumn() const +int BaseTextEditorWidget::verticalBlockSelectionFirstColumn() const { if (d->m_inBlockSelectionMode) return d->m_blockSelection.firstVisualColumn; return -1; } -int BaseTextEditor::verticalBlockSelectionLastColumn() const +int BaseTextEditorWidget::verticalBlockSelectionLastColumn() const { if (d->m_inBlockSelectionMode) return d->m_blockSelection.lastVisualColumn; return -1; } -QRegion BaseTextEditor::translatedLineRegion(int lineStart, int lineEnd) const +QRegion BaseTextEditorWidget::translatedLineRegion(int lineStart, int lineEnd) const { QRegion region; for (int i = lineStart ; i <= lineEnd; i++) { @@ -4707,7 +4707,7 @@ QRegion BaseTextEditor::translatedLineRegion(int lineStart, int lineEnd) const return region; } -void BaseTextEditor::setFindScope(const QTextCursor &start, const QTextCursor &end, +void BaseTextEditorWidget::setFindScope(const QTextCursor &start, const QTextCursor &end, int verticalBlockSelectionFirstColumn, int verticalBlockSelectionLastColumn) { @@ -4723,7 +4723,7 @@ void BaseTextEditor::setFindScope(const QTextCursor &start, const QTextCursor &e } } -void BaseTextEditor::_q_animateUpdate(int position, QPointF lastPos, QRectF rect) +void BaseTextEditorWidget::_q_animateUpdate(int position, QPointF lastPos, QRectF rect) { QTextCursor cursor(textCursor()); cursor.setPosition(position); @@ -4798,7 +4798,7 @@ void BaseTextEditorAnimator::finish() deleteLater(); } -void BaseTextEditor::_q_matchParentheses() +void BaseTextEditorWidget::_q_matchParentheses() { if (isReadOnly()) return; @@ -4874,7 +4874,7 @@ void BaseTextEditor::_q_matchParentheses() if (animatePosition >= 0) { - foreach (const QTextEdit::ExtraSelection &sel, BaseTextEditor::extraSelections(ParenthesesMatchingSelection)) { + foreach (const QTextEdit::ExtraSelection &sel, BaseTextEditorWidget::extraSelections(ParenthesesMatchingSelection)) { if (sel.cursor.selectionStart() == animatePosition || sel.cursor.selectionEnd() - 1 == animatePosition) { animatePosition = -1; @@ -4899,7 +4899,7 @@ void BaseTextEditor::_q_matchParentheses() setExtraSelections(ParenthesesMatchingSelection, extraSelections); } -void BaseTextEditor::_q_highlightBlocks() +void BaseTextEditorWidget::_q_highlightBlocks() { BaseTextEditorPrivateHighlightBlocks highlightBlocksInfo; @@ -4960,17 +4960,17 @@ void BaseTextEditor::_q_highlightBlocks() } } -void BaseTextEditor::setActionHack(QObject *hack) +void BaseTextEditorWidget::setActionHack(QObject *hack) { d->m_actionHack = hack; } -QObject *BaseTextEditor::actionHack() const +QObject *BaseTextEditorWidget::actionHack() const { return d->m_actionHack; } -void BaseTextEditor::changeEvent(QEvent *e) +void BaseTextEditorWidget::changeEvent(QEvent *e) { QPlainTextEdit::changeEvent(e); if (e->type() == QEvent::ApplicationFontChange @@ -4985,13 +4985,13 @@ void BaseTextEditor::changeEvent(QEvent *e) } } -void BaseTextEditor::focusInEvent(QFocusEvent *e) +void BaseTextEditorWidget::focusInEvent(QFocusEvent *e) { QPlainTextEdit::focusInEvent(e); updateHighlights(); } -void BaseTextEditor::focusOutEvent(QFocusEvent *e) +void BaseTextEditorWidget::focusOutEvent(QFocusEvent *e) { QPlainTextEdit::focusOutEvent(e); if (viewport()->cursor().shape() == Qt::BlankCursor) @@ -4999,7 +4999,7 @@ void BaseTextEditor::focusOutEvent(QFocusEvent *e) } -void BaseTextEditor::maybeSelectLine() +void BaseTextEditorWidget::maybeSelectLine() { QTextCursor cursor = textCursor(); if (!cursor.hasSelection()) { @@ -5017,19 +5017,19 @@ void BaseTextEditor::maybeSelectLine() } // shift+del -void BaseTextEditor::cutLine() +void BaseTextEditorWidget::cutLine() { maybeSelectLine(); cut(); } -void BaseTextEditor::deleteLine() +void BaseTextEditorWidget::deleteLine() { maybeSelectLine(); textCursor().removeSelectedText(); } -void BaseTextEditor::setExtraSelections(ExtraSelectionKind kind, const QList &selections) +void BaseTextEditorWidget::setExtraSelections(ExtraSelectionKind kind, const QList &selections) { if (selections.isEmpty() && d->m_extraSelections[kind].isEmpty()) return; @@ -5065,12 +5065,12 @@ void BaseTextEditor::setExtraSelections(ExtraSelectionKind kind, const QList BaseTextEditor::extraSelections(ExtraSelectionKind kind) const +QList BaseTextEditorWidget::extraSelections(ExtraSelectionKind kind) const { return d->m_extraSelections[kind]; } -void BaseTextEditor::maybeClearSomeExtraSelections(const QTextCursor &cursor) +void BaseTextEditorWidget::maybeClearSomeExtraSelections(const QTextCursor &cursor) { const int smallSelectionSize = 50 * 50; if (cursor.selectionEnd() - cursor.selectionStart() < smallSelectionSize) @@ -5089,7 +5089,7 @@ void BaseTextEditor::maybeClearSomeExtraSelections(const QTextCursor &cursor) QPlainTextEdit::setExtraSelections(all); } -QString BaseTextEditor::extraSelectionTooltip(int pos) const +QString BaseTextEditorWidget::extraSelectionTooltip(int pos) const { QList all; for (int i = 0; i < NExtraSelectionKinds; ++i) { @@ -5106,7 +5106,7 @@ QString BaseTextEditor::extraSelectionTooltip(int pos) const } // the blocks list must be sorted -void BaseTextEditor::setIfdefedOutBlocks(const QList &blocks) +void BaseTextEditorWidget::setIfdefedOutBlocks(const QList &blocks) { QTextDocument *doc = document(); BaseTextDocumentLayout *documentLayout = qobject_cast(doc->documentLayout()); @@ -5155,7 +5155,7 @@ void BaseTextEditor::setIfdefedOutBlocks(const QList documentLayout->requestUpdate(); } -void BaseTextEditor::format() +void BaseTextEditorWidget::format() { QTextCursor cursor = textCursor(); cursor.beginEditBlock(); @@ -5163,7 +5163,7 @@ void BaseTextEditor::format() cursor.endEditBlock(); } -void BaseTextEditor::rewrapParagraph() +void BaseTextEditorWidget::rewrapParagraph() { const int paragraphWidth = displaySettings().m_wrapColumn; const QRegExp anyLettersOrNumbers = QRegExp("\\w"); @@ -5288,11 +5288,11 @@ void BaseTextEditor::rewrapParagraph() cursor.endEditBlock(); } -void BaseTextEditor::unCommentSelection() +void BaseTextEditorWidget::unCommentSelection() { } -void BaseTextEditor::showEvent(QShowEvent* e) +void BaseTextEditorWidget::showEvent(QShowEvent* e) { if (!d->m_fontSettings.isEmpty()) { setFontSettings(d->m_fontSettings); @@ -5302,7 +5302,7 @@ void BaseTextEditor::showEvent(QShowEvent* e) } -void BaseTextEditor::setFontSettingsIfVisible(const TextEditor::FontSettings &fs) +void BaseTextEditorWidget::setFontSettingsIfVisible(const TextEditor::FontSettings &fs) { if (!isVisible()) { d->m_fontSettings = fs; @@ -5311,7 +5311,7 @@ void BaseTextEditor::setFontSettingsIfVisible(const TextEditor::FontSettings &fs setFontSettings(fs); } -void BaseTextEditor::setFontSettings(const TextEditor::FontSettings &fs) +void BaseTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { const QTextCharFormat textFormat = fs.toTextCharFormat(QLatin1String(Constants::C_TEXT)); const QTextCharFormat selectionFormat = fs.toTextCharFormat(QLatin1String(Constants::C_SELECTION)); @@ -5368,14 +5368,14 @@ void BaseTextEditor::setFontSettings(const TextEditor::FontSettings &fs) updateCurrentLineHighlight(); // Make sure it takes the new color } -void BaseTextEditor::setTabSettings(const TabSettings &ts) +void BaseTextEditorWidget::setTabSettings(const TabSettings &ts) { d->m_document->setTabSettings(ts); int charWidth = QFontMetrics(font()).width(QChar(' ')); setTabStopWidth(charWidth * ts.m_tabSize); } -void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds) +void BaseTextEditorWidget::setDisplaySettings(const DisplaySettings &ds) { setLineWrapMode(ds.m_textWrapping ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap); setLineNumbersVisible(ds.m_displayLineNumbers); @@ -5408,29 +5408,29 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds) extraArea()->update(); } -void BaseTextEditor::setBehaviorSettings(const TextEditor::BehaviorSettings &bs) +void BaseTextEditorWidget::setBehaviorSettings(const TextEditor::BehaviorSettings &bs) { setMouseNavigationEnabled(bs.m_mouseNavigation); setScrollWheelZoomingEnabled(bs.m_scrollWheelZooming); } -void BaseTextEditor::setStorageSettings(const StorageSettings &storageSettings) +void BaseTextEditorWidget::setStorageSettings(const StorageSettings &storageSettings) { d->m_document->setStorageSettings(storageSettings); } -void BaseTextEditor::setCompletionSettings(const TextEditor::CompletionSettings &completionSettings) +void BaseTextEditorWidget::setCompletionSettings(const TextEditor::CompletionSettings &completionSettings) { d->m_autoCompleter->setAutoParenthesesEnabled(completionSettings.m_autoInsertBrackets); d->m_autoCompleter->setSurroundWithEnabled(completionSettings.m_autoInsertBrackets); } -void BaseTextEditor::setExtraEncodingSettings(const ExtraEncodingSettings &extraEncodingSettings) +void BaseTextEditorWidget::setExtraEncodingSettings(const ExtraEncodingSettings &extraEncodingSettings) { d->m_document->setExtraEncodingSettings(extraEncodingSettings); } -void BaseTextEditor::fold() +void BaseTextEditorWidget::fold() { QTextDocument *doc = document(); BaseTextDocumentLayout *documentLayout = qobject_cast(doc->documentLayout()); @@ -5450,7 +5450,7 @@ void BaseTextEditor::fold() } } -void BaseTextEditor::unfold() +void BaseTextEditorWidget::unfold() { QTextDocument *doc = document(); BaseTextDocumentLayout *documentLayout = qobject_cast(doc->documentLayout()); @@ -5464,7 +5464,7 @@ void BaseTextEditor::unfold() documentLayout->emitDocumentSizeChanged(); } -void BaseTextEditor::unfoldAll() +void BaseTextEditorWidget::unfoldAll() { QTextDocument *doc = document(); BaseTextDocumentLayout *documentLayout = qobject_cast(doc->documentLayout()); @@ -5494,24 +5494,24 @@ void BaseTextEditor::unfoldAll() centerCursor(); } -void BaseTextEditor::setTextCodec(QTextCodec *codec) +void BaseTextEditorWidget::setTextCodec(QTextCodec *codec) { baseTextDocument()->setCodec(codec); } -QTextCodec *BaseTextEditor::textCodec() const +QTextCodec *BaseTextEditorWidget::textCodec() const { return baseTextDocument()->codec(); } -void BaseTextEditor::setReadOnly(bool b) +void BaseTextEditorWidget::setReadOnly(bool b) { QPlainTextEdit::setReadOnly(b); if (b) setTextInteractionFlags(textInteractionFlags() | Qt::TextSelectableByKeyboard); } -void BaseTextEditor::cut() +void BaseTextEditorWidget::cut() { if (d->m_inBlockSelectionMode) { copy(); @@ -5521,7 +5521,7 @@ void BaseTextEditor::cut() QPlainTextEdit::cut(); } -void BaseTextEditor::paste() +void BaseTextEditorWidget::paste() { if (d->m_inBlockSelectionMode) { d->removeBlockSelection(); @@ -5529,7 +5529,7 @@ void BaseTextEditor::paste() QPlainTextEdit::paste(); } -QMimeData *BaseTextEditor::createMimeDataFromSelection() const +QMimeData *BaseTextEditorWidget::createMimeDataFromSelection() const { if (d->m_inBlockSelectionMode) { QMimeData *mimeData = new QMimeData; @@ -5615,12 +5615,12 @@ QMimeData *BaseTextEditor::createMimeDataFromSelection() const return 0; } -bool BaseTextEditor::canInsertFromMimeData(const QMimeData *source) const +bool BaseTextEditorWidget::canInsertFromMimeData(const QMimeData *source) const { return QPlainTextEdit::canInsertFromMimeData(source); } -void BaseTextEditor::insertFromMimeData(const QMimeData *source) +void BaseTextEditorWidget::insertFromMimeData(const QMimeData *source) { if (isReadOnly()) return; @@ -5742,7 +5742,7 @@ void BaseTextEditor::insertFromMimeData(const QMimeData *source) setTextCursor(cursor); } -void BaseTextEditor::appendStandardContextMenuActions(QMenu *menu) +void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu) { menu->addSeparator(); Core::ActionManager *am = Core::ICore::instance()->actionManager(); @@ -5759,7 +5759,7 @@ void BaseTextEditor::appendStandardContextMenuActions(QMenu *menu) } -BaseTextEditorEditable::BaseTextEditorEditable(BaseTextEditor *editor) +BaseTextEditor::BaseTextEditor(BaseTextEditorWidget *editor) : e(editor) { using namespace Find; @@ -5789,44 +5789,44 @@ BaseTextEditorEditable::BaseTextEditorEditable(BaseTextEditor *editor) connect(editor, SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition())); } -BaseTextEditorEditable::~BaseTextEditorEditable() +BaseTextEditor::~BaseTextEditor() { delete m_toolBar; delete e; } -QWidget *BaseTextEditorEditable::toolBar() +QWidget *BaseTextEditor::toolBar() { return m_toolBar; } -int BaseTextEditorEditable::find(const QString &) const +int BaseTextEditor::find(const QString &) const { return 0; } -int BaseTextEditorEditable::currentLine() const +int BaseTextEditor::currentLine() const { return e->textCursor().blockNumber() + 1; } -int BaseTextEditorEditable::currentColumn() const +int BaseTextEditor::currentColumn() const { QTextCursor cursor = e->textCursor(); return cursor.position() - cursor.block().position() + 1; } -int BaseTextEditorEditable::columnCount() const +int BaseTextEditor::columnCount() const { return e->columnCount(); } -int BaseTextEditorEditable::rowCount() const +int BaseTextEditor::rowCount() const { return e->rowCount(); } -QRect BaseTextEditorEditable::cursorRect(int pos) const +QRect BaseTextEditor::cursorRect(int pos) const { QTextCursor tc = e->textCursor(); if (pos >= 0) @@ -5836,19 +5836,19 @@ QRect BaseTextEditorEditable::cursorRect(int pos) const return result; } -QString BaseTextEditorEditable::contents() const +QString BaseTextEditor::contents() const { return e->toPlainText(); } -QString BaseTextEditorEditable::selectedText() const +QString BaseTextEditor::selectedText() const { if (e->textCursor().hasSelection()) return e->textCursor().selectedText(); return QString(); } -QString BaseTextEditorEditable::textAt(int pos, int length) const +QString BaseTextEditor::textAt(int pos, int length) const { QTextCursor c = e->textCursor(); @@ -5864,41 +5864,41 @@ QString BaseTextEditorEditable::textAt(int pos, int length) const return c.selectedText(); } -void BaseTextEditorEditable::remove(int length) +void BaseTextEditor::remove(int length) { QTextCursor tc = e->textCursor(); tc.setPosition(tc.position() + length, QTextCursor::KeepAnchor); tc.removeSelectedText(); } -void BaseTextEditorEditable::insert(const QString &string) +void BaseTextEditor::insert(const QString &string) { QTextCursor tc = e->textCursor(); tc.insertText(string); } -void BaseTextEditorEditable::replace(int length, const QString &string) +void BaseTextEditor::replace(int length, const QString &string) { QTextCursor tc = e->textCursor(); tc.setPosition(tc.position() + length, QTextCursor::KeepAnchor); tc.insertText(string); } -void BaseTextEditorEditable::setCurPos(int pos) +void BaseTextEditor::setCursorPosition(int pos) { QTextCursor tc = e->textCursor(); tc.setPosition(pos); e->setTextCursor(tc); } -void BaseTextEditorEditable::select(int toPos) +void BaseTextEditor::select(int toPos) { QTextCursor tc = e->textCursor(); tc.setPosition(toPos, QTextCursor::KeepAnchor); e->setTextCursor(tc); } -void BaseTextEditorEditable::updateCursorPosition() +void BaseTextEditor::updateCursorPosition() { const QTextCursor cursor = e->textCursor(); const QTextBlock block = cursor.block(); @@ -5913,16 +5913,16 @@ void BaseTextEditorEditable::updateCursorPosition() } -QString BaseTextEditorEditable::contextHelpId() const +QString BaseTextEditor::contextHelpId() const { if (m_contextHelpId.isEmpty()) - emit const_cast(this)->contextHelpIdRequested(e->editableInterface(), + emit const_cast(this)->contextHelpIdRequested(e->editor(), e->textCursor().position()); return m_contextHelpId; } -void BaseTextEditor::setRefactorMarkers(const Internal::RefactorMarkers &markers) +void BaseTextEditorWidget::setRefactorMarkers(const Internal::RefactorMarkers &markers) { foreach (const RefactorMarker &marker, d->m_refactorOverlay->markers()) requestBlockUpdate(marker.cursor.block()); @@ -5931,7 +5931,7 @@ void BaseTextEditor::setRefactorMarkers(const Internal::RefactorMarkers &markers requestBlockUpdate(marker.cursor.block()); } -void BaseTextEditor::doFoo() { +void BaseTextEditorWidget::doFoo() { #ifdef DO_FOO qDebug() << Q_FUNC_INFO; RefactorMarkers markers = d->m_refactorOverlay->markers(); @@ -6011,14 +6011,14 @@ void Internal::BaseTextBlockSelection::fromSelection(const TabSettings &ts, cons firstBlock.movePosition(QTextCursor::StartOfBlock); lastBlock.movePosition(QTextCursor::EndOfBlock); } -bool BaseTextEditor::inFindScope(const QTextCursor &cursor) +bool BaseTextEditorWidget::inFindScope(const QTextCursor &cursor) { if (cursor.isNull()) return false; return inFindScope(cursor.selectionStart(), cursor.selectionEnd()); } -bool BaseTextEditor::inFindScope(int selectionStart, int selectionEnd) +bool BaseTextEditorWidget::inFindScope(int selectionStart, int selectionEnd) { if (d->m_findScopeStart.isNull()) return true; // no scope, everything is included @@ -6042,7 +6042,7 @@ bool BaseTextEditor::inFindScope(int selectionStart, int selectionEnd) return true; } -void BaseTextEditor::setBlockSelection(bool on) +void BaseTextEditorWidget::setBlockSelection(bool on) { if (d->m_inBlockSelectionMode != on) { d->m_inBlockSelectionMode = on; @@ -6052,12 +6052,12 @@ void BaseTextEditor::setBlockSelection(bool on) viewport()->update(); } -bool BaseTextEditor::hasBlockSelection() const +bool BaseTextEditorWidget::hasBlockSelection() const { return d->m_inBlockSelectionMode; } -void BaseTextEditor::handleBlockSelection(int diff_row, int diff_col) +void BaseTextEditorWidget::handleBlockSelection(int diff_row, int diff_col) { if (!d->m_inBlockSelectionMode) { @@ -6080,13 +6080,13 @@ void BaseTextEditor::handleBlockSelection(int diff_row, int diff_col) } -int BaseTextEditor::columnCount() const +int BaseTextEditorWidget::columnCount() const { QFontMetricsF fm(font()); return viewport()->rect().width() / fm.width(QLatin1Char('x')); } -int BaseTextEditor::rowCount() const +int BaseTextEditorWidget::rowCount() const { QFontMetricsF fm(font()); return viewport()->rect().height() / fm.lineSpacing(); diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 45b1eb5004..a4b2f0aad2 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -34,7 +34,7 @@ #ifndef BASETEXTEDITOR_H #define BASETEXTEDITOR_H -#include "itexteditable.h" +#include "itexteditor.h" #include "icompletioncollector.h" #include @@ -67,7 +67,7 @@ namespace Internal { class ITextMarkable; class BaseTextDocument; -class BaseTextEditorEditable; +class BaseTextEditor; class FontSettings; class BehaviorSettings; class CompletionSettings; @@ -118,14 +118,14 @@ private: }; -class TEXTEDITOR_EXPORT BaseTextEditor : public QPlainTextEdit +class TEXTEDITOR_EXPORT BaseTextEditorWidget : public QPlainTextEdit { Q_OBJECT Q_PROPERTY(int verticalBlockSelectionFirstColumn READ verticalBlockSelectionFirstColumn) Q_PROPERTY(int verticalBlockSelectionLastColumn READ verticalBlockSelectionLastColumn) public: - BaseTextEditor(QWidget *parent); - ~BaseTextEditor(); + BaseTextEditorWidget(QWidget *parent); + ~BaseTextEditorWidget(); static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0, const QString &editorId = QString(), @@ -152,7 +152,7 @@ public: , int at = -1) const; void convertPosition(int pos, int *line, int *column) const; - BaseTextEditorEditable *editableInterface() const; + BaseTextEditor *editor() const; ITextMarkable *markableInterface() const; virtual void triggerCompletions(); @@ -324,7 +324,7 @@ private: void maybeSelectLine(); public: - void duplicateFrom(BaseTextEditor *editor); + void duplicateFrom(BaseTextEditorWidget *editor); protected: BaseTextDocument *baseTextDocument() const; @@ -332,7 +332,7 @@ protected: void setDefaultPath(const QString &defaultPath); - virtual BaseTextEditorEditable *createEditableInterface() = 0; + virtual BaseTextEditor *createEditor() = 0; private slots: void editorContentsChange(int position, int charsRemoved, int charsAdded); @@ -539,19 +539,18 @@ private slots: void slotSelectionChanged(); void _q_animateUpdate(int position, QPointF lastPos, QRectF rect); void doFoo(); - }; -class TEXTEDITOR_EXPORT BaseTextEditorEditable : public ITextEditable +class TEXTEDITOR_EXPORT BaseTextEditor : public ITextEditor { Q_OBJECT - friend class BaseTextEditor; + friend class BaseTextEditorWidget; public: - BaseTextEditorEditable(BaseTextEditor *editor); - ~BaseTextEditorEditable(); + BaseTextEditor(BaseTextEditorWidget *editorWidget); + ~BaseTextEditor(); - inline BaseTextEditor *editor() const { return e; } + inline BaseTextEditorWidget *editorWidget() const { return e; } // EditorInterface inline QWidget *widget() { return e; } @@ -600,18 +599,18 @@ public: inline QTextCodec *textCodec() const { return e->textCodec(); } - // ITextEditable + // ITextEditor void remove(int length); void insert(const QString &string); void replace(int length, const QString &string); - void setCurPos(int pos); + void setCursorPosition(int pos); void select(int toPos); private slots: void updateCursorPosition(); private: - BaseTextEditor *e; + BaseTextEditorWidget *e; mutable QString m_contextHelpId; QToolBar *m_toolBar; Utils::LineColumnLabel *m_cursorPositionLabel; @@ -619,6 +618,6 @@ private: } // namespace TextEditor -Q_DECLARE_METATYPE(TextEditor::BaseTextEditor::Link) +Q_DECLARE_METATYPE(TextEditor::BaseTextEditorWidget::Link) #endif // BASETEXTEDITOR_H diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index 26e2c59131..0981e52147 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -181,7 +181,7 @@ public: int m_lastScrollPos; int m_lineNumber; - BaseTextEditor *q; + BaseTextEditorWidget *q; bool m_contentsChanged; bool m_lastCursorChangeWasInteresting; @@ -247,7 +247,7 @@ public: int m_visibleWrapColumn; QTextCharFormat m_linkFormat; - BaseTextEditor::Link m_currentLink; + BaseTextEditorWidget::Link m_currentLink; bool m_linkPressed; QTextCharFormat m_ifdefedOutFormat; @@ -261,11 +261,11 @@ public: void highlightSearchResults(const QTextBlock &block, TextEditorOverlay *overlay); QTimer *m_delayedUpdateTimer; - BaseTextEditorEditable *m_editable; + BaseTextEditor *m_editor; QObject *m_actionHack; - QList m_extraSelections[BaseTextEditor::NExtraSelectionKinds]; + QList m_extraSelections[BaseTextEditorWidget::NExtraSelectionKinds]; // block selection mode bool m_inBlockSelectionMode; diff --git a/src/plugins/texteditor/completionsupport.cpp b/src/plugins/texteditor/completionsupport.cpp index 85a8d1a057..75ffa49e80 100644 --- a/src/plugins/texteditor/completionsupport.cpp +++ b/src/plugins/texteditor/completionsupport.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include @@ -67,13 +67,13 @@ private slots: public: QList getCompletions() const; - void complete(ITextEditable *editor, CompletionPolicy policy, bool forced); + void complete(ITextEditor *editor, CompletionPolicy policy, bool forced); CompletionSupport *m_support; Internal::CompletionWidget *m_completionList; int m_startPosition; bool m_checkCompletionTrigger; // Whether to check for completion trigger after cleanup - ITextEditable *m_editor; + ITextEditor *m_editor; const QList m_completionCollectors; ICompletionCollector *m_completionCollector; CompletionPolicy m_policy; @@ -147,12 +147,12 @@ CompletionPolicy CompletionSupport::policy() const return d->m_policy; } -void CompletionSupport::complete(ITextEditable *editor, CompletionPolicy policy, bool forced) +void CompletionSupport::complete(ITextEditor *editor, CompletionPolicy policy, bool forced) { d->complete(editor, policy, forced); } -void CompletionSupportPrivate::complete(ITextEditable *editor, CompletionPolicy policy, bool forced) +void CompletionSupportPrivate::complete(ITextEditor *editor, CompletionPolicy policy, bool forced) { m_completionCollector = 0; diff --git a/src/plugins/texteditor/completionsupport.h b/src/plugins/texteditor/completionsupport.h index 3037252536..db706aa874 100644 --- a/src/plugins/texteditor/completionsupport.h +++ b/src/plugins/texteditor/completionsupport.h @@ -41,7 +41,7 @@ namespace TextEditor { -class ITextEditable; +class ITextEditor; class CompletionSupportPrivate; /* Completion support is responsible for querying the list of completion collectors @@ -60,7 +60,7 @@ public: CompletionPolicy policy() const; public slots: - void complete(TextEditor::ITextEditable *editor, + void complete(TextEditor::ITextEditor *editor, TextEditor::CompletionPolicy policy, bool forced); private: diff --git a/src/plugins/texteditor/completionwidget.cpp b/src/plugins/texteditor/completionwidget.cpp index a7a930648a..ae3dc748d0 100644 --- a/src/plugins/texteditor/completionwidget.cpp +++ b/src/plugins/texteditor/completionwidget.cpp @@ -35,7 +35,7 @@ #include "completionsupport.h" #include "icompletioncollector.h" -#include +#include #include #include @@ -141,7 +141,8 @@ QVariant AutoCompletionModel::data(const QModelIndex &index, int role) const } -CompletionWidget::CompletionWidget(CompletionSupport *support, ITextEditable *editor) +CompletionWidget::CompletionWidget(CompletionSupport *support, + ITextEditor *editor) : QFrame(0, Qt::Popup), m_support(support), m_editor(editor), @@ -263,7 +264,8 @@ void CompletionWidget::updatePositionAndSize(int startPos) setGeometry(pos.x(), pos.y(), width, height); } -CompletionListView::CompletionListView(CompletionSupport *support, ITextEditable *editor, CompletionWidget *completionWidget) +CompletionListView::CompletionListView(CompletionSupport *support, + ITextEditor *editor, CompletionWidget *completionWidget) : QListView(completionWidget), m_blockFocusOut(false), m_editor(editor), diff --git a/src/plugins/texteditor/completionwidget.h b/src/plugins/texteditor/completionwidget.h index 0ad2595729..d492cffa31 100644 --- a/src/plugins/texteditor/completionwidget.h +++ b/src/plugins/texteditor/completionwidget.h @@ -41,7 +41,7 @@ namespace TextEditor { class CompletionItem; -class ITextEditable; +class ITextEditor; class CompletionSupport; namespace Internal { @@ -58,7 +58,7 @@ class CompletionWidget : public QFrame Q_OBJECT public: - CompletionWidget(CompletionSupport *support, ITextEditable *editor); + CompletionWidget(CompletionSupport *support, ITextEditor *editor); ~CompletionWidget(); void setCompletionItems(const QList &completionitems); @@ -82,7 +82,7 @@ private: private: CompletionSupport *m_support; - ITextEditable *m_editor; + ITextEditor *m_editor; CompletionListView *m_completionListView; }; @@ -108,7 +108,7 @@ protected: private: friend class CompletionWidget; - CompletionListView(CompletionSupport *support, ITextEditable *editor, CompletionWidget *completionWidget); + CompletionListView(CompletionSupport *support, ITextEditor *editor, CompletionWidget *completionWidget); void setCompletionItems(const QList &completionitems); void keyboardSearch(const QString &search); @@ -119,7 +119,7 @@ private slots: private: bool m_blockFocusOut; - ITextEditable *m_editor; + ITextEditor *m_editor; QWidget *m_editorWidget; CompletionWidget *m_completionWidget; AutoCompletionModel *m_model; diff --git a/src/plugins/texteditor/icompletioncollector.cpp b/src/plugins/texteditor/icompletioncollector.cpp index de26dd9fb3..98a8ed180f 100644 --- a/src/plugins/texteditor/icompletioncollector.cpp +++ b/src/plugins/texteditor/icompletioncollector.cpp @@ -34,7 +34,7 @@ #include "icompletioncollector.h" #include "completionsettings.h" -#include "itexteditable.h" +#include "itexteditor.h" #include #include @@ -149,10 +149,10 @@ bool ICompletionCollector::partiallyComplete(const QListposition() - startPosition(); if (!firstKey.isEmpty() && firstKey.length() > typedLength) { - ed->setCurPos(startPosition()); + ed->setCursorPosition(startPosition()); ed->replace(typedLength, firstKey); } } @@ -162,7 +162,8 @@ bool ICompletionCollector::partiallyComplete(const QList &completionItems) { - qStableSort(completionItems.begin(), completionItems.end(), &ICompletionCollector::completionItemLessThan); + qStableSort(completionItems.begin(), completionItems.end(), + &ICompletionCollector::completionItemLessThan); } void ICompletionCollector::filter(const QList &items, diff --git a/src/plugins/texteditor/icompletioncollector.h b/src/plugins/texteditor/icompletioncollector.h index b7a0762358..d1b44743e6 100644 --- a/src/plugins/texteditor/icompletioncollector.h +++ b/src/plugins/texteditor/icompletioncollector.h @@ -47,7 +47,7 @@ class ICompletionCollectorPrivate; } class ICompletionCollector; -class ITextEditable; +class ITextEditor; class CompletionSettings; enum CompletionPolicy @@ -99,14 +99,14 @@ public: virtual QList getCompletions(); virtual bool shouldRestartCompletion(); - /* Returns the current active ITextEditable */ - virtual ITextEditable *editor() const = 0; + /* Returns the current active ITextEditor */ + virtual ITextEditor *editor() const = 0; virtual int startPosition() const = 0; /* * Returns true if this completion collector can be used with the given editor. */ - virtual bool supportsEditor(ITextEditable *editor) const = 0; + virtual bool supportsEditor(ITextEditor *editor) const = 0; /* * Returns true if this completion collector supports the given completion policy. @@ -117,10 +117,10 @@ public: * trigger an autocomplete. It will be called each time a character is typed in * the text editor. */ - virtual bool triggersCompletion(ITextEditable *editor) = 0; + virtual bool triggersCompletion(ITextEditor *editor) = 0; // returns starting position - virtual int startCompletion(ITextEditable *editor) = 0; + virtual int startCompletion(ITextEditor *editor) = 0; /* This method should add all the completions it wants to show into the list, * based on the given cursor position. @@ -192,7 +192,7 @@ public: fix(item); } - virtual bool triggersCompletion(TextEditor::ITextEditable *) + virtual bool triggersCompletion(TextEditor::ITextEditor *) { return false; } virtual bool partiallyComplete(const QList &) diff --git a/src/plugins/texteditor/indenter.cpp b/src/plugins/texteditor/indenter.cpp index f25840ff0a..dd4aaed7aa 100644 --- a/src/plugins/texteditor/indenter.cpp +++ b/src/plugins/texteditor/indenter.cpp @@ -51,7 +51,7 @@ bool Indenter::isElectricCharacter(const QChar &) const void Indenter::indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - BaseTextEditor *editor) + BaseTextEditorWidget *editor) { Q_UNUSED(doc); Q_UNUSED(block); @@ -62,7 +62,7 @@ void Indenter::indentBlock(QTextDocument *doc, void Indenter::indent(QTextDocument *doc, const QTextCursor &cursor, const QChar &typedChar, - BaseTextEditor *editor) + BaseTextEditorWidget *editor) { if (cursor.hasSelection()) { QTextBlock block = doc->findBlock(cursor.selectionStart()); @@ -76,7 +76,7 @@ void Indenter::indent(QTextDocument *doc, } } -void Indenter::reindent(QTextDocument *doc, const QTextCursor &cursor, BaseTextEditor *editor) +void Indenter::reindent(QTextDocument *doc, const QTextCursor &cursor, BaseTextEditorWidget *editor) { if (cursor.hasSelection()) { QTextBlock block = doc->findBlock(cursor.selectionStart()); diff --git a/src/plugins/texteditor/indenter.h b/src/plugins/texteditor/indenter.h index 8e29c3d865..2a23dbbf92 100644 --- a/src/plugins/texteditor/indenter.h +++ b/src/plugins/texteditor/indenter.h @@ -47,7 +47,7 @@ QT_END_NAMESPACE namespace TextEditor { -class BaseTextEditor; +class BaseTextEditorWidget; class TEXTEDITOR_EXPORT Indenter { @@ -62,17 +62,17 @@ public: virtual void indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - BaseTextEditor *editor); + BaseTextEditorWidget *editor); // Indent at cursor. Calls indentBlock for selection or current line. virtual void indent(QTextDocument *doc, const QTextCursor &cursor, const QChar &typedChar, - BaseTextEditor *editor); + BaseTextEditorWidget *editor); // Reindent at cursor. Selection will be adjusted according to the indentation // change of the first block. - virtual void reindent(QTextDocument *doc, const QTextCursor &cursor, BaseTextEditor *editor); + virtual void reindent(QTextDocument *doc, const QTextCursor &cursor, BaseTextEditorWidget *editor); }; } // namespace TextEditor diff --git a/src/plugins/texteditor/itexteditable.h b/src/plugins/texteditor/itexteditable.h deleted file mode 100644 index 048c32bdd8..0000000000 --- a/src/plugins/texteditor/itexteditable.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef ITEXTEDITABLE_H -#define ITEXTEDITABLE_H - -#include "texteditor_global.h" -#include "itexteditor.h" - -namespace TextEditor { - -class TEXTEDITOR_EXPORT ITextEditable : public ITextEditor -{ - Q_OBJECT -public: - ITextEditable() {} - virtual ~ITextEditable() {} - - /* Removes 'length' characters to the right of the cursor. */ - virtual void remove(int length) = 0; - - /* Inserts the given string to the right of the cursor. */ - virtual void insert(const QString &string) = 0; - - /* Replaces 'length' characters to the right of the cursor with the given string. */ - virtual void replace(int length, const QString &string) = 0; - - virtual void setCurPos(int pos) = 0; - - virtual void select(int toPos) = 0; -}; - -} // namespace TextEditor - -#endif // ITEXTEDITABLE_H diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h index 88590fd5ad..e576262ae8 100644 --- a/src/plugins/texteditor/itexteditor.h +++ b/src/plugins/texteditor/itexteditor.h @@ -114,6 +114,17 @@ public: virtual QString textAt(int pos, int length) const = 0; virtual QChar characterAt(int pos) const = 0; + /*! Removes \a length characters to the right of the cursor. */ + virtual void remove(int length) = 0; + /*! Inserts the given string to the right of the cursor. */ + virtual void insert(const QString &string) = 0; + /*! Replaces \a length characters to the right of the cursor with the given string. */ + virtual void replace(int length, const QString &string) = 0; + /*! Sets current cursor position to \a pos. */ + virtual void setCursorPosition(int pos) = 0; + /*! Selects text between current cursor position and \a toPos. */ + virtual void select(int toPos) = 0; + virtual void triggerCompletions() = 0; virtual void triggerQuickFix() = 0; diff --git a/src/plugins/texteditor/normalindenter.cpp b/src/plugins/texteditor/normalindenter.cpp index 931aef0436..f3ec97d0f1 100644 --- a/src/plugins/texteditor/normalindenter.cpp +++ b/src/plugins/texteditor/normalindenter.cpp @@ -67,7 +67,7 @@ NormalIndenter::~NormalIndenter() void NormalIndenter::indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - BaseTextEditor *editor) + BaseTextEditorWidget *editor) { Q_UNUSED(typedChar) diff --git a/src/plugins/texteditor/normalindenter.h b/src/plugins/texteditor/normalindenter.h index 7681755510..994debce63 100644 --- a/src/plugins/texteditor/normalindenter.h +++ b/src/plugins/texteditor/normalindenter.h @@ -47,7 +47,7 @@ public: virtual void indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, - BaseTextEditor *editor); + BaseTextEditorWidget *editor); }; } // namespace TextEditor diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index e20de6b1ea..977f4e9c9d 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -58,14 +58,14 @@ using namespace TextEditor; using namespace TextEditor::Internal; -PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor) - : BaseTextEditorEditable(editor), +PlainTextEditor::PlainTextEditor(PlainTextEditorWidget *editor) + : BaseTextEditor(editor), m_context(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, TextEditor::Constants::C_TEXTEDITOR) { } -PlainTextEditor::PlainTextEditor(QWidget *parent) - : BaseTextEditor(parent), +PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent) + : BaseTextEditorWidget(parent), m_isMissingSyntaxDefinition(false), m_ignoreMissingSyntaxDefinition(false) { @@ -84,35 +84,35 @@ PlainTextEditor::PlainTextEditor(QWidget *parent) connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure())); } -PlainTextEditor::~PlainTextEditor() +PlainTextEditorWidget::~PlainTextEditorWidget() {} -Core::Context PlainTextEditorEditable::context() const +Core::Context PlainTextEditor::context() const { return m_context; } -Core::IEditor *PlainTextEditorEditable::duplicate(QWidget *parent) +Core::IEditor *PlainTextEditor::duplicate(QWidget *parent) { - PlainTextEditor *newEditor = new PlainTextEditor(parent); - newEditor->duplicateFrom(editor()); - TextEditorPlugin::instance()->initializeEditor(newEditor); - return newEditor->editableInterface(); + PlainTextEditorWidget *newWidget = new PlainTextEditorWidget(parent); + newWidget->duplicateFrom(editorWidget()); + TextEditorPlugin::instance()->initializeEditor(newWidget); + return newWidget->editor(); } -QString PlainTextEditorEditable::id() const +QString PlainTextEditor::id() const { return QLatin1String(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID); } -void PlainTextEditor::unCommentSelection() +void PlainTextEditorWidget::unCommentSelection() { Utils::unCommentSelection(this, m_commentDefinition); } -void PlainTextEditor::setFontSettings(const FontSettings &fs) +void PlainTextEditorWidget::setFontSettings(const FontSettings &fs) { - BaseTextEditor::setFontSettings(fs); + BaseTextEditorWidget::setFontSettings(fs); if (baseTextDocument()->syntaxHighlighter()) { Highlighter *highlighter = @@ -143,9 +143,9 @@ void PlainTextEditor::setFontSettings(const FontSettings &fs) } } -void PlainTextEditor::setTabSettings(const TextEditor::TabSettings &ts) +void PlainTextEditorWidget::setTabSettings(const TextEditor::TabSettings &ts) { - BaseTextEditor::setTabSettings(ts); + BaseTextEditorWidget::setTabSettings(ts); if (baseTextDocument()->syntaxHighlighter()) { Highlighter *highlighter = @@ -154,7 +154,7 @@ void PlainTextEditor::setTabSettings(const TextEditor::TabSettings &ts) } } -void PlainTextEditor::configure() +void PlainTextEditorWidget::configure() { Core::MimeType mimeType; if (file()) @@ -162,7 +162,7 @@ void PlainTextEditor::configure() configure(mimeType); } -void PlainTextEditor::configure(const Core::MimeType &mimeType) +void PlainTextEditorWidget::configure(const Core::MimeType &mimeType) { Highlighter *highlighter = new Highlighter(); baseTextDocument()->setSyntaxHighlighter(highlighter); @@ -202,20 +202,20 @@ void PlainTextEditor::configure(const Core::MimeType &mimeType) setFontSettings(TextEditorSettings::instance()->fontSettings()); - emit configured(editableInterface()); + emit configured(editor()); } -bool PlainTextEditor::isMissingSyntaxDefinition() const +bool PlainTextEditorWidget::isMissingSyntaxDefinition() const { return m_isMissingSyntaxDefinition; } -bool PlainTextEditor::ignoreMissingSyntaxDefinition() const +bool PlainTextEditorWidget::ignoreMissingSyntaxDefinition() const { return m_ignoreMissingSyntaxDefinition; } -QString PlainTextEditor::findDefinitionId(const Core::MimeType &mimeType, +QString PlainTextEditorWidget::findDefinitionId(const Core::MimeType &mimeType, bool considerParents) const { QString definitionId = Manager::instance()->definitionIdByAnyMimeType(mimeType.aliases()); @@ -232,13 +232,13 @@ QString PlainTextEditor::findDefinitionId(const Core::MimeType &mimeType, return definitionId; } -void PlainTextEditor::acceptMissingSyntaxDefinitionInfo() +void PlainTextEditorWidget::acceptMissingSyntaxDefinitionInfo() { Core::ICore::instance()->showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY, Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS); } -void PlainTextEditor::ignoreMissingSyntaxDefinitionInfo() +void PlainTextEditorWidget::ignoreMissingSyntaxDefinitionInfo() { m_ignoreMissingSyntaxDefinition = true; } diff --git a/src/plugins/texteditor/plaintexteditor.h b/src/plugins/texteditor/plaintexteditor.h index bbfc63b5b2..f440f38e72 100644 --- a/src/plugins/texteditor/plaintexteditor.h +++ b/src/plugins/texteditor/plaintexteditor.h @@ -47,14 +47,14 @@ class MimeType; namespace TextEditor { -class PlainTextEditor; +class PlainTextEditorWidget; class Indenter; -class TEXTEDITOR_EXPORT PlainTextEditorEditable : public BaseTextEditorEditable +class TEXTEDITOR_EXPORT PlainTextEditor : public BaseTextEditor { Q_OBJECT public: - PlainTextEditorEditable(PlainTextEditor *); + PlainTextEditor(PlainTextEditorWidget *); Core::Context context() const; bool duplicateSupported() const { return true; } @@ -66,13 +66,13 @@ private: const Core::Context m_context; }; -class TEXTEDITOR_EXPORT PlainTextEditor : public BaseTextEditor +class TEXTEDITOR_EXPORT PlainTextEditorWidget : public BaseTextEditorWidget { Q_OBJECT public: - PlainTextEditor(QWidget *parent); - ~PlainTextEditor(); + PlainTextEditorWidget(QWidget *parent); + ~PlainTextEditorWidget(); void configure(const Core::MimeType &mimeType); bool isMissingSyntaxDefinition() const; @@ -92,7 +92,7 @@ signals: void configured(Core::IEditor *editor); protected: - virtual BaseTextEditorEditable *createEditableInterface() { return new PlainTextEditorEditable(this); } + virtual BaseTextEditor *createEditor() { return new PlainTextEditor(this); } private: QString findDefinitionId(const Core::MimeType &mimeType, bool considerParents) const; diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp index 496d99bdfa..b613aeceb8 100644 --- a/src/plugins/texteditor/plaintexteditorfactory.cpp +++ b/src/plugins/texteditor/plaintexteditorfactory.cpp @@ -85,18 +85,18 @@ Core::IFile *PlainTextEditorFactory::open(const QString &fileName) Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent) { - PlainTextEditor *rc = new PlainTextEditor(parent); + PlainTextEditorWidget *rc = new PlainTextEditorWidget(parent); TextEditorPlugin::instance()->initializeEditor(rc); connect(rc, SIGNAL(configured(Core::IEditor*)), this, SLOT(updateEditorInfoBar(Core::IEditor*))); - return rc->editableInterface(); + return rc->editor(); } void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor) { - PlainTextEditorEditable *editorEditable = qobject_cast(editor); + PlainTextEditor *editorEditable = qobject_cast(editor); if (editorEditable) { - PlainTextEditor *textEditor = static_cast(editorEditable->editor()); + PlainTextEditorWidget *textEditor = static_cast(editorEditable->editorWidget()); if (textEditor->isMissingSyntaxDefinition() && !textEditor->ignoreMissingSyntaxDefinition() && TextEditorSettings::instance()->highlighterSettings().alertWhenNoDefinition()) { diff --git a/src/plugins/texteditor/quickfix.cpp b/src/plugins/texteditor/quickfix.cpp index edac849795..8c76f3f319 100644 --- a/src/plugins/texteditor/quickfix.cpp +++ b/src/plugins/texteditor/quickfix.cpp @@ -43,7 +43,7 @@ using namespace TextEditor; -QuickFixState::QuickFixState(TextEditor::BaseTextEditor *editor) +QuickFixState::QuickFixState(TextEditor::BaseTextEditorWidget *editor) : _editor(editor) { } @@ -52,7 +52,7 @@ QuickFixState::~QuickFixState() { } -TextEditor::BaseTextEditor *QuickFixState::editor() const +TextEditor::BaseTextEditorWidget *QuickFixState::editor() const { return _editor; } @@ -99,7 +99,7 @@ QuickFixFactory::~QuickFixFactory() } QuickFixCollector::QuickFixCollector() - : _editable(0) + : m_editor(0) { } @@ -107,27 +107,27 @@ QuickFixCollector::~QuickFixCollector() { } -TextEditor::ITextEditable *QuickFixCollector::editor() const +TextEditor::ITextEditor *QuickFixCollector::editor() const { - return _editable; + return m_editor; } int QuickFixCollector::startPosition() const { - return _editable->position(); + return m_editor->position(); } -bool QuickFixCollector::triggersCompletion(TextEditor::ITextEditable *) +bool QuickFixCollector::triggersCompletion(TextEditor::ITextEditor *) { return false; } -int QuickFixCollector::startCompletion(TextEditor::ITextEditable *editable) +int QuickFixCollector::startCompletion(TextEditor::ITextEditor *editable) { Q_ASSERT(editable != 0); - _editable = editable; - TextEditor::BaseTextEditor *editor = qobject_cast(editable->widget()); + m_editor = editable; + TextEditor::BaseTextEditorWidget *editor = qobject_cast(editable->widget()); Q_ASSERT(editor != 0); if (TextEditor::QuickFixState *state = initializeCompletion(editor)) { @@ -147,12 +147,12 @@ int QuickFixCollector::startCompletion(TextEditor::ITextEditable *editable) it.toBack(); if (it.hasPrevious()) { it.previous(); - _quickFixes = it.value(); + m_quickFixes = it.value(); } delete state; - if (! _quickFixes.isEmpty()) + if (! m_quickFixes.isEmpty()) return editable->position(); } @@ -161,8 +161,8 @@ int QuickFixCollector::startCompletion(TextEditor::ITextEditable *editable) void QuickFixCollector::completions(QList *quickFixItems) { - for (int i = 0; i < _quickFixes.size(); ++i) { - TextEditor::QuickFixOperation::Ptr op = _quickFixes.at(i); + for (int i = 0; i < m_quickFixes.size(); ++i) { + TextEditor::QuickFixOperation::Ptr op = m_quickFixes.at(i); TextEditor::CompletionItem item(this); item.text = op->description(); @@ -175,13 +175,13 @@ void QuickFixCollector::fix(const TextEditor::CompletionItem &item) { const int index = item.data.toInt(); - if (index < _quickFixes.size()) { - TextEditor::QuickFixOperation::Ptr quickFix = _quickFixes.at(index); + if (index < m_quickFixes.size()) { + TextEditor::QuickFixOperation::Ptr quickFix = m_quickFixes.at(index); quickFix->perform(); } } void QuickFixCollector::cleanup() { - _quickFixes.clear(); + m_quickFixes.clear(); } diff --git a/src/plugins/texteditor/quickfix.h b/src/plugins/texteditor/quickfix.h index d936642cb1..051b455842 100644 --- a/src/plugins/texteditor/quickfix.h +++ b/src/plugins/texteditor/quickfix.h @@ -41,7 +41,7 @@ namespace TextEditor { -class BaseTextEditor; +class BaseTextEditorWidget; /*! State of the editor on which the QuickFixFactory and the QuickFixOperation work. @@ -52,13 +52,13 @@ class TEXTEDITOR_EXPORT QuickFixState { public: /// Creates a new state object for the given text editor. - QuickFixState(TextEditor::BaseTextEditor *editor); + QuickFixState(TextEditor::BaseTextEditorWidget *editor); virtual ~QuickFixState(); - TextEditor::BaseTextEditor *editor() const; + TextEditor::BaseTextEditorWidget *editor() const; private: - TextEditor::BaseTextEditor *_editor; + TextEditor::BaseTextEditorWidget *_editor; }; /*! @@ -153,12 +153,12 @@ public: virtual ~QuickFixCollector(); QList quickFixes() const - { return _quickFixes; } + { return m_quickFixes; } - virtual TextEditor::ITextEditable *editor() const; + virtual TextEditor::ITextEditor *editor() const; virtual int startPosition() const; - virtual bool triggersCompletion(TextEditor::ITextEditable *editor); - virtual int startCompletion(TextEditor::ITextEditable *editor); + virtual bool triggersCompletion(TextEditor::ITextEditor *editor); + virtual int startCompletion(TextEditor::ITextEditor *editor); virtual void completions(QList *completions); virtual bool supportsPolicy(TextEditor::CompletionPolicy policy) const @@ -171,13 +171,13 @@ public: virtual void cleanup(); /// Called from #startCompletion to create a QuickFixState . - virtual TextEditor::QuickFixState *initializeCompletion(BaseTextEditor *editable) = 0; + virtual TextEditor::QuickFixState *initializeCompletion(BaseTextEditorWidget *editable) = 0; virtual QList quickFixFactories() const = 0; private: - TextEditor::ITextEditable *_editable; - QList _quickFixes; + TextEditor::ITextEditor *m_editor; + QList m_quickFixes; }; } // namespace TextEditor diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index 2d2c420f47..141c935641 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -52,18 +52,18 @@ RefactoringChanges::RefactoringChanges() RefactoringChanges::~RefactoringChanges() { if (!m_fileToOpen.isEmpty()) { - BaseTextEditor::openEditorAt(m_fileToOpen, m_lineToOpen, m_columnToOpen); + BaseTextEditorWidget::openEditorAt(m_fileToOpen, m_lineToOpen, m_columnToOpen); } } -BaseTextEditor *RefactoringChanges::editorForFile(const QString &fileName, +BaseTextEditorWidget *RefactoringChanges::editorForFile(const QString &fileName, bool openIfClosed) { Core::EditorManager *editorManager = Core::EditorManager::instance(); const QList editors = editorManager->editorsForFileName(fileName); foreach (Core::IEditor *editor, editors) { - BaseTextEditor *textEditor = qobject_cast(editor->widget()); + BaseTextEditorWidget *textEditor = qobject_cast(editor->widget()); if (textEditor != 0) return textEditor; } @@ -80,7 +80,7 @@ BaseTextEditor *RefactoringChanges::editorForFile(const QString &fileName, Core::IEditor *editor = editorManager->openEditor(fileName, QString(), Core::EditorManager::NoActivate | Core::EditorManager::IgnoreNavigationHistory); - return qobject_cast(editor->widget()); + return qobject_cast(editor->widget()); } QList RefactoringChanges::rangesToSelections(QTextDocument *document, const QList &ranges) @@ -104,7 +104,7 @@ bool RefactoringChanges::createFile(const QString &fileName, const QString &cont if (QFile::exists(fileName)) return false; - BaseTextEditor *editor = editorForFile(fileName, openEditor); + BaseTextEditorWidget *editor = editorForFile(fileName, openEditor); QTextDocument *document; if (editor) @@ -156,9 +156,9 @@ RefactoringFile RefactoringChanges::file(const QString &fileName) return RefactoringFile(); } -BaseTextEditor *RefactoringChanges::openEditor(const QString &fileName, int pos) +BaseTextEditorWidget *RefactoringChanges::openEditor(const QString &fileName, int pos) { - BaseTextEditor *editor = editorForFile(fileName, true); + BaseTextEditorWidget *editor = editorForFile(fileName, true); if (pos != -1) { QTextCursor cursor = editor->textCursor(); cursor.setPosition(pos); diff --git a/src/plugins/texteditor/refactoringchanges.h b/src/plugins/texteditor/refactoringchanges.h index 2a53c91dbf..4367b56b40 100644 --- a/src/plugins/texteditor/refactoringchanges.h +++ b/src/plugins/texteditor/refactoringchanges.h @@ -43,7 +43,7 @@ QT_FORWARD_DECLARE_CLASS(QTextDocument) namespace TextEditor { -class BaseTextEditor; +class BaseTextEditorWidget; class RefactoringChanges; class TEXTEDITOR_EXPORT RefactoringFile @@ -83,7 +83,7 @@ protected: QString m_fileName; RefactoringChanges *m_refactoringChanges; mutable QTextDocument *m_document; - BaseTextEditor *m_editor; + BaseTextEditorWidget *m_editor; Utils::ChangeSet m_changes; QList m_indentRanges; bool m_openEditor; @@ -107,7 +107,7 @@ public: RefactoringFile file(const QString &fileName); - BaseTextEditor *openEditor(const QString &fileName, int pos = -1); + BaseTextEditorWidget *openEditor(const QString &fileName, int pos = -1); /*! \param fileName the file to activate the editor for @@ -118,13 +118,13 @@ public: private: - static BaseTextEditor *editorForFile(const QString &fileName, + static BaseTextEditorWidget *editorForFile(const QString &fileName, bool openIfClosed = false); static QList rangesToSelections(QTextDocument *document, const QList &ranges); virtual void indentSelection(const QTextCursor &selection, const QString &fileName, - const BaseTextEditor *textEditor) const = 0; + const BaseTextEditorWidget *textEditor) const = 0; virtual void fileChanged(const QString &fileName) = 0; friend class RefactoringFile; diff --git a/src/plugins/texteditor/refactoroverlay.cpp b/src/plugins/texteditor/refactoroverlay.cpp index 60ab256fb1..36d8f3beff 100644 --- a/src/plugins/texteditor/refactoroverlay.cpp +++ b/src/plugins/texteditor/refactoroverlay.cpp @@ -42,7 +42,7 @@ namespace TextEditor { -RefactorOverlay::RefactorOverlay(TextEditor::BaseTextEditor *editor) : +RefactorOverlay::RefactorOverlay(TextEditor::BaseTextEditorWidget *editor) : QObject(editor), m_editor(editor), m_maxWidth(0), diff --git a/src/plugins/texteditor/refactoroverlay.h b/src/plugins/texteditor/refactoroverlay.h index d93c4f7890..c8cfcd775c 100644 --- a/src/plugins/texteditor/refactoroverlay.h +++ b/src/plugins/texteditor/refactoroverlay.h @@ -40,7 +40,7 @@ #include namespace TextEditor { -class BaseTextEditor; +class BaseTextEditorWidget; struct TEXTEDITOR_EXPORT RefactorMarker { inline bool isValid() const { return !cursor.isNull(); } @@ -57,7 +57,7 @@ class TEXTEDITOR_EXPORT RefactorOverlay : public QObject { Q_OBJECT public: - explicit RefactorOverlay(TextEditor::BaseTextEditor *editor); + explicit RefactorOverlay(TextEditor::BaseTextEditorWidget *editor); bool isEmpty() const { return m_markers.isEmpty(); } void paint(QPainter *painter, const QRect &clip); @@ -72,7 +72,7 @@ public: private: void paintMarker(const RefactorMarker& marker, QPainter *painter, const QRect &clip); RefactorMarkers m_markers; - BaseTextEditor *m_editor; + BaseTextEditorWidget *m_editor; int m_maxWidth; const QIcon m_icon; }; diff --git a/src/plugins/texteditor/snippets/isnippetprovider.h b/src/plugins/texteditor/snippets/isnippetprovider.h index a9144e6d81..d0cc290e51 100644 --- a/src/plugins/texteditor/snippets/isnippetprovider.h +++ b/src/plugins/texteditor/snippets/isnippetprovider.h @@ -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(); diff --git a/src/plugins/texteditor/snippets/plaintextsnippetprovider.cpp b/src/plugins/texteditor/snippets/plaintextsnippetprovider.cpp index d33292c0e7..d040d38298 100644 --- a/src/plugins/texteditor/snippets/plaintextsnippetprovider.cpp +++ b/src/plugins/texteditor/snippets/plaintextsnippetprovider.cpp @@ -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 {} diff --git a/src/plugins/texteditor/snippets/plaintextsnippetprovider.h b/src/plugins/texteditor/snippets/plaintextsnippetprovider.h index 9c199dd447..3480e75bf1 100644 --- a/src/plugins/texteditor/snippets/plaintextsnippetprovider.h +++ b/src/plugins/texteditor/snippets/plaintextsnippetprovider.h @@ -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 diff --git a/src/plugins/texteditor/snippets/snippeteditor.cpp b/src/plugins/texteditor/snippets/snippeteditor.cpp index 5e5dffb786..92c1b05344 100644 --- a/src/plugins/texteditor/snippets/snippeteditor.cpp +++ b/src/plugins/texteditor/snippets/snippeteditor.cpp @@ -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); } diff --git a/src/plugins/texteditor/snippets/snippeteditor.h b/src/plugins/texteditor/snippets/snippeteditor.h index 1155b18003..4e6a12052f 100644 --- a/src/plugins/texteditor/snippets/snippeteditor.h +++ b/src/plugins/texteditor/snippets/snippeteditor.h @@ -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 diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp index a1217d16db..bd870a2ea9 100644 --- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp +++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp @@ -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(m_ui.snippetsEditorStack->widget(i)); + return static_cast(m_ui.snippetsEditorStack->widget(i)); } void SnippetsSettingsPagePrivate::configureUi(QWidget *w) @@ -335,7 +335,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w) ExtensionSystem::PluginManager::instance()->getObjects(); 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())); diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index d94850da97..7b42317bbb 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -104,7 +104,6 @@ HEADERS += texteditorplugin.h \ displaysettings.h \ displaysettingspage.h \ fontsettings.h \ - itexteditable.h \ itexteditor.h \ linenumberfilter.h \ texteditor_global.h \ diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index 3689f670ff..54d28eac3f 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -102,7 +102,7 @@ TextEditorActionHandler::TextEditorActionHandler(const char *context, this, SLOT(updateCurrentEditor(Core::IEditor*))); } -void TextEditorActionHandler::setupActions(BaseTextEditor *editor) +void TextEditorActionHandler::setupActions(BaseTextEditorWidget *editor) { initializeActions(); editor->setActionHack(this); @@ -564,7 +564,7 @@ void TextEditorActionHandler::updateCurrentEditor(Core::IEditor *editor) if (!editor) return; - BaseTextEditor *baseEditor = qobject_cast(editor->widget()); + BaseTextEditorWidget *baseEditor = qobject_cast(editor->widget()); if (baseEditor && baseEditor->actionHack() == this) { m_currentEditor = baseEditor; @@ -572,7 +572,7 @@ void TextEditorActionHandler::updateCurrentEditor(Core::IEditor *editor) } } -const QPointer &TextEditorActionHandler::currentEditor() const +const QPointer &TextEditorActionHandler::currentEditor() const { return m_currentEditor; } diff --git a/src/plugins/texteditor/texteditoractionhandler.h b/src/plugins/texteditor/texteditoractionhandler.h index a7de8004cd..d4fec4f846 100644 --- a/src/plugins/texteditor/texteditoractionhandler.h +++ b/src/plugins/texteditor/texteditoractionhandler.h @@ -45,8 +45,6 @@ namespace TextEditor { -class BaseTextEditor; - // Redirects slots from global actions to the respective editor. class TEXTEDITOR_EXPORT TextEditorActionHandler : public QObject @@ -62,7 +60,7 @@ public: }; explicit TextEditorActionHandler(const char *context, uint optionalActions = None); - void setupActions(BaseTextEditor *editor); + void setupActions(BaseTextEditorWidget *editor); void initializeActions(); @@ -73,7 +71,7 @@ public slots: void updateCopyAction(); protected: - const QPointer ¤tEditor() const; + const QPointer ¤tEditor() const; QAction *registerNewAction(const QString &id, bool scriptable=false, const QString &title = QString()); QAction *registerNewAction(const QString &id, QObject *receiver, const char *slot, bool scriptable = false, const QString &title = QString()); @@ -185,7 +183,7 @@ private: QAction *m_insertLineBelowAction; uint m_optionalActions; - QPointer m_currentEditor; + QPointer m_currentEditor; Core::Context m_contextId; bool m_initialized; }; diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index ebd4a93ec0..93afafccab 100644 --- a/src/plugins/texteditor/texteditoroverlay.cpp +++ b/src/plugins/texteditor/texteditoroverlay.cpp @@ -42,7 +42,7 @@ using namespace TextEditor; using namespace TextEditor::Internal; -TextEditorOverlay::TextEditorOverlay(BaseTextEditor *editor) : +TextEditorOverlay::TextEditorOverlay(BaseTextEditorWidget *editor) : QObject(editor), m_visible(false), m_borderWidth(1), diff --git a/src/plugins/texteditor/texteditoroverlay.h b/src/plugins/texteditor/texteditoroverlay.h index 10642d803b..bb5d051027 100644 --- a/src/plugins/texteditor/texteditoroverlay.h +++ b/src/plugins/texteditor/texteditoroverlay.h @@ -43,7 +43,7 @@ QT_FORWARD_DECLARE_CLASS(QWidget) namespace TextEditor { -class BaseTextEditor; +class BaseTextEditorWidget; namespace Internal { @@ -63,7 +63,7 @@ class TextEditorOverlay : public QObject { Q_OBJECT public: - TextEditorOverlay(BaseTextEditor *editor); + TextEditorOverlay(BaseTextEditorWidget *editor); QRect rect() const; void paint(QPainter *painter, const QRect &clip); @@ -120,7 +120,7 @@ private: int m_dropShadowWidth; bool m_alpha; int m_firstSelectionOriginalBegin; - BaseTextEditor *m_editor; + BaseTextEditorWidget *m_editor; QWidget *m_viewport; QList m_selections; QVector > m_equivalentSelections; diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 513caa37ea..04ecc63e5d 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -204,7 +204,7 @@ void TextEditorPlugin::extensionsInitialized() this, SLOT(updateCurrentSelection(QString))); } -void TextEditorPlugin::initializeEditor(PlainTextEditor *editor) +void TextEditorPlugin::initializeEditor(PlainTextEditorWidget *editor) { // common actions m_editorFactory->actionHandler()->setupActions(editor); @@ -271,7 +271,7 @@ void TextEditorPlugin::updateVariable(const QString &variable) void TextEditorPlugin::updateCurrentSelection(const QString &text) { Core::IEditor *iface = Core::EditorManager::instance()->currentEditor(); - ITextEditable *editor = qobject_cast(iface); + ITextEditor *editor = qobject_cast(iface); if (editor) { int pos = editor->position(); int anchor = editor->position(ITextEditor::Anchor); @@ -281,7 +281,7 @@ void TextEditorPlugin::updateCurrentSelection(const QString &text) if (selectionLength == 0) return; int start = qMin(pos, anchor); - editor->setCurPos(start); + editor->setCursorPosition(start); editor->replace(selectionLength, text); } } diff --git a/src/plugins/texteditor/texteditorplugin.h b/src/plugins/texteditor/texteditorplugin.h index 21da72096b..a430affe16 100644 --- a/src/plugins/texteditor/texteditorplugin.h +++ b/src/plugins/texteditor/texteditorplugin.h @@ -43,7 +43,7 @@ class SearchResultWindow; namespace TextEditor { class FontSettings; -class PlainTextEditor; +class PlainTextEditorWidget; class TextEditorSettings; class TextFileWizard; @@ -67,7 +67,7 @@ public: bool initialize(const QStringList &arguments, QString *errorMessage); void extensionsInitialized(); - void initializeEditor(PlainTextEditor *editor); + void initializeEditor(PlainTextEditorWidget *editor); PlainTextEditorFactory *editorFactory() { return m_editorFactory; } LineNumberFilter *lineNumberFilter() { return m_lineNumberFilter; } diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 2ceb12bf3a..fb92169488 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -224,7 +224,7 @@ TextEditorSettings *TextEditorSettings::instance() * Initializes editor settings. Also connects signals to keep them up to date * when they are changed. */ -void TextEditorSettings::initializeEditor(BaseTextEditor *editor) +void TextEditorSettings::initializeEditor(BaseTextEditorWidget *editor) { // Connect to settings change signals connect(this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), diff --git a/src/plugins/texteditor/texteditorsettings.h b/src/plugins/texteditor/texteditorsettings.h index c48ddddc07..44492082a2 100644 --- a/src/plugins/texteditor/texteditorsettings.h +++ b/src/plugins/texteditor/texteditorsettings.h @@ -40,7 +40,7 @@ namespace TextEditor { -class BaseTextEditor; +class BaseTextEditorWidget; class FontSettings; class TabSettings; class StorageSettings; @@ -69,7 +69,7 @@ public: static TextEditorSettings *instance(); - void initializeEditor(BaseTextEditor *editor); + void initializeEditor(BaseTextEditorWidget *editor); const FontSettings &fontSettings() const; const TabSettings &tabSettings() const; diff --git a/src/plugins/vcsbase/basevcseditorfactory.cpp b/src/plugins/vcsbase/basevcseditorfactory.cpp index a40a91cc5b..46ef803f95 100644 --- a/src/plugins/vcsbase/basevcseditorfactory.cpp +++ b/src/plugins/vcsbase/basevcseditorfactory.cpp @@ -96,7 +96,7 @@ Core::IFile *BaseVCSEditorFactory::open(const QString &fileName) Core::IEditor *BaseVCSEditorFactory::createEditor(QWidget *parent) { - VCSBaseEditor *vcsEditor = createVCSBaseEditor(m_d->m_type, parent); + VCSBaseEditorWidget *vcsEditor = createVCSBaseEditor(m_d->m_type, parent); vcsEditor ->setMimeType(m_d->m_mimeTypes.front()); m_d->m_editorHandler->setupActions(vcsEditor); @@ -106,7 +106,7 @@ Core::IEditor *BaseVCSEditorFactory::createEditor(QWidget *parent) connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), vcsEditor, SLOT(setFontSettings(TextEditor::FontSettings))); vcsEditor->setFontSettings(settings->fontSettings()); - return vcsEditor->editableInterface(); + return vcsEditor->editor(); } } // namespace VCSBase diff --git a/src/plugins/vcsbase/basevcseditorfactory.h b/src/plugins/vcsbase/basevcseditorfactory.h index a330c47675..b4184570b8 100644 --- a/src/plugins/vcsbase/basevcseditorfactory.h +++ b/src/plugins/vcsbase/basevcseditorfactory.h @@ -66,7 +66,7 @@ public: private: // Implement to create and initialize (call init()) a // VCSBaseEditor subclass - virtual VCSBaseEditor *createVCSBaseEditor(const VCSBaseEditorParameters *type, + virtual VCSBaseEditorWidget *createVCSBaseEditor(const VCSBaseEditorParameters *type, QWidget *parent) = 0; BaseVCSEditorFactoryPrivate *m_d; @@ -82,7 +82,7 @@ public: const char *describeSlot = 0); private: - virtual VCSBaseEditor *createVCSBaseEditor(const VCSBaseEditorParameters *type, + virtual VCSBaseEditorWidget *createVCSBaseEditor(const VCSBaseEditorParameters *type, QWidget *parent); QObject *m_describeReceiver; const char *m_describeSlot; @@ -99,10 +99,10 @@ VCSEditorFactory::VCSEditorFactory(const VCSBaseEditorParameters *type, } template -VCSBaseEditor *VCSEditorFactory::createVCSBaseEditor(const VCSBaseEditorParameters *type, +VCSBaseEditorWidget *VCSEditorFactory::createVCSBaseEditor(const VCSBaseEditorParameters *type, QWidget *parent) { - VCSBaseEditor *rc = new Editor(type, parent); + VCSBaseEditorWidget *rc = new Editor(type, parent); rc->init(); if (m_describeReceiver) connect(rc, SIGNAL(describeRequested(QString,QString)), m_describeReceiver, m_describeSlot); diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 371c71c8e0..75b74eec12 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -72,16 +72,16 @@ namespace VCSBase { -// VCSBaseEditorEditable: An editable with no support for duplicates +// VCSBaseEditor: An editor with no support for duplicates. // Creates a browse combo in the toolbar for diff output. // It also mirrors the signals of the VCSBaseEditor since the editor -// manager passes the Editable around. -class VCSBaseEditorEditable : public TextEditor::BaseTextEditorEditable +// manager passes the editor around. +class VCSBaseEditor : public TextEditor::BaseTextEditor { Q_OBJECT public: - VCSBaseEditorEditable(VCSBaseEditor *, - const VCSBaseEditorParameters *type); + VCSBaseEditor(VCSBaseEditorWidget *, + const VCSBaseEditorParameters *type); Core::Context context() const; bool duplicateSupported() const { return false; } @@ -101,26 +101,26 @@ private: bool m_temporary; }; -VCSBaseEditorEditable::VCSBaseEditorEditable(VCSBaseEditor *editor, - const VCSBaseEditorParameters *type) : - BaseTextEditorEditable(editor), +VCSBaseEditor::VCSBaseEditor(VCSBaseEditorWidget *widget, + const VCSBaseEditorParameters *type) : + BaseTextEditor(widget), m_id(type->id), m_context(type->context, TextEditor::Constants::C_TEXTEDITOR), m_temporary(false) { } -Core::Context VCSBaseEditorEditable::context() const +Core::Context VCSBaseEditor::context() const { return m_context; } -// Diff editable: creates a browse combo in the toolbar for diff output. -class VCSBaseDiffEditorEditable : public VCSBaseEditorEditable +// Diff editor: creates a browse combo in the toolbar for diff output. +class VCSBaseDiffEditor : public VCSBaseEditor { public: - VCSBaseDiffEditorEditable(VCSBaseEditor *, const VCSBaseEditorParameters *type); - ~VCSBaseDiffEditorEditable(); + VCSBaseDiffEditor(VCSBaseEditorWidget *, const VCSBaseEditorParameters *type); + ~VCSBaseDiffEditor(); virtual QWidget *toolBar() { return m_toolBar; } QComboBox *diffFileBrowseComboBox() const { return m_diffFileBrowseComboBox; } @@ -130,8 +130,8 @@ private: QComboBox *m_diffFileBrowseComboBox; }; -VCSBaseDiffEditorEditable::VCSBaseDiffEditorEditable(VCSBaseEditor *e, const VCSBaseEditorParameters *type) : - VCSBaseEditorEditable(e, type), +VCSBaseDiffEditor::VCSBaseDiffEditor(VCSBaseEditorWidget *w, const VCSBaseEditorParameters *type) : + VCSBaseEditor(w, type), m_toolBar(new QToolBar), m_diffFileBrowseComboBox(new QComboBox(m_toolBar)) { @@ -143,7 +143,7 @@ VCSBaseDiffEditorEditable::VCSBaseDiffEditorEditable(VCSBaseEditor *e, const VCS m_toolBar->addWidget(m_diffFileBrowseComboBox); } -VCSBaseDiffEditorEditable::~VCSBaseDiffEditorEditable() +VCSBaseDiffEditor::~VCSBaseDiffEditor() { delete m_toolBar; } @@ -174,8 +174,8 @@ struct VCSBaseEditorPrivate VCSBaseEditorPrivate::VCSBaseEditorPrivate(const VCSBaseEditorParameters *type) : m_parameters(type), m_cursorLine(-1), - m_annotateRevisionTextFormat(VCSBaseEditor::tr("Annotate \"%1\"")), - m_copyRevisionTextFormat(VCSBaseEditor::tr("Copy \"%1\"")), + m_annotateRevisionTextFormat(VCSBaseEditorWidget::tr("Annotate \"%1\"")), + m_copyRevisionTextFormat(VCSBaseEditorWidget::tr("Copy \"%1\"")), m_fileLogAnnotateEnabled(false), m_toolBar(0), m_configurationWidget(0) @@ -183,8 +183,8 @@ VCSBaseEditorPrivate::VCSBaseEditorPrivate(const VCSBaseEditorParameters *type) } // ------------ VCSBaseEditor -VCSBaseEditor::VCSBaseEditor(const VCSBaseEditorParameters *type, QWidget *parent) - : BaseTextEditor(parent), +VCSBaseEditorWidget::VCSBaseEditorWidget(const VCSBaseEditorParameters *type, QWidget *parent) + : BaseTextEditorWidget(parent), d(new VCSBaseEditorPrivate(type)) { if (VCSBase::Constants::Internal::debug) @@ -195,7 +195,7 @@ VCSBaseEditor::VCSBaseEditor(const VCSBaseEditorParameters *type, QWidget *paren setMimeType(QLatin1String(d->m_parameters->mimeType)); } -void VCSBaseEditor::init() +void VCSBaseEditorWidget::init() { switch (d->m_parameters->type) { case RegularCommandOutput: @@ -216,94 +216,94 @@ void VCSBaseEditor::init() } } -VCSBaseEditor::~VCSBaseEditor() +VCSBaseEditorWidget::~VCSBaseEditorWidget() { delete d; } -void VCSBaseEditor::setForceReadOnly(bool b) +void VCSBaseEditorWidget::setForceReadOnly(bool b) { Internal::VCSBaseTextDocument *vbd = qobject_cast(baseTextDocument()); - VCSBaseEditorEditable *eda = qobject_cast(editableInterface()); + VCSBaseEditor *eda = qobject_cast(editor()); QTC_ASSERT(vbd != 0 && eda != 0, return); setReadOnly(b); vbd->setForceReadOnly(b); eda->setTemporary(b); } -bool VCSBaseEditor::isForceReadOnly() const +bool VCSBaseEditorWidget::isForceReadOnly() const { const Internal::VCSBaseTextDocument *vbd = qobject_cast(baseTextDocument()); QTC_ASSERT(vbd, return false); return vbd->isForceReadOnly(); } -QString VCSBaseEditor::source() const +QString VCSBaseEditorWidget::source() const { return d->m_source; } -void VCSBaseEditor::setSource(const QString &source) +void VCSBaseEditorWidget::setSource(const QString &source) { d->m_source = source; } -QString VCSBaseEditor::annotateRevisionTextFormat() const +QString VCSBaseEditorWidget::annotateRevisionTextFormat() const { return d->m_annotateRevisionTextFormat; } -void VCSBaseEditor::setAnnotateRevisionTextFormat(const QString &f) +void VCSBaseEditorWidget::setAnnotateRevisionTextFormat(const QString &f) { d->m_annotateRevisionTextFormat = f; } -QString VCSBaseEditor::annotatePreviousRevisionTextFormat() const +QString VCSBaseEditorWidget::annotatePreviousRevisionTextFormat() const { return d->m_annotatePreviousRevisionTextFormat; } -void VCSBaseEditor::setAnnotatePreviousRevisionTextFormat(const QString &f) +void VCSBaseEditorWidget::setAnnotatePreviousRevisionTextFormat(const QString &f) { d->m_annotatePreviousRevisionTextFormat = f; } -QString VCSBaseEditor::copyRevisionTextFormat() const +QString VCSBaseEditorWidget::copyRevisionTextFormat() const { return d->m_copyRevisionTextFormat; } -void VCSBaseEditor::setCopyRevisionTextFormat(const QString &f) +void VCSBaseEditorWidget::setCopyRevisionTextFormat(const QString &f) { d->m_copyRevisionTextFormat = f; } -bool VCSBaseEditor::isFileLogAnnotateEnabled() const +bool VCSBaseEditorWidget::isFileLogAnnotateEnabled() const { return d->m_fileLogAnnotateEnabled; } -void VCSBaseEditor::setFileLogAnnotateEnabled(bool e) +void VCSBaseEditorWidget::setFileLogAnnotateEnabled(bool e) { d->m_fileLogAnnotateEnabled = e; } -QString VCSBaseEditor::diffBaseDirectory() const +QString VCSBaseEditorWidget::diffBaseDirectory() const { return d->m_diffBaseDirectory; } -void VCSBaseEditor::setDiffBaseDirectory(const QString &bd) +void VCSBaseEditorWidget::setDiffBaseDirectory(const QString &bd) { d->m_diffBaseDirectory = bd; } -QTextCodec *VCSBaseEditor::codec() const +QTextCodec *VCSBaseEditorWidget::codec() const { return baseTextDocument()->codec(); } -void VCSBaseEditor::setCodec(QTextCodec *c) +void VCSBaseEditorWidget::setCodec(QTextCodec *c) { if (c) { baseTextDocument()->setCodec(c); @@ -312,41 +312,41 @@ void VCSBaseEditor::setCodec(QTextCodec *c) } } -EditorContentType VCSBaseEditor::contentType() const +EditorContentType VCSBaseEditorWidget::contentType() const { return d->m_parameters->type; } -bool VCSBaseEditor::isModified() const +bool VCSBaseEditorWidget::isModified() const { return false; } -TextEditor::BaseTextEditorEditable *VCSBaseEditor::createEditableInterface() +TextEditor::BaseTextEditor *VCSBaseEditorWidget::createEditor() { - TextEditor::BaseTextEditorEditable *editable = 0; + TextEditor::BaseTextEditor *editor = 0; if (d->m_parameters->type == DiffOutput) { // Diff: set up diff file browsing - VCSBaseDiffEditorEditable *de = new VCSBaseDiffEditorEditable(this, d->m_parameters); + VCSBaseDiffEditor *de = new VCSBaseDiffEditor(this, d->m_parameters); QComboBox *diffBrowseComboBox = de->diffFileBrowseComboBox(); connect(diffBrowseComboBox, SIGNAL(activated(int)), this, SLOT(slotDiffBrowse(int))); - editable = de; + editor = de; } else { - editable = new VCSBaseEditorEditable(this, d->m_parameters); + editor = new VCSBaseEditor(this, d->m_parameters); } - d->m_toolBar = qobject_cast(editable->toolBar()); + d->m_toolBar = qobject_cast(editor->toolBar()); // Pass on signals. connect(this, SIGNAL(describeRequested(QString,QString)), - editable, SIGNAL(describeRequested(QString,QString))); + editor, SIGNAL(describeRequested(QString,QString))); connect(this, SIGNAL(annotateRevisionRequested(QString,QString,int)), - editable, SIGNAL(annotateRevisionRequested(QString,QString,int))); - return editable; + editor, SIGNAL(annotateRevisionRequested(QString,QString,int))); + return editor; } -void VCSBaseEditor::slotPopulateDiffBrowser() +void VCSBaseEditorWidget::slotPopulateDiffBrowser() { - VCSBaseDiffEditorEditable *de = static_cast(editableInterface()); + VCSBaseDiffEditor *de = static_cast(editor()); QComboBox *diffBrowseComboBox = de->diffFileBrowseComboBox(); diffBrowseComboBox->clear(); d->m_diffSections.clear(); @@ -370,7 +370,7 @@ void VCSBaseEditor::slotPopulateDiffBrowser() } } -void VCSBaseEditor::slotDiffBrowse(int index) +void VCSBaseEditorWidget::slotDiffBrowse(int index) { // goto diffed file as indicated by index/line number if (index < 0 || index >= d->m_diffSections.size()) @@ -400,7 +400,7 @@ static int sectionOfLine(int line, const QList §ions) return sectionCount - 1; } -void VCSBaseEditor::slotDiffCursorPositionChanged() +void VCSBaseEditorWidget::slotDiffCursorPositionChanged() { // Adapt diff file browse combo to new position // if the cursor goes across a file line. @@ -412,7 +412,7 @@ void VCSBaseEditor::slotDiffCursorPositionChanged() d->m_cursorLine = newCursorLine; const int section = sectionOfLine(d->m_cursorLine, d->m_diffSections); if (section != -1) { - VCSBaseDiffEditorEditable *de = static_cast(editableInterface()); + VCSBaseDiffEditor *de = static_cast(editor()); QComboBox *diffBrowseComboBox = de->diffFileBrowseComboBox(); if (diffBrowseComboBox->currentIndex() != section) { const bool blocked = diffBrowseComboBox->blockSignals(true); @@ -422,14 +422,14 @@ void VCSBaseEditor::slotDiffCursorPositionChanged() } } -QAction *VCSBaseEditor::createDescribeAction(const QString &change) +QAction *VCSBaseEditorWidget::createDescribeAction(const QString &change) { QAction *a = new QAction(tr("Describe change %1").arg(change), 0); connect(a, SIGNAL(triggered()), this, SLOT(describe())); return a; } -QAction *VCSBaseEditor::createAnnotateAction(const QString &change, bool previous) +QAction *VCSBaseEditorWidget::createAnnotateAction(const QString &change, bool previous) { // Use 'previous' format if desired and available, else default to standard. const QString &format = previous && !d->m_annotatePreviousRevisionTextFormat.isEmpty() ? @@ -440,7 +440,7 @@ QAction *VCSBaseEditor::createAnnotateAction(const QString &change, bool previou return a; } -QAction *VCSBaseEditor::createCopyRevisionAction(const QString &change) +QAction *VCSBaseEditorWidget::createCopyRevisionAction(const QString &change) { QAction *a = new QAction(d->m_copyRevisionTextFormat.arg(change), 0); a->setData(change); @@ -448,7 +448,7 @@ QAction *VCSBaseEditor::createCopyRevisionAction(const QString &change) return a; } -void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e) +void VCSBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e) { QMenu *menu = createStandardContextMenu(); // 'click on change-interaction' @@ -484,7 +484,7 @@ void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e) delete menu; } -void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e) +void VCSBaseEditorWidget::mouseMoveEvent(QMouseEvent *e) { bool overrideCursor = false; Qt::CursorShape cursorShape; @@ -508,13 +508,13 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e) overrideCursor = true; cursorShape = Qt::IBeamCursor; } - TextEditor::BaseTextEditor::mouseMoveEvent(e); + TextEditor::BaseTextEditorWidget::mouseMoveEvent(e); if (overrideCursor) viewport()->setCursor(cursorShape); } -void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e) +void VCSBaseEditorWidget::mouseReleaseEvent(QMouseEvent *e) { if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) { if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) { @@ -527,10 +527,10 @@ void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e) } } } - TextEditor::BaseTextEditor::mouseReleaseEvent(e); + TextEditor::BaseTextEditorWidget::mouseReleaseEvent(e); } -void VCSBaseEditor::mouseDoubleClickEvent(QMouseEvent *e) +void VCSBaseEditorWidget::mouseDoubleClickEvent(QMouseEvent *e) { if (d->m_parameters->type == DiffOutput) { if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) { @@ -538,10 +538,10 @@ void VCSBaseEditor::mouseDoubleClickEvent(QMouseEvent *e) jumpToChangeFromDiff(cursor); } } - TextEditor::BaseTextEditor::mouseDoubleClickEvent(e); + TextEditor::BaseTextEditorWidget::mouseDoubleClickEvent(e); } -void VCSBaseEditor::keyPressEvent(QKeyEvent *e) +void VCSBaseEditorWidget::keyPressEvent(QKeyEvent *e) { // Do not intercept return in editable patches. if (d->m_parameters->type == DiffOutput && isReadOnly() @@ -549,10 +549,10 @@ void VCSBaseEditor::keyPressEvent(QKeyEvent *e) jumpToChangeFromDiff(textCursor()); return; } - BaseTextEditor::keyPressEvent(e); + BaseTextEditorWidget::keyPressEvent(e); } -void VCSBaseEditor::describe() +void VCSBaseEditorWidget::describe() { if (VCSBase::Constants::Internal::debug) qDebug() << "VCSBaseEditor::describe" << d->m_currentChange; @@ -560,7 +560,7 @@ void VCSBaseEditor::describe() emit describeRequested(d->m_source, d->m_currentChange); } -void VCSBaseEditor::slotActivateAnnotation() +void VCSBaseEditorWidget::slotActivateAnnotation() { // The annotation highlighting depends on contents (change number // set with assigned colors) @@ -608,7 +608,7 @@ static inline bool checkChunkLine(const QString &line, int *modifiedLineNumber) return ok; } -void VCSBaseEditor::jumpToChangeFromDiff(QTextCursor cursor) +void VCSBaseEditorWidget::jumpToChangeFromDiff(QTextCursor cursor) { int chunkStart = 0; int lineCount = -1; @@ -651,7 +651,7 @@ void VCSBaseEditor::jumpToChangeFromDiff(QTextCursor cursor) editor->gotoLine(chunkStart + lineCount); } -void VCSBaseEditor::setPlainTextData(const QByteArray &data) +void VCSBaseEditorWidget::setPlainTextData(const QByteArray &data) { if (data.size() > Core::EditorManager::maxTextFileSize()) { setPlainText(msgTextTooLarge(data.size())); @@ -660,9 +660,9 @@ void VCSBaseEditor::setPlainTextData(const QByteArray &data) } } -void VCSBaseEditor::setFontSettings(const TextEditor::FontSettings &fs) +void VCSBaseEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { - TextEditor::BaseTextEditor::setFontSettings(fs); + TextEditor::BaseTextEditorWidget::setFontSettings(fs); if (d->m_parameters->type == DiffOutput) { if (DiffHighlighter *highlighter = qobject_cast(baseTextDocument()->syntaxHighlighter())) { static QVector categories; @@ -679,7 +679,7 @@ void VCSBaseEditor::setFontSettings(const TextEditor::FontSettings &fs) } } -const VCSBaseEditorParameters *VCSBaseEditor::findType(const VCSBaseEditorParameters *array, +const VCSBaseEditorParameters *VCSBaseEditorWidget::findType(const VCSBaseEditorParameters *array, int arraySize, EditorContentType et) { @@ -698,8 +698,8 @@ static QTextCodec *findFileCodec(const QString &source) if (!editors.empty()) { const EditorList::const_iterator ecend = editors.constEnd(); for (EditorList::const_iterator it = editors.constBegin(); it != ecend; ++it) - if (const TextEditor::BaseTextEditorEditable *be = qobject_cast(*it)) { - QTextCodec *codec = be->editor()->textCodec(); + if (const TextEditor::BaseTextEditor *be = qobject_cast(*it)) { + QTextCodec *codec = be->editorWidget()->textCodec(); if (VCSBase::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << source << codec->name(); return codec; @@ -733,7 +733,7 @@ static QTextCodec *findProjectCodec(const QString &dir) return 0; } -QTextCodec *VCSBaseEditor::getCodec(const QString &source) +QTextCodec *VCSBaseEditorWidget::getCodec(const QString &source) { if (!source.isEmpty()) { // Check file @@ -751,22 +751,22 @@ QTextCodec *VCSBaseEditor::getCodec(const QString &source) return sys; } -QTextCodec *VCSBaseEditor::getCodec(const QString &workingDirectory, const QStringList &files) +QTextCodec *VCSBaseEditorWidget::getCodec(const QString &workingDirectory, const QStringList &files) { if (files.empty()) return getCodec(workingDirectory); return getCodec(workingDirectory + QLatin1Char('/') + files.front()); } -VCSBaseEditor *VCSBaseEditor::getVcsBaseEditor(const Core::IEditor *editor) +VCSBaseEditorWidget *VCSBaseEditorWidget::getVcsBaseEditor(const Core::IEditor *editor) { - if (const TextEditor::BaseTextEditorEditable *be = qobject_cast(editor)) - return qobject_cast(be->editor()); + if (const TextEditor::BaseTextEditor *be = qobject_cast(editor)) + return qobject_cast(be->editorWidget()); return 0; } // Return line number of current editor if it matches. -int VCSBaseEditor::lineNumberOfCurrentEditor(const QString ¤tFile) +int VCSBaseEditorWidget::lineNumberOfCurrentEditor(const QString ¤tFile) { Core::IEditor *ed = Core::EditorManager::instance()->currentEditor(); if (!ed) @@ -776,16 +776,16 @@ int VCSBaseEditor::lineNumberOfCurrentEditor(const QString ¤tFile) if (!ifile || ifile->fileName() != currentFile) return -1; } - const TextEditor::BaseTextEditorEditable *eda = qobject_cast(ed); + const TextEditor::BaseTextEditor *eda = qobject_cast(ed); if (!eda) return -1; return eda->currentLine(); } -bool VCSBaseEditor::gotoLineOfEditor(Core::IEditor *e, int lineNumber) +bool VCSBaseEditorWidget::gotoLineOfEditor(Core::IEditor *e, int lineNumber) { if (lineNumber >= 0 && e) { - if (TextEditor::BaseTextEditorEditable *be = qobject_cast(e)) { + if (TextEditor::BaseTextEditor *be = qobject_cast(e)) { be->gotoLine(lineNumber); return true; } @@ -795,7 +795,7 @@ bool VCSBaseEditor::gotoLineOfEditor(Core::IEditor *e, int lineNumber) // Return source file or directory string depending on parameters // ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file'). -QString VCSBaseEditor::getSource(const QString &workingDirectory, +QString VCSBaseEditorWidget::getSource(const QString &workingDirectory, const QString &fileName) { if (fileName.isEmpty()) @@ -809,7 +809,7 @@ QString VCSBaseEditor::getSource(const QString &workingDirectory, return rc; } -QString VCSBaseEditor::getSource(const QString &workingDirectory, +QString VCSBaseEditorWidget::getSource(const QString &workingDirectory, const QStringList &fileNames) { return fileNames.size() == 1 ? @@ -817,7 +817,7 @@ QString VCSBaseEditor::getSource(const QString &workingDirectory, workingDirectory; } -QString VCSBaseEditor::getTitleId(const QString &workingDirectory, +QString VCSBaseEditorWidget::getTitleId(const QString &workingDirectory, const QStringList &fileNames, const QString &revision) { @@ -840,7 +840,7 @@ QString VCSBaseEditor::getTitleId(const QString &workingDirectory, return rc; } -bool VCSBaseEditor::setConfigurationWidget(QWidget *w) +bool VCSBaseEditorWidget::setConfigurationWidget(QWidget *w) { if (!d->m_toolBar || d->m_configurationWidget) return false; @@ -859,13 +859,13 @@ bool VCSBaseEditor::setConfigurationWidget(QWidget *w) return true; } -QWidget *VCSBaseEditor::configurationWidget() const +QWidget *VCSBaseEditorWidget::configurationWidget() const { return d->m_configurationWidget; } // Find the complete file from a diff relative specification. -QString VCSBaseEditor::findDiffFile(const QString &f, Core::IVersionControl *control /* = 0 */) const +QString VCSBaseEditorWidget::findDiffFile(const QString &f, Core::IVersionControl *control /* = 0 */) const { // Try the file itself, expand to absolute. const QFileInfo in(f); @@ -900,19 +900,19 @@ QString VCSBaseEditor::findDiffFile(const QString &f, Core::IVersionControl *con return QString(); } -void VCSBaseEditor::slotAnnotateRevision() +void VCSBaseEditorWidget::slotAnnotateRevision() { if (const QAction *a = qobject_cast(sender())) emit annotateRevisionRequested(source(), a->data().toString(), - editableInterface()->currentLine()); + editor()->currentLine()); } -void VCSBaseEditor::slotCopyRevision() +void VCSBaseEditorWidget::slotCopyRevision() { QApplication::clipboard()->setText(d->m_currentChange); } -QStringList VCSBaseEditor::annotationPreviousVersions(const QString &) const +QStringList VCSBaseEditorWidget::annotationPreviousVersions(const QString &) const { return QStringList(); } diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h index 16f3112cb4..afa75274a5 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.h +++ b/src/plugins/vcsbase/vcsbaseeditor.h @@ -76,7 +76,8 @@ enum EditorContentType { // Helper struct used to parametrize an editor with mime type, context // and id. The extension is currently only a suggestion when running // VCS commands with redirection. -struct VCSBASE_EXPORT VCSBaseEditorParameters { +struct VCSBASE_EXPORT VCSBaseEditorParameters +{ EditorContentType type; const char *id; const char *displayName; @@ -90,7 +91,7 @@ struct VCSBASE_EXPORT VCSBaseEditorParameters { // The source property should contain the file or directory the log // refers to and will be emitted with describeRequested(). // This is for VCS that need a current directory. -class VCSBASE_EXPORT VCSBaseEditor : public TextEditor::BaseTextEditor +class VCSBASE_EXPORT VCSBaseEditorWidget : public TextEditor::BaseTextEditorWidget { Q_PROPERTY(QString source READ source WRITE setSource) Q_PROPERTY(QString diffBaseDirectory READ diffBaseDirectory WRITE setDiffBaseDirectory) @@ -99,15 +100,16 @@ class VCSBASE_EXPORT VCSBaseEditor : public TextEditor::BaseTextEditor Q_PROPERTY(QString copyRevisionTextFormat READ copyRevisionTextFormat WRITE setCopyRevisionTextFormat) Q_PROPERTY(bool isFileLogAnnotateEnabled READ isFileLogAnnotateEnabled WRITE setFileLogAnnotateEnabled) Q_OBJECT + protected: // Initialization requires calling init() (which in turns calls // virtual functions). - explicit VCSBaseEditor(const VCSBaseEditorParameters *type, + explicit VCSBaseEditorWidget(const VCSBaseEditorParameters *type, QWidget *parent); public: void init(); - virtual ~VCSBaseEditor(); + virtual ~VCSBaseEditorWidget(); /* Force read-only: Make it a read-only, temporary file. * Should be set to true by version control views. It is not on @@ -159,9 +161,9 @@ public: static QTextCodec *getCodec(const QString &source); static QTextCodec *getCodec(const QString &workingDirectory, const QStringList &files); - // Utility to return the editor from the IEditor returned by the editor - // manager which is a BaseTextEditable. - static VCSBaseEditor *getVcsBaseEditor(const Core::IEditor *editor); + // Utility to return the widget from the IEditor returned by the editor + // manager which is a BaseTextEditor. + static VCSBaseEditorWidget *getVcsBaseEditor(const Core::IEditor *editor); // Utility to find the line number of the current editor. Optionally, // pass in the file name to match it. To be used when jumping to current @@ -199,7 +201,7 @@ public slots: void setPlainTextData(const QByteArray &data); protected: - virtual TextEditor::BaseTextEditorEditable *createEditableInterface(); + virtual TextEditor::BaseTextEditor *createEditor(); void contextMenuEvent(QContextMenuEvent *e); void mouseMoveEvent(QMouseEvent *e); -- cgit v1.2.3