From 3aca10232a1cf1f8abbebcc39c46ba2779feed9a Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Mon, 19 Sep 2022 03:04:11 -0400 Subject: Everything in concurrent::run is in another thread... --- qdeduper/mingui.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qdeduper/mingui.cpp b/qdeduper/mingui.cpp index 413ed27..c10be0c 100644 --- a/qdeduper/mingui.cpp +++ b/qdeduper/mingui.cpp @@ -348,10 +348,10 @@ void DeduperMainWindow::scan_dirs(std::vector> paths) std::for_each(paths.begin(), paths.end(), [fs](auto p){fs->add_path(p.first, p.second);}); fs->add_magic_number("\x89PNG\r\n"); fs->add_magic_number("\xff\xd8\xff"); - QObject::connect(fs, &FileScanner::scan_done_prep, [this](auto n) { + QObject::connect(fs, &FileScanner::scan_done_prep, this, [this](auto n) { this->pd->setMaximum(n - 1); - }); - QObject::connect(fs, &FileScanner::file_scanned, [this](const fs::path &p, size_t c) { + }, Qt::ConnectionType::QueuedConnection); + QObject::connect(fs, &FileScanner::file_scanned, this, [this](const fs::path &p, size_t c) { static auto lt = std::chrono::steady_clock::now(); using namespace std::literals; if (std::chrono::steady_clock::now() - lt > 100ms) @@ -360,7 +360,7 @@ void DeduperMainWindow::scan_dirs(std::vector> paths) this->pd->setLabelText(QString("Looking for files to scan: %1").arg(fsstr_to_qstring(p))); this->pd->setValue(c); } - }); + }, Qt::ConnectionType::QueuedConnection); fs->scan(); this->pd->setMaximum(fs->file_list().size() - 1); this->pd->setLabelText("Scanning..."); -- cgit v1.2.3