This commit is contained in:
luoliangyi 2024-04-29 18:02:18 +08:00
parent 815e90a133
commit 83886ff8b7
3 changed files with 32 additions and 10 deletions

View File

@ -102,6 +102,9 @@ void Form_DeviceConfig::Init(const std::vector<DeviceConfig>& deviceConfigs)
while (' ' == *name)
++name;
if (0 == strcmp(SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA, name))
continue;
if (SANE_TYPE_STRING == desp->type)
{
char value[256] = { 0 };
@ -200,6 +203,9 @@ void Form_DeviceConfig::Init(const std::vector<DeviceConfig>& deviceConfigs)
while (' ' == *name)
++name;
if (0 == strcmp(SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA, name))
continue;
const char* title = desp->title;
while (' ' == *title)
++title;
@ -532,6 +538,13 @@ void Form_DeviceConfig::Update(int ignoreId)
if (k == ignoreId)
continue;
const char* name = desp->name;
while (' ' == *name)
++name;
if (0 == strcmp(SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA, name))
continue;
DeviceConfigEx *pDeviceConfigEx = nullptr;
for (int i = 0; i < (int)m_deviceConfigsGroups.size(); ++i)
{

View File

@ -3678,6 +3678,9 @@ namespace ver_2
while (' ' == *name)
++name;
if (0 == strcmp(SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA, name))
continue;
const char* title = desp->title;
while (' ' == *title)
++title;
@ -3701,19 +3704,19 @@ namespace ver_2
devParam.valueType = 1;
devParam.stringValue = value;
devParam.rangeType = 1;
if (SANE_CONSTRAINT_STRING_LIST == desp->constraint_type)
{
devParam.rangeType = 1;
const SANE_String_Const* p = desp->constraint.string_list;
while (NULL != *p)
{
devParam.stringValueList.push_back(*p);
++p;
}
assert(!devParams.empty());
devParams[devParams.size() - 1].devParams.push_back(devParam);
}
assert(!devParams.empty());
devParams[devParams.size() - 1].devParams.push_back(devParam);
}
else if (SANE_TYPE_INT == desp->type)
{

View File

@ -2860,15 +2860,21 @@ namespace ver_2
if (1 == devParams[k].devParams[i].valueType)
{
assert(1 == devParams[k].devParams[i].rangeType);
cJSON_AddItemToObject(param, "value_type", cJSON_CreateString("string"));
cJSON_AddItemToObject(param, "value", cJSON_CreateString(devParams[k].devParams[i].stringValue.c_str()));
cJSON* valueList = cJSON_CreateArray();
for (int j = 0; j < (int)devParams[k].devParams[i].stringValueList.size(); ++j)
cJSON_AddItemToArray(valueList, cJSON_CreateString(devParams[k].devParams[i].stringValueList[j].c_str()));
cJSON_AddItemToObject(param, "range_type", cJSON_CreateString("list"));
cJSON_AddItemToObject(param, "value_list", valueList);
if (1 == devParams[k].devParams[i].rangeType)
{
cJSON* valueList = cJSON_CreateArray();
for (int j = 0; j < (int)devParams[k].devParams[i].stringValueList.size(); ++j)
cJSON_AddItemToArray(valueList, cJSON_CreateString(devParams[k].devParams[i].stringValueList[j].c_str()));
cJSON_AddItemToObject(param, "range_type", cJSON_CreateString("list"));
cJSON_AddItemToObject(param, "value_list", valueList);
}
else
{
assert(0 == devParams[k].devParams[i].rangeType);
}
}
else if (2 == devParams[k].devParams[i].valueType)
{