This commit is contained in:
parent
cd3ca8c6f9
commit
2eeaa33974
|
@ -25,7 +25,7 @@ Form_DeviceConfig::Form_DeviceConfig(SANE_Handle devHandle, const std::vector<De
|
|||
{
|
||||
for (int n = 0; n < (int)deviceConfigsGroups[m].deviceConfigs.size(); ++n)
|
||||
{
|
||||
DeviceConfig &deviceConfig = deviceConfigsGroups[m].deviceConfigs[n];
|
||||
DeviceConfigEx &deviceConfig = deviceConfigsGroups[m].deviceConfigs[n];
|
||||
if (deviceConfig.name == deviceConfigs[i].name && deviceConfig.valueType == deviceConfigs[i].valueType)
|
||||
{
|
||||
deviceConfig.stringValue = deviceConfigs[i].stringValue;
|
||||
|
@ -60,7 +60,7 @@ std::vector<DeviceConfig> Form_DeviceConfig::GetDeviceConfigs()
|
|||
{
|
||||
for (int j = 0; j < (int)m_baseDeviceConfigsGroups[i].deviceConfigs.size(); ++j)
|
||||
{
|
||||
const DeviceConfig &deviceConfig = m_baseDeviceConfigsGroups[i].deviceConfigs[j];
|
||||
const DeviceConfigEx &deviceConfig = m_baseDeviceConfigsGroups[i].deviceConfigs[j];
|
||||
|
||||
QWidget *ctrl = nullptr;
|
||||
for (int k = 0; k < (int)m_ctrlList.size(); ++k)
|
||||
|
@ -76,7 +76,6 @@ std::vector<DeviceConfig> Form_DeviceConfig::GetDeviceConfigs()
|
|||
{
|
||||
DeviceConfig dc;
|
||||
dc.name = deviceConfig.name;
|
||||
dc.title = deviceConfig.title;
|
||||
dc.valueType = deviceConfig.valueType;
|
||||
|
||||
if (1 == deviceConfig.rangeType)
|
||||
|
@ -216,7 +215,7 @@ void Form_DeviceConfig::Init(SANE_Handle devHandle)
|
|||
char value[256] = { 0 };
|
||||
sane_control_option(devHandle, i, SANE_ACTION_GET_VALUE, value, NULL);
|
||||
|
||||
DeviceConfig devConfig;
|
||||
DeviceConfigEx devConfig;
|
||||
devConfig.name = name;
|
||||
devConfig.title = title;
|
||||
devConfig.valueType = 1;
|
||||
|
@ -241,7 +240,7 @@ void Form_DeviceConfig::Init(SANE_Handle devHandle)
|
|||
SANE_Int value = 0;
|
||||
sane_control_option(devHandle, i, SANE_ACTION_GET_VALUE, &value, NULL);
|
||||
|
||||
DeviceConfig devConfig;
|
||||
DeviceConfigEx devConfig;
|
||||
devConfig.name = name;
|
||||
devConfig.title = title;
|
||||
devConfig.valueType = 2;
|
||||
|
@ -271,7 +270,7 @@ void Form_DeviceConfig::Init(SANE_Handle devHandle)
|
|||
SANE_Word value = 0;
|
||||
sane_control_option(devHandle, i, SANE_ACTION_GET_VALUE, &value, NULL);
|
||||
|
||||
DeviceConfig devConfig;
|
||||
DeviceConfigEx devConfig;
|
||||
devConfig.name = name;
|
||||
devConfig.title = title;
|
||||
devConfig.valueType = 3;
|
||||
|
@ -301,7 +300,7 @@ void Form_DeviceConfig::Init(SANE_Handle devHandle)
|
|||
SANE_Bool value = 0;
|
||||
sane_control_option(devHandle, i, SANE_ACTION_GET_VALUE, &value, NULL);
|
||||
|
||||
DeviceConfig devConfig;
|
||||
DeviceConfigEx devConfig;
|
||||
devConfig.name = name;
|
||||
devConfig.title = title;
|
||||
devConfig.valueType = 4;
|
||||
|
@ -340,7 +339,7 @@ void Form_DeviceConfig::Init(SANE_Handle devHandle)
|
|||
|
||||
for (int j = 0; j < (int)m_baseDeviceConfigsGroups[i].deviceConfigs.size(); ++j)
|
||||
{
|
||||
const DeviceConfig &deviceConfig = m_baseDeviceConfigsGroups[i].deviceConfigs[j];
|
||||
const DeviceConfigEx &deviceConfig = m_baseDeviceConfigsGroups[i].deviceConfigs[j];
|
||||
|
||||
// 创建Label
|
||||
QLabel *label = new QLabel;
|
||||
|
@ -442,7 +441,7 @@ void Form_DeviceConfig::Update(std::vector<DeviceConfigsGroup> &deviceConfigsGro
|
|||
{
|
||||
for (int j = 0; j < (int)deviceConfigsGroups[i].deviceConfigs.size(); ++j)
|
||||
{
|
||||
const DeviceConfig &deviceConfig = deviceConfigsGroups[i].deviceConfigs[j];
|
||||
const DeviceConfigEx &deviceConfig = deviceConfigsGroups[i].deviceConfigs[j];
|
||||
|
||||
QWidget *ctrl = nullptr;
|
||||
for (int k = 0; k < (int)m_ctrlList.size(); ++k)
|
||||
|
|
|
@ -9,6 +9,26 @@
|
|||
struct DeviceConfig
|
||||
{
|
||||
DeviceConfig()
|
||||
{
|
||||
valueType = 0;
|
||||
intValue = 0;
|
||||
doubleValue = 0;
|
||||
boolValue = false;
|
||||
}
|
||||
|
||||
// 配置名
|
||||
std::string name;
|
||||
// 配置值
|
||||
int valueType; // 0-无,1-字符串,2-整型,3-浮点,4-布尔
|
||||
std::string stringValue;
|
||||
int intValue;
|
||||
double doubleValue;
|
||||
bool boolValue;
|
||||
};
|
||||
|
||||
struct DeviceConfigEx
|
||||
{
|
||||
DeviceConfigEx()
|
||||
{
|
||||
valueType = 0;
|
||||
intValue = 0;
|
||||
|
@ -47,7 +67,7 @@ struct DeviceConfig
|
|||
struct DeviceConfigsGroup
|
||||
{
|
||||
std::string groupTitle;
|
||||
std::vector<DeviceConfig> deviceConfigs;
|
||||
std::vector<DeviceConfigEx> deviceConfigs;
|
||||
};
|
||||
|
||||
class Form_DeviceConfig : public QWidget
|
||||
|
|
Loading…
Reference in New Issue