forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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());
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
@@ -57,7 +57,7 @@ QString ModelManagerSupportInternal::displayName() const
|
||||
}
|
||||
|
||||
BaseEditorDocumentProcessor *ModelManagerSupportInternal::editorDocumentProcessor(
|
||||
TextEditor::BaseTextDocument *baseTextDocument)
|
||||
TextEditor::TextDocument *baseTextDocument)
|
||||
{
|
||||
return new BuiltinEditorDocumentProcessor(baseTextDocument);
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
virtual CppCompletionAssistProvider *completionAssistProvider();
|
||||
virtual BaseEditorDocumentProcessor *editorDocumentProcessor(
|
||||
TextEditor::BaseTextDocument *baseTextDocument);
|
||||
TextEditor::TextDocument *baseTextDocument);
|
||||
|
||||
private:
|
||||
QScopedPointer<CppCompletionAssistProvider> m_completionAssistProvider;
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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()
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ namespace Internal {
|
||||
|
||||
class ResourceHandler;
|
||||
|
||||
class FormWindowFile : public TextEditor::BaseTextDocument
|
||||
class FormWindowFile : public TextEditor::TextDocument
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@@ -42,7 +42,7 @@
|
||||
namespace DiffEditor {
|
||||
|
||||
DiffEditorDocument::DiffEditorDocument() :
|
||||
Core::TextDocument(),
|
||||
Core::BaseTextDocument(),
|
||||
m_controller(new DiffEditorController(this))
|
||||
{
|
||||
setId(Constants::DIFF_EDITOR_ID);
|
||||
|
@@ -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:
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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; });
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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; });
|
||||
|
@@ -162,7 +162,7 @@ void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e)
|
||||
// ProFileDocument
|
||||
//
|
||||
|
||||
class ProFileDocument : public BaseTextDocument
|
||||
class ProFileDocument : public TextDocument
|
||||
{
|
||||
public:
|
||||
ProFileDocument();
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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:
|
||||
|
@@ -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());
|
||||
|
@@ -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);
|
||||
|
@@ -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));
|
||||
|
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
typedef QList<BarDescriptorAsset> BarDescriptorAssetList;
|
||||
|
||||
class BarDescriptorDocument : public Core::TextDocument
|
||||
class BarDescriptorDocument : public Core::BaseTextDocument
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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)) {
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
@@ -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==============
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
@@ -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,
|
||||
|
@@ -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; });
|
||||
|
||||
|
@@ -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";
|
||||
}
|
||||
|
@@ -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);
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user