|
|
|
@ -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)
|
|
|
|
@ -123,7 +122,7 @@ std::vector<DeviceConfig> Form_DeviceConfig::GetDeviceConfigs()
|
|
|
|
|
{
|
|
|
|
|
assert(3 == deviceConfig.valueType);
|
|
|
|
|
QSlider *slider = (QSlider *)ctrl;
|
|
|
|
|
if (deviceConfig.doubleValue * 100 != slider->value())
|
|
|
|
|
if (round(deviceConfig.doubleValue * 100) != slider->value())
|
|
|
|
|
{
|
|
|
|
|
dc.doubleValue = slider->value() / 100.0;
|
|
|
|
|
deviceConfigs.push_back(dc);
|
|
|
|
@ -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;
|
|
|
|
@ -389,8 +388,8 @@ void Form_DeviceConfig::Init(SANE_Handle devHandle)
|
|
|
|
|
assert(3 == deviceConfig.valueType);
|
|
|
|
|
QSlider *slider = new QSlider;
|
|
|
|
|
slider->setOrientation(Qt::Horizontal);
|
|
|
|
|
slider->setRange(deviceConfig.doubleValueMin * 100, deviceConfig.doubleValueMax * 100);
|
|
|
|
|
//slider->setValue(deviceConfig.doubleValue * 100);
|
|
|
|
|
slider->setRange(round(deviceConfig.doubleValueMin * 100), round(deviceConfig.doubleValueMax * 100));
|
|
|
|
|
//slider->setValue(round(deviceConfig.doubleValue * 100));
|
|
|
|
|
ctrl = slider;
|
|
|
|
|
}
|
|
|
|
|
else if (0 == deviceConfig.rangeType)
|
|
|
|
@ -407,7 +406,7 @@ void Form_DeviceConfig::Init(SANE_Handle devHandle)
|
|
|
|
|
#else
|
|
|
|
|
spinBox->setMinimumWidth(150);
|
|
|
|
|
#endif
|
|
|
|
|
spinBox->setRange(1, 1000);
|
|
|
|
|
spinBox->setRange(-1, 1000);
|
|
|
|
|
//spinBox->setValue(deviceConfig.intValue);
|
|
|
|
|
ctrl = spinBox;
|
|
|
|
|
}
|
|
|
|
@ -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)
|
|
|
|
@ -484,7 +483,7 @@ void Form_DeviceConfig::Update(std::vector<DeviceConfigsGroup> &deviceConfigsGro
|
|
|
|
|
{
|
|
|
|
|
assert(3 == deviceConfig.valueType);
|
|
|
|
|
QSlider *slider = (QSlider *)ctrl;
|
|
|
|
|
slider->setValue(deviceConfig.doubleValue * 100);
|
|
|
|
|
slider->setValue(round(deviceConfig.doubleValue * 100));
|
|
|
|
|
}
|
|
|
|
|
else if (0 == deviceConfig.rangeType)
|
|
|
|
|
{
|
|
|
|
|