code_app/modules/twainui/dialog_progress_ui.h

62 lines
1.5 KiB
C
Raw Normal View History

2023-04-20 09:49:48 +00:00
#ifndef DIALOG_PROGRESS_UI_H
#define DIALOG_PROGRESS_UI_H
#include <QDialog>
#include <qtranslator.h>
#include <QCloseEvent>
2023-08-12 01:57:04 +00:00
#include "twainui.h"
#include "base/HGThread.h"
2023-04-20 09:49:48 +00:00
namespace Ui {
class Dialog_progress_ui;
}
class Dialog_progress_ui : public QDialog
{
Q_OBJECT
2023-05-24 06:40:06 +00:00
bool quit_ = false;
2023-04-20 09:49:48 +00:00
public:
explicit Dialog_progress_ui(class Manager *mgr, std::function<void (ui_result)> callback, std::function<void (int, void *, int)> *notify, QWidget *parent = nullptr);
2023-04-20 09:49:48 +00:00
~Dialog_progress_ui();
protected:
virtual void keyPressEvent(QKeyEvent *e) override;
virtual void closeEvent(QCloseEvent *e) override;
2023-04-20 09:49:48 +00:00
signals:
2023-04-27 03:04:52 +00:00
void scan_status(QString finishInfo, bool isScanning);
2023-05-24 06:40:06 +00:00
void scan_finish(int flag, QString finishInfo);
void image_recived();
2023-04-20 09:49:48 +00:00
private slots:
void on_pbtn_cancelScan_clicked();
void on_pbtn_close_clicked();
2023-04-27 03:04:52 +00:00
void on_scan_status(QString finishInfo, bool isScanning);
2023-05-24 06:40:06 +00:00
void on_scan_finish(int flag, QString finishInfo);
void on_image_recived();
2023-04-20 09:49:48 +00:00
2023-05-10 12:30:07 +00:00
public:
static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
2023-04-20 09:49:48 +00:00
static void FuncNotify(int event, void *msg, int flag);
2023-05-24 06:40:06 +00:00
void clear_callback(void)
{
quit_ = true;
m_callback = std::function<void(ui_result)>();
}
2023-04-20 09:49:48 +00:00
private:
Ui::Dialog_progress_ui *ui;
int m_imageRecivedCount;
class Manager *m_mgr;
2023-04-20 09:49:48 +00:00
std::function<void (ui_result)> m_callback;
2023-04-27 03:04:52 +00:00
QTimer *m_timer;
2023-05-10 12:30:07 +00:00
bool m_isScanning;
HGThread m_thread;
2023-04-20 09:49:48 +00:00
};
#endif // DIALOG_PROGRESS_UI_H