//Chris Xiong 2022 //License: MPL-2.0 #ifndef SIGDB_QT_HPP #define SIGDB_QT_HPP #include #include #include #include #include #include #include "signature_db.hpp" namespace fs = std::filesystem; class SignatureDB : public QObject { Q_OBJECT private: signature_db *sdb; std::unordered_map fmap; std::unordered_map frmap; std::map, double> distmap; std::vector> groups; populate_cfg_t cfg; void create_priv_struct(); public: SignatureDB(); SignatureDB(const fs::path &dbpath); ~SignatureDB(); bool valid(); bool is_dirty(); populate_cfg_t get_sig_config(); void set_sig_config(populate_cfg_t cfg); void scan_files(const std::vector &files); void interrupt_scan(); std::vector> search_file(const fs::path &files); size_t num_groups(); std::vector get_group(size_t gid); std::map, double> group_distances(size_t gid); std::vector get_image_ids(); fs::path get_image_path(size_t id); size_t get_path_id(const fs::path &p); bool load(const fs::path &p); bool save(const fs::path &p); int64_t db_memory_usage(); Q_SIGNALS: void image_scanned(size_t n); }; #endif