有“设备”功能的app,设置项增加不支持弹窗提示

This commit is contained in:
yangjiaxuan 2023-06-15 13:45:17 +08:00
parent ecffb647ce
commit 1aeb4d5b96
5 changed files with 805 additions and 707 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -887,7 +887,16 @@ void hg_settingdialog::slot_checkedClicked()
m_list_IdValueTitle.append(QPair<QPair<int, QVariant>, QString>(QPair<int, QVariant>(id, checkBoxcurrentState), md5(opt->title))); m_list_IdValueTitle.append(QPair<QPair<int, QVariant>, QString>(QPair<int, QVariant>(id, checkBoxcurrentState), md5(opt->title)));
SANE_Int method = 0; SANE_Int method = 0;
sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &checkBoxcurrentState, &method); SANE_Status ret = sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &checkBoxcurrentState, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
SANE_Bool value = false;
ret = sane_control_option(m_handle, id, SANE_ACTION_GET_VALUE, &value, &method);
checkBox->setCheckState(value ? Qt::Checked : Qt::Unchecked);
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus(); updateUIStatus();
else if(method & SANE_INFO_INEXACT) else if(method & SANE_INFO_INEXACT)
@ -941,7 +950,19 @@ void hg_settingdialog::slot_string_list_comboBoxClicked()
*((SANE_Fixed*)buf) = SANE_FIX(atof(comboBoxcurrentItem.c_str())); *((SANE_Fixed*)buf) = SANE_FIX(atof(comboBoxcurrentItem.c_str()));
else else
strcpy(buf, comboBoxcurrentItem.c_str()); strcpy(buf, comboBoxcurrentItem.c_str());
sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, buf, &method); SANE_Status ret = sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, buf, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
char* value = (char*)malloc(opt->size * 2 + 4);
ret = sane_control_option(m_handle, id, SANE_ACTION_GET_VALUE, value, &method);
if (value != nullptr)
comboBox->setCurrentText(QString::fromStdString(value));
free(value);
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus(); updateUIStatus();
else if(method & SANE_INFO_INEXACT) else if(method & SANE_INFO_INEXACT)
@ -966,7 +987,13 @@ void hg_settingdialog::slot_pushButtonClicked()
after = 0; after = 0;
// restore to default setting ? // restore to default setting ?
sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, NULL, &after); SANE_Status ret = sane_control_option(m_handle, 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) if((after & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus(); updateUIStatus();
@ -1194,7 +1221,18 @@ void hg_settingdialog::slot_word_list_comboBoxClicked(int value)
SANE_Int method = 0; SANE_Int method = 0;
sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &temp, &method); SANE_Status ret = sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &temp, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
char* value = (char*)malloc(opt->size * 2 + 4);
ret = sane_control_option(m_handle, id, SANE_ACTION_GET_VALUE, value, &method);
if (value != nullptr)
comboBox->setCurrentText(QString::fromStdString(value));
free(value);
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus(); updateUIStatus();
else if(method & SANE_INFO_INEXACT) else if(method & SANE_INFO_INEXACT)
@ -1250,7 +1288,25 @@ 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_list_IdValueTitle.append(QPair<QPair<int, QVariant>, QString>(QPair<int, QVariant>(id, temp), md5(opt->title)));
} }
sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &val, &method); SANE_Status ret = sane_control_option(m_handle, id, SANE_ACTION_SET_VALUE, &val, &method);
if (ret == SANE_STATUS_UNSUPPORTED)
{
if (!db_val)
{
SANE_Int value = 0;
ret = sane_control_option(m_handle, id, SANE_ACTION_GET_VALUE, &value, &method);
slider->setValue(value);
}
else
{
SANE_Fixed value = 0;
ret = sane_control_option(m_handle, id, SANE_ACTION_GET_VALUE, &value, &method);
slider->setValue(value);
}
QMessageBox::information(this, tr("Prompt"), tr("The funtion is unsupported"));
return;
}
if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS) if((method & SANE_INFO_RELOAD_OPTIONS) == SANE_INFO_RELOAD_OPTIONS)
updateUIStatus(); updateUIStatus();
else if(method & SANE_INFO_INEXACT) else if(method & SANE_INFO_INEXACT)