配置文件增加写入当前app版本
This commit is contained in:
parent
ed9788e18a
commit
6d45250946
|
@ -561,6 +561,7 @@ int config::save_scanner_configs(const DEVCFG* cfg)
|
|||
child->create_empty(true);
|
||||
scheme = new gb::json();
|
||||
scheme->set_value("cur_sel", cfg->cur_scheme);
|
||||
scheme->set_value("version", cfg->appVersionNum);
|
||||
child->set_value(NULL, scheme);
|
||||
delete scheme;
|
||||
for(size_t i = 0; i < cfg->schemes.size(); ++i)
|
||||
|
|
|
@ -67,6 +67,7 @@ typedef struct _dev_configs
|
|||
{
|
||||
std::string name; // device name
|
||||
int cur_scheme; // -1 is none user scheme applied, and points to the default setting which at first in 'schemes'
|
||||
std::string appVersionNum;
|
||||
std::vector<OPTSCHEME> schemes; // NOTE: the first is always the default setting, and (cur_scheme + 1) is the user customizing setting, -1 is the default setting
|
||||
bool operator==(const std::string& n)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ hg_settingdialog::hg_settingdialog(void *handle, QWidget *parent
|
|||
m_handle = handle;
|
||||
initUi();
|
||||
on_select_scheme(cur_ind_, false);
|
||||
getAppVersion();
|
||||
}
|
||||
|
||||
hg_settingdialog::~hg_settingdialog()
|
||||
|
@ -2109,6 +2110,26 @@ void hg_settingdialog::record_changed_option(int opt, const QVariant& var)
|
|||
it->val = var;
|
||||
}
|
||||
|
||||
void hg_settingdialog::getAppVersion()
|
||||
{
|
||||
SANE_About *about = nullptr;
|
||||
unsigned int len = 0;
|
||||
std::string versionNum;
|
||||
if (sane_io_control(m_handle, IO_CTRL_CODE_ABOUT_INFO, about, &len) == SANE_STATUS_NO_MEM)
|
||||
{
|
||||
about = (SANE_About*)malloc(len + 128);
|
||||
if (about)
|
||||
{
|
||||
memset(about, 0, len + 128);
|
||||
if (sane_io_control(m_handle, IO_CTRL_CODE_ABOUT_INFO, about, &len) == SANE_STATUS_GOOD)
|
||||
{
|
||||
versionNum = about->version;
|
||||
schemes_->appVersionNum = versionNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hg_settingdialog::on_current_scheme_changed()
|
||||
{
|
||||
QString scheme(comb_->currentText());
|
||||
|
|
|
@ -99,6 +99,7 @@ private:
|
|||
int apply_setting(const SANE_Option_Descriptor* desc, int opt_ind, OPTVAL* val);
|
||||
int apply_settings(OPTSCHEME* scheme);
|
||||
void record_changed_option(int opt, const QVariant& var);
|
||||
void getAppVersion();
|
||||
|
||||
private:
|
||||
QVector<QPair<QPair<int, QVariant>, QString>> m_list_IdValueTitle;
|
||||
|
|
Loading…
Reference in New Issue