forked from qt-creator/qt-creator
Project: Remove Project::document() method
The document is used to do file watching, which may or may not be ideal. So make sure we do not leak the information how we watch files into the API and its users. The method is not used sensibly anywhere in creator, so it seems safe to remove it entirely. Change-Id: Ieed755bd5c852875378e4e96665dc906499975b0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -1246,19 +1246,13 @@ static QTextCodec *findFileCodec(const QString &source)
|
||||
// Find the codec by checking the projects (root dir of project file)
|
||||
static QTextCodec *findProjectCodec(const QString &dir)
|
||||
{
|
||||
const FilePath dirPath = FilePath::fromString(dir);
|
||||
typedef QList<ProjectExplorer::Project*> ProjectList;
|
||||
// Try to find a project under which file tree the file is.
|
||||
const ProjectList projects = ProjectExplorer::SessionManager::projects();
|
||||
if (!projects.empty()) {
|
||||
const ProjectList::const_iterator pcend = projects.constEnd();
|
||||
for (ProjectList::const_iterator it = projects.constBegin(); it != pcend; ++it)
|
||||
if (const Core::IDocument *document = (*it)->document())
|
||||
if (document->filePath().toString().startsWith(dir)) {
|
||||
QTextCodec *codec = (*it)->editorConfiguration()->textCodec();
|
||||
return codec;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
const ProjectExplorer::Project *p
|
||||
= findOrDefault(projects, equal(&ProjectExplorer::Project::projectDirectory, dirPath));
|
||||
return p ? p->editorConfiguration()->textCodec() : nullptr;
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditor::getCodec(const QString &source)
|
||||
|
||||
Reference in New Issue
Block a user