diff options
author | 2022-09-26 22:14:18 -0400 | |
---|---|---|
committer | 2022-09-26 22:17:44 -0400 | |
commit | 2e7924a07d45c1d1468552f951dcd2f2dcc948fa (patch) | |
tree | 24b6788b505a82f70f7dd82f8d9f1570fc88fef1 /qdeduper/sigdb_qt.cpp | |
parent | 43a058c0957bec3fc564a7a019bdc03829e32e70 (diff) | |
download | deduper-2e7924a07d45c1d1468552f951dcd2f2dcc948fa.tar.xz |
Add a few basic settings items.
Yes I stole qmp's settings design and silently relicensed the
(largely identical) code. But who in the world cares, plus I'm the
author of qmp anyway.
Diffstat (limited to 'qdeduper/sigdb_qt.cpp')
-rw-r--r-- | qdeduper/sigdb_qt.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/qdeduper/sigdb_qt.cpp b/qdeduper/sigdb_qt.cpp index a67f330..2128f8d 100644 --- a/qdeduper/sigdb_qt.cpp +++ b/qdeduper/sigdb_qt.cpp @@ -32,6 +32,15 @@ signature_config cfg_subslice = SignatureDB::SignatureDB() : QObject(nullptr) { sdb = new signature_db(); + cfg = { + 3, + 3, + cfg_full, + cfg_subslice, + 0.3, + nullptr, + 1 + }; } SignatureDB::SignatureDB(const fs::path &dbpath) : QObject(nullptr) @@ -82,17 +91,21 @@ bool SignatureDB::is_dirty() return sdb->is_dirty(); } -void SignatureDB::scan_files(const std::vector<fs::path> &files, int njobs) +populate_cfg_t SignatureDB::get_sig_config() { - populate_cfg_t pcfg = { - 3, - 3, - cfg_full, - cfg_subslice, - 0.3, - [this](size_t c,int){Q_EMIT image_scanned(c);}, - njobs - }; + return cfg; +} + +void SignatureDB::set_sig_config(populate_cfg_t cfg) +{ + this->cfg = cfg; +} + +void SignatureDB::scan_files(const std::vector<fs::path> &files) +{ + populate_cfg_t pcfg = cfg; + pcfg.callback = [this](size_t c,int){Q_EMIT image_scanned(c);}; + sdb->populate(files, pcfg); Q_EMIT image_scanned(~size_t(0)); @@ -109,17 +122,8 @@ void SignatureDB::interrupt_scan() std::vector<std::pair<size_t, double>> SignatureDB::search_file(const fs::path &files) { - populate_cfg_t pcfg = { - 3, - 3, - cfg_full, - cfg_subslice, - 0.3, - nullptr, - 0 - }; if(sdb) - return sdb->search_image(files, pcfg, false); + return sdb->search_image(files, cfg, false); return {}; } |