#3003 Hierarchy import dialog. Update status during search

This commit is contained in:
Bjørn Erik Jensen 2018-06-04 09:02:49 +02:00
parent 9b07529ca2
commit 0abc41afdb

View File

@ -420,14 +420,23 @@ QStringList RicFileHierarchyDialog::buildDirectoryListRecursive(const QString& c
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicFileHierarchyDialog::buildDirectoryListRecursiveSimple(const QString& currentDir, void RicFileHierarchyDialog::buildDirectoryListRecursiveSimple(const QString& currentDir,
const QString& currentPathFilter, const QString& currentPathFilter,
QStringList* accumulatedDirs) QStringList* accumulatedDirs)
{ {
QString rootDir = currentDir; QString currDir = currentDir;
QString pathFilter = currentPathFilter; QString pathFilter = currentPathFilter;
if (pathFilter.startsWith(SEPARATOR)) pathFilter.remove(0, 1); if (pathFilter.startsWith(SEPARATOR)) pathFilter.remove(0, 1);
if (pathFilter.endsWith(SEPARATOR)) pathFilter.chop(1); if (pathFilter.endsWith(SEPARATOR)) pathFilter.chop(1);
if (rootDir.endsWith(SEPARATOR)) rootDir.chop(1); if (currDir.endsWith(SEPARATOR)) currDir.chop(1);
if (cancelPressed())
{
accumulatedDirs->clear();
return;
}
updateStatus(SEARCHING_FOR_DIRS, currDir);
QApplication::processEvents();
if (pathFilter.isEmpty()) if (pathFilter.isEmpty())
{ {
@ -436,12 +445,12 @@ void RicFileHierarchyDialog::buildDirectoryListRecursiveSimple(const QString& cu
} }
QStringList pathFilters = pathFilter.split(SEPARATOR); QStringList pathFilters = pathFilter.split(SEPARATOR);
QDir qdir(rootDir, pathFilters[0], QDir::NoSort, QDir::Dirs | QDir::NoDotAndDotDot); QDir qdir(currDir, pathFilters[0], QDir::NoSort, QDir::Dirs | QDir::NoDotAndDotDot);
QStringList subDirs = qdir.entryList(); QStringList subDirs = qdir.entryList();
if (pathFilters.size() == 1 && pathFilters[0] == "*") if (pathFilters.size() == 1 && pathFilters[0] == "*")
{ {
accumulatedDirs->push_back(rootDir); accumulatedDirs->push_back(currDir);
} }
for (const QString& subDir : subDirs) for (const QString& subDir : subDirs)
@ -464,6 +473,7 @@ void RicFileHierarchyDialog::buildDirectoryListRecursiveSimple(const QString& cu
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------