调整配置文件名

This commit is contained in:
yangjiaxuan 2023-05-22 17:41:44 +08:00
parent 6c4ea84b5b
commit f6e1c03277
3 changed files with 20 additions and 13 deletions

View File

@ -284,15 +284,9 @@ public:
{ {
root_dir_ = std::string(root) + PATH_SYMBOL; root_dir_ = std::string(root) + PATH_SYMBOL;
} }
void add_scanner(const char* sane_name, int pid) void add_scanner(const char* sane_name)
{ {
char buf[10] = { 0 };
sprintf(buf, "%x", pid);
std::string devName = sane_name; std::string devName = sane_name;
if (pid != 0)
{
devName = devName.substr(0, devName.find(" - ")) + " - " + buf;
}
bool found = false; bool found = false;

View File

@ -56,8 +56,15 @@ hg_settingdialog::hg_settingdialog(SANE_Handle handle, const SANEAPI* saneApi, b
int pid = 0; int pid = 0;
saneApi->sane_control_option_api(m_devHandle, (SANE_Int)0x8853, SANE_ACTION_GET_VALUE, &pid, NULL); saneApi->sane_control_option_api(m_devHandle, (SANE_Int)0x8853, SANE_ACTION_GET_VALUE, &pid, NULL);
dev_que_.add_scanner(devName, pid); char buf[10] = { 0 };
dev_que_.open_scanner(saneApi, handle, devName, false); sprintf(buf, "%x", pid);
std::string deviceName = m_devName;
if (pid != 0)
{
deviceName = deviceName.substr(0, deviceName.find(" ")) + " " + buf;
}
dev_que_.add_scanner(deviceName.c_str());
dev_que_.open_scanner(saneApi, handle, deviceName.c_str(), false);
std::string n(dev_que_.opened_scanner_name()); std::string n(dev_que_.opened_scanner_name());
for(int i = 0; i < dev_que_.scanners(); ++i) for(int i = 0; i < dev_que_.scanners(); ++i)

View File

@ -63,13 +63,19 @@ char *apply_current_config(const char *dev_name, SANE_Handle device, LPSANEAPI a
if(QFile::exists(old)) if(QFile::exists(old))
dev_que::update_old_cfg(old.toStdString().c_str()); dev_que::update_old_cfg(old.toStdString().c_str());
std::string devName = dev_name;
int pid = 0; int pid = 0;
api->sane_control_option_api(device, (SANE_Int)0x8853, SANE_ACTION_GET_VALUE, &pid, NULL); api->sane_control_option_api(device, (SANE_Int)0x8853, SANE_ACTION_GET_VALUE, &pid, NULL);
devQue.add_scanner(devName.c_str(), pid); char buf[10] = { 0 };
devQue.open_scanner(api, device, dev_name, true); sprintf(buf, "%x", pid);
std::string devName = dev_name;
if (pid != 0)
{
devName = devName.substr(0, devName.find(" ")) + " " + buf;
}
devQue.add_scanner(devName.c_str());
devQue.open_scanner(api, device, devName.c_str(), true);
std::string n(devQue.opened_scanner_name()); std::string n(devQue.opened_scanner_name());
for(int i = 0; i < devQue.scanners(); ++i) for(int i = 0; i < devQue.scanners(); ++i)