设置界面以title判断字段全部改为name字段判断

This commit is contained in:
yangjiaxuan 2022-10-10 11:46:28 +08:00
parent 356b8a44c9
commit ecc79b86fe
1 changed files with 22 additions and 22 deletions

View File

@ -318,7 +318,7 @@ void hg_settingdialog::createUI()
case SANE_TYPE_BOOL:
{
QCheckBox *checkBoxCreation = new QCheckBox(scrollArea);
if (strcmp(opt->title, OPTION_TITLE_ZDYSMQY) == 0)
if (strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0)
{
QLabel *title = new QLabel(scrollArea);
h = new QHBoxLayout();
@ -335,7 +335,7 @@ void hg_settingdialog::createUI()
reinterpret_cast<QFormLayout*>(widget->layout())->addRow(h);
connect(btn_cut_area_, SIGNAL(clicked(bool)), this, SLOT(slot_cutButtonClicked()));
}
else if (strcmp(opt->title, OPTION_TITLE_QYSDQX) == 0)
else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0)
{
QLabel *title = new QLabel(scrollArea);
h = new QHBoxLayout();
@ -362,9 +362,9 @@ void hg_settingdialog::createUI()
else
init.val = m_list_defaultOptions.at(i).second;
checkBoxCreation->setChecked(init.val.toBool());
if (strcmp(opt->title, OPTION_TITLE_ZDYSMQY) == 0)
if (strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0)
btn_cut_area_->setEnabled(init.val.toBool());
else if (strcmp(opt->title, OPTION_TITLE_QYSDQX) == 0)
else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0)
btn_gamma_->setEnabled(init.val.toBool());
connect(checkBoxCreation, SIGNAL(stateChanged(int)), this, SLOT(slot_checkedClicked()));
m_list_widgets.append(checkBoxCreation);
@ -646,13 +646,13 @@ void hg_settingdialog::createUI()
} //switch(opt->type)
// if (Utf8ToStdString(opt->title) == "分辨率")
if (strcmp(opt->title, OPTION_TITLE_FBL) == 0)
if (strcmp(opt->name, SANE_STD_OPT_NAME_RESOLUTION) == 0)
{
m_dpiId = i + 1;
m_dpiValue = m_list_defaultOptions.at(i).second.toInt();
}
// else if (Utf8ToStdString(opt->title) == "纸张尺寸")
else if (strcmp(opt->title, OPTION_TITLE_ZZCC) == 0)
else if (strcmp(opt->name, SANE_STD_OPT_NAME_PAPER) == 0)
{
m_paperSizeId = i + 1;
m_paperSizeValue = m_list_defaultOptions.at(i).second.toString();
@ -684,7 +684,7 @@ void hg_settingdialog::createUI()
}
// else if (Utf8ToStdString(opt->title) == "颜色模式")
if (strcmp(opt->title, OPTION_TITLE_YSMS) == 0)
if (strcmp(opt->name, SANE_STD_OPT_NAME_COLOR_MODE) == 0)
{
m_colorModeId = i + 1;
m_colorModeValue = m_list_defaultOptions.at(i).second.toString();
@ -880,17 +880,17 @@ void hg_settingdialog::updateUIStatus()
bool hide = (opt->cap & SANE_CAP_INACTIVE) == SANE_CAP_INACTIVE;
QWidget* w_label = layout ? layout->labelForField(widget) : nullptr;
if( strcmp(opt->title, OPTION_TITLE_SMQYZCmm) == 0 ||
strcmp(opt->title, OPTION_TITLE_SMQYSCmm) == 0 ||
strcmp(opt->title, OPTION_TITLE_SMQYYCmm) == 0 ||
strcmp(opt->title, OPTION_TITLE_SMQYXCmm) == 0 )
if( strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_LEFT) == 0 ||
strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_TOP) == 0 ||
strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_RIGHT) == 0 ||
strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA_BOTTOM) == 0 )
hide = true;
refresh_control_value(id);
if(w_label)
hide ? w_label->hide() : w_label->show();
widget->setVisible(!hide);
if(strcmp(opt->title, OPTION_TITLE_ZDYSMQY) == 0)
if(strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0)
{
if(hide)
{
@ -929,9 +929,9 @@ void hg_settingdialog::slot_checkedClicked()
else if(method & SANE_INFO_INEXACT)
checkBox->setCheckState(checkBoxcurrentState ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
if(strcmp(opt->title, OPTION_TITLE_ZDYSMQY) == 0)
if(strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0)
btn_cut_area_->setEnabled(checkBoxcurrentState);
else if (strcmp(opt->title, OPTION_TITLE_QYSDQX) == 0)
else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0)
btn_gamma_->setEnabled(checkBoxcurrentState);
record_changed_option((int)id, checkBoxcurrentState);
}
@ -1699,9 +1699,9 @@ void hg_settingdialog::on_select_scheme(int scheme_ind, bool apply_to_dev)
if(ok)
{
changed_opts_.push_back(co);
if(strcmp(opt->title, OPTION_TITLE_ZDYSMQY) == 0)
if(strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0)
btn_cut_area_->setEnabled(co.val.toBool());
else if(strcmp(opt->title, OPTION_TITLE_QYSDQX) == 0)
else if(strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0)
{
btn_gamma_->setEnabled(co.val.toBool());
if(co.val.toBool())
@ -1838,7 +1838,7 @@ void hg_settingdialog::save_scheme(void)
if(cur_ind_ >= 0 && cur_ind_ + 1 < (int)schemes_->schemes.size())
{
OPTSCHEME& schm = schemes_->schemes[cur_ind_ + 1];
std::vector<OPTVAL>::iterator it1 = std::find(schm.opts.begin(), schm.opts.end(), OPTION_TITLE_QYSDQX);
std::vector<OPTVAL>::iterator it1 = std::find(schm.opts.begin(), schm.opts.end(), SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA);
if(it1 != schm.opts.end())
{
if(it1->extra.empty())
@ -1869,12 +1869,12 @@ void hg_settingdialog::save_scheme(void)
}
os.name += buf;
std::vector<OPTVAL>::iterator it1 = std::find(os.opts.begin(), os.opts.end(), OPTION_TITLE_QYSDQX);
std::vector<OPTVAL>::iterator it1 = std::find(os.opts.begin(), os.opts.end(), SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA);
save_gamma = it1 != os.opts.end();
if (cur_ind_ >= 0 && cur_ind_ + 1 < (int)schemes_->schemes.size())
{
bool overwrite = true, ask = true;
std::vector<OPTVAL>::iterator it2 = std::find(src.opts.begin(), src.opts.end(), OPTION_TITLE_QYSDQX);
std::vector<OPTVAL>::iterator it2 = std::find(src.opts.begin(), src.opts.end(), SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA);
if(save_gamma && it2 != src.opts.end())
{
@ -1925,7 +1925,7 @@ void hg_settingdialog::save_scheme(void)
gamma_file = gen_gamma_file_path();
config::save_2_file(gamma_file, &m_gammaData, sizeof(m_gammaData));
std::vector<OPTVAL>::iterator it1 = std::find(os.opts.begin(), os.opts.end(), OPTION_TITLE_QYSDQX);
std::vector<OPTVAL>::iterator it1 = std::find(os.opts.begin(), os.opts.end(), SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA);
if(it1 != os.opts.end())
it1->extra = gamma_file.toStdString();
}
@ -2194,7 +2194,7 @@ void hg_settingdialog::slot_pushButton_scheme_management(void)
OPTSCHEME* s = &schemes_->schemes[id + 1];
for(size_t i = 0; i < s->opts.size(); ++i)
{
if(s->opts[i].name == OPTION_TITLE_QYSDQX)
if(s->opts[i].name == SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA)
{
SANE_Gamma gmma;
if(config::load_custom_gamma(s->opts[i].extra.c_str(), &gmma))
@ -2227,7 +2227,7 @@ void hg_settingdialog::slot_pushButton_scheme_management(void)
OPTSCHEME* s = &schemes_->schemes[i];
for(size_t i = 0; i < s->opts.size(); ++i)
{
if(s->opts[i].name == OPTION_TITLE_QYSDQX)
if(s->opts[i].name == SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA)
{
SANE_Gamma gmma;
if(config::load_custom_gamma(s->opts[i].extra.c_str(), &gmma))