aboutsummaryrefslogtreecommitdiff
path: root/qdeduper/sigdb_qt.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-19 02:39:03 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-19 02:39:03 -0400
commit41e9051f2d809c42c3dfecc2eb11ad544cbd27b7 (patch)
treee370e08b0e0a45c6eef38704aa2f2b2b0e6d8033 /qdeduper/sigdb_qt.hpp
parent4b8d314f575d9e893d8dda7431194f8b470fc888 (diff)
downloaddeduper-41e9051f2d809c42c3dfecc2eb11ad544cbd27b7.tar.xz
You break it, you fix it!
The GUI is now working again, with scanning built-in.
Diffstat (limited to 'qdeduper/sigdb_qt.hpp')
-rw-r--r--qdeduper/sigdb_qt.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/qdeduper/sigdb_qt.hpp b/qdeduper/sigdb_qt.hpp
new file mode 100644
index 0000000..8a5178a
--- /dev/null
+++ b/qdeduper/sigdb_qt.hpp
@@ -0,0 +1,41 @@
+#ifndef SIGDB_QT_HPP
+#define SIGDB_QT_HPP
+
+#include <filesystem>
+#include <map>
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+#include <QObject>
+
+#include "signature_db.hpp"
+
+namespace fs = std::filesystem;
+
+class SignatureDB : public QObject
+{
+ Q_OBJECT
+private:
+ signature_db *sdb;
+ std::unordered_map<size_t, fs::path> fmap;
+ std::unordered_map<fs::path, size_t> frmap;
+ std::map<std::pair<size_t, size_t>, double> distmap;
+ std::vector<std::vector<size_t>> groups;
+public:
+ SignatureDB();
+ SignatureDB(const fs::path& dbpath);
+ ~SignatureDB();
+
+ void scan_files(const std::vector<fs::path> &files, int njobs);
+ size_t num_groups();
+ std::vector<size_t> get_group(size_t gid);
+ std::map<std::pair<size_t, size_t>, double> group_distances(size_t gid);
+
+ fs::path get_image_path(size_t id);
+ size_t get_path_id(const fs::path& p);
+Q_SIGNALS:
+ void image_scanned(size_t n);
+};
+
+#endif