#ifndef __SYSTEMCONFIG_H__ #define __SYSTEMCONFIG_H__ #include "GlobalVariable.h" #include "SystemConfigStruct.h" #include enum class eSystemConfigType { eSCT_BaseConfig = 0, // 基础配置 eSCT_CompareAI, // AI对比 eSCT_NoiseDetect, // 噪音检测 eSCT_Database, // 数据库设置 eSCT_DetectPeriod // 检测时段 }; #define Config_Base "ACAS_Base" // 基础配置 #define Config_CompareAI "ACAS_CompareAI" // AI对比配置 #define Config_NoiseDetect "ACAS_NoiseDetect" // 噪音检测配置 #define Config_Database "ACAS_Database" // 数据库设置 #define Config_DetectPeriod "ACAS_DetectPeriod" // 检测时段配置 /** * @brief ACA系统的设置信息 * */ #define SysConfig SystemConfigInfo::instance() class SystemConfigInfo { SystemConfigInfo() = default; SystemConfigInfo(const SystemConfigInfo&) = delete; SystemConfigInfo& operator=(const SystemConfigInfo&) = delete; public: ~SystemConfigInfo() = default; static SystemConfigInfo& instance() { static SystemConfigInfo instance; return instance; } /* 系统设置类型 */ const QMap mapSysConfigDesc = { {eSystemConfigType::eSCT_BaseConfig, "基础配置"}, {eSystemConfigType::eSCT_CompareAI, "AI对比设置"}, {eSystemConfigType::eSCT_NoiseDetect, "噪音检测参数"}, {eSystemConfigType::eSCT_Database, "数据库设置信息"}, {eSystemConfigType::eSCT_DetectPeriod, "检测时段信息"} }; /* 获取未被修改的基础配置 */ const BaseConfig_t& getBaseConfigSrc() const { return m_baseConfigSrc; } /* 设置基础配置 */ void setBaseConfig(const BaseConfig_t& config); /* 将数据库的json转换成结构体 */ bool getBaseConfigFromJson(const std::string& jsonStr); /* 将结构体转换成json */ bool setBaseConfigToJson(const BaseConfig_t& baseConfig, std::string& strJson) const; public: private: /* 基础配置未被修改版本 */ BaseConfig_t m_baseConfigSrc; }; #endif // __SYSTEMCONFIG_H__