Use iterator instead of collecting all the files to search beforehand.

Especially for the file system filter, it's better not to block while
collecting all the file names by first iterating over the file system.
Now, the filters return an iterator, and the search thread takes a file
from it, searches it, and takes the next file.

This also unifies the file iterator for the custom locator filters and
the find in files on file system search filter.

Task-number: QTCREATORBUG-1690
This commit is contained in:
con
2010-06-24 15:44:46 +02:00
parent 4214193d21
commit e8c0c7895c
12 changed files with 227 additions and 98 deletions

View File

@@ -68,18 +68,10 @@ void FindInFiles::findAll(const QString &txt, QTextDocument::FindFlags findFlags
BaseFileFind::findAll(txt, findFlags);
}
QStringList FindInFiles::files()
Utils::FileIterator *FindInFiles::files()
{
QStringList fileList;
QDirIterator it(m_directory->currentText(),
fileNameFilters(),
QDir::Files|QDir::Readable,
QDirIterator::Subdirectories);
while (it.hasNext())
fileList << it.next();
return fileList;
return new Utils::SubDirFileIterator(QStringList() << m_directory->currentText(),
fileNameFilters());
}
QWidget *FindInFiles::createConfigWidget()