diff options
author | hjk <hjk121@nokiamail.com> | 2014-09-22 18:43:31 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-09-25 18:00:51 +0200 |
commit | 0fcca946adbc17ee6f911a5891e9c5dc11631288 (patch) | |
tree | 1c2fe74498b7eb123f908d408b8ff3bfc4fea12e | |
parent | 33670d22f7a133d1b2a495a123ff36fc31daebe1 (diff) | |
download | qt-creator-0fcca946adbc17ee6f911a5891e9c5dc11631288.tar.gz |
Rename {Core,TextEditor},{Base,}TextDocument classes
First step of some more 'Base' removal in TextEditor.
s/Core::TextDocument/Core::BaseTextDocument/
s/TextEditor::BaseTextDocument/TextEditor::TextDocument/
Change-Id: I71ba325a2f0ad72ec9dae0d96846cbae72d326f7
Reviewed-by: hjk <hjk121@nokiamail.com>
70 files changed, 213 insertions, 212 deletions
diff --git a/src/plugins/android/androidmanifestdocument.cpp b/src/plugins/android/androidmanifestdocument.cpp index 0abb250292..d6a92f6b30 100644 --- a/src/plugins/android/androidmanifestdocument.cpp +++ b/src/plugins/android/androidmanifestdocument.cpp @@ -50,7 +50,7 @@ AndroidManifestDocument::AndroidManifestDocument(AndroidManifestEditorWidget *ed bool AndroidManifestDocument::save(QString *errorString, const QString &fileName, bool autoSave) { m_editorWidget->preSave(); - return BaseTextDocument::save(errorString, fileName, autoSave); + return TextDocument::save(errorString, fileName, autoSave); } QString AndroidManifestDocument::defaultPath() const @@ -67,7 +67,7 @@ QString AndroidManifestDocument::suggestedFileName() const bool AndroidManifestDocument::isModified() const { - return BaseTextDocument::isModified() || m_editorWidget->isModified(); + return TextDocument::isModified() || m_editorWidget->isModified(); } bool AndroidManifestDocument::isSaveAsAllowed() const diff --git a/src/plugins/android/androidmanifestdocument.h b/src/plugins/android/androidmanifestdocument.h index e741f5208a..cfd46237a0 100644 --- a/src/plugins/android/androidmanifestdocument.h +++ b/src/plugins/android/androidmanifestdocument.h @@ -37,7 +37,7 @@ namespace Internal { class AndroidManifestEditorWidget; -class AndroidManifestDocument : public TextEditor::BaseTextDocument +class AndroidManifestDocument : public TextEditor::TextDocument { public: explicit AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget); diff --git a/src/plugins/android/javaeditor.cpp b/src/plugins/android/javaeditor.cpp index 1fbcc0960b..4e22f01b56 100644 --- a/src/plugins/android/javaeditor.cpp +++ b/src/plugins/android/javaeditor.cpp @@ -66,7 +66,7 @@ public: // JavaDocument // -class JavaDocument : public TextEditor::BaseTextDocument +class JavaDocument : public TextEditor::TextDocument { public: JavaDocument(); diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp index f485bffd5a..1842cfc816 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp @@ -90,7 +90,7 @@ QList<TextEditor::BlockRange> toTextEditorBlocks( namespace ClangCodeModel { -ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::BaseTextDocument *document) +ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocument *document) : BaseEditorDocumentProcessor(document) , m_parser(document->filePath()) , m_parserRevision(0) diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.h b/src/plugins/clangcodemodel/clangeditordocumentprocessor.h index 1aa4df9085..d85a71e8a9 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.h +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.h @@ -46,7 +46,7 @@ class ClangEditorDocumentProcessor : public CppTools::BaseEditorDocumentProcesso Q_OBJECT public: - ClangEditorDocumentProcessor(TextEditor::BaseTextDocument *document); + ClangEditorDocumentProcessor(TextEditor::TextDocument *document); ~ClangEditorDocumentProcessor(); // BaseEditorDocumentProcessor interface diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp index 289ab8bde4..8943616223 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp @@ -63,7 +63,7 @@ CppTools::CppCompletionAssistProvider *ModelManagerSupport::completionAssistProv } CppTools::BaseEditorDocumentProcessor *ModelManagerSupport::editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument) + TextEditor::TextDocument *baseTextDocument) { return new ClangCodeModel::ClangEditorDocumentProcessor(baseTextDocument); } diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.h b/src/plugins/clangcodemodel/clangmodelmanagersupport.h index 8855ecd514..5819c6f38a 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.h +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.h @@ -50,7 +50,7 @@ public: virtual CppTools::CppCompletionAssistProvider *completionAssistProvider(); virtual CppTools::BaseEditorDocumentProcessor *editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument); + TextEditor::TextDocument *baseTextDocument); private: QScopedPointer<CppTools::CppCompletionAssistProvider> m_completionAssistProvider; diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index 47c4c58c53..b0daf9d608 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -71,7 +71,7 @@ CMakeEditor::CMakeEditor() void CMakeEditor::finalizeInitialization() { connect(document(), &IDocument::changed, [this]() { - BaseTextDocument *document = textDocument(); + TextDocument *document = textDocument(); if (!document->isModified()) return; InfoBar *infoBar = document->infoBar(); @@ -240,7 +240,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor, // CMakeDocument // -class CMakeDocument : public BaseTextDocument +class CMakeDocument : public TextDocument { public: CMakeDocument(); diff --git a/src/plugins/coreplugin/textdocument.cpp b/src/plugins/coreplugin/textdocument.cpp index f716fe18f4..276e3a0ee1 100644 --- a/src/plugins/coreplugin/textdocument.cpp +++ b/src/plugins/coreplugin/textdocument.cpp @@ -48,10 +48,10 @@ enum { debug = 0 }; namespace Core { namespace Internal { -class TextDocumentPrivate +class BaseTextDocumentPrivate { public: - TextDocumentPrivate() : m_readResult(Utils::TextFileFormat::ReadSuccess) {} + BaseTextDocumentPrivate() : m_readResult(Utils::TextFileFormat::ReadSuccess) {} Utils::TextFileFormat m_format; Utils::TextFileFormat::ReadResult m_readResult; @@ -60,23 +60,23 @@ public: } // namespace Internal -TextDocument::TextDocument(QObject *parent) : - IDocument(parent), d(new Internal::TextDocumentPrivate) +BaseTextDocument::BaseTextDocument(QObject *parent) : + IDocument(parent), d(new Internal::BaseTextDocumentPrivate) { setCodec(Core::EditorManager::defaultTextCodec()); } -TextDocument::~TextDocument() +BaseTextDocument::~BaseTextDocument() { delete d; } -bool TextDocument::hasDecodingError() const +bool BaseTextDocument::hasDecodingError() const { return d->m_readResult == Utils::TextFileFormat::ReadEncodingError; } -QByteArray TextDocument::decodingErrorSample() const +QByteArray BaseTextDocument::decodingErrorSample() const { return d->m_decodingErrorSample; } @@ -85,7 +85,7 @@ QByteArray TextDocument::decodingErrorSample() const Writes out text using the format obtained from the last read. */ -bool TextDocument::write(const QString &fileName, const QString &data, QString *errorMessage) const +bool BaseTextDocument::write(const QString &fileName, const QString &data, QString *errorMessage) const { return write(fileName, format(), data, errorMessage); } @@ -94,7 +94,7 @@ bool TextDocument::write(const QString &fileName, const QString &data, QString * Writes out text using a custom \a format. */ -bool TextDocument::write(const QString &fileName, const Utils::TextFileFormat &format, const QString &data, QString *errorMessage) const +bool BaseTextDocument::write(const QString &fileName, const Utils::TextFileFormat &format, const QString &data, QString *errorMessage) const { if (debug) qDebug() << Q_FUNC_INFO << this << fileName; @@ -105,7 +105,7 @@ bool TextDocument::write(const QString &fileName, const Utils::TextFileFormat &f Autodetects format and reads in the text file specified by \a fileName. */ -TextDocument::ReadResult TextDocument::read(const QString &fileName, QStringList *plainTextList, QString *errorString) +BaseTextDocument::ReadResult BaseTextDocument::read(const QString &fileName, QStringList *plainTextList, QString *errorString) { d->m_readResult = Utils::TextFileFormat::readFile(fileName, codec(), @@ -117,7 +117,7 @@ TextDocument::ReadResult TextDocument::read(const QString &fileName, QStringList Autodetects format and reads in the text file specified by \a fileName. */ -TextDocument::ReadResult TextDocument::read(const QString &fileName, QString *plainText, QString *errorString) +BaseTextDocument::ReadResult BaseTextDocument::read(const QString &fileName, QString *plainText, QString *errorString) { d->m_readResult = Utils::TextFileFormat::readFile(fileName, codec(), @@ -125,19 +125,19 @@ TextDocument::ReadResult TextDocument::read(const QString &fileName, QString *pl return d->m_readResult; } -const QTextCodec *TextDocument::codec() const +const QTextCodec *BaseTextDocument::codec() const { return d->m_format.codec; } -void TextDocument::setCodec(const QTextCodec *codec) +void BaseTextDocument::setCodec(const QTextCodec *codec) { if (debug) qDebug() << Q_FUNC_INFO << this << (codec ? codec->name() : QByteArray()); d->m_format.codec = codec; } -void TextDocument::switchUtf8Bom() +void BaseTextDocument::switchUtf8Bom() { if (debug) qDebug() << Q_FUNC_INFO << this << "UTF-8 BOM: " << !d->m_format.hasUtf8Bom; @@ -148,7 +148,7 @@ void TextDocument::switchUtf8Bom() Returns the format obtained from the last call to \c read(). */ -Utils::TextFileFormat TextDocument::format() const +Utils::TextFileFormat BaseTextDocument::format() const { return d->m_format; } diff --git a/src/plugins/coreplugin/textdocument.h b/src/plugins/coreplugin/textdocument.h index dd4791e9c3..c9cea26bde 100644 --- a/src/plugins/coreplugin/textdocument.h +++ b/src/plugins/coreplugin/textdocument.h @@ -36,16 +36,17 @@ namespace Core { -namespace Internal { class TextDocumentPrivate; } +namespace Internal { class BaseTextDocumentPrivate; } -class CORE_EXPORT TextDocument : public IDocument +class CORE_EXPORT BaseTextDocument : public IDocument { Q_OBJECT + public: typedef Utils::TextFileFormat::ReadResult ReadResult; - explicit TextDocument(QObject *parent = 0); - virtual ~TextDocument(); + explicit BaseTextDocument(QObject *parent = 0); + virtual ~BaseTextDocument(); Utils::TextFileFormat format() const; const QTextCodec *codec() const; @@ -63,7 +64,7 @@ public: bool write(const QString &fileName, const Utils::TextFileFormat &format, const QString &data, QString *errorMessage) const; private: - Internal::TextDocumentPrivate *d; + Internal::BaseTextDocumentPrivate *d; }; } // namespace Core diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index bb5eb7922d..277c6379de 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -214,7 +214,7 @@ void CodepasterPlugin::postEditor() if (const BaseTextEditor *textEditor = qobject_cast<const BaseTextEditor *>(editor)) data = textEditor->selectedText(); if (data.isEmpty()) { - if (auto textDocument = qobject_cast<const BaseTextDocument *>(document)) + if (auto textDocument = qobject_cast<const TextDocument *>(document)) data = textDocument->plainText(); } post(data, mimeType); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 36c24fd514..2f3170161b 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -706,7 +706,7 @@ void CppEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL d->m_declDefLink = link; IDocument *targetDocument = DocumentModel::documentForFilePath( d->m_declDefLink->targetFile->fileName()); if (textDocument() != targetDocument) { - if (auto textDocument = qobject_cast<BaseTextDocument *>(targetDocument)) + if (auto textDocument = qobject_cast<TextDocument *>(targetDocument)) connect(textDocument, SIGNAL(contentsChanged()), this, SLOT(abortDeclDefLink())); } @@ -741,7 +741,7 @@ void CppEditorWidget::abortDeclDefLink() IDocument *targetDocument = DocumentModel::documentForFilePath(d->m_declDefLink->targetFile->fileName()); if (textDocument() != targetDocument) { - if (auto textDocument = qobject_cast<BaseTextDocument *>(targetDocument)) + if (auto textDocument = qobject_cast<TextDocument *>(targetDocument)) disconnect(textDocument, SIGNAL(contentsChanged()), this, SLOT(abortDeclDefLink())); } diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp index 559b38768f..5df0c2d47f 100644 --- a/src/plugins/cppeditor/cppeditordocument.cpp +++ b/src/plugins/cppeditor/cppeditordocument.cpp @@ -166,7 +166,7 @@ void CppEditorDocument::applyFontSettings() b = b.next(); } } - BaseTextDocument::applyFontSettings(); // rehighlights and updates additional formats + TextDocument::applyFontSettings(); // rehighlights and updates additional formats } void CppEditorDocument::invalidateFormatterCache() diff --git a/src/plugins/cppeditor/cppeditordocument.h b/src/plugins/cppeditor/cppeditordocument.h index 13bfd66fc3..64249a4fed 100644 --- a/src/plugins/cppeditor/cppeditordocument.h +++ b/src/plugins/cppeditor/cppeditordocument.h @@ -44,7 +44,7 @@ namespace CppEditor { namespace Internal { -class CppEditorDocument : public TextEditor::BaseTextDocument +class CppEditorDocument : public TextEditor::TextDocument { Q_OBJECT diff --git a/src/plugins/cppeditor/fileandtokenactions_test.cpp b/src/plugins/cppeditor/fileandtokenactions_test.cpp index 2bfccaead7..91a6573849 100644 --- a/src/plugins/cppeditor/fileandtokenactions_test.cpp +++ b/src/plugins/cppeditor/fileandtokenactions_test.cpp @@ -104,7 +104,7 @@ public: static void escape(); /// Undoing changes - static void undoChangesInDocument(BaseTextDocument *editorDocument); + static void undoChangesInDocument(TextDocument *editorDocument); static void undoChangesInAllEditorWidgets(); /// Execute actions for the current cursor position of editorWidget. @@ -255,7 +255,7 @@ void TestActionsTestCase::escape() QTest::keyClick(w, Qt::Key_Escape); } -void TestActionsTestCase::undoChangesInDocument(BaseTextDocument *editorDocument) +void TestActionsTestCase::undoChangesInDocument(TextDocument *editorDocument) { QTextDocument * const document = editorDocument->document(); QVERIFY(document); @@ -266,7 +266,7 @@ void TestActionsTestCase::undoChangesInDocument(BaseTextDocument *editorDocument void TestActionsTestCase::undoChangesInAllEditorWidgets() { foreach (IDocument *document, DocumentModel::openedDocuments()) { - BaseTextDocument *baseTextDocument = qobject_cast<BaseTextDocument *>(document); + TextDocument *baseTextDocument = qobject_cast<TextDocument *>(document); undoChangesInDocument(baseTextDocument); } } diff --git a/src/plugins/cpptools/baseeditordocumentprocessor.cpp b/src/plugins/cpptools/baseeditordocumentprocessor.cpp index bde9d5183a..2888b353dc 100644 --- a/src/plugins/cpptools/baseeditordocumentprocessor.cpp +++ b/src/plugins/cpptools/baseeditordocumentprocessor.cpp @@ -47,7 +47,7 @@ namespace CppTools { */ BaseEditorDocumentProcessor::BaseEditorDocumentProcessor( - TextEditor::BaseTextDocument *document) + TextEditor::TextDocument *document) : m_baseTextDocument(document) { QTC_CHECK(document); @@ -57,7 +57,7 @@ BaseEditorDocumentProcessor::~BaseEditorDocumentProcessor() { } -TextEditor::BaseTextDocument *BaseEditorDocumentProcessor::baseTextDocument() const +TextEditor::TextDocument *BaseEditorDocumentProcessor::baseTextDocument() const { return m_baseTextDocument; } diff --git a/src/plugins/cpptools/baseeditordocumentprocessor.h b/src/plugins/cpptools/baseeditordocumentprocessor.h index a6ac2e8a31..95571f902b 100644 --- a/src/plugins/cpptools/baseeditordocumentprocessor.h +++ b/src/plugins/cpptools/baseeditordocumentprocessor.h @@ -49,10 +49,10 @@ class CPPTOOLS_EXPORT BaseEditorDocumentProcessor : public QObject BaseEditorDocumentProcessor(); public: - BaseEditorDocumentProcessor(TextEditor::BaseTextDocument *document); + BaseEditorDocumentProcessor(TextEditor::TextDocument *document); virtual ~BaseEditorDocumentProcessor(); - TextEditor::BaseTextDocument *baseTextDocument() const; + TextEditor::TextDocument *baseTextDocument() const; // Function interface to implement virtual void run() = 0; @@ -90,7 +90,7 @@ protected: QTextDocument *textDocument() const { return m_baseTextDocument->document(); } private: - TextEditor::BaseTextDocument *m_baseTextDocument; + TextEditor::TextDocument *m_baseTextDocument; }; } // namespace CppTools diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.cpp b/src/plugins/cpptools/builtineditordocumentprocessor.cpp index 74c8d26cc6..3b3dd5f2bc 100644 --- a/src/plugins/cpptools/builtineditordocumentprocessor.cpp +++ b/src/plugins/cpptools/builtineditordocumentprocessor.cpp @@ -123,7 +123,7 @@ QList<TextEditor::BlockRange> toTextEditorBlocks( namespace CppTools { BuiltinEditorDocumentProcessor::BuiltinEditorDocumentProcessor( - TextEditor::BaseTextDocument *document, + TextEditor::TextDocument *document, bool enableSemanticHighlighter) : BaseEditorDocumentProcessor(document) , m_parser(document->filePath()) diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.h b/src/plugins/cpptools/builtineditordocumentprocessor.h index 94c31e6112..9cd7aab3e8 100644 --- a/src/plugins/cpptools/builtineditordocumentprocessor.h +++ b/src/plugins/cpptools/builtineditordocumentprocessor.h @@ -45,7 +45,7 @@ class CPPTOOLS_EXPORT BuiltinEditorDocumentProcessor : public BaseEditorDocument BuiltinEditorDocumentProcessor(); public: - BuiltinEditorDocumentProcessor(TextEditor::BaseTextDocument *document, + BuiltinEditorDocumentProcessor(TextEditor::TextDocument *document, bool enableSemanticHighlighter = true); ~BuiltinEditorDocumentProcessor(); diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 8ab5e8cfa6..dad4a80738 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -952,7 +952,7 @@ CppCompletionAssistProvider *CppModelManager::completionAssistProvider(const QSt } BaseEditorDocumentProcessor *CppModelManager::editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument) const + TextEditor::TextDocument *baseTextDocument) const { QTC_ASSERT(baseTextDocument, return 0); ModelManagerSupport *cms = modelManagerSupportForMimeType(baseTextDocument->mimeType()); diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 2b680ea8e7..0769a23e30 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -47,7 +47,7 @@ namespace Core { class IEditor; } namespace CPlusPlus { class LookupContext; } namespace ProjectExplorer { class Project; } -namespace TextEditor { class BaseTextDocument; } +namespace TextEditor { class TextDocument; } namespace CppTools { @@ -133,7 +133,7 @@ public: ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const; CppCompletionAssistProvider *completionAssistProvider(const QString &mimeType) const; BaseEditorDocumentProcessor *editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument) const; + TextEditor::TextDocument *baseTextDocument) const; void setIndexingSupport(CppIndexingSupport *indexingSupport); CppIndexingSupport *indexingSupport(); diff --git a/src/plugins/cpptools/cppmodelmanagersupport.h b/src/plugins/cpptools/cppmodelmanagersupport.h index 423b096415..5b0721c971 100644 --- a/src/plugins/cpptools/cppmodelmanagersupport.h +++ b/src/plugins/cpptools/cppmodelmanagersupport.h @@ -34,7 +34,7 @@ #include <QString> -namespace TextEditor { class BaseTextDocument; } +namespace TextEditor { class TextDocument; } namespace CppTools { @@ -51,7 +51,7 @@ public: virtual CppCompletionAssistProvider *completionAssistProvider() = 0; virtual BaseEditorDocumentProcessor *editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument) = 0; + TextEditor::TextDocument *baseTextDocument) = 0; }; } // CppTools namespace diff --git a/src/plugins/cpptools/cppmodelmanagersupportinternal.cpp b/src/plugins/cpptools/cppmodelmanagersupportinternal.cpp index 9074a499b2..722483355a 100644 --- a/src/plugins/cpptools/cppmodelmanagersupportinternal.cpp +++ b/src/plugins/cpptools/cppmodelmanagersupportinternal.cpp @@ -57,7 +57,7 @@ QString ModelManagerSupportInternal::displayName() const } BaseEditorDocumentProcessor *ModelManagerSupportInternal::editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument) + TextEditor::TextDocument *baseTextDocument) { return new BuiltinEditorDocumentProcessor(baseTextDocument); } diff --git a/src/plugins/cpptools/cppmodelmanagersupportinternal.h b/src/plugins/cpptools/cppmodelmanagersupportinternal.h index 2e9a335ba5..f71829e945 100644 --- a/src/plugins/cpptools/cppmodelmanagersupportinternal.h +++ b/src/plugins/cpptools/cppmodelmanagersupportinternal.h @@ -50,7 +50,7 @@ public: virtual CppCompletionAssistProvider *completionAssistProvider(); virtual BaseEditorDocumentProcessor *editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument); + TextEditor::TextDocument *baseTextDocument); private: QScopedPointer<CppCompletionAssistProvider> m_completionAssistProvider; diff --git a/src/plugins/cpptools/cpprefactoringchanges.cpp b/src/plugins/cpptools/cpprefactoringchanges.cpp index 057522c776..ac6d740b79 100644 --- a/src/plugins/cpptools/cpprefactoringchanges.cpp +++ b/src/plugins/cpptools/cpprefactoringchanges.cpp @@ -52,7 +52,7 @@ public: virtual void indentSelection(const QTextCursor &selection, const QString &fileName, - const TextEditor::BaseTextDocument *textDocument) const + const TextEditor::TextDocument *textDocument) const { const TextEditor::TabSettings &tabSettings = ProjectExplorer::actualTabSettings(fileName, textDocument); @@ -63,7 +63,7 @@ public: virtual void reindentSelection(const QTextCursor &selection, const QString &fileName, - const TextEditor::BaseTextDocument *textDocument) const + const TextEditor::TextDocument *textDocument) const { const TextEditor::TabSettings &tabSettings = ProjectExplorer::actualTabSettings(fileName, textDocument); diff --git a/src/plugins/cpptools/semantichighlighter.cpp b/src/plugins/cpptools/semantichighlighter.cpp index c39630d966..8f59252598 100644 --- a/src/plugins/cpptools/semantichighlighter.cpp +++ b/src/plugins/cpptools/semantichighlighter.cpp @@ -42,14 +42,14 @@ using TextEditor::SemanticHighlighter::clearExtraAdditionalFormatsUntilEnd; namespace CppTools { -SemanticHighlighter::SemanticHighlighter(TextEditor::BaseTextDocument *baseTextDocument) +SemanticHighlighter::SemanticHighlighter(TextEditor::TextDocument *baseTextDocument) : QObject(baseTextDocument) , m_baseTextDocument(baseTextDocument) , m_revision(0) { QTC_CHECK(m_baseTextDocument); - connect(baseTextDocument, &TextEditor::BaseTextDocument::fontSettingsChanged, + connect(baseTextDocument, &TextEditor::TextDocument::fontSettingsChanged, this, &SemanticHighlighter::onDocumentFontSettingsChanged); updateFormatMapFromFontSettings(); diff --git a/src/plugins/cpptools/semantichighlighter.h b/src/plugins/cpptools/semantichighlighter.h index fb12bf34e6..6ba7659e96 100644 --- a/src/plugins/cpptools/semantichighlighter.h +++ b/src/plugins/cpptools/semantichighlighter.h @@ -67,7 +67,7 @@ public: typedef std::function<QFuture<TextEditor::HighlightingResult> ()> HighlightingRunner; public: - explicit SemanticHighlighter(TextEditor::BaseTextDocument *baseTextDocument); + explicit SemanticHighlighter(TextEditor::TextDocument *baseTextDocument); ~SemanticHighlighter(); void setHighlightingRunner(HighlightingRunner highlightingRunner); @@ -88,7 +88,7 @@ private: void updateFormatMapFromFontSettings(); private: - TextEditor::BaseTextDocument *m_baseTextDocument; + TextEditor::TextDocument *m_baseTextDocument; unsigned m_revision; QScopedPointer<QFutureWatcher<TextEditor::HighlightingResult>> m_watcher; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 07506aeb86..d1a1adc083 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1879,7 +1879,7 @@ void DebuggerPluginPrivate::requestContextMenu(BaseTextEditor *editor, bool contextUsable = true; BreakpointModelId id = BreakpointModelId(); - BaseTextDocument *document = editor->textDocument(); + TextDocument *document = editor->textDocument(); args.fileName = document->filePath(); if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) { QString line = document->plainText() diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp index 3410b83e50..b784c9d1a5 100644 --- a/src/plugins/debugger/disassembleragent.cpp +++ b/src/plugins/debugger/disassembleragent.cpp @@ -100,7 +100,7 @@ public: DisassemblerLines contentsAtCurrentLocation() const; public: - QPointer<BaseTextDocument> document; + QPointer<TextDocument> document; Location location; QPointer<DebuggerEngine> engine; TextMark locationMark; @@ -291,7 +291,7 @@ void DisassemblerAgent::setContentsToDocument(const DisassemblerLines &contents) widget->setReadOnly(true); widget->setRequestMarkEnabled(true); } - d->document = qobject_cast<BaseTextDocument *>(editor->document()); + d->document = qobject_cast<TextDocument *>(editor->document()); QTC_ASSERT(d->document, return); d->document->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, true); d->document->setProperty(Debugger::Constants::OPENED_WITH_DISASSEMBLY, true); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index fead81e657..c77aafb659 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -1325,8 +1325,8 @@ void QmlEngine::updateScriptSource(const QString &fileName, int lineOffset, int void QmlEngine::updateDocument(Core::IDocument *document, const QTextDocument *textDocument) { - TextEditor::BaseTextDocument *baseTextDocument - = qobject_cast<TextEditor::BaseTextDocument *>(document); + TextEditor::TextDocument *baseTextDocument + = qobject_cast<TextEditor::TextDocument *>(document); if (!baseTextDocument) return; diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp index 8a6aa00db6..ed36b289f6 100644 --- a/src/plugins/debugger/sourceutils.cpp +++ b/src/plugins/debugger/sourceutils.cpp @@ -262,7 +262,7 @@ bool getUninitializedVariables(const Snapshot &snapshot, // Editor tooltip support bool isCppEditor(BaseTextEditorWidget *editorWidget) { - const BaseTextDocument *document = editorWidget->textDocument(); + const TextDocument *document = editorWidget->textDocument(); return ProjectFile::classify(document->filePath()) != ProjectFile::Unclassified; } diff --git a/src/plugins/designer/formwindowfile.h b/src/plugins/designer/formwindowfile.h index 5cde87bf63..2bbba069d0 100644 --- a/src/plugins/designer/formwindowfile.h +++ b/src/plugins/designer/formwindowfile.h @@ -43,7 +43,7 @@ namespace Internal { class ResourceHandler; -class FormWindowFile : public TextEditor::BaseTextDocument +class FormWindowFile : public TextEditor::TextDocument { Q_OBJECT diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp index b65be0c10f..12e265a035 100644 --- a/src/plugins/diffeditor/diffeditordocument.cpp +++ b/src/plugins/diffeditor/diffeditordocument.cpp @@ -42,7 +42,7 @@ namespace DiffEditor { DiffEditorDocument::DiffEditorDocument() : - Core::TextDocument(), + Core::BaseTextDocument(), m_controller(new DiffEditorController(this)) { setId(Constants::DIFF_EDITOR_ID); diff --git a/src/plugins/diffeditor/diffeditordocument.h b/src/plugins/diffeditor/diffeditordocument.h index 6785a71553..8c483c4992 100644 --- a/src/plugins/diffeditor/diffeditordocument.h +++ b/src/plugins/diffeditor/diffeditordocument.h @@ -38,7 +38,7 @@ namespace DiffEditor { class DiffEditorController; -class DIFFEDITOR_EXPORT DiffEditorDocument : public Core::TextDocument +class DIFFEDITOR_EXPORT DiffEditorDocument : public Core::BaseTextDocument { Q_OBJECT public: diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 1c49452e30..c03ef0575b 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -1876,8 +1876,8 @@ void FakeVimPluginPrivate::setUseFakeVimInternal(bool on) // Context(FAKEVIM_CONTEXT)); resetCommandBuffer(); foreach (IEditor *editor, m_editorToHandler.keys()) { - if (BaseTextDocument *textDocument = - qobject_cast<BaseTextDocument *>(editor->document())) { + if (TextDocument *textDocument = + qobject_cast<TextDocument *>(editor->document())) { m_editorToHandler[editor]->restoreWidget(textDocument->tabSettings().m_tabSize); } } diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp index 8619816b13..a0ab449248 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp @@ -53,7 +53,7 @@ ProjectFilesFactory::ProjectFilesFactory() addMimeType(Constants::INCLUDES_MIMETYPE); addMimeType(Constants::CONFIG_MIMETYPE); - setDocumentCreator([]() { return new BaseTextDocument(Constants::FILES_EDITOR_ID); }); + setDocumentCreator([]() { return new TextDocument(Constants::FILES_EDITOR_ID); }); setEditorActionHandlers(TextEditorActionHandler::None); } diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp index 604589cbd7..51f825c02f 100644 --- a/src/plugins/glsleditor/glsleditor.cpp +++ b/src/plugins/glsleditor/glsleditor.cpp @@ -337,7 +337,7 @@ GlslEditorFactory::GlslEditorFactory() addMimeType(Constants::GLSL_MIMETYPE_VERT_ES); addMimeType(Constants::GLSL_MIMETYPE_FRAG_ES); - setDocumentCreator([]() { return new BaseTextDocument(Constants::C_GLSLEDITOR_ID); }); + setDocumentCreator([]() { return new TextDocument(Constants::C_GLSLEDITOR_ID); }); setEditorWidgetCreator([]() { return new GlslEditorWidget; }); setIndenterCreator([]() { return new GlslIndenter; }); setSyntaxHighlighterCreator([]() { return new GlslHighlighter; }); diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp index 9ccc12a836..a61ad1ee9d 100644 --- a/src/plugins/glsleditor/glslhighlighter.cpp +++ b/src/plugins/glsleditor/glslhighlighter.cpp @@ -77,7 +77,7 @@ void GlslHighlighter::highlightBlock(const QString &text) lex.setScanKeywords(false); lex.setScanComments(true); const int variant = languageVariant(parent() - ? static_cast<BaseTextDocument*>(parent())->mimeType() + ? static_cast<TextDocument*>(parent())->mimeType() : QString()); lex.setVariant(variant); diff --git a/src/plugins/projectexplorer/allprojectsfind.cpp b/src/plugins/projectexplorer/allprojectsfind.cpp index b54e54782c..47e47fdd2d 100644 --- a/src/plugins/projectexplorer/allprojectsfind.cpp +++ b/src/plugins/projectexplorer/allprojectsfind.cpp @@ -83,7 +83,7 @@ Utils::FileIterator *AllProjectsFind::filesForProjects(const QStringList &nameFi foreach (const QString &filter, nameFilters) { filterRegs << QRegExp(filter, Qt::CaseInsensitive, QRegExp::Wildcard); } - QMap<QString, QTextCodec *> openEditorEncodings = BaseTextDocument::openedTextDocumentEncodings(); + QMap<QString, QTextCodec *> openEditorEncodings = TextDocument::openedTextDocumentEncodings(); QMap<QString, QTextCodec *> encodings; foreach (const Project *project, projects) { QStringList projectFiles = project->files(Project::AllFiles); diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp index 6f7ef0abe1..df36682313 100644 --- a/src/plugins/projectexplorer/editorconfiguration.cpp +++ b/src/plugins/projectexplorer/editorconfiguration.cpp @@ -405,7 +405,7 @@ void EditorConfiguration::editorsClosed(const QList<Core::IEditor*> &closedEdito } TabSettings actualTabSettings(const QString &fileName, - const BaseTextDocument *baseTextdocument) + const TextDocument *baseTextdocument) { if (baseTextdocument) return baseTextdocument->tabSettings(); diff --git a/src/plugins/projectexplorer/editorconfiguration.h b/src/plugins/projectexplorer/editorconfiguration.h index 6631a84953..54c3972215 100644 --- a/src/plugins/projectexplorer/editorconfiguration.h +++ b/src/plugins/projectexplorer/editorconfiguration.h @@ -43,7 +43,7 @@ class Id; namespace TextEditor { class BaseTextEditor; class BaseTextEditorWidget; -class BaseTextDocument; +class TextDocument; class TabSettings; class ICodeStylePreferences; class TypingSettings; @@ -121,7 +121,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 TextEditor::TabSettings actualTabSettings( - const QString &fileName, const TextEditor::BaseTextDocument *baseTextDocument); + const QString &fileName, const TextEditor::TextDocument *baseTextDocument); } // ProjectExplorer diff --git a/src/plugins/pythoneditor/pythoneditor.cpp b/src/plugins/pythoneditor/pythoneditor.cpp index d7423df5f1..e3580863b5 100644 --- a/src/plugins/pythoneditor/pythoneditor.cpp +++ b/src/plugins/pythoneditor/pythoneditor.cpp @@ -74,7 +74,7 @@ PythonEditorFactory::PythonEditorFactory() | TextEditorActionHandler::UnCommentSelection | TextEditorActionHandler::UnCollapseAll); - setDocumentCreator([]() { return new BaseTextDocument(Constants::C_PYTHONEDITOR_ID); }); + setDocumentCreator([]() { return new TextDocument(Constants::C_PYTHONEDITOR_ID); }); setEditorWidgetCreator([]() { return new PythonEditorWidget; }); setIndenterCreator([]() { return new PythonIndenter; }); setSyntaxHighlighterCreator([]() { return new PythonHighlighter; }); diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp index b998efcd73..7ce1ff7a72 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp @@ -162,7 +162,7 @@ void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e) // ProFileDocument // -class ProFileDocument : public BaseTextDocument +class ProFileDocument : public TextDocument { public: ProFileDocument(); diff --git a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp index 1ec88bd7be..5119b1f899 100644 --- a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp +++ b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp @@ -49,7 +49,7 @@ void BaseTextEditModifier::indent(int offset, int length) if (TextEditor::BaseTextEditorWidget *baseTextEditorWidget = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit())) { - TextEditor::BaseTextDocument *baseTextEditorDocument = baseTextEditorWidget->textDocument(); + TextEditor::TextDocument *baseTextEditorDocument = baseTextEditorWidget->textDocument(); QTextDocument *textDocument = baseTextEditorWidget->document(); int startLine = -1; diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp index 62396d426f..233e7f8450 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.cpp +++ b/src/plugins/qmljseditor/qmljseditordocument.cpp @@ -574,7 +574,7 @@ void QmlJSEditorDocument::setDiagnosticRanges(const QVector<QTextLayout::FormatR void QmlJSEditorDocument::applyFontSettings() { - BaseTextDocument::applyFontSettings(); + TextDocument::applyFontSettings(); d->m_semanticHighlighter->updateFontSettings(fontSettings()); if (!isSemanticInfoOutdated()) { d->m_semanticHighlightingNecessary = false; @@ -584,7 +584,7 @@ void QmlJSEditorDocument::applyFontSettings() void QmlJSEditorDocument::triggerPendingUpdates() { - BaseTextDocument::triggerPendingUpdates(); // calls applyFontSettings if necessary + TextDocument::triggerPendingUpdates(); // calls applyFontSettings if necessary // might still need to rehighlight if font settings did not change if (d->m_semanticHighlightingNecessary && !isSemanticInfoOutdated()) { d->m_semanticHighlightingNecessary = false; diff --git a/src/plugins/qmljseditor/qmljseditordocument.h b/src/plugins/qmljseditor/qmljseditordocument.h index 64077497e1..9748b80577 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.h +++ b/src/plugins/qmljseditor/qmljseditordocument.h @@ -45,7 +45,7 @@ class QmlJSEditorDocumentPrivate; class QmlOutlineModel; } // Internal -class QMLJSEDITOR_EXPORT QmlJSEditorDocument : public TextEditor::BaseTextDocument +class QMLJSEDITOR_EXPORT QmlJSEditorDocument : public TextEditor::TextDocument { Q_OBJECT public: diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 886d1f0685..5849c913ff 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -247,7 +247,7 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const WorkingCopy workingCopy; foreach (IDocument *document, DocumentModel::openedDocuments()) { const QString key = document->filePath(); - if (TextEditor::BaseTextDocument *textDocument = qobject_cast<TextEditor::BaseTextDocument *>(document)) { + if (TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(document)) { // TODO the language should be a property on the document, not the editor if (DocumentModel::editorsForDocument(document).first()->context().contains(ProjectExplorer::Constants::LANG_QMLJS)) workingCopy.insert(key, textDocument->plainText(), textDocument->document()->revision()); diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp index fb1c14f036..971e926e96 100644 --- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp +++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp @@ -51,7 +51,7 @@ public: virtual void indentSelection(const QTextCursor &selection, const QString &fileName, - const TextEditor::BaseTextDocument *textDocument) const + const TextEditor::TextDocument *textDocument) const { // ### shares code with QmlJSTextEditor::indent QTextDocument *doc = selection.document(); @@ -75,7 +75,7 @@ public: virtual void reindentSelection(const QTextCursor &selection, const QString &fileName, - const TextEditor::BaseTextDocument *textDocument) const + const TextEditor::TextDocument *textDocument) const { const TextEditor::TabSettings &tabSettings = ProjectExplorer::actualTabSettings(fileName, textDocument); diff --git a/src/plugins/qnx/bardescriptordocument.cpp b/src/plugins/qnx/bardescriptordocument.cpp index 76dd08f2db..653ae40734 100644 --- a/src/plugins/qnx/bardescriptordocument.cpp +++ b/src/plugins/qnx/bardescriptordocument.cpp @@ -46,7 +46,7 @@ using namespace Qnx; using namespace Qnx::Internal; BarDescriptorDocument::BarDescriptorDocument(QObject *parent) - : Core::TextDocument(parent) + : Core::BaseTextDocument(parent) { setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID); setMimeType(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE)); diff --git a/src/plugins/qnx/bardescriptordocument.h b/src/plugins/qnx/bardescriptordocument.h index 2fea2d2169..6a8e861d9d 100644 --- a/src/plugins/qnx/bardescriptordocument.h +++ b/src/plugins/qnx/bardescriptordocument.h @@ -55,7 +55,7 @@ public: typedef QList<BarDescriptorAsset> BarDescriptorAssetList; -class BarDescriptorDocument : public Core::TextDocument +class BarDescriptorDocument : public Core::BaseTextDocument { Q_OBJECT diff --git a/src/plugins/qnx/bardescriptoreditorwidget.cpp b/src/plugins/qnx/bardescriptoreditorwidget.cpp index fb9f547472..d38586848a 100644 --- a/src/plugins/qnx/bardescriptoreditorwidget.cpp +++ b/src/plugins/qnx/bardescriptoreditorwidget.cpp @@ -168,7 +168,7 @@ void BarDescriptorEditorWidget::initAssetsPage() void BarDescriptorEditorWidget::initSourcePage() { - BaseTextDocumentPtr doc(new BaseTextDocument); + BaseTextDocumentPtr doc(new TextDocument); doc->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID); // FIXME: This looks odd. doc->setIndenter(new TextEditor::NormalIndenter); diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index 1fee2bca11..9b303350a0 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -174,12 +174,12 @@ void BaseFileFind::runSearch(Core::SearchResult *search) watcher->setFuture(Utils::findInFilesRegExp(parameters.text, files(parameters.nameFilters, parameters.additionalParameters), textDocumentFlagsForFindFlags(parameters.flags), - BaseTextDocument::openedTextDocumentContents())); + TextDocument::openedTextDocumentContents())); } else { watcher->setFuture(Utils::findInFiles(parameters.text, files(parameters.nameFilters, parameters.additionalParameters), textDocumentFlagsForFindFlags(parameters.flags), - BaseTextDocument::openedTextDocumentContents())); + TextDocument::openedTextDocumentContents())); } FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Searching"), Constants::TASK_SEARCH); diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index f19f077889..a49219342a 100644 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -70,10 +70,10 @@ using namespace Core; namespace TextEditor { -class BaseTextDocumentPrivate +class TextDocumentPrivate { public: - BaseTextDocumentPrivate() : + TextDocumentPrivate() : m_fontSettingsNeedsApply(false), m_highlighter(0), m_indenter(new Indenter), @@ -105,7 +105,7 @@ public: TextMarks m_marksCache; // Marks not owned }; -QTextCursor BaseTextDocumentPrivate::indentOrUnindent(const QTextCursor &textCursor, bool doIndent) +QTextCursor TextDocumentPrivate::indentOrUnindent(const QTextCursor &textCursor, bool doIndent) { QTextCursor cursor = textCursor; cursor.beginEditBlock(); @@ -157,7 +157,7 @@ QTextCursor BaseTextDocumentPrivate::indentOrUnindent(const QTextCursor &textCur return cursor; } -void BaseTextDocumentPrivate::resetRevisions() +void TextDocumentPrivate::resetRevisions() { BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(m_document.documentLayout()); QTC_ASSERT(documentLayout, return); @@ -167,7 +167,7 @@ void BaseTextDocumentPrivate::resetRevisions() block.setRevision(documentLayout->lastSaveRevision); } -void BaseTextDocumentPrivate::updateRevisions() +void TextDocumentPrivate::updateRevisions() { BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(m_document.documentLayout()); QTC_ASSERT(documentLayout, return); @@ -190,8 +190,8 @@ void BaseTextDocumentPrivate::updateRevisions() // /////////////////////////////////////////////////////////////////////// -BaseTextDocument::BaseTextDocument(Id id) - : d(new BaseTextDocumentPrivate) +TextDocument::TextDocument(Id id) + : d(new TextDocumentPrivate) { QObject::connect(&d->m_document, &QTextDocument::modificationChanged, [this](bool modified) { // we only want to update the block revisions when going back to the saved version, @@ -201,7 +201,7 @@ BaseTextDocument::BaseTextDocument(Id id) emit changed(); }); - QObject::connect(&d->m_document, &QTextDocument::contentsChanged, this, &BaseTextDocument::contentsChanged); + QObject::connect(&d->m_document, &QTextDocument::contentsChanged, this, &TextDocument::contentsChanged); // set new document layout QTextOption opt = d->m_document.defaultTextOption(); @@ -216,16 +216,16 @@ BaseTextDocument::BaseTextDocument(Id id) setId(id); } -BaseTextDocument::~BaseTextDocument() +TextDocument::~TextDocument() { delete d; } -QMap<QString, QString> BaseTextDocument::openedTextDocumentContents() +QMap<QString, QString> TextDocument::openedTextDocumentContents() { QMap<QString, QString> workingCopy; foreach (IDocument *document, DocumentModel::openedDocuments()) { - BaseTextDocument *textEditorDocument = qobject_cast<BaseTextDocument *>(document); + TextDocument *textEditorDocument = qobject_cast<TextDocument *>(document); if (!textEditorDocument) continue; QString fileName = textEditorDocument->filePath(); @@ -234,11 +234,11 @@ QMap<QString, QString> BaseTextDocument::openedTextDocumentContents() return workingCopy; } -QMap<QString, QTextCodec *> BaseTextDocument::openedTextDocumentEncodings() +QMap<QString, QTextCodec *> TextDocument::openedTextDocumentEncodings() { QMap<QString, QTextCodec *> workingCopy; foreach (IDocument *document, DocumentModel::openedDocuments()) { - BaseTextDocument *textEditorDocument = qobject_cast<BaseTextDocument *>(document); + TextDocument *textEditorDocument = qobject_cast<TextDocument *>(document); if (!textEditorDocument) continue; QString fileName = textEditorDocument->filePath(); @@ -247,42 +247,42 @@ QMap<QString, QTextCodec *> BaseTextDocument::openedTextDocumentEncodings() return workingCopy; } -QString BaseTextDocument::plainText() const +QString TextDocument::plainText() const { return document()->toPlainText(); } -QString BaseTextDocument::textAt(int pos, int length) const +QString TextDocument::textAt(int pos, int length) const { return Convenience::textAt(QTextCursor(document()), pos, length); } -QChar BaseTextDocument::characterAt(int pos) const +QChar TextDocument::characterAt(int pos) const { return document()->characterAt(pos); } -void BaseTextDocument::setTypingSettings(const TypingSettings &typingSettings) +void TextDocument::setTypingSettings(const TypingSettings &typingSettings) { d->m_typingSettings = typingSettings; } -void BaseTextDocument::setStorageSettings(const StorageSettings &storageSettings) +void TextDocument::setStorageSettings(const StorageSettings &storageSettings) { d->m_storageSettings = storageSettings; } -const TypingSettings &BaseTextDocument::typingSettings() const +const TypingSettings &TextDocument::typingSettings() const { return d->m_typingSettings; } -const StorageSettings &BaseTextDocument::storageSettings() const +const StorageSettings &TextDocument::storageSettings() const { return d->m_storageSettings; } -void BaseTextDocument::setTabSettings(const TabSettings &tabSettings) +void TextDocument::setTabSettings(const TabSettings &tabSettings) { if (tabSettings == d->m_tabSettings) return; @@ -294,12 +294,12 @@ void BaseTextDocument::setTabSettings(const TabSettings &tabSettings) emit tabSettingsChanged(); } -const TabSettings &BaseTextDocument::tabSettings() const +const TabSettings &TextDocument::tabSettings() const { return d->m_tabSettings; } -void BaseTextDocument::setFontSettings(const FontSettings &fontSettings) +void TextDocument::setFontSettings(const FontSettings &fontSettings) { if (fontSettings == d->m_fontSettings) return; @@ -308,13 +308,13 @@ void BaseTextDocument::setFontSettings(const FontSettings &fontSettings) emit fontSettingsChanged(); } -void BaseTextDocument::triggerPendingUpdates() +void TextDocument::triggerPendingUpdates() { if (d->m_fontSettingsNeedsApply) applyFontSettings(); } -void BaseTextDocument::applyFontSettings() +void TextDocument::applyFontSettings() { d->m_fontSettingsNeedsApply = false; if (d->m_highlighter) { @@ -323,42 +323,42 @@ void BaseTextDocument::applyFontSettings() } } -const FontSettings &BaseTextDocument::fontSettings() const +const FontSettings &TextDocument::fontSettings() const { return d->m_fontSettings; } -void BaseTextDocument::setExtraEncodingSettings(const ExtraEncodingSettings &extraEncodingSettings) +void TextDocument::setExtraEncodingSettings(const ExtraEncodingSettings &extraEncodingSettings) { d->m_extraEncodingSettings = extraEncodingSettings; } -void BaseTextDocument::autoIndent(const QTextCursor &cursor, QChar typedChar) +void TextDocument::autoIndent(const QTextCursor &cursor, QChar typedChar) { d->m_indenter->indent(&d->m_document, cursor, typedChar, d->m_tabSettings); } -void BaseTextDocument::autoReindent(const QTextCursor &cursor) +void TextDocument::autoReindent(const QTextCursor &cursor) { d->m_indenter->reindent(&d->m_document, cursor, d->m_tabSettings); } -QTextCursor BaseTextDocument::indent(const QTextCursor &cursor) +QTextCursor TextDocument::indent(const QTextCursor &cursor) { return d->indentOrUnindent(cursor, true); } -QTextCursor BaseTextDocument::unindent(const QTextCursor &cursor) +QTextCursor TextDocument::unindent(const QTextCursor &cursor) { return d->indentOrUnindent(cursor, false); } -const ExtraEncodingSettings &BaseTextDocument::extraEncodingSettings() const +const ExtraEncodingSettings &TextDocument::extraEncodingSettings() const { return d->m_extraEncodingSettings; } -void BaseTextDocument::setIndenter(Indenter *indenter) +void TextDocument::setIndenter(Indenter *indenter) { // clear out existing code formatter data for (QTextBlock it = document()->begin(); it.isValid(); it = it.next()) { @@ -369,42 +369,42 @@ void BaseTextDocument::setIndenter(Indenter *indenter) d->m_indenter.reset(indenter); } -Indenter *BaseTextDocument::indenter() const +Indenter *TextDocument::indenter() const { return d->m_indenter.data(); } -bool BaseTextDocument::isSaveAsAllowed() const +bool TextDocument::isSaveAsAllowed() const { return true; } -QString BaseTextDocument::defaultPath() const +QString TextDocument::defaultPath() const { return d->m_defaultPath; } -QString BaseTextDocument::suggestedFileName() const +QString TextDocument::suggestedFileName() const { return d->m_suggestedFileName; } -void BaseTextDocument::setDefaultPath(const QString &defaultPath) +void TextDocument::setDefaultPath(const QString &defaultPath) { d->m_defaultPath = defaultPath; } -void BaseTextDocument::setSuggestedFileName(const QString &suggestedFileName) +void TextDocument::setSuggestedFileName(const QString &suggestedFileName) { d->m_suggestedFileName = suggestedFileName; } -QTextDocument *BaseTextDocument::document() const +QTextDocument *TextDocument::document() const { return &d->m_document; } -SyntaxHighlighter *BaseTextDocument::syntaxHighlighter() const +SyntaxHighlighter *TextDocument::syntaxHighlighter() const { return d->m_highlighter; } @@ -416,7 +416,7 @@ SyntaxHighlighter *BaseTextDocument::syntaxHighlighter() const * If \a autoSave is true, the cursor will be restored and some signals suppressed * and we do not clean up the text file (cleanWhitespace(), ensureFinalNewLine()). */ -bool BaseTextDocument::save(QString *errorString, const QString &saveFileName, bool autoSave) +bool TextDocument::save(QString *errorString, const QString &saveFileName, bool autoSave) { QTextCursor cursor(&d->m_document); @@ -501,17 +501,17 @@ bool BaseTextDocument::save(QString *errorString, const QString &saveFileName, b return true; } -bool BaseTextDocument::setContents(const QByteArray &contents) +bool TextDocument::setContents(const QByteArray &contents) { return setPlainText(QString::fromUtf8(contents)); } -bool BaseTextDocument::shouldAutoSave() const +bool TextDocument::shouldAutoSave() const { return d->m_autoSaveRevision != d->m_document.revision(); } -void BaseTextDocument::setFilePath(const QString &newName) +void TextDocument::setFilePath(const QString &newName) { if (newName == filePath()) return; @@ -519,19 +519,19 @@ void BaseTextDocument::setFilePath(const QString &newName) IDocument::setFilePath(QDir::cleanPath(fi.absoluteFilePath())); } -bool BaseTextDocument::isFileReadOnly() const +bool TextDocument::isFileReadOnly() const { if (filePath().isEmpty()) //have no corresponding file, so editing is ok return false; return d->m_fileIsReadOnly; } -bool BaseTextDocument::isModified() const +bool TextDocument::isModified() const { return d->m_document.isModified(); } -void BaseTextDocument::checkPermissions() +void TextDocument::checkPermissions() { bool previousReadOnly = d->m_fileIsReadOnly; if (!filePath().isEmpty()) { @@ -544,7 +544,7 @@ void BaseTextDocument::checkPermissions() emit changed(); } -bool BaseTextDocument::open(QString *errorString, const QString &fileName, const QString &realFileName) +bool TextDocument::open(QString *errorString, const QString &fileName, const QString &realFileName) { QStringList content; @@ -591,14 +591,14 @@ bool BaseTextDocument::open(QString *errorString, const QString &fileName, const || readResult == Utils::TextFileFormat::ReadEncodingError; } -bool BaseTextDocument::reload(QString *errorString, QTextCodec *codec) +bool TextDocument::reload(QString *errorString, QTextCodec *codec) { QTC_ASSERT(codec, return false); setCodec(codec); return reload(errorString); } -bool BaseTextDocument::reload(QString *errorString) +bool TextDocument::reload(QString *errorString) { emit aboutToReload(); BaseTextDocumentLayout *documentLayout = @@ -615,7 +615,7 @@ bool BaseTextDocument::reload(QString *errorString) return success; } -bool BaseTextDocument::setPlainText(const QString &text) +bool TextDocument::setPlainText(const QString &text) { if (text.size() > EditorManager::maxTextFileSize()) { document()->setPlainText(BaseTextEditorWidget::msgTextTooLarge(text.size())); @@ -629,7 +629,7 @@ bool BaseTextDocument::setPlainText(const QString &text) return true; } -bool BaseTextDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type) +bool TextDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type) { if (flag == FlagIgnore) return true; @@ -641,7 +641,7 @@ bool BaseTextDocument::reload(QString *errorString, ReloadFlag flag, ChangeType } } -void BaseTextDocument::setSyntaxHighlighter(SyntaxHighlighter *highlighter) +void TextDocument::setSyntaxHighlighter(SyntaxHighlighter *highlighter) { if (d->m_highlighter) delete d->m_highlighter; @@ -650,7 +650,7 @@ void BaseTextDocument::setSyntaxHighlighter(SyntaxHighlighter *highlighter) d->m_highlighter->setDocument(&d->m_document); } -void BaseTextDocument::cleanWhitespace(const QTextCursor &cursor) +void TextDocument::cleanWhitespace(const QTextCursor &cursor) { bool hasSelection = cursor.hasSelection(); QTextCursor copyCursor = cursor; @@ -662,7 +662,7 @@ void BaseTextDocument::cleanWhitespace(const QTextCursor &cursor) copyCursor.endEditBlock(); } -void BaseTextDocument::cleanWhitespace(QTextCursor &cursor, bool cleanIndentation, bool inEntireDocument) +void TextDocument::cleanWhitespace(QTextCursor &cursor, bool cleanIndentation, bool inEntireDocument) { BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(d->m_document.documentLayout()); Q_ASSERT(cursor.visualNavigation() == false); @@ -697,7 +697,7 @@ void BaseTextDocument::cleanWhitespace(QTextCursor &cursor, bool cleanIndentatio } } -void BaseTextDocument::ensureFinalNewLine(QTextCursor& cursor) +void TextDocument::ensureFinalNewLine(QTextCursor& cursor) { cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor); bool emptyFile = !cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); @@ -709,12 +709,12 @@ void BaseTextDocument::ensureFinalNewLine(QTextCursor& cursor) } } -TextMarks BaseTextDocument::marks() const +TextMarks TextDocument::marks() const { return d->m_marksCache; } -bool BaseTextDocument::addMark(TextMark *mark) +bool TextDocument::addMark(TextMark *mark) { if (mark->baseTextDocument()) return false; @@ -748,7 +748,7 @@ bool BaseTextDocument::addMark(TextMark *mark) return false; } -TextMarks BaseTextDocument::marksAt(int line) const +TextMarks TextDocument::marksAt(int line) const { QTC_ASSERT(line >= 1, return TextMarks()); int blockNumber = line - 1; @@ -761,7 +761,7 @@ TextMarks BaseTextDocument::marksAt(int line) const return TextMarks(); } -void BaseTextDocument::removeMarkFromMarksCache(TextMark *mark) +void TextDocument::removeMarkFromMarksCache(TextMark *mark) { auto documentLayout = qobject_cast<BaseTextDocumentLayout*>(d->m_document.documentLayout()); QTC_ASSERT(documentLayout, return); @@ -801,7 +801,7 @@ void BaseTextDocument::removeMarkFromMarksCache(TextMark *mark) } } -void BaseTextDocument::removeMark(TextMark *mark) +void TextDocument::removeMark(TextMark *mark) { QTextBlock block = d->m_document.findBlockByNumber(mark->lineNumber() - 1); if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData())) { @@ -813,7 +813,7 @@ void BaseTextDocument::removeMark(TextMark *mark) mark->setBaseTextDocument(0); } -void BaseTextDocument::updateMark(TextMark *mark) +void TextDocument::updateMark(TextMark *mark) { Q_UNUSED(mark) auto documentLayout = qobject_cast<BaseTextDocumentLayout*>(d->m_document.documentLayout()); @@ -821,7 +821,7 @@ void BaseTextDocument::updateMark(TextMark *mark) documentLayout->requestUpdate(); } -void BaseTextDocument::moveMark(TextMark *mark, int previousLine) +void TextDocument::moveMark(TextMark *mark, int previousLine) { QTextBlock block = d->m_document.findBlockByNumber(previousLine - 1); if (TextBlockUserData *data = BaseTextDocumentLayout::testUserData(block)) { diff --git a/src/plugins/texteditor/basetextdocument.h b/src/plugins/texteditor/basetextdocument.h index 553a7fb24f..55ba153982 100644 --- a/src/plugins/texteditor/basetextdocument.h +++ b/src/plugins/texteditor/basetextdocument.h @@ -48,25 +48,25 @@ QT_END_NAMESPACE namespace TextEditor { -class BaseTextDocumentPrivate; class ExtraEncodingSettings; class FontSettings; class Indenter; class StorageSettings; class SyntaxHighlighter; class TabSettings; +class TextDocumentPrivate; class TextMark; class TypingSettings; typedef QList<TextMark *> TextMarks; -class TEXTEDITOR_EXPORT BaseTextDocument : public Core::TextDocument +class TEXTEDITOR_EXPORT TextDocument : public Core::BaseTextDocument { Q_OBJECT public: - explicit BaseTextDocument(Core::Id id = Core::Id()); - virtual ~BaseTextDocument(); + explicit TextDocument(Core::Id id = Core::Id()); + virtual ~TextDocument(); static QMap<QString, QString> openedTextDocumentContents(); static QMap<QString, QTextCodec *> openedTextDocumentEncodings(); @@ -98,7 +98,7 @@ public: void removeMark(TextMark *mark); void updateMark(TextMark *mark); void moveMark(TextMark *mark, int previousLine); - void removeMarkFromMarksCache(TextEditor::TextMark *mark); + void removeMarkFromMarksCache(TextMark *mark); // IDocument implementation. bool save(QString *errorString, const QString &fileName, bool autoSave); @@ -146,10 +146,10 @@ private: void cleanWhitespace(QTextCursor &cursor, bool cleanIndentation, bool inEntireDocument); void ensureFinalNewLine(QTextCursor &cursor); - BaseTextDocumentPrivate *d; + TextDocumentPrivate *d; }; -typedef QSharedPointer<BaseTextDocument> BaseTextDocumentPtr; +typedef QSharedPointer<TextDocument> BaseTextDocumentPtr; } // namespace TextEditor diff --git a/src/plugins/texteditor/basetextdocumentlayout.cpp b/src/plugins/texteditor/basetextdocumentlayout.cpp index 09d6104623..012193303a 100644 --- a/src/plugins/texteditor/basetextdocumentlayout.cpp +++ b/src/plugins/texteditor/basetextdocumentlayout.cpp @@ -591,7 +591,7 @@ TextMarks BaseTextDocumentLayout::documentClosing() return marks; } -void BaseTextDocumentLayout::documentReloaded(TextMarks marks, BaseTextDocument *baseTextDocument) +void BaseTextDocumentLayout::documentReloaded(TextMarks marks, TextDocument *baseTextDocument) { foreach (TextMark *mark, marks) { int blockNumber = mark->lineNumber() - 1; diff --git a/src/plugins/texteditor/basetextdocumentlayout.h b/src/plugins/texteditor/basetextdocumentlayout.h index cf7e85066f..928c55d66b 100644 --- a/src/plugins/texteditor/basetextdocumentlayout.h +++ b/src/plugins/texteditor/basetextdocumentlayout.h @@ -218,7 +218,7 @@ public: QSizeF documentSize() const; TextMarks documentClosing(); - void documentReloaded(TextMarks marks, BaseTextDocument *baseextDocument); + void documentReloaded(TextMarks marks, TextDocument *baseextDocument); void updateMarksLineNumber(); void updateMarksBlock(const QTextBlock &block); diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 0180d5e938..494a9fc6f7 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -251,7 +251,7 @@ public: void updateCannotDecodeInfo(); void collectToCircularClipboard(); - void ctor(const QSharedPointer<BaseTextDocument> &doc); + void ctor(const QSharedPointer<TextDocument> &doc); void handleHomeKey(bool anchor); void handleBackspaceKey(); void moveLineUpDown(bool up); @@ -324,7 +324,7 @@ public: bool m_contentsChanged; bool m_lastCursorChangeWasInteresting; - QSharedPointer<BaseTextDocument> m_document; + QSharedPointer<TextDocument> m_document; QByteArray m_tempState; QByteArray m_tempNavigationState; @@ -590,12 +590,12 @@ BaseTextEditorWidget::BaseTextEditorWidget(QWidget *parent) d = new BaseTextEditorWidgetPrivate(this); } -void BaseTextEditorWidget::setTextDocument(const QSharedPointer<BaseTextDocument> &doc) +void BaseTextEditorWidget::setTextDocument(const QSharedPointer<TextDocument> &doc) { d->ctor(doc); } -void BaseTextEditorWidgetPrivate::ctor(const QSharedPointer<BaseTextDocument> &doc) +void BaseTextEditorWidgetPrivate::ctor(const QSharedPointer<TextDocument> &doc) { q->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); @@ -889,7 +889,7 @@ int BaseTextEditorWidgetPrivate::visualIndent(const QTextBlock &block) const void BaseTextEditorWidget::selectEncoding() { - BaseTextDocument *doc = d->m_document.data(); + TextDocument *doc = d->m_document.data(); CodecSelector codecSelector(this, doc); switch (codecSelector.exec()) { @@ -999,7 +999,7 @@ void BaseTextEditorWidgetPrivate::foldLicenseHeader() } } -BaseTextDocument *BaseTextEditorWidget::textDocument() const +TextDocument *BaseTextEditorWidget::textDocument() const { return d->m_document.data(); } @@ -2844,16 +2844,16 @@ void BaseTextEditorWidgetPrivate::setupDocumentSignals() QObject::connect(doc, &QTextDocument::contentsChange, this, &BaseTextEditorWidgetPrivate::editorContentsChange); - QObject::connect(m_document.data(), &BaseTextDocument::aboutToReload, + QObject::connect(m_document.data(), &TextDocument::aboutToReload, this, &BaseTextEditorWidgetPrivate::documentAboutToBeReloaded); - QObject::connect(m_document.data(), &BaseTextDocument::reloadFinished, + QObject::connect(m_document.data(), &TextDocument::reloadFinished, this, &BaseTextEditorWidgetPrivate::documentReloadFinished); - QObject::connect(m_document.data(), &BaseTextDocument::tabSettingsChanged, + QObject::connect(m_document.data(), &TextDocument::tabSettingsChanged, this, &BaseTextEditorWidgetPrivate::updateTabStops); - QObject::connect(m_document.data(), &BaseTextDocument::fontSettingsChanged, + QObject::connect(m_document.data(), &TextDocument::fontSettingsChanged, this, &BaseTextEditorWidgetPrivate::applyFontSettingsDelayed); slotUpdateExtraAreaWidth(); @@ -2862,7 +2862,7 @@ void BaseTextEditorWidgetPrivate::setupDocumentSignals() // Connect to settings change signals connect(settings, &TextEditorSettings::fontSettingsChanged, - m_document.data(), &BaseTextDocument::setFontSettings); + m_document.data(), &TextDocument::setFontSettings); connect(settings, &TextEditorSettings::typingSettingsChanged, q, &BaseTextEditorWidget::setTypingSettings); connect(settings, &TextEditorSettings::storageSettingsChanged, @@ -6531,7 +6531,7 @@ QColor BaseTextEditorWidget::replacementPenColor(int blockNumber) const void BaseTextEditorWidget::setupFallBackEditor(Id id) { - BaseTextDocumentPtr doc(new BaseTextDocument(id)); + BaseTextDocumentPtr doc(new TextDocument(id)); doc->setFontSettings(TextEditorSettings::fontSettings()); setTextDocument(doc); } @@ -6553,7 +6553,7 @@ void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu) if (a && a->isEnabled()) menu->addAction(a); - BaseTextDocument *doc = textDocument(); + TextDocument *doc = textDocument(); if (doc->codec()->name() == QByteArray("UTF-8") && doc->supportsUtf8Bom()) { a = ActionManager::command(Constants::SWITCH_UTF8BOM)->action(); if (a && a->isEnabled()) { @@ -6578,7 +6578,7 @@ BaseTextEditor::~BaseTextEditor() delete d; } -BaseTextDocument *BaseTextEditor::textDocument() const +TextDocument *BaseTextEditor::textDocument() const { BaseTextEditorWidget *widget = editorWidget(); QTC_CHECK(!widget->d->m_document.isNull()); @@ -6782,18 +6782,18 @@ void BaseTextBlockSelection::clear() } // returns a cursor which always has the complete selection -QTextCursor BaseTextBlockSelection::selection(const BaseTextDocument *baseTextDocument) const +QTextCursor BaseTextBlockSelection::selection(const TextDocument *baseTextDocument) const { return cursor(baseTextDocument, true); } // returns a cursor which always has the correct position and anchor -QTextCursor BaseTextBlockSelection::cursor(const BaseTextDocument *baseTextDocument) const +QTextCursor BaseTextBlockSelection::cursor(const TextDocument *baseTextDocument) const { return cursor(baseTextDocument, false); } -QTextCursor BaseTextBlockSelection::cursor(const BaseTextDocument *baseTextDocument, +QTextCursor BaseTextBlockSelection::cursor(const TextDocument *baseTextDocument, bool fullSelection) const { if (!baseTextDocument) diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index f6357fc84a..0aac1f39eb 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -138,7 +138,7 @@ public: static BaseTextEditor *currentTextEditor(); BaseTextEditorWidget *editorWidget() const; - BaseTextDocument *textDocument() const; + TextDocument *textDocument() const; // Some convenience text access QTextDocument *qdocument() const; @@ -217,7 +217,7 @@ public: ~BaseTextEditorWidget(); void setTextDocument(const BaseTextDocumentPtr &doc); - BaseTextDocument *textDocument() const; + TextDocument *textDocument() const; BaseTextDocumentPtr textDocumentPtr() const; // IEditor @@ -625,7 +625,7 @@ public: BaseTextEditorFactory(QObject *parent = 0); typedef std::function<BaseTextEditor *()> EditorCreator; - typedef std::function<BaseTextDocument *()> DocumentCreator; + typedef std::function<TextDocument *()> DocumentCreator; typedef std::function<BaseTextEditorWidget *()> EditorWidgetCreator; typedef std::function<SyntaxHighlighter *()> SyntaxHighLighterCreator; typedef std::function<Indenter *()> IndenterCreator; diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index f390ac38fe..9028cc02f7 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -49,7 +49,7 @@ namespace TextEditor { -class BaseTextDocument; +class TextDocument; namespace Internal { class TextEditorOverlay; @@ -64,8 +64,8 @@ public: BaseTextBlockSelection(const BaseTextBlockSelection &other); void clear(); - QTextCursor selection(const BaseTextDocument *baseTextDocument) const; - QTextCursor cursor(const BaseTextDocument *baseTextDocument) const; + QTextCursor selection(const TextDocument *baseTextDocument) const; + QTextCursor cursor(const TextDocument *baseTextDocument) const; void fromPostition(int positionBlock, int positionColumn, int anchorBlock, int anchorColumn); bool hasSelection() { return !(positionBlock == anchorBlock && positionColumn == anchorColumn); } @@ -85,7 +85,7 @@ public: int anchorColumn; private: - QTextCursor cursor(const BaseTextDocument *baseTextDocument, bool fullSelection) const; + QTextCursor cursor(const TextDocument *baseTextDocument, bool fullSelection) const; }; //================BaseTextEditorPrivate============== diff --git a/src/plugins/texteditor/codecselector.cpp b/src/plugins/texteditor/codecselector.cpp index 14faaf7279..0e3a0f887a 100644 --- a/src/plugins/texteditor/codecselector.cpp +++ b/src/plugins/texteditor/codecselector.cpp @@ -62,7 +62,7 @@ public: } // namespace TextEditor -CodecSelector::CodecSelector(QWidget *parent, BaseTextDocument *doc) +CodecSelector::CodecSelector(QWidget *parent, TextDocument *doc) : QDialog(parent) { m_hasDecodingError = doc->hasDecodingError(); diff --git a/src/plugins/texteditor/codecselector.h b/src/plugins/texteditor/codecselector.h index f95f5acaba..813558e94e 100644 --- a/src/plugins/texteditor/codecselector.h +++ b/src/plugins/texteditor/codecselector.h @@ -39,7 +39,7 @@ namespace Utils { class ListWidget; } namespace TextEditor { -class BaseTextDocument; +class TextDocument; namespace Internal { @@ -49,7 +49,7 @@ class CodecSelector : public QDialog public: - CodecSelector(QWidget *parent, BaseTextDocument *doc); + CodecSelector(QWidget *parent, TextDocument *doc); ~CodecSelector(); QTextCodec *selectedCodec() const; diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp index b4a916f29b..43a4b7ce40 100644 --- a/src/plugins/texteditor/findincurrentfile.cpp +++ b/src/plugins/texteditor/findincurrentfile.cpp @@ -63,7 +63,7 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters, { Q_UNUSED(nameFilters) QString fileName = additionalParameters.toString(); - QMap<QString, QTextCodec *> openEditorEncodings = BaseTextDocument::openedTextDocumentEncodings(); + QMap<QString, QTextCodec *> openEditorEncodings = TextDocument::openedTextDocumentEncodings(); QTextCodec *codec = openEditorEncodings.value(fileName); if (!codec) codec = Core::EditorManager::defaultTextCodec(); diff --git a/src/plugins/texteditor/findinopenfiles.cpp b/src/plugins/texteditor/findinopenfiles.cpp index e3e33beda3..dd1995e58c 100644 --- a/src/plugins/texteditor/findinopenfiles.cpp +++ b/src/plugins/texteditor/findinopenfiles.cpp @@ -65,7 +65,7 @@ Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters, Q_UNUSED(nameFilters) Q_UNUSED(additionalParameters) QMap<QString, QTextCodec *> openEditorEncodings - = BaseTextDocument::openedTextDocumentEncodings(); + = TextDocument::openedTextDocumentEncodings(); QStringList fileNames; QList<QTextCodec *> codecs; foreach (Core::DocumentModel::Entry *entry, diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp index a9cc7e0884..78b4e0800c 100644 --- a/src/plugins/texteditor/plaintexteditorfactory.cpp +++ b/src/plugins/texteditor/plaintexteditorfactory.cpp @@ -61,7 +61,7 @@ PlainTextEditorFactory::PlainTextEditorFactory() setDisplayName(qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME)); addMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT)); - setDocumentCreator([]() { return new BaseTextDocument(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID); }); + setDocumentCreator([]() { return new TextDocument(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID); }); setEditorWidgetCreator([]() { return new PlainTextEditorWidget; }); setIndenterCreator([]() { return new NormalIndenter; }); diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index a7474e2029..e025fbd22a 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -384,7 +384,7 @@ void RefactoringFile::apply() void RefactoringFile::indentOrReindent(void (RefactoringChangesData::*mf)(const QTextCursor &, const QString &, - const BaseTextDocument *) const, + const TextDocument *) const, const RefactoringSelections &ranges) { typedef QPair<QTextCursor, QTextCursor> CursorPair; @@ -406,12 +406,12 @@ void RefactoringFile::fileChanged() RefactoringChangesData::~RefactoringChangesData() {} -void RefactoringChangesData::indentSelection(const QTextCursor &, const QString &, const BaseTextDocument *) const +void RefactoringChangesData::indentSelection(const QTextCursor &, const QString &, const TextDocument *) const { qWarning() << Q_FUNC_INFO << "not implemented"; } -void RefactoringChangesData::reindentSelection(const QTextCursor &, const QString &, const BaseTextDocument *) const +void RefactoringChangesData::reindentSelection(const QTextCursor &, const QString &, const TextDocument *) const { qWarning() << Q_FUNC_INFO << "not implemented"; } diff --git a/src/plugins/texteditor/refactoringchanges.h b/src/plugins/texteditor/refactoringchanges.h index 27af9999b6..af42647d0c 100644 --- a/src/plugins/texteditor/refactoringchanges.h +++ b/src/plugins/texteditor/refactoringchanges.h @@ -44,7 +44,7 @@ class QTextDocument; QT_END_NAMESPACE namespace TextEditor { -class BaseTextDocument; +class TextDocument; class BaseTextEditorWidget; class RefactoringChanges; class RefactoringFile; @@ -99,7 +99,7 @@ protected: void indentOrReindent(void (RefactoringChangesData::*mf)(const QTextCursor &, const QString &, - const BaseTextDocument *) const, + const TextDocument *) const, const RefactoringSelections &ranges); protected: @@ -159,10 +159,10 @@ public: virtual void indentSelection(const QTextCursor &selection, const QString &fileName, - const BaseTextDocument *textEditor) const; + const TextDocument *textEditor) const; virtual void reindentSelection(const QTextCursor &selection, const QString &fileName, - const BaseTextDocument *textEditor) const; + const TextDocument *textEditor) const; virtual void fileChanged(const QString &fileName); }; diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp index 033b88b3fa..1c4f039b6f 100644 --- a/src/plugins/texteditor/textmark.cpp +++ b/src/plugins/texteditor/textmark.cpp @@ -171,12 +171,12 @@ void TextMark::dragToLine(int lineNumber) Q_UNUSED(lineNumber); } -BaseTextDocument *TextMark::baseTextDocument() const +TextDocument *TextMark::baseTextDocument() const { return m_baseTextDocument; } -void TextMark::setBaseTextDocument(BaseTextDocument *baseTextDocument) +void TextMark::setBaseTextDocument(TextDocument *baseTextDocument) { m_baseTextDocument = baseTextDocument; } @@ -197,7 +197,7 @@ TextMarkRegistry::TextMarkRegistry(QObject *parent) void TextMarkRegistry::add(TextMark *mark) { m_marks[FileName::fromString(mark->fileName())].insert(mark); - auto document = qobject_cast<BaseTextDocument*>(DocumentModel::documentForFilePath(mark->fileName())); + auto document = qobject_cast<TextDocument*>(DocumentModel::documentForFilePath(mark->fileName())); if (!document) return; document->addMark(mark); @@ -210,7 +210,7 @@ bool TextMarkRegistry::remove(TextMark *mark) void TextMarkRegistry::editorOpened(Core::IEditor *editor) { - auto document = qobject_cast<BaseTextDocument *>(editor ? editor->document() : 0); + auto document = qobject_cast<TextDocument *>(editor ? editor->document() : 0); if (!document) return; if (!m_marks.contains(FileName::fromString(document->filePath()))) @@ -223,7 +223,7 @@ void TextMarkRegistry::editorOpened(Core::IEditor *editor) void TextMarkRegistry::documentRenamed(IDocument *document, const QString &oldName, const QString &newName) { - BaseTextDocument *baseTextDocument = qobject_cast<BaseTextDocument *>(document); + TextDocument *baseTextDocument = qobject_cast<TextDocument *>(document); if (!document) return; FileName oldFileName = FileName::fromString(oldName); diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h index 8532aea82b..b637c9ee0e 100644 --- a/src/plugins/texteditor/textmark.h +++ b/src/plugins/texteditor/textmark.h @@ -44,7 +44,7 @@ QT_END_NAMESPACE namespace TextEditor { class BaseTextEditor; -class BaseTextDocument; +class TextDocument; namespace Internal { class TextMarkRegistry; } @@ -87,14 +87,14 @@ public: double widthFactor() const; void setWidthFactor(double factor); - BaseTextDocument *baseTextDocument() const; - void setBaseTextDocument(BaseTextDocument *baseTextDocument); + TextDocument *baseTextDocument() const; + void setBaseTextDocument(TextDocument *baseTextDocument); private: Q_DISABLE_COPY(TextMark) friend class Internal::TextMarkRegistry; - BaseTextDocument *m_baseTextDocument; + TextDocument *m_baseTextDocument; QString m_fileName; int m_lineNumber; Priority m_priority; diff --git a/src/plugins/vcsbase/basevcseditorfactory.cpp b/src/plugins/vcsbase/basevcseditorfactory.cpp index 4b718a70a6..73a33b9c40 100644 --- a/src/plugins/vcsbase/basevcseditorfactory.cpp +++ b/src/plugins/vcsbase/basevcseditorfactory.cpp @@ -65,8 +65,8 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters, setEditorActionHandlers(TextEditorActionHandler::None); setDuplicatedSupported(false); - setDocumentCreator([=]() -> BaseTextDocument* { - auto document = new BaseTextDocument(parameters->id); + setDocumentCreator([=]() -> TextDocument* { + auto document = new TextDocument(parameters->id); // if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE)) document->setMimeType(QLatin1String(parameters->mimeType)); return document; diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 36c7b4c0d0..de0fa2b528 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -1205,7 +1205,7 @@ const VcsBaseEditorParameters *VcsBaseEditor::findType(const VcsBaseEditorParame static QTextCodec *findFileCodec(const QString &source) { Core::IDocument *document = Core::DocumentModel::documentForFilePath(source); - if (Core::TextDocument *textDocument = qobject_cast<Core::TextDocument *>(document)) + if (Core::BaseTextDocument *textDocument = qobject_cast<Core::BaseTextDocument *>(document)) return const_cast<QTextCodec *>(textDocument->codec()); return 0; } |