国产系统设置参数判断返回值

This commit is contained in:
yangjiaxuan 2023-06-13 18:13:52 +08:00
parent cf3f5352e3
commit f661a28ccc
1 changed files with 42 additions and 7 deletions

View File

@ -923,7 +923,12 @@ void hg_settingdialog::slot_checkedClicked()
m_list_IdValueTitle.append(QPair<QPair<int, QVariant>, QString>(QPair<int, QVariant>(id, checkBoxcurrentState), md5(opt->title)));
SANE_Int method = 0;
m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &checkBoxcurrentState, &method);
SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &checkBoxcurrentState, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus();
else if(method & SANE_INFO_INEXACT)
@ -977,7 +982,12 @@ void hg_settingdialog::slot_string_list_comboBoxClicked()
*((SANE_Fixed*)buf) = SANE_FIX(atof(comboBoxcurrentItem.c_str()));
else
strcpy(buf, comboBoxcurrentItem.c_str());
m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, buf, &method);
SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, buf, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus();
else if(method & SANE_INFO_INEXACT)
@ -1002,7 +1012,12 @@ void hg_settingdialog::slot_pushButtonClicked()
after = 0;
// restore to default setting ?
m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, NULL, &after);
SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, NULL, &after);
if (ret == SANE_STATUS_UNSUPPORTED)
{
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((after & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus();
@ -1229,7 +1244,12 @@ void hg_settingdialog::slot_word_list_comboBoxClicked(int value)
SANE_Int method = 0;
m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &temp, &method);
SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &temp, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus();
else if(method & SANE_INFO_INEXACT)
@ -1285,7 +1305,12 @@ void hg_settingdialog::slot_sliderClicked(int value)
m_list_IdValueTitle.append(QPair<QPair<int, QVariant>, QString>(QPair<int, QVariant>(id, temp), md5(opt->title)));
}
m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &val, &method);
SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &val, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus();
else if(method & SANE_INFO_INEXACT)
@ -1354,7 +1379,12 @@ void hg_settingdialog::slot_spinBoxClicked(int value)
m_list_IdValueTitle.append(QPair<QPair<int, QVariant>, QString>(QPair<int, QVariant>(id, temp), md5(opt->title)));
SANE_Int method = 0;
m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &temp, &method);
SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, &temp, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus();
else if(value != temp)
@ -1405,7 +1435,12 @@ void hg_settingdialog::slot_lineEditInput()
buf = malloc(opt->size * 2 + 4);
strcpy((char*)buf, lineEditCurrentText.c_str());
}
m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, buf, &method);
SANE_Status ret = m_saneAPI.sane_control_option_api(m_devHandle, id, SANE_ACTION_SET_VALUE, buf, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus();
else if(method & SANE_INFO_INEXACT)