HGSaneUI模块增加msgbox对话框
This commit is contained in:
parent
e2e0a53772
commit
f7fe3de983
|
@ -103,7 +103,7 @@ class DeviceUser* DeviceUserMgr::OpenDeviceUser()
|
|||
if (nullptr == dev)
|
||||
{
|
||||
HGSane_CloseSource(source);
|
||||
QMessageBox::information(m_wnd, tr("tips"), tr(errInfo));
|
||||
QMessageBox::information(m_wnd, tr("tips"), QString::fromUtf8(errInfo));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,4 +6,6 @@ show_srclist_ui
|
|||
show_devlist_ui
|
||||
show_setting_ui
|
||||
show_scan_ui
|
||||
show_msgbox_info
|
||||
show_msgbox_warning
|
||||
show_twain_srclist_ui
|
|
@ -165,6 +165,46 @@ int show_scan_ui(const SANEAPI* saneApi, SANE_Handle handle, const char *devName
|
|||
return 0;
|
||||
}
|
||||
|
||||
int show_msgbox_info(const char *title, const char *text, HGWindow parent)
|
||||
{
|
||||
if (nullptr == title || nullptr == text)
|
||||
return -1;
|
||||
|
||||
QWidget *qParent = nullptr;
|
||||
#ifdef HG_CMP_MSC
|
||||
if (!g_ownApplication)
|
||||
g_ownApplication = QMfcApp::pluginInstance(g_hInst);
|
||||
QWinWidget win(parent);
|
||||
win.showCentered();
|
||||
qParent = &win;
|
||||
#else
|
||||
qParent = parent;
|
||||
#endif
|
||||
|
||||
QMessageBox::information(qParent, QString::fromUtf8(title), QString::fromUtf8(text));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int show_msgbox_warning(const char *title, const char *text, HGWindow parent)
|
||||
{
|
||||
if (nullptr == title || nullptr == text)
|
||||
return -1;
|
||||
|
||||
QWidget *qParent = nullptr;
|
||||
#ifdef HG_CMP_MSC
|
||||
if (!g_ownApplication)
|
||||
g_ownApplication = QMfcApp::pluginInstance(g_hInst);
|
||||
QWinWidget win(parent);
|
||||
win.showCentered();
|
||||
qParent = &win;
|
||||
#else
|
||||
qParent = parent;
|
||||
#endif
|
||||
|
||||
QMessageBox::warning(qParent, QString::fromUtf8(title), QString::fromUtf8(text));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(HG_CMP_MSC)
|
||||
int show_twain_srclist_ui(DSMENTRYPROC dsmProc, const TW_IDENTITY *appId, HGWindow parent, TW_IDENTITY *ds)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,9 @@ HGEXPORT int show_setting_ui(const SANEAPI* saneApi, SANE_Handle handle, const c
|
|||
HGEXPORT int show_scan_ui(const SANEAPI* saneApi, SANE_Handle handle, const char *devName, HGWindow parent,
|
||||
show_scan_ui_image_callback callback, void *callbackParam);
|
||||
|
||||
HGEXPORT int show_msgbox_info(const char *title, const char *text, HGWindow parent);
|
||||
HGEXPORT int show_msgbox_warning(const char *title, const char *text, HGWindow parent);
|
||||
|
||||
#if defined(HG_CMP_MSC)
|
||||
HGEXPORT int show_twain_srclist_ui(DSMENTRYPROC dsmProc, const TW_IDENTITY *appId, HGWindow parent, TW_IDENTITY *ds);
|
||||
#endif
|
||||
|
|
|
@ -120,7 +120,7 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
|
|||
SANE_Status stat = p->m_saneAPI.sane_start_api(p->m_saneDev);
|
||||
if (SANE_STATUS_GOOD != stat)
|
||||
{
|
||||
emit p->eventFunc(tr(p->m_saneAPI.sane_strstatus_api(stat)));
|
||||
emit p->eventFunc(QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(stat)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
|
|||
if (SANE_STATUS_GOOD == stat2)
|
||||
{
|
||||
// m_bufferSize空间不够
|
||||
emit p->eventFunc(tr(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_INVAL)));
|
||||
emit p->eventFunc(QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_INVAL)));
|
||||
break;
|
||||
}
|
||||
else if (SANE_STATUS_EOF == stat2)
|
||||
|
@ -158,7 +158,7 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
|
|||
}
|
||||
else if (SANE_STATUS_GOOD != stat1 || readSize != params.bytes_per_line * params.lines)
|
||||
{
|
||||
emit p->eventFunc(tr(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_INVAL)));
|
||||
emit p->eventFunc(QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_INVAL)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
|
|||
}
|
||||
else
|
||||
{
|
||||
emit p->eventFunc(tr(p->m_saneAPI.sane_strstatus_api(stat2)));
|
||||
emit p->eventFunc(QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(stat2)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void Dialog_Device_Select::on_pushButton_OK_clicked()
|
|||
SANE_Status ret = m_saneAPI.sane_open_api(m_vDevName[index].c_str(), &dev);
|
||||
if (SANE_STATUS_GOOD != ret)
|
||||
{
|
||||
QMessageBox::information(this, tr("tips"), tr(m_saneAPI.sane_strstatus_api(ret)));
|
||||
QMessageBox::information(this, tr("tips"), QString::fromUtf8(m_saneAPI.sane_strstatus_api(ret)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue