From 67be79385f0b22fe6428e213d2b6422742d994c4 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Mon, 29 Aug 2022 00:30:57 -0400 Subject: Add mingui. --- mingui/mingui.hpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 mingui/mingui.hpp (limited to 'mingui/mingui.hpp') diff --git a/mingui/mingui.hpp b/mingui/mingui.hpp new file mode 100644 index 0000000..7ed0eb1 --- /dev/null +++ b/mingui/mingui.hpp @@ -0,0 +1,64 @@ +#ifndef MINGUI_HPP +#define MINGUI_HPP + +#include +#include +#include + +#include + +class QHBoxLayout; +class QLabel; +class QStatusBar; + +class MinGuiWidget : public QWidget +{ + Q_OBJECT +private: + QHBoxLayout *l; + QLabel *infopanel; + QLabel *permamsg; + QWidget *imgcontainer; + QStatusBar *sb; + void mark_toggle(std::size_t x); + void mark_all_but(std::size_t x); + void mark_all(); + void mark_none(); + void mark_view_update(bool update_msg = true); + std::string common_prefix(const std::vector &fns); + std::vector imgw; + std::vector marks; + std::unordered_set marked; + std::vector current_set; +protected: + void keyPressEvent(QKeyEvent *e) override; + void keyReleaseEvent(QKeyEvent *e) override; +public: + MinGuiWidget(); + void show_images(const std::vector &fns); + void update_distances(const std::map, double> &d); + void update_permamsg(std::size_t cur, std::size_t size); + void save_list(); +Q_SIGNALS: + void next(); + void prev(); +}; + +class ImageWidget : public QWidget +{ + Q_OBJECT +private: + QString fn; + std::size_t idx; + QLabel *im; + QLabel *lb; +protected: + void mouseReleaseEvent(QMouseEvent *event) override; +public: + ImageWidget(std::string f, std::string dispfn, std::size_t _idx, int max_width, int max_height, QWidget *par); + void set_marked(bool marked); +Q_SIGNALS: + void clicked(); +}; + +#endif -- cgit v1.2.3