code_app/app/scantool/form_deviceconfig.h

70 lines
1.6 KiB
C
Raw Normal View History

2024-04-24 03:57:56 +00:00
#ifndef FORM_DEVICECONFIG_H
#define FORM_DEVICECONFIG_H
#include <QWidget>
#include <string>
#include <vector>
#include "sane/sane_ex.h"
2024-04-24 03:57:56 +00:00
struct DeviceConfig
{
DeviceConfig()
{
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<DeviceConfig> deviceConfigs;
};
2024-04-24 03:57:56 +00:00
class Form_DeviceConfig : public QWidget
{
Q_OBJECT
public:
explicit Form_DeviceConfig(SANE_Handle devHandle, const std::vector<DeviceConfig>& deviceConfigs, QWidget *parent = nullptr);
2024-04-24 03:57:56 +00:00
~Form_DeviceConfig();
std::vector<DeviceConfig> GetDeviceConfigs();
2024-04-24 03:57:56 +00:00
private:
void ResetDevice(SANE_Handle devHandle);
void CreateUI(const std::vector<DeviceConfig>& deviceConfigs);
2024-04-24 03:57:56 +00:00
private:
std::vector<DeviceConfigsGroup> m_deviceConfigsGroups;
2024-04-24 03:57:56 +00:00
};
#endif // FORM_DEVICECONFIG_H