MCPcopy Create free account
hub / github.com/Faster3ck/Converseen / loadDirectoryFiles

Method loadDirectoryFiles

src/mainwindowimpl.cpp:391–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391void MainWindowImpl::loadDirectoryFiles(
392 const QString &directory,
393 const QStringList &readableFiltersList,
394 const QDirIterator::IteratorFlag &flag)
395{
396 auto *progress = new QProgressDialog(
397 tr("Scanning folders for images..."),
398 QString(),
399 0,
400 0,
401 this);
402
403 progress->setWindowTitle(QApplication::applicationName());
404 progress->setSizeGripEnabled(false);
405 progress->setFixedSize(progress->sizeHint());
406 progress->setWindowModality(Qt::ApplicationModal);
407 progress->setCancelButton(nullptr);
408 progress->setMinimumDuration(0);
409
410 QApplication::setOverrideCursor(Qt::WaitCursor);
411 progress->show();
412
413 auto *watcher = new QFutureWatcher<QStringList>(this);
414
415 connect(watcher, &QFutureWatcher<QStringList>::finished,
416 this, [this, watcher, progress]()
417 {
418 const QStringList fileNames = watcher->result();
419
420 if (!fileNames.isEmpty())
421 loadFiles(fileNames);
422
423 progress->close();
424 progress->deleteLater();
425
426 QApplication::restoreOverrideCursor();
427
428 watcher->deleteLater();
429 });
430
431 watcher->setFuture(QtConcurrent::run(
432 [directory, readableFiltersList, flag]()
433 {
434 QStringList fileNames;
435
436 QDirIterator it(directory,
437 readableFiltersList,
438 QDir::Files,
439 flag);
440
441 while (it.hasNext())
442 fileNames << it.next();
443
444 return fileNames;
445 }));
446}
447
448void MainWindowImpl::loadFiles(QStringList fileNames)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected