Commit 0fcca946 authored by hjk's avatar hjk
Browse files

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: default avatarhjk <hjk121@nokiamail.com>
parent 33670d22
......@@ -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
......
......@@ -37,7 +37,7 @@ namespace Internal {
class AndroidManifestEditorWidget;
class AndroidManifestDocument : public TextEditor::BaseTextDocument
class AndroidManifestDocument : public TextEditor::TextDocument
{
public:
explicit AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget);
......
......@@ -66,7 +66,7 @@ public:
// JavaDocument
//
class JavaDocument : public TextEditor::BaseTextDocument
class JavaDocument : public TextEditor::TextDocument
{
public:
JavaDocument();
......
......@@ -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)
......
......@@ -46,7 +46,7 @@ class ClangEditorDocumentProcessor : public CppTools::BaseEditorDocumentProcesso
Q_OBJECT
public:
ClangEditorDocumentProcessor(TextEditor::BaseTextDocument *document);
ClangEditorDocumentProcessor(TextEditor::TextDocument *document);
~ClangEditorDocumentProcessor();
// BaseEditorDocumentProcessor interface
......
......@@ -63,7 +63,7 @@ CppTools::CppCompletionAssistProvider *ModelManagerSupport::completionAssistProv
}
CppTools::BaseEditorDocumentProcessor *ModelManagerSupport::editorDocumentProcessor(
TextEditor::BaseTextDocument *baseTextDocument)
TextEditor::TextDocument *baseTextDocument)
{
return new ClangCodeModel::ClangEditorDocumentProcessor(baseTextDocument);
}
......@@ -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;
......
......@@ -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();
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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);
......
......@@ -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()));
}
......
......@@ -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()
......
......@@ -44,7 +44,7 @@
namespace CppEditor {
namespace Internal {
class CppEditorDocument : public TextEditor::BaseTextDocument
class CppEditorDocument : public TextEditor::TextDocument
{
Q_OBJECT
......
......@@ -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);
}
}
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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())
......
......@@ -45,7 +45,7 @@ class CPPTOOLS_EXPORT BuiltinEditorDocumentProcessor : public BaseEditorDocument
BuiltinEditorDocumentProcessor();
public:
BuiltinEditorDocumentProcessor(TextEditor::BaseTextDocument *document,
BuiltinEditorDocumentProcessor(TextEditor::TextDocument *document,
bool enableSemanticHighlighter = true);
~BuiltinEditorDocumentProcessor();
......
......@@ -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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment