调整配置文件名
This commit is contained in:
parent
183b20afe0
commit
a295dadbef
|
@ -284,13 +284,21 @@ public:
|
|||
{
|
||||
root_dir_ = std::string(root) + PATH_SYMBOL;
|
||||
}
|
||||
void add_scanner(const char* sane_name)
|
||||
void add_scanner(const char* sane_name, int pid)
|
||||
{
|
||||
char buf[10] = { 0 };
|
||||
sprintf(buf, "%x", pid);
|
||||
std::string devName = sane_name;
|
||||
if (pid != 0)
|
||||
{
|
||||
devName = devName.substr(0, devName.find(" - ")) + " - " + buf;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
|
||||
for(auto& v: que_)
|
||||
{
|
||||
if(v.name == sane_name)
|
||||
if(v.name == devName)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
|
@ -302,7 +310,7 @@ public:
|
|||
SCANNER s;
|
||||
size_t pos = 0;
|
||||
|
||||
s.model = s.name = sane_name;
|
||||
s.model = s.name = devName;
|
||||
s.cfg = nullptr;
|
||||
pos = s.model.find(" - ");
|
||||
if(pos != std::string::npos)
|
||||
|
|
|
@ -52,7 +52,10 @@ hg_settingdialog::hg_settingdialog(SANE_Handle handle, const SANEAPI* saneApi, b
|
|||
if(QFile::exists(old))
|
||||
dev_que::update_old_cfg(old.toStdString().c_str());
|
||||
|
||||
dev_que_.add_scanner(devName);
|
||||
int pid = 0;
|
||||
saneApi->sane_control_option_api(m_devHandle, (SANE_Int)0x8853, SANE_ACTION_GET_VALUE, &pid, NULL);
|
||||
|
||||
dev_que_.add_scanner(devName, pid);
|
||||
dev_que_.open_scanner(saneApi, handle, devName, false);
|
||||
|
||||
std::string n(dev_que_.opened_scanner_name());
|
||||
|
@ -110,7 +113,7 @@ hg_settingdialog::~hg_settingdialog()
|
|||
cur_cfg_->release();
|
||||
hg_setting_ui_ = NULL;
|
||||
|
||||
m_callback(UI_RESULT_CLOSE_NORMAL);
|
||||
m_callback(UI_RESULT_CLOSE_SETTING);
|
||||
}
|
||||
|
||||
void hg_settingdialog::initUi()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "twain_user/twainui.h"
|
||||
#include <QMessageBox>
|
||||
#include <string>
|
||||
#include "dialog_device_select.h"
|
||||
#include "dialog_progress_ui.h"
|
||||
#include "hg_settingdialog.h"
|
||||
|
@ -62,7 +63,12 @@ char *apply_current_config(const char *dev_name, SANE_Handle device, LPSANEAPI a
|
|||
if(QFile::exists(old))
|
||||
dev_que::update_old_cfg(old.toStdString().c_str());
|
||||
|
||||
devQue.add_scanner(dev_name);
|
||||
std::string devName = dev_name;
|
||||
|
||||
int pid = 0;
|
||||
api->sane_control_option_api(device, (SANE_Int)0x8853, SANE_ACTION_GET_VALUE, &pid, NULL);
|
||||
|
||||
devQue.add_scanner(devName.c_str(), pid);
|
||||
devQue.open_scanner(api, device, dev_name, true);
|
||||
|
||||
std::string n(devQue.opened_scanner_name());
|
||||
|
|
Loading…
Reference in New Issue