96 lines
2.1 KiB
C++
96 lines
2.1 KiB
C++
#ifndef FORM_DEVICECONFIG_H
|
||
#define FORM_DEVICECONFIG_H
|
||
|
||
#include <QWidget>
|
||
#include <string>
|
||
#include <vector>
|
||
#include "sane/sane_ex.h"
|
||
|
||
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;
|
||
doubleValue = 0;
|
||
boolValue = false;
|
||
|
||
rangeType = 0;
|
||
intValueMin = 0;
|
||
intValueMax = 0;
|
||
doubleValueMin = 0;
|
||
doubleValueMax = 0;
|
||
}
|
||
|
||
// 配置名
|
||
std::string name;
|
||
std::string title;
|
||
|
||
// 配置值
|
||
int valueType; // 0-无,1-字符串,2-整型,3-浮点,4-布尔
|
||
std::string stringValue;
|
||
int intValue;
|
||
double doubleValue;
|
||
bool boolValue;
|
||
|
||
// 配置取值范围
|
||
int rangeType; // 0-无,1-字符串列表,2-整型列表,3-浮点数列表,4-整型范围,5-浮点数范围
|
||
std::vector<std::string> stringValueList;
|
||
std::vector<int> intValueList;
|
||
std::vector<double> doubleValueList;
|
||
int intValueMin;
|
||
int intValueMax;
|
||
double doubleValueMin;
|
||
double doubleValueMax;
|
||
};
|
||
|
||
struct DeviceConfigsGroup
|
||
{
|
||
std::string groupTitle;
|
||
std::vector<DeviceConfigEx> deviceConfigs;
|
||
};
|
||
|
||
class Form_DeviceConfig : public QWidget
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit Form_DeviceConfig(SANE_Handle devHandle, const std::vector<DeviceConfig>& deviceConfigs, QWidget *parent = nullptr);
|
||
~Form_DeviceConfig();
|
||
|
||
std::vector<DeviceConfig> GetDeviceConfigs();
|
||
|
||
private:
|
||
void Init(SANE_Handle devHandle);
|
||
void Update(std::vector<DeviceConfigsGroup> &deviceConfigsGroups);
|
||
|
||
private slots:
|
||
void on_defaultBtn_clicked();
|
||
|
||
private:
|
||
std::vector<DeviceConfigsGroup> m_baseDeviceConfigsGroups;
|
||
std::vector<QWidget*> m_ctrlList;
|
||
};
|
||
|
||
#endif // FORM_DEVICECONFIG_H
|