Commit fc9a99fc authored by Eike Ziller's avatar Eike Ziller
Browse files

TextEditors: Move document related function to document



Change-Id: I9d0abacbd1b503390164934a1b833fd305ae3fbe
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent b7ce718d
...@@ -82,7 +82,8 @@ Utils::FileIterator *AllProjectsFind::filesForProjects(const QStringList &nameFi ...@@ -82,7 +82,8 @@ Utils::FileIterator *AllProjectsFind::filesForProjects(const QStringList &nameFi
foreach (const QString &filter, nameFilters) { foreach (const QString &filter, nameFilters) {
filterRegs << QRegExp(filter, Qt::CaseInsensitive, QRegExp::Wildcard); filterRegs << QRegExp(filter, Qt::CaseInsensitive, QRegExp::Wildcard);
} }
QMap<QString, QTextCodec *> openEditorEncodings = TextEditor::ITextEditor::openedTextDocumentEncodings(); QMap<QString, QTextCodec *> openEditorEncodings
= TextEditor::ITextEditorDocument::openedTextDocumentEncodings();
QMap<QString, QTextCodec *> encodings; QMap<QString, QTextCodec *> encodings;
foreach (const Project *project, projects) { foreach (const Project *project, projects) {
QStringList projectFiles = project->files(Project::AllFiles); QStringList projectFiles = project->files(Project::AllFiles);
......
...@@ -173,12 +173,12 @@ void BaseFileFind::runSearch(Core::SearchResult *search) ...@@ -173,12 +173,12 @@ void BaseFileFind::runSearch(Core::SearchResult *search)
watcher->setFuture(Utils::findInFilesRegExp(parameters.text, watcher->setFuture(Utils::findInFilesRegExp(parameters.text,
files(parameters.nameFilters, parameters.additionalParameters), files(parameters.nameFilters, parameters.additionalParameters),
textDocumentFlagsForFindFlags(parameters.flags), textDocumentFlagsForFindFlags(parameters.flags),
ITextEditor::openedTextDocumentContents())); ITextEditorDocument::openedTextDocumentContents()));
} else { } else {
watcher->setFuture(Utils::findInFiles(parameters.text, watcher->setFuture(Utils::findInFiles(parameters.text,
files(parameters.nameFilters, parameters.additionalParameters), files(parameters.nameFilters, parameters.additionalParameters),
textDocumentFlagsForFindFlags(parameters.flags), textDocumentFlagsForFindFlags(parameters.flags),
ITextEditor::openedTextDocumentContents())); ITextEditorDocument::openedTextDocumentContents()));
} }
FutureProgress *progress = FutureProgress *progress =
ProgressManager::addTask(watcher->future(), tr("Search"), Constants::TASK_SEARCH); ProgressManager::addTask(watcher->future(), tr("Search"), Constants::TASK_SEARCH);
......
...@@ -63,7 +63,8 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters, ...@@ -63,7 +63,8 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters,
{ {
Q_UNUSED(nameFilters) Q_UNUSED(nameFilters)
QString fileName = additionalParameters.toString(); QString fileName = additionalParameters.toString();
QMap<QString, QTextCodec *> openEditorEncodings = ITextEditor::openedTextDocumentEncodings(); QMap<QString, QTextCodec *> openEditorEncodings
= ITextEditorDocument::openedTextDocumentEncodings();
QTextCodec *codec = openEditorEncodings.value(fileName); QTextCodec *codec = openEditorEncodings.value(fileName);
if (!codec) if (!codec)
codec = Core::EditorManager::defaultTextCodec(); codec = Core::EditorManager::defaultTextCodec();
......
...@@ -63,7 +63,8 @@ Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters, ...@@ -63,7 +63,8 @@ Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters,
{ {
Q_UNUSED(nameFilters) Q_UNUSED(nameFilters)
Q_UNUSED(additionalParameters) Q_UNUSED(additionalParameters)
QMap<QString, QTextCodec *> openEditorEncodings = ITextEditor::openedTextDocumentEncodings(); QMap<QString, QTextCodec *> openEditorEncodings
= ITextEditorDocument::openedTextDocumentEncodings();
QStringList fileNames; QStringList fileNames;
QList<QTextCodec *> codecs; QList<QTextCodec *> codecs;
foreach (Core::DocumentModel::Entry *entry, foreach (Core::DocumentModel::Entry *entry,
......
...@@ -38,7 +38,7 @@ ITextEditorDocument::ITextEditorDocument(QObject *parent) ...@@ -38,7 +38,7 @@ ITextEditorDocument::ITextEditorDocument(QObject *parent)
{ {
} }
QMap<QString, QString> ITextEditor::openedTextDocumentContents() QMap<QString, QString> ITextEditorDocument::openedTextDocumentContents()
{ {
QMap<QString, QString> workingCopy; QMap<QString, QString> workingCopy;
foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) { foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) {
...@@ -51,7 +51,7 @@ QMap<QString, QString> ITextEditor::openedTextDocumentContents() ...@@ -51,7 +51,7 @@ QMap<QString, QString> ITextEditor::openedTextDocumentContents()
return workingCopy; return workingCopy;
} }
QMap<QString, QTextCodec *> TextEditor::ITextEditor::openedTextDocumentEncodings() QMap<QString, QTextCodec *> ITextEditorDocument::openedTextDocumentEncodings()
{ {
QMap<QString, QTextCodec *> workingCopy; QMap<QString, QTextCodec *> workingCopy;
foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) { foreach (Core::IDocument *document, Core::EditorManager::documentModel()->openedDocuments()) {
......
...@@ -87,6 +87,9 @@ public: ...@@ -87,6 +87,9 @@ public:
virtual ITextMarkable *markableInterface() const = 0; virtual ITextMarkable *markableInterface() const = 0;
static QMap<QString, QString> openedTextDocumentContents();
static QMap<QString, QTextCodec *> openedTextDocumentEncodings();
signals: signals:
void contentsChanged(); void contentsChanged();
}; };
...@@ -133,9 +136,6 @@ public: ...@@ -133,9 +136,6 @@ public:
virtual const Utils::CommentDefinition* commentDefinition() const = 0; virtual const Utils::CommentDefinition* commentDefinition() const = 0;
static QMap<QString, QString> openedTextDocumentContents();
static QMap<QString, QTextCodec *> openedTextDocumentEncodings();
enum MarkRequestKind { enum MarkRequestKind {
BreakpointRequest, BreakpointRequest,
BookmarkRequest, BookmarkRequest,
......
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