#ifndef DIALOG_PROGRESS_UI_H #define DIALOG_PROGRESS_UI_H #include #include #include #include "twainui.h" #include "base/HGThread.h" namespace Ui { class Dialog_progress_ui; } class Dialog_progress_ui : public QDialog { Q_OBJECT bool quit_ = false; public: explicit Dialog_progress_ui(class Manager *mgr, std::function callback, std::function *notify, QWidget *parent = nullptr); ~Dialog_progress_ui(); protected: virtual void keyPressEvent(QKeyEvent *e) override; virtual void closeEvent(QCloseEvent *e) override; signals: void scan_status(QString finishInfo, bool isScanning); void scan_finish(int flag, QString finishInfo); void image_recived(); private slots: void on_pbtn_cancelScan_clicked(); void on_pbtn_close_clicked(); void on_scan_status(QString finishInfo, bool isScanning); void on_scan_finish(int flag, QString finishInfo); void on_image_recived(); public: static void HGAPI ThreadFunc(HGThread thread, HGPointer param); static void FuncNotify(int event, void *msg, int flag); void clear_callback(void) { quit_ = true; m_callback = std::function(); } private: Ui::Dialog_progress_ui *ui; int m_imageRecivedCount; class Manager *m_mgr; std::function m_callback; QTimer *m_timer; bool m_isScanning; HGThread m_thread; }; #endif // DIALOG_PROGRESS_UI_H