带界面扫描结束时,需要通知notifyApp

This commit is contained in:
gb 2023-05-17 10:36:24 +08:00
parent 2e49040846
commit d2df66b41a
2 changed files with 8 additions and 1 deletions

View File

@ -776,7 +776,7 @@ static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID);
static std::once_flag oc;
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT)
,count_(-1), bUiOnly_(false), is_getting_count_(false)
,count_(-1), bUiOnly_(false), is_getting_count_(false), show_setting_(false)
{
//std::call_once(oc, [&]() { log4cplus::Initializer(); });
}
@ -1101,6 +1101,7 @@ Result huagao_ds::userInterfaceDisable(const Identity&, UserInterface& ui)
Result huagao_ds::userInterfaceEnable(const Identity&, UserInterface& ui)
{
bUiOnly_ = false;
show_setting_ = false;
if (!ui.showUi())
{
scanner_->ui_show_progress((HWND)ui.parent().raw(), m_bIndicator);
@ -1683,6 +1684,7 @@ Result huagao_ds::capCommon(const Identity&, Msg msg, Capability& data) {
}
Twpp::Result huagao_ds::showTwainUI(Twpp::UserInterface& data, bool bUiOnly)
{
show_setting_ = true;
bUiOnly_ = bUiOnly;
// display user UI ... (setting UI, can we show my own main window here ?)
return scanner_->ui_show_setting((HWND)data.parent().raw(), !bUiOnly, m_bIndicator) ? success() : seqError();
@ -3583,6 +3585,7 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
}
rc = notifyCloseCancel();
}
show_setting_ = false;
break;
case SANE_EVENT_UI_CLOSE_CANCEL:
scanner_->stop();
@ -3590,7 +3593,10 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
//break;
case SANE_EVENT_UI_CLOSE_NORMAL:
case SANE_EVENT_SCAN_FINISHED:
scanner_->ui_hide();
scanner_status_ = SCANNER_STATUS_STOPPED; // notifyCloseCancel is not need, because it done in EndXfer
if(show_setting_)
notifyCloseCancel();
//notifyCloseOk();
//break;
break;

View File

@ -55,6 +55,7 @@ class huagao_ds : public Twpp::SourceFromThis<huagao_ds> {
bool log_all_triple_;
bool app_trigger_event_;
bool bUiOnly_;
bool show_setting_;
int count_;
volatile bool is_getting_count_;
static std::string get_hidedlg_path(void);