Kaynağa Gözat

V0.3
1、完成了所有的页面UI,还差检测时段的增删改查

Apple 3 hafta önce
ebeveyn
işleme
49a54408d8
35 değiştirilmiş dosya ile 2646 ekleme ve 1451 silme
  1. 4 0
      SQL/ACASetting.sql
  2. 6 1
      SettingLibrary/DataBase/GlobalInfo.h
  3. 170 0
      SettingLibrary/DataManager/SystemConfig.cpp
  4. 54 4
      SettingLibrary/DataManager/SystemConfig.h
  5. 91 1
      SettingLibrary/DataManager/SystemConfigStruct.cpp
  6. 63 0
      SettingLibrary/DataManager/SystemConfigStruct.h
  7. 62 0
      SettingLibrary/Modules/AICompare/aicomparewidget.cpp
  8. 17 0
      SettingLibrary/Modules/AICompare/aicomparewidget.h
  9. 17 57
      SettingLibrary/Modules/AICompare/aicomparewidget.ui
  10. 21 11
      SettingLibrary/Modules/Basic/basicwidget.cpp
  11. 1 1
      SettingLibrary/Modules/Basic/basicwidget.h
  12. 13 13
      SettingLibrary/Modules/Basic/basicwidget.ui
  13. 4 4
      SettingLibrary/Modules/Basic/compareitemlistdialog.cpp
  14. 22 4
      SettingLibrary/Modules/CheckPeriod/checkperiodwidget.cpp
  15. 7 2
      SettingLibrary/Modules/CheckPeriod/checkperiodwidget.h
  16. 35 167
      SettingLibrary/Modules/CheckPeriod/checkperiodwidget.ui
  17. 76 0
      SettingLibrary/Modules/Database/databasewidget.cpp
  18. 13 0
      SettingLibrary/Modules/Database/databasewidget.h
  19. 150 106
      SettingLibrary/Modules/Database/databasewidget.ui
  20. 101 8
      SettingLibrary/Modules/Noise/noisemonitorparamdialog.cpp
  21. 23 4
      SettingLibrary/Modules/Noise/noisemonitorparamdialog.h
  22. 0 972
      SettingLibrary/Modules/Noise/noisemonitorparamdialog.ui
  23. 722 0
      SettingLibrary/Modules/Noise/noisemonitorparamwidget.ui
  24. 137 2
      SettingLibrary/Modules/Noise/noisewidget.cpp
  25. 23 1
      SettingLibrary/Modules/Noise/noisewidget.h
  26. 23 83
      SettingLibrary/Modules/Noise/noisewidget.ui
  27. 3 3
      SettingLibrary/Network/FromWebAPI.cpp
  28. 5 0
      SettingLibrary/Resources/QSS.qrc
  29. 128 0
      SettingLibrary/Resources/qss/white/aicomparewidget.qss
  30. 260 0
      SettingLibrary/Resources/qss/white/checkperiodwidget.qss
  31. 112 0
      SettingLibrary/Resources/qss/white/databasewidget.qss
  32. 112 0
      SettingLibrary/Resources/qss/white/noisemonitorparamwidget.qss
  33. 84 0
      SettingLibrary/Resources/qss/white/noisewidget.qss
  34. 32 5
      SettingLibrary/setinfomanager.cpp
  35. 55 2
      SettingLibrary/setinfowidget.cpp

+ 4 - 0
SQL/ACASetting.sql

@@ -157,3 +157,7 @@ WHEN NOT MATCHED THEN
 SELECT *
 FROM tACASystemConfig;
 
+#删除一条系统设置信息
+DELETE FROM tACASystemConfig
+WHERE PKID = 1;
+

+ 6 - 1
SettingLibrary/DataBase/GlobalInfo.h

@@ -30,7 +30,10 @@ public:
     const CompareItemInfo_t& getDefaultCompareItem() const {return m_defaultCompareItem; }
     /* 设置对比项默认的参数 */
     void setDefaultCompareItem(const CompareItemInfo_t& item);
-    
+    /* 获取最外层的窗口指针 */
+    QWidget* getTopWindow() const { return m_topWindow; }
+    /* 设置最外层的窗口指针 */
+    void setTopWindow(QWidget* topWindow) { m_topWindow = topWindow; }
 
 public:
     
@@ -40,6 +43,8 @@ private:
     /* 对比项默认参数 */
     CompareItemInfo_t m_defaultCompareItem;
 
+    /* 最外层的窗口指针 */
+    QWidget* m_topWindow = nullptr;
 
 };
 

+ 170 - 0
SettingLibrary/DataManager/SystemConfig.cpp

@@ -50,3 +50,173 @@ bool SystemConfigInfo::setBaseConfigToJson(const BaseConfig_t& baseConfig, std::
 }
 
 
+/* 设置AI对比配置 */
+void SystemConfigInfo::setAICompareConfig(const AICompareConfig_t& config)
+{
+    m_aiCompareConfig = config;
+}
+
+/* 将数据库的json转换成AI对比配置 */
+bool SystemConfigInfo::getAICompareConfigFromJson(const std::string& jsonStr)
+{
+    try {
+        nJson jsonConfig = nJson::parse(jsonStr);
+        m_aiCompareConfig.nAiComputeDuration = jsonConfig["AiComputeDuration"].get<int>();
+        m_aiCompareConfig.strAiCompareDir = jsonConfig["AiCompareDir"].is_null() ? "" : QString::fromStdString(jsonConfig["AiCompareDir"].get<std::string>());
+    }nJsonCatch
+
+    return true;
+}
+
+/* 将AI对比配置转换成json */
+bool SystemConfigInfo::setAICompareConfigToJson(const AICompareConfig_t& aiCompareConfig, std::string& strJson) const
+{
+    try {
+        nJson jsonConfig;
+        jsonConfig["AiComputeDuration"] = aiCompareConfig.nAiComputeDuration;
+        jsonConfig["AiCompareDir"] = aiCompareConfig.strAiCompareDir.toStdString();
+
+        strJson = jsonConfig.dump();
+    }nJsonCatch
+
+    return true;
+}
+
+
+/* 设置噪音检测基础配置 */
+void SystemConfigInfo::setNoiseDetectBaseConfig(const NoiseDetectBaseConfig_t& config)
+{
+    m_noiseDetectBaseConfig = config;
+}
+
+/* 将数据库的json转换成噪音检测基础配置 */
+bool SystemConfigInfo::getNoiseDetectBaseConfigFromJson(const std::string& jsonStr)
+{
+    try {
+        nJson jsonConfig = nJson::parse(jsonStr);
+        m_noiseDetectBaseConfig.strNoiseServerAddr = jsonConfig["NoiseServerAddr"].is_null() ? "" : QString::fromStdString(jsonConfig["NoiseServerAddr"].get<std::string>());
+        m_noiseDetectBaseConfig.strNoiseDetectDir = jsonConfig["NoiseDetectDir"].is_null() ? "" : QString::fromStdString(jsonConfig["NoiseDetectDir"].get<std::string>());
+        m_noiseDetectBaseConfig.strServerPath = jsonConfig["ServerPath"].is_null() ? "" : QString::fromStdString(jsonConfig["ServerPath"].get<std::string>());
+        m_noiseDetectBaseConfig.nNoiseDetectDuration = jsonConfig["NoiseDetectDuration"].get<int>();
+        m_noiseDetectBaseConfig.isEnableNoiseDetect = jsonConfig["EnableNoiseDetect"].get<bool>();
+        m_noiseDetectBaseConfig.isEnableMainRoadDetect = jsonConfig["EnableMainRoadDetect"].get<bool>();
+    }nJsonCatch
+
+    return true;
+}
+
+/* 将噪音检测基础配置转换成json */
+bool SystemConfigInfo::setNoiseDetectBaseConfigToJson(const NoiseDetectBaseConfig_t& noiseDetectBaseConfig, std::string& strJson) const
+{
+    try {
+        nJson jsonConfig;
+        jsonConfig["NoiseServerAddr"] = noiseDetectBaseConfig.strNoiseServerAddr.toStdString();
+        jsonConfig["NoiseDetectDir"] = noiseDetectBaseConfig.strNoiseDetectDir.toStdString();
+        jsonConfig["ServerPath"] = noiseDetectBaseConfig.strServerPath.toStdString();
+        jsonConfig["NoiseDetectDuration"] = noiseDetectBaseConfig.nNoiseDetectDuration;
+        jsonConfig["EnableNoiseDetect"] = noiseDetectBaseConfig.isEnableNoiseDetect;
+        jsonConfig["EnableMainRoadDetect"] = noiseDetectBaseConfig.isEnableMainRoadDetect;
+
+        strJson = jsonConfig.dump();
+    }nJsonCatch
+
+    return true;
+}
+
+
+/* 设置噪音检测参数 */
+void SystemConfigInfo::setNoiseDetectParam(const NoiseDetectParam_t& config)
+{
+    m_noiseDetectParam = config;
+}
+
+/* 将数据库的json转换成噪音检测参数 */
+bool SystemConfigInfo::getNoiseDetectParamFromJson(const std::string& jsonStr)
+{
+    try {
+        nJson jsonConfig = nJson::parse(jsonStr);
+        m_noiseDetectParam.strRegitrationCode = QString::fromStdString(jsonConfig["RegistrationCode"].get<std::string>());
+        m_noiseDetectParam.nNoiseDetectContinueCount = jsonConfig["NoiseDetectContinueCount"].is_null() ? 0 : jsonConfig["NoiseDetectContinueCount"].get<int>();
+        m_noiseDetectParam.nNoiseContinueCountIsWarn = jsonConfig["NoiseContinueCountIsWarn"].is_null() ? 0 : jsonConfig["NoiseContinueCountIsWarn"].get<int>();
+        m_noiseDetectParam.nNoiseContinueCountPercent = jsonConfig["NoiseContinueCountPercent"].is_null() ? 0 : jsonConfig["NoiseContinueCountPercent"].get<int>();
+        m_noiseDetectParam.nFreqComponentMini = jsonConfig["FreqComponentMini"].is_null() ? 0 : jsonConfig["FreqComponentMini"].get<int>();
+        m_noiseDetectParam.nFreqComponentMax = jsonConfig["FreqComponentMax"].is_null() ? 0 : jsonConfig["FreqComponentMax"].get<int>();   
+        m_noiseDetectParam.fOneDBThreshold = jsonConfig["OneDBThreshold"].is_null() ? 0.0f : jsonConfig["OneDBThreshold"].get<float>();
+        m_noiseDetectParam.nOneDBComponentMini = jsonConfig["OneDBComponentMini"].is_null() ? 0 : jsonConfig["OneDBComponentMini"].get<int>();
+        m_noiseDetectParam.fNoiseThreshold = jsonConfig["NoiseThreshold"].is_null() ? 0.0f : jsonConfig["NoiseThreshold"].get<float>();
+        m_noiseDetectParam.nNoiseComponentMini = jsonConfig["NoiseComponentMini"].is_null() ? 0 : jsonConfig["NoiseComponentMini"].get<int>();
+        m_noiseDetectParam.nNoiseDetectDuration = jsonConfig["NoiseDetectDuration"].is_null() ? 0 : jsonConfig["NoiseDetectDuration"].get<int>();
+        m_noiseDetectParam.nNoiseDetectPercent = jsonConfig["NoiseDetectPercent"].is_null() ? 0 : jsonConfig["NoiseDetectPercent"].get<int>();
+        m_noiseDetectParam.nNoiseDBMax = jsonConfig["NoiseDBMax"].is_null() ? 0 : jsonConfig["NoiseDBMax"].get<int>();
+    }nJsonCatch
+
+    return true;
+}
+
+/* 将噪音检测参数转换成json */
+bool SystemConfigInfo::setNoiseDetectParamToJson(const NoiseDetectParam_t& noiseDetectParam, std::string& strJson) const
+{
+    try {
+        nJson jsonConfig;
+        jsonConfig["RegistrationCode"] = noiseDetectParam.strRegitrationCode.toStdString();
+        jsonConfig["NoiseDetectContinueCount"] = noiseDetectParam.nNoiseDetectContinueCount;
+        jsonConfig["NoiseContinueCountIsWarn"] = noiseDetectParam.nNoiseContinueCountIsWarn;
+        jsonConfig["NoiseContinueCountPercent"] = noiseDetectParam.nNoiseContinueCountPercent;
+        jsonConfig["FreqComponentMini"] = noiseDetectParam.nFreqComponentMini;
+        jsonConfig["FreqComponentMax"] = noiseDetectParam.nFreqComponentMax;
+        jsonConfig["OneDBThreshold"] = noiseDetectParam.fOneDBThreshold;
+        jsonConfig["OneDBComponentMini"] = noiseDetectParam.nOneDBComponentMini;
+        jsonConfig["NoiseThreshold"] = noiseDetectParam.fNoiseThreshold;
+        jsonConfig["NoiseComponentMini"] = noiseDetectParam.nNoiseComponentMini;
+        jsonConfig["NoiseDetectDuration"] = noiseDetectParam.nNoiseDetectDuration;
+        jsonConfig["NoiseDetectPercent"] = noiseDetectParam.nNoiseDetectPercent;
+        jsonConfig["NoiseDBMax"] = noiseDetectParam.nNoiseDBMax;
+
+        strJson = jsonConfig.dump();
+    }nJsonCatch
+
+    return true;
+}
+
+
+/* 设置数据库设置 */
+void SystemConfigInfo::setDatabaseConfig(const DatabaseConfig_t& config)
+{
+    m_databaseConfig = config;
+}
+
+/* 将数据库的json转换成数据库设置 */
+bool SystemConfigInfo::getDatabaseConfigFromJson(const std::string& jsonStr)
+{
+    try {
+        nJson jsonConfig = nJson::parse(jsonStr);
+        m_databaseConfig.nRecordLogRetain = jsonConfig["RecordLogRetain"].is_null() ? 0 : jsonConfig["RecordLogRetain"].get<int>();
+        m_databaseConfig.nOperatorLogRetain = jsonConfig["OperatorLogRetain"].is_null() ? 0 : jsonConfig["OperatorLogRetain"].get<int>();
+        m_databaseConfig.nRecordFileRetain = jsonConfig["RecordFileRetain"].is_null() ? 0 : jsonConfig["RecordFileRetain"].get<int>();
+        m_databaseConfig.nClientPort = jsonConfig["ClientPort"].is_null() ? 0 : jsonConfig["ClientPort"].get<int>();
+        m_databaseConfig.nListenPort = jsonConfig["ListenPort"].is_null() ? 0 : jsonConfig["ListenPort"].get<int>();
+        m_databaseConfig.strRecordFilePath = jsonConfig["RecordFilePath"].is_null() ? "" : QString::fromStdString(jsonConfig["RecordFilePath"].get<std::string>());
+        
+    }nJsonCatch
+
+    return true;
+}
+/* 将数据库设置转换成json */
+bool SystemConfigInfo::setDatabaseConfigToJson(const DatabaseConfig_t& databaseConfig, std::string& strJson) const
+{
+    try {
+        nJson jsonConfig;
+        jsonConfig["RecordLogRetain"] = databaseConfig.nRecordLogRetain;
+        jsonConfig["OperatorLogRetain"] = databaseConfig.nOperatorLogRetain;
+        jsonConfig["RecordFileRetain"] = databaseConfig.nRecordFileRetain;
+        jsonConfig["ClientPort"] = databaseConfig.nClientPort;
+        jsonConfig["ListenPort"] = databaseConfig.nListenPort;
+        jsonConfig["RecordFilePath"] = databaseConfig.strRecordFilePath.toStdString();
+
+        strJson = jsonConfig.dump();
+    }nJsonCatch
+
+    return true;
+}
+
+

+ 54 - 4
SettingLibrary/DataManager/SystemConfig.h

@@ -12,7 +12,8 @@ enum class eSystemConfigType
 {
     eSCT_BaseConfig = 0,        // 基础配置
     eSCT_CompareAI,             // AI对比
-    eSCT_NoiseDetect,           // 噪音检测
+    eSCT_NoiseBase,             // 噪音检测基础
+    eSCT_NoiseParam,            // 噪音检测参数
     eSCT_Database,              // 数据库设置
     eSCT_DetectPeriod           // 检测时段
 };
@@ -20,7 +21,8 @@ enum class eSystemConfigType
 
 #define Config_Base "ACAS_Base"                 // 基础配置
 #define Config_CompareAI "ACAS_CompareAI"       // AI对比配置
-#define Config_NoiseDetect "ACAS_NoiseDetect"   // 噪音检测配置
+#define Config_NoiseBase "ACAS_NoiseBase"       // 噪音检测基础配置
+#define Config_NoiseParam "ACAS_NoiseParam"     // 噪音检测参数
 #define Config_Database "ACAS_Database"         // 数据库设置
 #define Config_DetectPeriod "ACAS_DetectPeriod" // 检测时段配置
 
@@ -48,12 +50,13 @@ public:
     const QMap<eSystemConfigType, std::string> mapSysConfigDesc = {
         {eSystemConfigType::eSCT_BaseConfig, "基础配置"},
         {eSystemConfigType::eSCT_CompareAI, "AI对比设置"},
-        {eSystemConfigType::eSCT_NoiseDetect, "噪音检测参数"},
+        {eSystemConfigType::eSCT_NoiseBase, "噪音检测基础设置"},
+        {eSystemConfigType::eSCT_NoiseParam, "噪音检测参数"},
         {eSystemConfigType::eSCT_Database, "数据库设置信息"},
         {eSystemConfigType::eSCT_DetectPeriod, "检测时段信息"}
     };
 
-
+    /*-------------------------------------------------------------------------------------*/
     /* 获取未被修改的基础配置 */
     const BaseConfig_t& getBaseConfigSrc() const { return m_baseConfigSrc; }
     /* 设置基础配置 */
@@ -63,6 +66,45 @@ public:
     /* 将结构体转换成json */
     bool setBaseConfigToJson(const BaseConfig_t& baseConfig, std::string& strJson) const;
     
+    /*-------------------------------------------------------------------------------------*/
+    /* 获取AI对比配置 */
+    const AICompareConfig_t& getAICompareConfig() const { return m_aiCompareConfig; }
+    /* 设置AI对比配置 */
+    void setAICompareConfig(const AICompareConfig_t& config);
+    /* 将数据库的json转换成AI对比配置 */
+    bool getAICompareConfigFromJson(const std::string& jsonStr);
+    /* 将AI对比配置转换成json */
+    bool setAICompareConfigToJson(const AICompareConfig_t& aiCompareConfig, std::string& strJson) const;
+
+    /*-------------------------------------------------------------------------------------*/
+    /* 获取噪音检测基础配置 */
+    const NoiseDetectBaseConfig_t& getNoiseDetectBaseConfig() const { return m_noiseDetectBaseConfig; }
+    /* 设置噪音检测基础配置 */
+    void setNoiseDetectBaseConfig(const NoiseDetectBaseConfig_t& config);
+    /* 将数据库的json转换成噪音检测基础配置 */
+    bool getNoiseDetectBaseConfigFromJson(const std::string& jsonStr);
+    /* 将噪音检测基础配置转换成json */
+    bool setNoiseDetectBaseConfigToJson(const NoiseDetectBaseConfig_t& noiseDetectBaseConfig, std::string& strJson) const;
+
+    /*-------------------------------------------------------------------------------------*/
+    /* 获取噪音检测参数 */
+    const NoiseDetectParam_t& getNoiseDetectParam() const { return m_noiseDetectParam; }
+    /* 设置噪音检测参数 */
+    void setNoiseDetectParam(const NoiseDetectParam_t& config);
+    /* 将数据库的json转换成噪音检测参数 */
+    bool getNoiseDetectParamFromJson(const std::string& jsonStr);
+    /* 将噪音检测参数转换成json */
+    bool setNoiseDetectParamToJson(const NoiseDetectParam_t& noiseDetectParam, std::string& strJson) const;
+
+    /*-------------------------------------------------------------------------------------*/
+    /* 获取数据库设置 */
+    const DatabaseConfig_t& getDatabaseConfig() const { return m_databaseConfig; }
+    /* 设置数据库设置 */
+    void setDatabaseConfig(const DatabaseConfig_t& config);
+    /* 将数据库的json转换成数据库设置 */
+    bool getDatabaseConfigFromJson(const std::string& jsonStr);
+    /* 将数据库设置转换成json */
+    bool setDatabaseConfigToJson(const DatabaseConfig_t& databaseConfig, std::string& strJson) const;
 
 public:
     
@@ -70,6 +112,14 @@ public:
 private:
     /* 基础配置未被修改版本 */
     BaseConfig_t m_baseConfigSrc;
+    /* ai对比需要的参数 */
+    AICompareConfig_t m_aiCompareConfig;
+    /* 噪音检测基础配置 */
+    NoiseDetectBaseConfig_t m_noiseDetectBaseConfig;
+    /* 噪音检测参数 */
+    NoiseDetectParam_t m_noiseDetectParam;
+    /* 数据库设置 */
+    DatabaseConfig_t m_databaseConfig;
 
 };
 

+ 91 - 1
SettingLibrary/DataManager/SystemConfigStruct.cpp

@@ -25,6 +25,96 @@ bool BaseConfig_t::operator==(const BaseConfig_t &other) const
         return true;
     }
 
-    return true;
+    return false;
+}
+
+
+bool AICompareConfig_t::operator==(const AICompareConfig_t &other) const
+{
+    if(&other == this)
+    {
+        return true; // 自身比较
+    }
+
+    if(nAiComputeDuration == other.nAiComputeDuration &&
+       strAiCompareDir == other.strAiCompareDir)
+    {
+        return true;
+    }
+
+    return false;
+}
+
+
+bool NoiseDetectBaseConfig_t::operator==(const NoiseDetectBaseConfig_t &other) const
+{
+    if(&other == this)
+    {
+        return true;
+    }
+
+    if( strNoiseServerAddr == other.strNoiseServerAddr &&
+        strNoiseDetectDir == other.strNoiseDetectDir &&
+        strServerPath == other.strServerPath &&
+        nNoiseDetectDuration == other.nNoiseDetectDuration &&
+        isEnableNoiseDetect == other.isEnableNoiseDetect &&
+        isEnableMainRoadDetect == other.isEnableMainRoadDetect
+    )
+    {
+        return true;
+    }
+
+    return false;
+}
+
+
+bool NoiseDetectParam_t::operator==(const NoiseDetectParam_t &other) const
+{
+    if(&other == this)
+    {
+        return true; // 自身比较
+    }
+
+    if( strRegitrationCode == other.strRegitrationCode &&
+        nNoiseDetectContinueCount == other.nNoiseDetectContinueCount &&
+        nNoiseContinueCountIsWarn == other.nNoiseContinueCountIsWarn &&
+        nNoiseContinueCountPercent == other.nNoiseContinueCountPercent &&
+        nFreqComponentMini == other.nFreqComponentMini && 
+        nFreqComponentMax == other.nFreqComponentMax &&
+        fOneDBThreshold == other.fOneDBThreshold &&
+        nOneDBComponentMini == other.nOneDBComponentMini &&
+        fNoiseThreshold == other.fNoiseThreshold &&
+        nNoiseComponentMini == other.nNoiseComponentMini &&
+        nNoiseDetectDuration == other.nNoiseDetectDuration &&
+        nNoiseDetectPercent == other.nNoiseDetectPercent &&
+        nNoiseDBMax == other.nNoiseDBMax
+    )
+    {
+        return true;
+    }
+
+    return false;
+}
+
+
+bool DatabaseConfig_t::operator==(const DatabaseConfig_t &other) const
+{
+    if(&other == this)
+    {
+        return true; // 自身比较
+    }
+
+    if( nRecordLogRetain == other.nRecordLogRetain &&
+        nOperatorLogRetain == other.nOperatorLogRetain &&
+        nRecordFileRetain == other.nRecordFileRetain &&
+        nClientPort == other.nClientPort &&
+        nListenPort == other.nListenPort &&
+        strRecordFilePath == other.strRecordFilePath
+    )
+    {
+        return true;
+    }
+
+    return false;
 }
 

+ 63 - 0
SettingLibrary/DataManager/SystemConfigStruct.h

@@ -47,6 +47,69 @@ struct BaseConfig_t
  * AI对比
  * ============================================================================= */
 
+struct AICompareConfig_t
+{
+    int nAiComputeDuration = 0;     /* AI计算所需文件的时长,单位为秒 */
+    QString strAiCompareDir;        /* AI对比文件夹 */
+
+    bool operator==(const AICompareConfig_t &other) const;
+};
+
+
+/* =============================================================================
+ * 噪音检测
+ * ============================================================================= */
+struct NoiseDetectBaseConfig_t
+{
+    QString strNoiseServerAddr;         /* 噪音检测服务器地址 */
+    QString strNoiseDetectDir;          /* 噪音检测文件夹 */
+    QString strServerPath;              /* 噪音检测服务器路径 */
+    int nNoiseDetectDuration = 0;       /* 噪音检测间隔,单位为秒 */
+    
+    bool isEnableNoiseDetect = false;   /* 是否启用噪音检测 */
+    bool isEnableMainRoadDetect = false;/* 是否启用主通道噪音检测 */
+
+    bool operator==(const NoiseDetectBaseConfig_t &other) const;
+};
+
+/**
+ * @brief 噪音检测参数
+ * 
+ */
+struct NoiseDetectParam_t
+{
+    QString strRegitrationCode;                 /* 注册码 */
+    int nNoiseDetectContinueCount = 0;          /* 噪音检测持续次数 */
+    int nNoiseContinueCountIsWarn = 0;          /* 噪音持续几次为报警 */
+    int nNoiseContinueCountPercent = 0;         /* 检测持续次数中,噪音次数占的百分比 */
+    int nFreqComponentMini = 0;                 /* 噪音检测频率分量最小值 */
+    int nFreqComponentMax = 0;                  /* 噪音检测频率分量最大值 */
+    float fOneDBThreshold = 0;                  /* 单音量阈值 */
+    int nOneDBComponentMini = 0;                /* 单音量分量最小值 */
+    float fNoiseThreshold = 0;                  /* 噪音阈值 */
+    int nNoiseComponentMini = 0;                /* 噪音分量最小值 */
+    int nNoiseDetectDuration = 0;               /* 噪音判断时长 */
+    int nNoiseDetectPercent = 0;                /* 噪音检测百分比 */
+    int nNoiseDBMax = 0;                        /* 噪音最大DB值 */
+
+    bool operator==(const NoiseDetectParam_t &other) const;
+};
+
+/* =============================================================================
+ * 数据库配置
+ * ============================================================================= */
+
+struct DatabaseConfig_t
+{
+    int nRecordLogRetain = 0;       /* 录音日志保留天数 */
+    int nOperatorLogRetain = 0;     /* 操作日志保留天数 */
+    int nRecordFileRetain = 0;      /* 录音文件保留小时数 */
+    int nClientPort = 0;            /* 客户端端口 */
+    int nListenPort = 0;            /* 监听端口 */
+    QString strRecordFilePath;      /* 录音文件路径 */
+
+    bool operator==(const DatabaseConfig_t &other) const;
+};
 
 
 

+ 62 - 0
SettingLibrary/Modules/AICompare/aicomparewidget.cpp

@@ -1,14 +1,76 @@
 #include "aicomparewidget.h"
 #include "ui_aicomparewidget.h"
 
+#include <QIntValidator>
+#include "UIStyleManager.h"
+#include "SystemConfig.h"
+#include "FromWebAPI.h"
+
 AICompareWidget::AICompareWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::AICompareWidget)
 {
     ui->setupUi(this);
+
+    m_logger = spdlog::get("ACASetting");
+    if(m_logger == nullptr)
+    {
+        fmt::print("AICompareWidget: Logger ACAServer not found\n");
+        return;
+    }
+
+    /* 设置 lineEdit_length 只能输入数字 */
+    ui->lineEdit_length->setValidator(new QIntValidator(1, 120, this));
+
+    /* 设置初始化的参数 */
+    const AICompareConfig_t &aiConfig = SysConfig.getAICompareConfig();
+    ui->lineEdit_length->setText(QString::number(aiConfig.nAiComputeDuration));
+    ui->lineEdit_dir->setText(aiConfig.strAiCompareDir);
+
+    /* 设置样式 */
+    UIStyle.registerWidget(this);
 }
 
 AICompareWidget::~AICompareWidget()
 {
+    UIStyle.unregisterWidget(this);
     delete ui;
 }
+
+/* 保存配置项 */
+bool AICompareWidget::saveConfig()
+{
+    AICompareConfig_t aiConfig;
+    aiConfig.nAiComputeDuration = ui->lineEdit_length->text().toInt();
+    aiConfig.strAiCompareDir = ui->lineEdit_dir->text();
+
+    /* 和历史数据进行对比 */
+    const AICompareConfig_t &oldConfig = SysConfig.getAICompareConfig();
+    if(aiConfig == oldConfig)
+    {
+        SPDLOG_LOGGER_DEBUG(m_logger, "AI对比配置没有变化,不需要更新");
+        return false;
+    }
+
+    /* 将AI对比配置转换成json */
+    std::string strJson;
+    if(!SysConfig.setAICompareConfigToJson(aiConfig, strJson))
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "设置AI对比配置转换成JSON失败");
+        return false;
+    }
+
+    /* 更新数据库信息 */
+    if(!m_fromWebAPI->updateSystemConfig(Config_CompareAI, strJson, SysConfig.mapSysConfigDesc[eSystemConfigType::eSCT_CompareAI]))
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "更新AI对比配置失败");
+        return false;
+    }
+
+    /* 更新系统设置 */
+    SysConfig.setAICompareConfig(aiConfig);
+
+    SPDLOG_LOGGER_DEBUG(m_logger, "AI对比配置更新成功");
+    return true;
+}
+

+ 17 - 0
SettingLibrary/Modules/AICompare/aicomparewidget.h

@@ -2,6 +2,9 @@
 #define AICOMPAREWIDGET_H
 
 #include <QWidget>
+#include "spdlog/spdlog.h"
+
+class FromWebAPI;
 
 namespace Ui {
 class AICompareWidget;
@@ -15,8 +18,22 @@ public:
     explicit AICompareWidget(QWidget *parent = nullptr);
     ~AICompareWidget();
 
+    /* 设置Webapi指针 */
+    void setWebAPI(FromWebAPI* webApi) { m_fromWebAPI = webApi; }
+    /* 保存配置项 */
+    bool saveConfig();
+
+private slots:
+    
+    
+
 private:
     Ui::AICompareWidget *ui;
+
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+
+    FromWebAPI* m_fromWebAPI = nullptr;
+
 };
 
 #endif // AICOMPAREWIDGET_H

+ 17 - 57
SettingLibrary/Modules/AICompare/aicomparewidget.ui

@@ -14,47 +14,7 @@
    <string>Form</string>
   </property>
   <property name="styleSheet">
-   <string notr="true">QWidget#widget
-{
-	border-bottom: 1px solid #E9E9E9;
-}
-
-QLabel
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-
-QLineEdit
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	padding-left: 12px;
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QLineEdit:hover,QLineEdit:focus
-{
-	border: 1px solid #4458FE;
-}
-
-QPushButton
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	font-weight: 500;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QPushButton:hover
-{
-	border: 1px solid #4458FE;
-	color: #4458FE;
-}</string>
+   <string notr="true"/>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <property name="spacing">
@@ -104,7 +64,7 @@ QPushButton:hover
        </widget>
       </item>
       <item row="0" column="1">
-       <widget class="QLineEdit" name="lineEdit_2">
+       <widget class="QLineEdit" name="lineEdit_length">
         <property name="minimumSize">
          <size>
           <width>168</width>
@@ -120,7 +80,7 @@ QPushButton:hover
        </widget>
       </item>
       <item row="1" column="1">
-       <widget class="QLineEdit" name="lineEdit">
+       <widget class="QLineEdit" name="lineEdit_dir">
         <property name="minimumSize">
          <size>
           <width>168</width>
@@ -149,7 +109,20 @@ QPushButton:hover
     </widget>
    </item>
    <item>
-    <widget class="QPushButton" name="btnRestore">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QPushButton" name="pBtn_restore">
      <property name="minimumSize">
       <size>
        <width>102</width>
@@ -167,19 +140,6 @@ QPushButton:hover
      </property>
     </widget>
    </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <resources/>

+ 21 - 11
SettingLibrary/Modules/Basic/basicwidget.cpp

@@ -9,6 +9,7 @@
 #include "tipwidget.h"
 #include "SystemConfigStruct.h"
 #include "SystemConfig.h"
+#include "GlobalInfo.h"
 #include <string>
 
 
@@ -68,28 +69,25 @@ BasicWidget::~BasicWidget()
 }
 
 /* 保存数据 */
-void BasicWidget::saveBasicInfo()
+bool BasicWidget::saveBasicInfo()
 {
     bool isSuccess = true;
     /* 保存基础信息 */
     if(!saveBasicSettingInfo())
     {
-        TipWidget::display(TipWidget::OPERATOR_WARN, "保存基础信息失败", this);
+        TipWidget::display(TipWidget::OPERATOR_WARN, "保存基础信息失败", GInfo.getTopWindow());
         isSuccess = false;
     }
     /* 保存对比项信息 */
     if(!saveCompareItemInfo())
     {
-        TipWidget::display(TipWidget::OPERATOR_WARN, "保存对比项信息失败", this);
+        TipWidget::display(TipWidget::OPERATOR_WARN, "保存对比项信息失败", GInfo.getTopWindow());
         isSuccess = false;
     }
 
-    if(isSuccess)
-    {
-        TipWidget::display(TipWidget::OPERATOR_OK, "保存设置成功", this);
-    }
-
     m_isModify = false;  // 保存成功后,重置修改标志
+
+    return isSuccess;
 }
 
 void BasicWidget::do_pBtn_CompareItemClicked()
@@ -104,6 +102,7 @@ void BasicWidget::do_pBtn_CompareItemClicked()
 bool BasicWidget::saveBasicSettingInfo()
 {
     BaseConfig_t baseConfig;
+    const BaseConfig_t& srcBaseConfig = SysConfig.getBaseConfigSrc();
     /* 获取基础配置信息 */
     baseConfig.strServerIP = ui->lineEdit_serverIP->text();
     baseConfig.nRecordMode = ui->comBox_recordMode->currentData().toInt();
@@ -112,10 +111,21 @@ bool BasicWidget::saveBasicSettingInfo()
 
     baseConfig.isEnableMultiCore = ui->checkBox_enableMultiCPU->isChecked();
     baseConfig.isEnableDebugLog = ui->checkBox_enableDebug->isChecked();
-    baseConfig.isClearDirSystemOn = ui->checkBox_clearHistoryDir;
-    baseConfig.isUsingSoundCardName = ui->checkBox_enableSoundCardName;
+    baseConfig.isClearDirSystemOn = ui->checkBox_clearHistoryDir->isChecked();
+    baseConfig.isUsingSoundCardName = ui->checkBox_enableSoundCardName->isChecked();
+
+    // SPDLOG_LOGGER_DEBUG(m_logger, "修改后的基础配置信息: ServerIP: {}, RecordMode: {}, DriverName: {}, NotConsistency: {}, EnableMultiCore: {}, EnableDebugLog: {}, ClearHistoryDirOnStart: {}, UseSoundCardName: {}",
+    //     baseConfig.strServerIP.toStdString(), baseConfig.nRecordMode, baseConfig.strDriverName.toStdString(),
+    //     baseConfig.nNotConsistency, baseConfig.isEnableMultiCore, baseConfig.isEnableDebugLog,
+    //     baseConfig.isClearDirSystemOn, baseConfig.isUsingSoundCardName);
+
+    
+    // SPDLOG_LOGGER_DEBUG(m_logger, "现有的基础配置信息: ServerIP: {}, RecordMode: {}, DriverName: {}, NotConsistency: {}, EnableMultiCore: {}, EnableDebugLog: {}, ClearHistoryDirOnStart: {}, UseSoundCardName: {}",
+    //     srcBaseConfig.strServerIP.toStdString(), srcBaseConfig.nRecordMode, srcBaseConfig.strDriverName.toStdString(),
+    //     srcBaseConfig.nNotConsistency, srcBaseConfig.isEnableMultiCore, srcBaseConfig.isEnableDebugLog,
+    //     srcBaseConfig.isClearDirSystemOn, srcBaseConfig.isUsingSoundCardName);
 
-    if(baseConfig == SysConfig.getBaseConfigSrc())
+    if(baseConfig == srcBaseConfig)
     {
         SPDLOG_LOGGER_DEBUG(m_logger, "基础配置信息没有修改,不需要保存");
         return true;

+ 1 - 1
SettingLibrary/Modules/Basic/basicwidget.h

@@ -23,7 +23,7 @@ public:
     ~BasicWidget();
 
     /* 保存数据 */
-    void saveBasicInfo();
+    bool saveBasicInfo();
     /* 设置WebAPI指针 */
     void setWebAPI(FromWebAPI* api) { m_fromWebAPI = api; }
 

+ 13 - 13
SettingLibrary/Modules/Basic/basicwidget.ui

@@ -264,6 +264,19 @@
      </layout>
     </widget>
    </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
@@ -326,19 +339,6 @@
      </property>
     </widget>
    </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <customwidgets>

+ 4 - 4
SettingLibrary/Modules/Basic/compareitemlistdialog.cpp

@@ -140,7 +140,7 @@ void CompareItemListDialog::do_pBtn_delete_Clicked()
     QModelIndexList selectedRows = ui->tableView->selectionModel()->selectedRows();
     if(selectedRows.isEmpty())
     {
-        TipWidget::display(TipWidget::OPERATOR_WARN, "请先选择要删除的对比项", this);
+        TipWidget::display(TipWidget::OPERATOR_WARN, "请先选择要删除的对比项", GInfo.getTopWindow());
         return;
     }
     /* 确认删除 */
@@ -171,7 +171,7 @@ void CompareItemListDialog::do_pBtn_edit_Clicked()
     QModelIndexList selectedRows = ui->tableView->selectionModel()->selectedRows();
     if(selectedRows.isEmpty())
     {
-        TipWidget::display(TipWidget::OPERATOR_WARN, "请先选择要编辑的对比项", this);
+        TipWidget::display(TipWidget::OPERATOR_WARN, "请先选择要编辑的对比项", GInfo.getTopWindow());
         return;
     }
     /* 只取出第一个 */
@@ -182,7 +182,7 @@ void CompareItemListDialog::do_pBtn_edit_Clicked()
     CompareItemInfo_t ciInfo = CIData.findCompareItemByID(nID);
     if(ciInfo.nID < 0)
     {
-        TipWidget::display(TipWidget::OPERATOR_WARN, "对比项不存在,无法编辑", this);
+        TipWidget::display(TipWidget::OPERATOR_WARN, "对比项不存在,无法编辑", GInfo.getTopWindow());
         SPDLOG_LOGGER_WARN(m_logger, "对比项ID {} 不存在,无法编辑", nID);
         return;
     }
@@ -201,7 +201,7 @@ void CompareItemListDialog::do_pBtn_edit_Clicked()
     /* 修改全局对比项数据 */
     if(!CIData.modifyCompareItem(newCiInfo))
     {
-        TipWidget::display(TipWidget::OPERATOR_WARN, "对比项修改失败,请稍后重试", this);
+        TipWidget::display(TipWidget::OPERATOR_WARN, "对比项修改失败,请稍后重试", GInfo.getTopWindow());
         SPDLOG_LOGGER_ERROR(m_logger, "对比项ID {} 修改失败", nID);
         return;
     }

+ 22 - 4
SettingLibrary/Modules/CheckPeriod/checkperiodwidget.cpp

@@ -2,28 +2,46 @@
 #include "ui_checkperiodwidget.h"
 #include "addperioddialog.h"
 
+#include "UIStyleManager.h"
+#include "customcombobox.h"
+
 CheckPeriodWidget::CheckPeriodWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::CheckPeriodWidget)
 {
     ui->setupUi(this);
 
-    connect(ui->btnCheckAdd, &QPushButton::clicked, this, &CheckPeriodWidget::OnBtnCheckAddClicked);
-    connect(ui->btnNoCheckAdd, &QPushButton::clicked, this, &CheckPeriodWidget::OnBtnNoCheckAddClicked);
+    m_logger = spdlog::get("ACASetting");
+    if(m_logger == nullptr)
+    {
+        fmt::print("CheckPeriodWidget: Logger ACASetting not found\n");
+        return;
+    }
+
+
+    /* 下拉框设置阴影 */
+    ui->comboBox_selectCompareItem->setViewShadowEffect();
+
+    connect(ui->pBtn_addDetectPlan, &QPushButton::clicked, this, &CheckPeriodWidget::do_pBtn_addDetectPlan_clicked);
+    connect(ui->pBtn_addNoDetectPlan, &QPushButton::clicked, this, &CheckPeriodWidget::do_pBtn_addNoDetectPlan_clicked);
+
+    /* 设置UI */
+    UIStyle.registerWidget(this);
 }
 
 CheckPeriodWidget::~CheckPeriodWidget()
 {
+    UIStyle.unregisterWidget(this);
     delete ui;
 }
 
-void CheckPeriodWidget::OnBtnCheckAddClicked()
+void CheckPeriodWidget::do_pBtn_addDetectPlan_clicked()
 {
     AddPeriodDialog dlg(PERIOD_WEEK);
     dlg.exec();
 }
 
-void CheckPeriodWidget::OnBtnNoCheckAddClicked()
+void CheckPeriodWidget::do_pBtn_addNoDetectPlan_clicked()
 {
     AddPeriodDialog dlg(PERIOD_DATE);
     dlg.exec();

+ 7 - 2
SettingLibrary/Modules/CheckPeriod/checkperiodwidget.h

@@ -2,6 +2,8 @@
 #define CHECKPERIODWIDGET_H
 
 #include <QWidget>
+#include "spdlog/spdlog.h"
+
 
 namespace Ui {
 class CheckPeriodWidget;
@@ -16,11 +18,14 @@ public:
     ~CheckPeriodWidget();
 
 private slots:
-    void OnBtnCheckAddClicked();
-    void OnBtnNoCheckAddClicked();
+    void do_pBtn_addDetectPlan_clicked();
+    void do_pBtn_addNoDetectPlan_clicked();
 
 private:
     Ui::CheckPeriodWidget *ui;
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+
+
 };
 
 #endif // CHECKPERIODWIDGET_H

+ 35 - 167
SettingLibrary/Modules/CheckPeriod/checkperiodwidget.ui

@@ -6,141 +6,15 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>352</width>
-    <height>721</height>
+    <width>360</width>
+    <height>761</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
   <property name="styleSheet">
-   <string notr="true">QWidget#widget_2,#widget_3
-{
-	border-bottom: 1px solid #E9E9E9;
-}
-
-QLabel
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QLabel#label,#label_6
-{
-	image: url(:/tip.png);
-}
-QLabel#label_2,#label_7
-{
-	color: rgba(58,63,99,0.8);
-}
-QLabel#label_4,#label_5
-{
-	font-weight: 500;
-	font-size: 16px;
-}
-
-QComboBox
-{
-	padding-left: 12px;
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-}
-QComboBox:hover,QComboBox:on
-{
-	border: 1px solid #4458FE;
-}
-QComboBox QAbstractItemView
-{
-	margin-left: 4px;
-	margin-right: 20px;
-	margin-bottom: 4px;
-	font-size: 14px;
-	background-color: #FFFFFF;
-	outline:0px;
-	border-radius: 4px;
-}
-QComboBox QAbstractItemView::item {
-    border-radius: 4px;
-	color: #3A3F63;
-    height: 40px;
-	background-color: #FFFFFF;
-	font-size: 14px;
-	padding-left: 12px;
-}
-QComboBox QAbstractItemView::item:hover 
-{
-	font-weight: 500;
-    color: #3A3F63;
-	background-color: #EEF2FF;
-}
-QComboBox QAbstractItemView::item:selected
-{
-	font-weight: 500;
-    color: #3A3F63;
-	background-color: #EEF2FF;
-}
-QComboBox::down-arrow
-{
-	width: 16px;
-	image: url(:/down_arrow.png);
-	padding-right: 8px;
-}
-QComboBox::drop-down
-{	
-	width: 16px;
-	background-color: transparent;
-}
-
-QPushButton#btnCheckAdd,#btnNoCheckAdd
-{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #4F8AFF, stop:1 #4B5EFF);
-	border-radius: 4px;
-	font-weight: 500;
-	font-size: 14px;
-	color: #FFFFFF;
-}
-QPushButton#btnCheckAdd:hover,#btnNoCheckAdd:hover
-{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #4F8AFF, stop:1 #7182ff);
-}
-QPushButton#btnRestore
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	font-weight: 500;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QPushButton#btnRestore:hover
-{
-	border: 1px solid #4458FE;
-	color: #4458FE;
-}
-
-QCheckBox
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QCheckBox::indicator
-{
-	width: 16px; 
-	height: 16px;
-}
-QCheckBox::indicator:unchecked
-{
-	image: url(:/unchecked.png);
-}
-QCheckBox::indicator:checked
-{
-	image: url(:/checked.png);
-}</string>
+   <string notr="true"/>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_4">
    <property name="spacing">
@@ -159,7 +33,7 @@ QCheckBox::indicator:checked
     <number>0</number>
    </property>
    <item>
-    <widget class="QWidget" name="widget" native="true">
+    <widget class="QWidget" name="widget_top" native="true">
      <layout class="QVBoxLayout" name="verticalLayout_3">
       <property name="spacing">
        <number>16</number>
@@ -182,7 +56,7 @@ QCheckBox::indicator:checked
          <number>4</number>
         </property>
         <item>
-         <widget class="QLabel" name="label">
+         <widget class="QLabel" name="label_tipIcon1">
           <property name="minimumSize">
            <size>
             <width>16</width>
@@ -201,7 +75,7 @@ QCheckBox::indicator:checked
          </widget>
         </item>
         <item>
-         <widget class="QLabel" name="label_2">
+         <widget class="QLabel" name="label_tip1">
           <property name="text">
            <string>起始时间和结束时间相同时,将全天候检测</string>
           </property>
@@ -222,19 +96,13 @@ QCheckBox::indicator:checked
          </widget>
         </item>
         <item>
-         <widget class="QComboBox" name="comboBox">
+         <widget class="CustomComboBox" name="comboBox_selectCompareItem">
           <property name="minimumSize">
            <size>
             <width>268</width>
             <height>32</height>
            </size>
           </property>
-          <property name="maximumSize">
-           <size>
-            <width>268</width>
-            <height>32</height>
-           </size>
-          </property>
          </widget>
         </item>
        </layout>
@@ -243,7 +111,13 @@ QCheckBox::indicator:checked
     </widget>
    </item>
    <item>
-    <widget class="QWidget" name="widget_2" native="true">
+    <widget class="QWidget" name="widget_detectPlan" native="true">
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>296</height>
+      </size>
+     </property>
      <layout class="QVBoxLayout" name="verticalLayout_2">
       <property name="spacing">
        <number>16</number>
@@ -266,14 +140,14 @@ QCheckBox::indicator:checked
          <number>0</number>
         </property>
         <item>
-         <widget class="QLabel" name="label_4">
+         <widget class="QLabel" name="label_detectPlan">
           <property name="text">
            <string>不一致检测计划</string>
           </property>
          </widget>
         </item>
         <item>
-         <widget class="QPushButton" name="btnCheckAdd">
+         <widget class="QPushButton" name="pBtn_addDetectPlan">
           <property name="minimumSize">
            <size>
             <width>60</width>
@@ -294,13 +168,13 @@ QCheckBox::indicator:checked
        </layout>
       </item>
       <item>
-       <widget class="QWidget" name="widgetCheckList" native="true"/>
+       <widget class="QListWidget" name="listWidget_detectPlan"/>
       </item>
      </layout>
     </widget>
    </item>
    <item>
-    <widget class="QWidget" name="widget_3" native="true">
+    <widget class="QWidget" name="widget_noDetectPlan" native="true">
      <layout class="QVBoxLayout" name="verticalLayout">
       <property name="spacing">
        <number>16</number>
@@ -323,14 +197,14 @@ QCheckBox::indicator:checked
          <number>0</number>
         </property>
         <item>
-         <widget class="QLabel" name="label_5">
+         <widget class="QLabel" name="label_noDetectPlan">
           <property name="text">
            <string>不检测日期列表</string>
           </property>
          </widget>
         </item>
         <item>
-         <widget class="QPushButton" name="btnNoCheckAdd">
+         <widget class="QPushButton" name="pBtn_addNoDetectPlan">
           <property name="minimumSize">
            <size>
             <width>60</width>
@@ -351,7 +225,7 @@ QCheckBox::indicator:checked
        </layout>
       </item>
       <item>
-       <widget class="QWidget" name="widgetNoCheckList" native="true"/>
+       <widget class="QListWidget" name="listWidget_noDetectPlan"/>
       </item>
       <item>
        <layout class="QGridLayout" name="gridLayout">
@@ -362,28 +236,28 @@ QCheckBox::indicator:checked
          <number>16</number>
         </property>
         <item row="0" column="1">
-         <widget class="QCheckBox" name="checkBox_3">
+         <widget class="QCheckBox" name="checkBox_applyOverload">
           <property name="text">
            <string>应用于过载检测</string>
           </property>
          </widget>
         </item>
         <item row="1" column="1">
-         <widget class="QCheckBox" name="checkBox_5">
+         <widget class="QCheckBox" name="checkBox_applyNoise">
           <property name="text">
            <string>应用于噪音检测</string>
           </property>
          </widget>
         </item>
         <item row="0" column="0">
-         <widget class="QCheckBox" name="checkBox_2">
+         <widget class="QCheckBox" name="checkBox_applySlient">
           <property name="text">
            <string>应用于静音检测</string>
           </property>
          </widget>
         </item>
         <item row="1" column="0">
-         <widget class="QCheckBox" name="checkBox_4">
+         <widget class="QCheckBox" name="checkBox_applyPhase">
           <property name="text">
            <string>应用于反相检测</string>
           </property>
@@ -397,7 +271,7 @@ QCheckBox::indicator:checked
          <number>4</number>
         </property>
         <item>
-         <widget class="QLabel" name="label_6">
+         <widget class="QLabel" name="label_tipIcon2">
           <property name="minimumSize">
            <size>
             <width>16</width>
@@ -416,7 +290,7 @@ QCheckBox::indicator:checked
          </widget>
         </item>
         <item>
-         <widget class="QLabel" name="label_7">
+         <widget class="QLabel" name="label_tip2">
           <property name="text">
            <string>不勾选将无时间限制,一直检测!</string>
           </property>
@@ -428,7 +302,7 @@ QCheckBox::indicator:checked
     </widget>
    </item>
    <item>
-    <widget class="QPushButton" name="btnRestore">
+    <widget class="QPushButton" name="pBtn_restore">
      <property name="minimumSize">
       <size>
        <width>102</width>
@@ -446,21 +320,15 @@ QCheckBox::indicator:checked
      </property>
     </widget>
    </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>CustomComboBox</class>
+   <extends>QComboBox</extends>
+   <header location="global">customcombobox.h</header>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>

+ 76 - 0
SettingLibrary/Modules/Database/databasewidget.cpp

@@ -1,14 +1,90 @@
 #include "databasewidget.h"
 #include "ui_databasewidget.h"
 
+
+#include "SystemConfig.h"
+#include "UIStyleManager.h"
+#include "FromWebAPI.h"
+
+#include <QIntValidator>
+
+
+
 DatabaseWidget::DatabaseWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::DatabaseWidget)
 {
     ui->setupUi(this);
+    m_logger = spdlog::get("ACASetting");
+    if(m_logger == nullptr)
+    {
+        fmt::print("DatabaseWidget: Logger ACASetting not found\n");
+        return;
+    }
+
+    /* 限制输入栏输入格式 */
+    ui->lineEdit_recordLogRetain->setValidator(new QIntValidator(1, 360, this));
+    ui->lineEdit_operatorLOgRetain->setValidator(new QIntValidator(1, 360, this));
+    ui->lineEdit_recordFileRetain->setValidator(new QIntValidator(1, 24, this));
+    ui->lineEdit_clientPort->setValidator(new QIntValidator(1, 65535, this));
+    ui->lineEdit_listenPort->setValidator(new QIntValidator(1, 65535, this));
+
+    /* 获取初始配置 */
+    m_databaseConfig = SysConfig.getDatabaseConfig();
+    ui->lineEdit_recordLogRetain->setText(QString::number(m_databaseConfig.nRecordLogRetain));
+    ui->lineEdit_operatorLOgRetain->setText(QString::number(m_databaseConfig.nOperatorLogRetain));
+    ui->lineEdit_recordFileRetain->setText(QString::number(m_databaseConfig.nRecordFileRetain));
+    ui->lineEdit_clientPort->setText(QString::number(m_databaseConfig.nClientPort));
+    ui->lineEdit_listenPort->setText(QString::number(m_databaseConfig.nListenPort));
+    ui->lineEdit_recordFilePath->setText(m_databaseConfig.strRecordFilePath);
+    
+
+    UIStyle.registerWidget(this);
 }
 
 DatabaseWidget::~DatabaseWidget()
 {
+    UIStyle.unregisterWidget(this);
     delete ui;
 }
+
+
+/* 保存参数 */
+bool DatabaseWidget::saveParams()
+{
+    m_databaseConfig.nRecordLogRetain = ui->lineEdit_recordLogRetain->text().toInt();
+    m_databaseConfig.nOperatorLogRetain = ui->lineEdit_operatorLOgRetain->text().toInt();
+    m_databaseConfig.nRecordFileRetain = ui->lineEdit_recordFileRetain->text().toInt();
+    m_databaseConfig.nClientPort = ui->lineEdit_clientPort->text().toInt();
+    m_databaseConfig.nListenPort = ui->lineEdit_listenPort->text().toInt();
+    m_databaseConfig.strRecordFilePath = ui->lineEdit_recordFilePath->text();
+    
+    /* 和旧数据对比 */
+    const DatabaseConfig_t& oldConfig = SysConfig.getDatabaseConfig();
+    if(m_databaseConfig == oldConfig)
+    {
+        SPDLOG_LOGGER_DEBUG(m_logger, "数据库配置信息没有修改");
+        return true;
+    }
+    /* 生成json文件 */
+    std::string jsonStr;
+    if(!SysConfig.setDatabaseConfigToJson(m_databaseConfig, jsonStr))
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "数据库配置转换成json失败");
+        return false;
+    }
+
+    /* 写入到数据库 */
+    if(!m_fromWebAPI->updateSystemConfig(Config_Database, jsonStr, SysConfig.mapSysConfigDesc[eSystemConfigType::eSCT_Database]))
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "更新数据库配置失败");
+        return false;
+    }
+
+    /* 设置数据库配置 */
+    SysConfig.setDatabaseConfig(m_databaseConfig);
+    SPDLOG_LOGGER_DEBUG(m_logger, "数据库配置信息保存成功");
+
+    return true;
+}
+

+ 13 - 0
SettingLibrary/Modules/Database/databasewidget.h

@@ -2,6 +2,10 @@
 #define DATABASEWIDGET_H
 
 #include <QWidget>
+#include "spdlog/spdlog.h"
+#include "SystemConfigStruct.h"
+
+class FromWebAPI;
 
 namespace Ui {
 class DatabaseWidget;
@@ -15,8 +19,17 @@ public:
     explicit DatabaseWidget(QWidget *parent = nullptr);
     ~DatabaseWidget();
 
+    /* 设置WebAPI指针 */
+    void setWebAPI(class FromWebAPI* webAPI) { m_fromWebAPI = webAPI; }
+    /* 保存参数 */
+    bool saveParams();
+
 private:
     Ui::DatabaseWidget *ui;
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+    FromWebAPI* m_fromWebAPI = nullptr;
+
+    DatabaseConfig_t m_databaseConfig; // 数据库配置
 };
 
 #endif // DATABASEWIDGET_H

+ 150 - 106
SettingLibrary/Modules/Database/databasewidget.ui

@@ -10,51 +10,17 @@
     <height>553</height>
    </rect>
   </property>
+  <property name="minimumSize">
+   <size>
+    <width>352</width>
+    <height>0</height>
+   </size>
+  </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
   <property name="styleSheet">
-   <string notr="true">QWidget#widget
-{
-	border-bottom: 1px solid #E9E9E9;
-}
-
-QLabel
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-
-QLineEdit
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	padding-left: 12px;
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QLineEdit:hover,QLineEdit:focus
-{
-	border: 1px solid #4458FE;
-}
-
-QPushButton
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	font-weight: 500;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QPushButton:hover
-{
-	border: 1px solid #4458FE;
-	color: #4458FE;
-}</string>
+   <string notr="true"/>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <property name="spacing">
@@ -91,26 +57,16 @@ QPushButton:hover
        <number>24</number>
       </property>
       <property name="horizontalSpacing">
-       <number>0</number>
+       <number>1</number>
       </property>
       <property name="verticalSpacing">
        <number>16</number>
       </property>
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_2">
-        <property name="text">
-         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;录音日志保留:</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QWidget" name="widget_2" native="true">
+      <item row="3" column="1">
+       <widget class="QLineEdit" name="lineEdit_clientPort">
         <property name="minimumSize">
          <size>
-          <width>232</width>
+          <width>172</width>
           <height>32</height>
          </size>
         </property>
@@ -132,11 +88,11 @@ QPushButton:hover
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
-       <widget class="QWidget" name="widget_3" native="true">
+      <item row="5" column="1">
+       <widget class="QLineEdit" name="lineEdit_recordFilePath">
         <property name="minimumSize">
          <size>
-          <width>232</width>
+          <width>172</width>
           <height>32</height>
          </size>
         </property>
@@ -148,21 +104,11 @@ QPushButton:hover
         </property>
        </widget>
       </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="label_4">
-        <property name="text">
-         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;录音文件保留:</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QWidget" name="widget_4" native="true">
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="lineEdit_operatorLOgRetain">
         <property name="minimumSize">
          <size>
-          <width>232</width>
+          <width>172</width>
           <height>32</height>
          </size>
         </property>
@@ -174,21 +120,11 @@ QPushButton:hover
         </property>
        </widget>
       </item>
-      <item row="3" column="0">
-       <widget class="QLabel" name="label_6">
-        <property name="text">
-         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;客户端通讯端口:</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="1">
-       <widget class="QLineEdit" name="lineEdit_2">
+      <item row="4" column="1">
+       <widget class="QLineEdit" name="lineEdit_listenPort">
         <property name="minimumSize">
          <size>
-          <width>232</width>
+          <width>172</width>
           <height>32</height>
          </size>
         </property>
@@ -210,11 +146,21 @@ QPushButton:hover
         </property>
        </widget>
       </item>
-      <item row="4" column="1">
-       <widget class="QLineEdit" name="lineEdit">
+      <item row="5" column="0">
+       <widget class="QLabel" name="label_7">
+        <property name="text">
+         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;录音文件目录:</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QLineEdit" name="lineEdit_recordFileRetain">
         <property name="minimumSize">
          <size>
-          <width>232</width>
+          <width>172</width>
           <height>32</height>
          </size>
         </property>
@@ -226,21 +172,80 @@ QPushButton:hover
         </property>
        </widget>
       </item>
-      <item row="5" column="0">
-       <widget class="QLabel" name="label_7">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_2">
         <property name="text">
-         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;录音文件目录:</string>
+         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;录音日志保留:</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
-      <item row="5" column="1">
-       <widget class="QLineEdit" name="lineEdit_3">
+      <item row="2" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="text">
+         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;录音文件保留:</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="label_6">
+        <property name="text">
+         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;客户端通讯端口:</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="2">
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="1" column="2">
+       <widget class="QLabel" name="label">
         <property name="minimumSize">
          <size>
-          <width>232</width>
+          <width>60</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>(1~360)</string>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="2">
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="0" column="1">
+       <widget class="QLineEdit" name="lineEdit_recordLogRetain">
+        <property name="minimumSize">
+         <size>
+          <width>172</width>
           <height>32</height>
          </size>
         </property>
@@ -252,9 +257,61 @@ QPushButton:hover
         </property>
        </widget>
       </item>
+      <item row="0" column="2">
+       <widget class="QLabel" name="label_10">
+        <property name="minimumSize">
+         <size>
+          <width>60</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>(1~360)</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="2">
+       <widget class="QLabel" name="label_11">
+        <property name="minimumSize">
+         <size>
+          <width>60</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>(1~24)</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="2">
+       <spacer name="horizontalSpacer_3">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
      </layout>
     </widget>
    </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item>
     <widget class="QPushButton" name="btnRestore">
      <property name="minimumSize">
@@ -274,19 +331,6 @@ QPushButton:hover
      </property>
     </widget>
    </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <resources/>

+ 101 - 8
SettingLibrary/Modules/Noise/noisemonitorparamdialog.cpp

@@ -1,20 +1,113 @@
 #include "noisemonitorparamdialog.h"
-#include "ui_noisemonitorparamdialog.h"
+#include "ui_noisemonitorparamwidget.h"
+
+#include <QFile>
+#include <QIntValidator>
+#include "UIStyleManager.h"
+
 
 NoiseMonitorParamDialog::NoiseMonitorParamDialog(QWidget *parent) :
-    QDialog(parent),
-    ui(new Ui::NoiseMonitorParamDialog)
+    DialogBase(parent),
+    ui(new Ui::NoiseMonitorParamWidget)
 {
-    ui->setupUi(this);
+    QWidget* content = new QWidget(this);
+    ui->setupUi(content);
+
+    m_logger = spdlog::get("ACASetting");
+    if(m_logger == nullptr)
+    {
+        fmt::print("NoiseMonitorParamDialog: Logger ACASetting not found\n");
+        return;
+    }
+    /* 设置弹窗内容 */
+    setContentWidget(content);
+    /* 设置弹窗标题 */
+    setTitle("噪音监测参数");
 
-    setWindowFlag(Qt::FramelessWindowHint);
-    setAttribute(Qt::WA_TranslucentBackground);
+    /* 设置lineEdit输入限制 */
+    ui->lineEdit_noiseDetectContinueCount->setValidator(new QIntValidator(1, 100, this));
+    ui->lineEdit_noiseContinueCountIsWarn->setValidator(new QIntValidator(1, 10, this));
+    ui->lineEdit_noiseContinueCountPercent->setValidator(new QIntValidator(1, 100, this));
+    ui->lineEdit_freqComponentMini->setValidator(new QIntValidator(this));
+    ui->lineEdit_freqComponentMax->setValidator(new QIntValidator(this));
+    ui->lineEdit_oneDBThreshold->setValidator(new QDoubleValidator(0.0, 1.0, 2, this));
+    ui->lineEdit_oneDBComponentMini->setValidator(new QIntValidator(-30, 30, this));
+    ui->lineEdit_noiseThreahold->setValidator(new QDoubleValidator(0.0, 1.0, 2, this));
+    ui->lineEdit_noiseComponentMini->setValidator(new QIntValidator(-30, 30, this));
+    ui->lineEdit_noiseDetectDuration->setValidator(new QIntValidator(this));
+    ui->lineEdit_noiseDetectPercent->setValidator(new QIntValidator(1, 100, this));
+    ui->lineEdit_noiseDBMax->setValidator(new QIntValidator(this));
 
-    connect(ui->btnCancel, &QPushButton::clicked, this, &NoiseMonitorParamDialog::reject);
-    connect(ui->btnClose, &QPushButton::clicked, this, &NoiseMonitorParamDialog::close);
+
+    /* 设置qss */
+    setQss();
 }
 
 NoiseMonitorParamDialog::~NoiseMonitorParamDialog()
 {
     delete ui;
 }
+
+/* 设置初始参数 */
+void NoiseMonitorParamDialog::setInitialParams(NoiseDetectParam_t& noiseDetectParam)
+{
+    m_noiseDetectParam = noiseDetectParam;
+    /* 设置初始参数到界面 */
+    ui->lineEdit_registCode->setText(noiseDetectParam.strRegitrationCode);
+    ui->lineEdit_noiseDetectContinueCount->setText(QString::number(noiseDetectParam.nNoiseDetectContinueCount));
+    ui->lineEdit_noiseContinueCountIsWarn->setText(QString::number(noiseDetectParam.nNoiseContinueCountIsWarn));
+    ui->lineEdit_noiseContinueCountPercent->setText(QString::number(noiseDetectParam.nNoiseContinueCountPercent));
+    ui->lineEdit_freqComponentMini->setText(QString::number(noiseDetectParam.nFreqComponentMini));
+    ui->lineEdit_freqComponentMax->setText(QString::number(noiseDetectParam.nFreqComponentMax));
+    ui->lineEdit_oneDBThreshold->setText(QString::number(noiseDetectParam.fOneDBThreshold));
+    ui->lineEdit_oneDBComponentMini->setText(QString::number(noiseDetectParam.nOneDBComponentMini));
+    ui->lineEdit_noiseThreahold->setText(QString::number(noiseDetectParam.fNoiseThreshold));
+    ui->lineEdit_noiseComponentMini->setText(QString::number(noiseDetectParam.nNoiseComponentMini));
+    ui->lineEdit_noiseDetectDuration->setText(QString::number(noiseDetectParam.nNoiseDetectDuration));
+    ui->lineEdit_noiseDetectPercent->setText(QString::number(noiseDetectParam.nNoiseDetectPercent));
+    ui->lineEdit_noiseDBMax->setText(QString::number(noiseDetectParam.nNoiseDBMax));
+}
+
+
+/* 设置qss */
+void NoiseMonitorParamDialog::setQss()
+{
+    QString qssPath = UIStyle.getQSSPath() + "/noisemonitorparamwidget.qss";
+    QFile file(qssPath);
+    if(file.open(QFile::ReadOnly))
+    {
+        QString qss = file.readAll();
+        this->setStyleSheet(qss);
+        file.close();
+    }else {
+        SPDLOG_LOGGER_WARN(m_logger, "无法打开QSS文件: {}", qssPath.toStdString());
+    }
+}
+
+/* 点击了OK */
+bool NoiseMonitorParamDialog::isOKClicked()
+{
+    updateNoiseDetectParam();
+
+    return true;
+}
+
+/* 更新噪音检测参数 */
+void NoiseMonitorParamDialog::updateNoiseDetectParam()
+{
+    m_noiseDetectParam.strRegitrationCode = ui->lineEdit_registCode->text();
+    m_noiseDetectParam.nNoiseDetectContinueCount = ui->lineEdit_noiseDetectContinueCount->text().toInt();
+    m_noiseDetectParam.nNoiseContinueCountIsWarn = ui->lineEdit_noiseContinueCountIsWarn->text().toInt();
+    m_noiseDetectParam.nNoiseContinueCountPercent = ui->lineEdit_noiseContinueCountPercent->text().toInt();
+    m_noiseDetectParam.nFreqComponentMini = ui->lineEdit_freqComponentMini->text().toInt();
+    m_noiseDetectParam.nFreqComponentMax = ui->lineEdit_freqComponentMax->text().toInt();
+    m_noiseDetectParam.fOneDBThreshold = ui->lineEdit_oneDBThreshold->text().toFloat();
+    m_noiseDetectParam.nOneDBComponentMini = ui->lineEdit_oneDBComponentMini->text().toInt();
+    m_noiseDetectParam.fNoiseThreshold = ui->lineEdit_noiseThreahold->text().toFloat();
+    m_noiseDetectParam.nNoiseComponentMini = ui->lineEdit_noiseComponentMini->text().toInt();
+    m_noiseDetectParam.nNoiseDetectDuration = ui->lineEdit_noiseDetectDuration->text().toInt();
+    m_noiseDetectParam.nNoiseDetectPercent = ui->lineEdit_noiseDetectPercent->text().toInt();
+    m_noiseDetectParam.nNoiseDBMax = ui->lineEdit_noiseDBMax->text().toInt();
+
+}
+

+ 23 - 4
SettingLibrary/Modules/Noise/noisemonitorparamdialog.h

@@ -1,13 +1,16 @@
 #ifndef NOISEMONITORPARAMDIALOG_H
 #define NOISEMONITORPARAMDIALOG_H
 
-#include <QDialog>
+#include "DialogBase.h"
+#include "spdlog/spdlog.h"
+#include "SystemConfigStruct.h"
+
 
 namespace Ui {
-class NoiseMonitorParamDialog;
+class NoiseMonitorParamWidget;
 }
 
-class NoiseMonitorParamDialog : public QDialog
+class NoiseMonitorParamDialog : public DialogBase
 {
     Q_OBJECT
 
@@ -15,8 +18,24 @@ public:
     explicit NoiseMonitorParamDialog(QWidget *parent = nullptr);
     ~NoiseMonitorParamDialog();
 
+    /* 设置初始参数 */
+    void setInitialParams(NoiseDetectParam_t& noiseDetectParam);
+    /* 获取当前参数 */
+    NoiseDetectParam_t getCurrentParams() const { return m_noiseDetectParam; }
+
 private:
-    Ui::NoiseMonitorParamDialog *ui;
+    /* 设置qss */
+    void setQss();
+    /* 点击了OK */
+    bool isOKClicked() override;
+    /* 更新噪音检测参数 */
+    void updateNoiseDetectParam();
+
+private:
+    Ui::NoiseMonitorParamWidget *ui;
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+
+    NoiseDetectParam_t m_noiseDetectParam; // 噪音检测参数
 };
 
 #endif // NOISEMONITORPARAMDIALOG_H

+ 0 - 972
SettingLibrary/Modules/Noise/noisemonitorparamdialog.ui

@@ -1,972 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>NoiseMonitorParamDialog</class>
- <widget class="QDialog" name="NoiseMonitorParamDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>1000</width>
-    <height>774</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <property name="styleSheet">
-   <string notr="true">QWidget#widgetBackground
-{
-	background: #FFFFFF;
-	border-radius: 8px;
-}
-QWidget#widgetTop
-{
-	border-bottom: 1px solid #E6E9F4;
-}
-
-QLabel
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QLabel#labelTitle
-{
-	font-weight: 500;
-	font-size: 18px;
-}
-QLabel#label,#label_8,#label_9,#label_14,#label_17
-{
-	font-weight: 500;
-	font-size: 16px;
-}
-
-QPushButton#btnClose
-{
-	border-image: url(:/close.png);
-}
-QPushButton#btnClose:hover
-{
-	border-image: url(:/close_hover.png);
-}
-QPushButton#btnCancel
-{
-	background: #FFFFFF;
-	border-radius: 16px;
-	border: 1px solid #E6E9F4;
-	font-weight: 500;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QPushButton#btnCancel:hover
-{
-	border: 1px solid #4458FE;
-	color: #4458FE;
-}
-QPushButton#btnOK
-{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #4F8AFF, stop:1 #4B5EFF);
-	border-radius: 16px;
-	font-weight: 500;
-	font-size: 14px;
-	color: #FFFFFF;
-}
-QPushButton#btnOK:hover
-{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #4F8AFF, stop:1 #7182ff);
-}
-QPushButton#btnDefault
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	font-weight: 500;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QPushButton#btnDefault:hover
-{
-	border: 1px solid #4458FE;
-	color: #4458FE;
-}
-
-QLineEdit
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-	padding-left: 12px;
-}
-QLineEdit:hover,QLineEdit:focus
-{
-	border: 1px solid #4458FE;
-}</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout">
-   <property name="leftMargin">
-    <number>0</number>
-   </property>
-   <property name="topMargin">
-    <number>0</number>
-   </property>
-   <property name="rightMargin">
-    <number>0</number>
-   </property>
-   <property name="bottomMargin">
-    <number>0</number>
-   </property>
-   <property name="spacing">
-    <number>0</number>
-   </property>
-   <item row="0" column="0">
-    <widget class="QWidget" name="widgetBackground" native="true">
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <property name="spacing">
-       <number>0</number>
-      </property>
-      <property name="leftMargin">
-       <number>0</number>
-      </property>
-      <property name="topMargin">
-       <number>0</number>
-      </property>
-      <property name="rightMargin">
-       <number>0</number>
-      </property>
-      <property name="bottomMargin">
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="QWidget" name="widgetTop" native="true">
-        <property name="minimumSize">
-         <size>
-          <width>0</width>
-          <height>57</height>
-         </size>
-        </property>
-        <property name="maximumSize">
-         <size>
-          <width>16777215</width>
-          <height>57</height>
-         </size>
-        </property>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <property name="spacing">
-          <number>0</number>
-         </property>
-         <property name="leftMargin">
-          <number>32</number>
-         </property>
-         <property name="topMargin">
-          <number>0</number>
-         </property>
-         <property name="rightMargin">
-          <number>16</number>
-         </property>
-         <property name="bottomMargin">
-          <number>0</number>
-         </property>
-         <item>
-          <widget class="QLabel" name="labelTitle">
-           <property name="text">
-            <string>噪音监测参数</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="btnClose">
-           <property name="minimumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="text">
-            <string/>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-      <item>
-       <widget class="QWidget" name="widgetContent" native="true">
-        <widget class="QLabel" name="label">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>32</y>
-           <width>64</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>监测信息</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_2">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>64</y>
-           <width>176</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;注册码:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit">
-         <property name="geometry">
-          <rect>
-           <x>208</x>
-           <y>64</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_2">
-         <property name="geometry">
-          <rect>
-           <x>208</x>
-           <y>112</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_3">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>112</y>
-           <width>176</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;连续几次噪音判断为预警:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_3">
-         <property name="geometry">
-          <rect>
-           <x>694</x>
-           <y>64</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_4">
-         <property name="geometry">
-          <rect>
-           <x>504</x>
-           <y>64</y>
-           <width>190</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音检测持续次数:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_4">
-         <property name="geometry">
-          <rect>
-           <x>694</x>
-           <y>112</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_5">
-         <property name="geometry">
-          <rect>
-           <x>504</x>
-           <y>112</y>
-           <width>190</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;持续次数里噪音次数百分比:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_5">
-         <property name="geometry">
-          <rect>
-           <x>208</x>
-           <y>208</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_6">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>208</y>
-           <width>176</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;连续几次噪音判断为预警:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_6">
-         <property name="geometry">
-          <rect>
-           <x>694</x>
-           <y>208</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_7">
-         <property name="geometry">
-          <rect>
-           <x>504</x>
-           <y>208</y>
-           <width>190</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;频率分量最大值:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_8">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>176</y>
-           <width>250</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>分析频率分量的范围 (单位Hz)</string>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_7">
-         <property name="geometry">
-          <rect>
-           <x>694</x>
-           <y>304</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_9">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>272</y>
-           <width>250</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>单音(正弦、方波、锯齿波等)</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_10">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>304</y>
-           <width>176</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;单音阈值:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_8">
-         <property name="geometry">
-          <rect>
-           <x>208</x>
-           <y>304</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_11">
-         <property name="geometry">
-          <rect>
-           <x>504</x>
-           <y>304</y>
-           <width>190</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;单音最小分量:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_9">
-         <property name="geometry">
-          <rect>
-           <x>694</x>
-           <y>400</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_12">
-         <property name="geometry">
-          <rect>
-           <x>504</x>
-           <y>400</y>
-           <width>190</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音最小分量:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_10">
-         <property name="geometry">
-          <rect>
-           <x>208</x>
-           <y>400</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_13">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>400</y>
-           <width>176</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音阈值:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_14">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>368</y>
-           <width>250</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>噪声(白噪、分红噪、布朗噪等)</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="btnDefault">
-         <property name="geometry">
-          <rect>
-           <x>209</x>
-           <y>448</y>
-           <width>88</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>默认设置</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_15">
-         <property name="geometry">
-          <rect>
-           <x>308</x>
-           <y>448</y>
-           <width>600</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>使用较小噪音系数(漏报减少,误报率加大),使用较大嗓音系数(误报减少,漏报率加大)</string>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_11">
-         <property name="geometry">
-          <rect>
-           <x>694</x>
-           <y>544</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_16">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>544</y>
-           <width>176</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音判断时长(毫秒):</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_17">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>512</y>
-           <width>232</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>基础噪音判断</string>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_12">
-         <property name="geometry">
-          <rect>
-           <x>208</x>
-           <y>544</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_18">
-         <property name="geometry">
-          <rect>
-           <x>504</x>
-           <y>544</y>
-           <width>190</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音判断百分比:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLineEdit" name="lineEdit_13">
-         <property name="geometry">
-          <rect>
-           <x>208</x>
-           <y>592</y>
-           <width>208</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_19">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>592</y>
-           <width>176</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音最大DB值:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_20">
-         <property name="geometry">
-          <rect>
-           <x>906</x>
-           <y>64</y>
-           <width>70</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>(1~100)</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_21">
-         <property name="geometry">
-          <rect>
-           <x>420</x>
-           <y>304</y>
-           <width>70</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>(0.0~1.0)</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_22">
-         <property name="geometry">
-          <rect>
-           <x>420</x>
-           <y>400</y>
-           <width>70</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>(0.0~1.0)</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_23">
-         <property name="geometry">
-          <rect>
-           <x>906</x>
-           <y>112</y>
-           <width>70</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>(1~100)%</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_24">
-         <property name="geometry">
-          <rect>
-           <x>906</x>
-           <y>304</y>
-           <width>70</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>(-30~30)</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_25">
-         <property name="geometry">
-          <rect>
-           <x>906</x>
-           <y>400</y>
-           <width>70</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>(-30~30)</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_26">
-         <property name="geometry">
-          <rect>
-           <x>906</x>
-           <y>544</y>
-           <width>70</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>(1~100)%</string>
-         </property>
-        </widget>
-       </widget>
-      </item>
-      <item>
-       <widget class="QWidget" name="widgetBottom" native="true">
-        <property name="minimumSize">
-         <size>
-          <width>0</width>
-          <height>64</height>
-         </size>
-        </property>
-        <property name="maximumSize">
-         <size>
-          <width>16777215</width>
-          <height>64</height>
-         </size>
-        </property>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <property name="spacing">
-          <number>16</number>
-         </property>
-         <property name="leftMargin">
-          <number>0</number>
-         </property>
-         <property name="topMargin">
-          <number>0</number>
-         </property>
-         <property name="rightMargin">
-          <number>32</number>
-         </property>
-         <property name="bottomMargin">
-          <number>32</number>
-         </property>
-         <item>
-          <spacer name="horizontalSpacer">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <widget class="QPushButton" name="btnCancel">
-           <property name="minimumSize">
-            <size>
-             <width>60</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>60</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="text">
-            <string>取消</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="btnOK">
-           <property name="minimumSize">
-            <size>
-             <width>60</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>60</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="text">
-            <string>确定</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>

+ 722 - 0
SettingLibrary/Modules/Noise/noisemonitorparamwidget.ui

@@ -0,0 +1,722 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NoiseMonitorParamWidget</class>
+ <widget class="QWidget" name="NoiseMonitorParamWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1000</width>
+    <height>630</height>
+   </rect>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>1000</width>
+    <height>630</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="widgetContent" native="true">
+     <widget class="QLabel" name="label">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>32</y>
+        <width>64</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>监测信息</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_2">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>64</y>
+        <width>176</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;注册码:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_registCode">
+      <property name="geometry">
+       <rect>
+        <x>208</x>
+        <y>64</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_noiseContinueCountIsWarn">
+      <property name="geometry">
+       <rect>
+        <x>208</x>
+        <y>112</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_3">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>112</y>
+        <width>176</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;连续几次噪音判断为预警:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_noiseDetectContinueCount">
+      <property name="geometry">
+       <rect>
+        <x>694</x>
+        <y>64</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_4">
+      <property name="geometry">
+       <rect>
+        <x>504</x>
+        <y>64</y>
+        <width>190</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音检测持续次数:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_noiseContinueCountPercent">
+      <property name="geometry">
+       <rect>
+        <x>694</x>
+        <y>112</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_5">
+      <property name="geometry">
+       <rect>
+        <x>504</x>
+        <y>112</y>
+        <width>190</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;持续次数里噪音次数百分比:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_freqComponentMini">
+      <property name="geometry">
+       <rect>
+        <x>208</x>
+        <y>208</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_6">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>208</y>
+        <width>176</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#d21f21;&quot;&gt;*&lt;/span&gt;频率分量最小值:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_freqComponentMax">
+      <property name="geometry">
+       <rect>
+        <x>694</x>
+        <y>208</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_7">
+      <property name="geometry">
+       <rect>
+        <x>504</x>
+        <y>208</y>
+        <width>190</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;频率分量最大值:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_8">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>176</y>
+        <width>250</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>分析频率分量的范围 (单位Hz)</string>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_oneDBComponentMini">
+      <property name="geometry">
+       <rect>
+        <x>694</x>
+        <y>304</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_9">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>272</y>
+        <width>250</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>单音(正弦、方波、锯齿波等)</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_10">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>304</y>
+        <width>176</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;单音阈值:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_oneDBThreshold">
+      <property name="geometry">
+       <rect>
+        <x>208</x>
+        <y>304</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_11">
+      <property name="geometry">
+       <rect>
+        <x>504</x>
+        <y>304</y>
+        <width>190</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;单音最小分量:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_noiseComponentMini">
+      <property name="geometry">
+       <rect>
+        <x>694</x>
+        <y>400</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_12">
+      <property name="geometry">
+       <rect>
+        <x>504</x>
+        <y>400</y>
+        <width>190</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音最小分量:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_noiseThreahold">
+      <property name="geometry">
+       <rect>
+        <x>208</x>
+        <y>400</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_13">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>400</y>
+        <width>176</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音阈值:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_14">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>368</y>
+        <width>250</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>噪声(白噪、分红噪、布朗噪等)</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_defaultSetting">
+      <property name="geometry">
+       <rect>
+        <x>209</x>
+        <y>448</y>
+        <width>88</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>默认设置</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_15">
+      <property name="geometry">
+       <rect>
+        <x>308</x>
+        <y>448</y>
+        <width>600</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>使用较小噪音系数(漏报减少,误报率加大),使用较大嗓音系数(误报减少,漏报率加大)</string>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_noiseDetectPercent">
+      <property name="geometry">
+       <rect>
+        <x>694</x>
+        <y>544</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_16">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>544</y>
+        <width>176</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音判断时长(毫秒):</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_17">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>512</y>
+        <width>232</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>基础噪音判断</string>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_noiseDetectDuration">
+      <property name="geometry">
+       <rect>
+        <x>208</x>
+        <y>544</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_18">
+      <property name="geometry">
+       <rect>
+        <x>504</x>
+        <y>544</y>
+        <width>190</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音判断百分比:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_noiseDBMax">
+      <property name="geometry">
+       <rect>
+        <x>208</x>
+        <y>592</y>
+        <width>208</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_19">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>592</y>
+        <width>176</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;噪音最大DB值:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_20">
+      <property name="geometry">
+       <rect>
+        <x>906</x>
+        <y>64</y>
+        <width>70</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>(1~100)</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_21">
+      <property name="geometry">
+       <rect>
+        <x>420</x>
+        <y>304</y>
+        <width>70</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>(0.0~1.0)</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_22">
+      <property name="geometry">
+       <rect>
+        <x>420</x>
+        <y>400</y>
+        <width>70</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>(0.0~1.0)</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_23">
+      <property name="geometry">
+       <rect>
+        <x>906</x>
+        <y>112</y>
+        <width>70</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>(1~100)%</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_24">
+      <property name="geometry">
+       <rect>
+        <x>906</x>
+        <y>304</y>
+        <width>70</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>(-30~30)</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_25">
+      <property name="geometry">
+       <rect>
+        <x>906</x>
+        <y>400</y>
+        <width>70</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>(-30~30)</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_26">
+      <property name="geometry">
+       <rect>
+        <x>906</x>
+        <y>544</y>
+        <width>70</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>(1~100)%</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 137 - 2
SettingLibrary/Modules/Noise/noisewidget.cpp

@@ -2,22 +2,157 @@
 #include "ui_noisewidget.h"
 #include "noisemonitorparamdialog.h"
 
+#include <QIntValidator>
+
+#include "UIStyleManager.h"
+#include "SystemConfig.h"
+#include "FromWebAPI.h"
+
+
+
 NoiseWidget::NoiseWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::NoiseWidget)
 {
     ui->setupUi(this);
 
-    connect(ui->btnModNoise, &QPushButton::clicked, this, &NoiseWidget::OnBtnModNoiseClicked);
+    m_logger = spdlog::get("ACASetting");
+    if(m_logger == nullptr)
+    {
+        fmt::print("NoiseWidget: Logger ACASetting not found\n");
+        return;
+    }
+
+    /* 设置输入数字的栏只能输入数字 */
+    ui->lineEdit_detectInternal->setValidator(new QIntValidator(this));
+
+    /* 设置初始参数 */
+    const NoiseDetectBaseConfig_t &noiseConfig = SysConfig.getNoiseDetectBaseConfig();
+    ui->lineEdit_serverAddr->setText(noiseConfig.strNoiseServerAddr);
+    ui->lineEdit_noiseFileDir->setText(noiseConfig.strNoiseDetectDir);
+    ui->lineEdit_serverPath->setText(noiseConfig.strServerPath);
+    ui->lineEdit_serverPath->setText(noiseConfig.strServerPath);
+    ui->lineEdit_detectInternal->setText(QString::number(noiseConfig.nNoiseDetectDuration));
+    ui->checkBox_enableNoiseDetect->setChecked(noiseConfig.isEnableNoiseDetect);
+    ui->checkBox_mainRoadEnable->setChecked(noiseConfig.isEnableMainRoadDetect);
+
+    /* 获取噪音检测参数 */
+    m_noiseDetectParam = SysConfig.getNoiseDetectParam();
+
+    connect(ui->pBtn_editNoiseParam, &QPushButton::clicked, this, &NoiseWidget::do_pBtn_editNoiseParam_clicked);
+
+    UIStyle.registerWidget(this);
 }
 
 NoiseWidget::~NoiseWidget()
 {
+    UIStyle.unregisterWidget(this);
     delete ui;
 }
 
-void NoiseWidget::OnBtnModNoiseClicked()
+void NoiseWidget::do_pBtn_editNoiseParam_clicked()
 {
     NoiseMonitorParamDialog dlg;
+    /* 设置当前参数 */
+    dlg.setInitialParams(m_noiseDetectParam);
+    /* 执行对话框 */
     dlg.exec();
+
+    /* 判断是否点击了OK */
+    if(!dlg.isOK())
+    {
+        return;
+    }
+    /* 获取当前参数 */
+    m_noiseDetectParam = dlg.getCurrentParams();
+
+}
+
+
+/* 保存参数 */
+bool NoiseWidget::saveConfig()
+{
+    bool isSuccess = true;
+    /* 先保存基础设置 */
+    if(!saveBaseConfig())
+    {
+        isSuccess = false;
+        return false;
+    }
+    /* 再保存噪音检测参数 */
+    if(!saveNoiseDetectParam())
+    {
+        isSuccess = false;
+        return false;
+    }
+
+    return isSuccess;
+}
+
+/* 保存基础参数 */
+bool NoiseWidget::saveBaseConfig()
+{
+    NoiseDetectBaseConfig_t noiseConfig;
+    noiseConfig.strNoiseServerAddr = ui->lineEdit_serverAddr->text();
+    noiseConfig.strNoiseDetectDir = ui->lineEdit_noiseFileDir->text();
+    noiseConfig.strServerPath = ui->lineEdit_serverPath->text();
+    noiseConfig.nNoiseDetectDuration = ui->lineEdit_detectInternal->text().toInt();
+    noiseConfig.isEnableNoiseDetect = ui->checkBox_enableNoiseDetect->isChecked();
+    noiseConfig.isEnableMainRoadDetect = ui->checkBox_mainRoadEnable->isChecked();
+
+    /* 和历史数据进行对比 */
+    const NoiseDetectBaseConfig_t &oldConfig = SysConfig.getNoiseDetectBaseConfig();
+    if(noiseConfig == oldConfig)
+    {
+        SPDLOG_LOGGER_DEBUG(m_logger, "噪音检测基础配置没有变化,不需要更新");
+        return true;
+    }
+
+    /* 将噪音检测基础配置转换成json */
+    std::string strJson;
+    if(!SysConfig.setNoiseDetectBaseConfigToJson(noiseConfig, strJson))
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "设置噪音检测基础配置转换成JSON失败");
+        return false;
+    }
+    /* 更新数据库信息 */
+    if(!m_fromWebAPI->updateSystemConfig(Config_NoiseBase, strJson, SysConfig.mapSysConfigDesc[eSystemConfigType::eSCT_NoiseBase]))
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "更新噪音检测基础配置失败");
+        return false;
+    }
+
+    return true;
+}
+
+/* 保存噪音检测参数 */
+bool NoiseWidget::saveNoiseDetectParam()
+{
+    /* 和历史数据进行对比 */
+    const NoiseDetectParam_t &oldParam = SysConfig.getNoiseDetectParam();
+    if(m_noiseDetectParam == oldParam)
+    {
+        SPDLOG_LOGGER_DEBUG(m_logger, "噪音检测参数没有变化,不需要更新");
+        return true;
+    }
+
+    /* 将噪音检测参数转换成json */
+    std::string strJson;
+    if(!SysConfig.setNoiseDetectParamToJson(m_noiseDetectParam, strJson))
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "设置噪音检测参数转换成JSON失败");
+        return false;
+    }
+
+    /* 更新数据库信息 */
+    if(!m_fromWebAPI->updateSystemConfig(Config_NoiseParam, strJson, SysConfig.mapSysConfigDesc[eSystemConfigType::eSCT_NoiseParam]))
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "更新噪音检测参数失败");
+        return false;
+    }
+
+    /* 更新系统配置 */
+    SysConfig.setNoiseDetectParam(m_noiseDetectParam);
+
+    return true;
 }

+ 23 - 1
SettingLibrary/Modules/Noise/noisewidget.h

@@ -3,6 +3,12 @@
 
 #include <QWidget>
 
+#include "spdlog/spdlog.h"
+#include "SystemConfigStruct.h"
+
+
+class FromWebAPI;
+
 namespace Ui {
 class NoiseWidget;
 }
@@ -15,11 +21,27 @@ public:
     explicit NoiseWidget(QWidget *parent = nullptr);
     ~NoiseWidget();
 
+    /* 设置WebAPI */
+    void setWebAPI(FromWebAPI* api) { m_fromWebAPI = api; }
+    /* 保存参数 */
+    bool saveConfig();
+
 private slots:
-    void OnBtnModNoiseClicked();
+    void do_pBtn_editNoiseParam_clicked();
+
+private:
+    /* 保存基础参数 */
+    bool saveBaseConfig();
+    /* 保存噪音检测参数 */
+    bool saveNoiseDetectParam();
 
 private:
     Ui::NoiseWidget *ui;
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+
+    FromWebAPI* m_fromWebAPI = nullptr; // 用于从Web API获取数据
+
+    NoiseDetectParam_t m_noiseDetectParam; // 噪音检测参数
 };
 
 #endif // NOISEWIDGET_H

+ 23 - 83
SettingLibrary/Modules/Noise/noisewidget.ui

@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>352</width>
+    <width>362</width>
     <height>620</height>
    </rect>
   </property>
@@ -14,67 +14,7 @@
    <string>Form</string>
   </property>
   <property name="styleSheet">
-   <string notr="true">QWidget#widget
-{
-	border-bottom: 1px solid #E9E9E9;
-}
-
-QLabel
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-
-QLineEdit
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	padding-left: 12px;
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QLineEdit:hover,QLineEdit:focus
-{
-	border: 1px solid #4458FE;
-}
-
-QCheckBox
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QCheckBox::indicator
-{
-	width: 16px; 
-	height: 16px;
-}
-QCheckBox::indicator:unchecked
-{
-	image: url(:/unchecked.png);
-}
-QCheckBox::indicator:checked
-{
-	image: url(:/checked.png);
-}
-
-QPushButton
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	font-weight: 500;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QPushButton:hover
-{
-	border: 1px solid #4458FE;
-	color: #4458FE;
-}</string>
+   <string notr="true"/>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <property name="spacing">
@@ -126,7 +66,7 @@ QPushButton:hover
          </widget>
         </item>
         <item>
-         <widget class="QLineEdit" name="lineEditNoiseServerAddr_2">
+         <widget class="QLineEdit" name="lineEdit_serverAddr">
           <property name="minimumSize">
            <size>
             <width>246</width>
@@ -149,14 +89,14 @@ QPushButton:hover
          <number>24</number>
         </property>
         <item>
-         <widget class="QCheckBox" name="checkBox_2">
+         <widget class="QCheckBox" name="checkBox_mainRoadEnable">
           <property name="text">
            <string>主输出开启噪音检测</string>
           </property>
          </widget>
         </item>
         <item>
-         <widget class="QCheckBox" name="checkBox">
+         <widget class="QCheckBox" name="checkBox_enableNoiseDetect">
           <property name="text">
            <string>开启噪音检测服务</string>
           </property>
@@ -193,7 +133,7 @@ QPushButton:hover
          </widget>
         </item>
         <item>
-         <widget class="QLineEdit" name="lineEditFileDirectory">
+         <widget class="QLineEdit" name="lineEdit_noiseFileDir">
           <property name="minimumSize">
            <size>
             <width>246</width>
@@ -226,7 +166,7 @@ QPushButton:hover
          </widget>
         </item>
         <item>
-         <widget class="QLineEdit" name="lineEditServerIP_3">
+         <widget class="QLineEdit" name="lineEdit_serverPath">
           <property name="minimumSize">
            <size>
             <width>246</width>
@@ -259,7 +199,7 @@ QPushButton:hover
          </widget>
         </item>
         <item>
-         <widget class="QLineEdit" name="lineEditServerIP_4">
+         <widget class="QLineEdit" name="lineEdit_detectInternal">
           <property name="minimumSize">
            <size>
             <width>246</width>
@@ -279,10 +219,23 @@ QPushButton:hover
      </layout>
     </widget>
    </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout_7">
      <item>
-      <widget class="QPushButton" name="btnRestore">
+      <widget class="QPushButton" name="pBtn_restore">
        <property name="minimumSize">
         <size>
          <width>102</width>
@@ -314,7 +267,7 @@ QPushButton:hover
       </spacer>
      </item>
      <item>
-      <widget class="QPushButton" name="btnModNoise">
+      <widget class="QPushButton" name="pBtn_editNoiseParam">
        <property name="minimumSize">
         <size>
          <width>122</width>
@@ -334,19 +287,6 @@ QPushButton:hover
      </item>
     </layout>
    </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <resources/>

+ 3 - 3
SettingLibrary/Network/FromWebAPI.cpp

@@ -492,10 +492,10 @@ bool FromWebAPI::getSystemConfig(QMap<std::string, std::string>& mapConfig)
         json0["opName"] = "ACAS_GetSystemConfigInfo";
         QString strSend = QString::fromStdString(json0.dump());
         QString strRet;
-        int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_BatchTransAction, strSend, strRet);
+        int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strSend, strRet);
         if(ret != 0)
         {
-            SPDLOG_LOGGER_ERROR(m_logger, "获取系统配置信息失败: {}", nJson::parse(strRet.toStdString()).dump(4));
+            SPDLOG_LOGGER_ERROR(m_logger, "获取系统配置信息失败, 错误码: {}, {}", ret, strRet.toStdString());
             return false;
         }
 
@@ -540,7 +540,7 @@ bool FromWebAPI::updateSystemConfig(const std::string& key, const std::string& v
         int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Update, strSend, strRet);
         if(ret != 0)
         {
-            SPDLOG_LOGGER_ERROR(m_logger, "更新系统设置失败: {}", nJson::parse(strRet.toStdString()).dump(4));
+            SPDLOG_LOGGER_ERROR(m_logger, "更新系统设置失败, 错误码:{}, {}", ret, strRet.toStdString());
             return false;
         }
     }nJsonCatch

+ 5 - 0
SettingLibrary/Resources/QSS.qrc

@@ -7,5 +7,10 @@
         <file>qss/white/compareitemwidget.qss</file>
         <file>qss/white/singlecompareroadwidget.qss</file>
         <file>qss/white/warning.qss</file>
+        <file>qss/white/aicomparewidget.qss</file>
+        <file>qss/white/noisewidget.qss</file>
+        <file>qss/white/noisemonitorparamwidget.qss</file>
+        <file>qss/white/databasewidget.qss</file>
+        <file>qss/white/checkperiodwidget.qss</file>
     </qresource>
 </RCC>

+ 128 - 0
SettingLibrary/Resources/qss/white/aicomparewidget.qss

@@ -0,0 +1,128 @@
+
+
+QWidget#widget
+{
+	background: transparent;
+	border-bottom: 1px solid #E9E9E9;
+}
+
+QLabel
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+
+
+/* ==========================================================
+ *  QLineEdit
+ * ========================================================== */
+
+QLineEdit
+{
+	background: #FFFFFF;
+	border-radius: 4px;
+	border: 1px solid #E6E9F4;
+	padding-left: 12px;
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+
+QLineEdit:hover,QLineEdit:focus
+{
+	border: 1px solid #4458FE;
+}
+
+
+/* ==========================================================
+ *  QPushButton
+ * ========================================================== */
+
+QPushButton
+{
+	font-weight: 500;
+	font-size: 14px;
+	text-align: center;
+}
+
+/* QPushButton#pBtn_close
+{
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Light.png);
+    qproperty-iconSize: 20px 20px;
+}
+QPushButton#pBtn_close[Hover = true]
+{    
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+
+    border: 1px solid #4458FE;
+} */
+
+/********* 普通椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_cancel, #pBtn_saveTotemplate
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+	border-radius: 16px;
+}
+QPushButton#pBtn_cancel:hover, #pBtn_saveTotemplate:hover
+{
+    background: transparent;
+	color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 16px;
+} */
+
+
+/********* 带有底色椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_ok
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+} */
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_restore
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+}
+QPushButton#pBtn_restore:hover
+{
+    background: transparent;
+    color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 4px;
+}
+
+
+/********* 带有底色方框按钮三种状态效果 *********/
+/* QPushButton#pBtn_addPlan
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 4px;
+}
+
+QPushButton#pBtn_addPlan:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 4px;
+} */

+ 260 - 0
SettingLibrary/Resources/qss/white/checkperiodwidget.qss

@@ -0,0 +1,260 @@
+
+QWidget#widget_detectPlan,#widget_noDetectPlan
+{
+	border-bottom: 1px solid #E9E9E9;
+}
+
+/* ==========================================================
+ *  QLabel
+ * ========================================================== */
+
+QLabel
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+
+QLabel#label_tipIcon1 ,#label_tipIcon2
+{
+	image: url(:/icon/tip.png);
+}
+
+QLabel#label_tip1, #label_tip2
+{
+	color: rgba(58,63,99,0.8);
+}
+
+QLabel#label_detectPlan, #label_noDetectPlan
+{
+	font-weight: 500;
+	font-size: 16px;
+}
+
+
+
+
+
+/* ==========================================================
+ *  QPushButton
+ * ========================================================== */
+
+QPushButton
+{
+	font-weight: 500;
+	font-size: 14px;
+	text-align: center;
+}
+
+/* QPushButton#pBtn_close
+{
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Light.png);
+    qproperty-iconSize: 20px 20px;
+}
+QPushButton#pBtn_close[Hover = true]
+{    
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+
+    border: 1px solid #4458FE;
+} */
+
+/********* 普通椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_cancel, #pBtn_saveTotemplate
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+	border-radius: 16px;
+}
+QPushButton#pBtn_cancel:hover, #pBtn_saveTotemplate:hover
+{
+    background: transparent;
+	color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 16px;
+} */
+
+
+/********* 带有底色椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_ok
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+} */
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_restore
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+}
+QPushButton#pBtn_restore:hover
+{
+    background: transparent;
+    color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 4px;
+}
+
+
+/********* 带有底色方框按钮三种状态效果 *********/
+QPushButton#pBtn_addDetectPlan, #pBtn_addNoDetectPlan
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 4px;
+}
+
+QPushButton#pBtn_addDetectPlan:hover, #pBtn_addNoDetectPlan:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 4px;
+}
+
+/* ==========================================================
+ *  QCheckBox
+ * ========================================================== */
+QCheckBox
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+QCheckBox::indicator
+{
+	width: 16px; 
+	height: 16px;
+}
+QCheckBox::indicator:unchecked
+{
+	image: url(:/icon/unchecked.png);
+}
+QCheckBox::indicator:checked
+{
+	image: url(:/icon/checked.png);
+}
+
+/* ==========================================================
+ *  QComboBox(这个是在用的)
+ * ========================================================== */
+
+QComboBox:enabled
+{
+    background-color:#FFFFFF;
+    border: 1px solid #E6E9F4;
+    border-radius: 4px;
+    font-size:14px;
+    font-weight: 400;
+    color:#3A3F63;
+    padding-left: 12px;
+}
+
+/* 不能编辑的时候的样式,setEnable(false) */
+QComboBox:!enabled
+{
+    background:rgba(0,0,0,0.04);
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+    font-size:14px;
+    font-weight: 400;
+    color:rgba(58,63,99,0.65);
+    padding-left: 12px;
+}
+
+QComboBox:hover
+{
+    border: 1px solid #4458FE;
+    border-radius: 4px;
+    background:transparent;
+}
+
+/* 下拉箭头所在的位置方框 */
+QComboBox::drop-down
+{
+    width: 24px;
+    border: none;
+}
+/* 下拉箭头图标 */
+QComboBox::down-arrow
+{
+    image: url(:/icon/down_arrow.png);
+    height:16px;
+    width:16px;
+}
+
+/* 下拉条样式,就是view,整个下拉窗体的样式 */
+QComboBox QAbstractItemView
+{
+    background-color: #FFFFFF;
+    margin: 12px;
+    outline:0px;
+    font-size:14px;
+    color: #3A3F63;
+    border-radius: 4px;
+}
+
+/* 使下面两句生效,需要加上如下语句 */
+/* m_comBoxDev->setView(new QListView()); */
+QComboBox QAbstractItemView::item
+{
+    background-color: #FFFFFF;
+    border-radius:4px;
+    color: #3A3F63;
+    padding-left: 12px;
+    height: 32px;
+}
+
+QComboBox QAbstractItemView::item:hover
+{
+    border-radius:4px;
+    background-color: #EEF2FF;
+}
+
+/******** combobox 滚动条  *********/
+/*主体部分*/
+QComboBox QScrollBar::vertical
+{ 
+    width:8px;
+    background:transparent;
+    border:none;
+    border-radius:5px;
+}
+/*滑块主体*/
+QComboBox QScrollBar::handle::vertical
+{
+    width: 8px;
+    background: #E2E2E2;
+    border-radius: 3px;
+    min-width: 8px;
+}
+QComboBox QScrollBar::handle::vertical::hover
+{
+    background:transparent;
+}
+/*上箭头*/
+QComboBox QScrollBar::add-line::vertical
+{
+    border:none;
+}
+/*下箭头*/
+QComboBox QScrollBar::sub-line::vertical
+{
+    border:none;
+}
+

+ 112 - 0
SettingLibrary/Resources/qss/white/databasewidget.qss

@@ -0,0 +1,112 @@
+/* ==========================================================
+ *  QLineEdit
+ * ========================================================== */
+
+QLineEdit
+{
+	background: #FFFFFF;
+	border-radius: 4px;
+	border: 1px solid #E6E9F4;
+	padding-left: 12px;
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+
+QLineEdit:hover,QLineEdit:focus
+{
+	border: 1px solid #4458FE;
+}
+
+
+/* ==========================================================
+ *  QPushButton
+ * ========================================================== */
+
+QPushButton
+{
+	font-weight: 500;
+	font-size: 14px;
+	text-align: center;
+}
+
+/* QPushButton#pBtn_close
+{
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Light.png);
+    qproperty-iconSize: 20px 20px;
+}
+QPushButton#pBtn_close[Hover = true]
+{    
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+
+    border: 1px solid #4458FE;
+} */
+
+/********* 普通椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_cancel, #pBtn_saveTotemplate
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+	border-radius: 16px;
+}
+QPushButton#pBtn_cancel:hover, #pBtn_saveTotemplate:hover
+{
+    background: transparent;
+	color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 16px;
+} */
+
+
+/********* 带有底色椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_ok
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+} */
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+}
+QPushButton:hover
+{
+    background: transparent;
+    color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 4px;
+}
+
+
+/********* 带有底色方框按钮三种状态效果 *********/
+/* QPushButton#pBtn_addPlan
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 4px;
+}
+
+QPushButton#pBtn_addPlan:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 4px;
+} */

+ 112 - 0
SettingLibrary/Resources/qss/white/noisemonitorparamwidget.qss

@@ -0,0 +1,112 @@
+/* ==========================================================
+ *  QLineEdit
+ * ========================================================== */
+
+QLineEdit
+{
+	background: #FFFFFF;
+	border-radius: 4px;
+	border: 1px solid #E6E9F4;
+	padding-left: 12px;
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+
+QLineEdit:hover,QLineEdit:focus
+{
+	border: 1px solid #4458FE;
+}
+
+
+/* ==========================================================
+ *  QPushButton
+ * ========================================================== */
+
+QPushButton
+{
+	font-weight: 500;
+	font-size: 14px;
+	text-align: center;
+}
+
+/* QPushButton#pBtn_close
+{
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Light.png);
+    qproperty-iconSize: 20px 20px;
+}
+QPushButton#pBtn_close[Hover = true]
+{    
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+
+    border: 1px solid #4458FE;
+} */
+
+/********* 普通椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_cancel, #pBtn_saveTotemplate
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+	border-radius: 16px;
+}
+QPushButton#pBtn_cancel:hover, #pBtn_saveTotemplate:hover
+{
+    background: transparent;
+	color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 16px;
+} */
+
+
+/********* 带有底色椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_ok
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+} */
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_defaultSetting
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+}
+QPushButton#pBtn_defaultSetting:hover
+{
+    background: transparent;
+    color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 4px;
+}
+
+
+/********* 带有底色方框按钮三种状态效果 *********/
+/* QPushButton#pBtn_addPlan
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 4px;
+}
+
+QPushButton#pBtn_addPlan:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 4px;
+} */

+ 84 - 0
SettingLibrary/Resources/qss/white/noisewidget.qss

@@ -0,0 +1,84 @@
+QWidget#widget
+{
+	border-bottom: 1px solid #E9E9E9;
+}
+
+QLabel
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+
+QLineEdit
+{
+	background: #FFFFFF;
+	border-radius: 4px;
+	border: 1px solid #E6E9F4;
+	padding-left: 12px;
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+QLineEdit:hover,QLineEdit:focus
+{
+	border: 1px solid #4458FE;
+}
+
+QCheckBox
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+QCheckBox::indicator
+{
+	width: 16px; 
+	height: 16px;
+}
+QCheckBox::indicator:unchecked
+{
+	image: url(:/unchecked.png);
+}
+QCheckBox::indicator:checked
+{
+	image: url(:/checked.png);
+}
+
+QPushButton
+{
+	background: #FFFFFF;
+	border-radius: 4px;
+	border: 1px solid #E6E9F4;
+	font-weight: 500;
+	font-size: 14px;
+	color: #3A3F63;
+}
+QPushButton:hover
+{
+	border: 1px solid #4458FE;
+	color: #4458FE;
+}
+
+/* ==========================================================
+ *  QCheckBox
+ * ========================================================== */
+QCheckBox
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+QCheckBox::indicator
+{
+	width: 16px; 
+	height: 16px;
+}
+QCheckBox::indicator:unchecked
+{
+	image: url(:/icon/unchecked.png);
+}
+QCheckBox::indicator:checked
+{
+	image: url(:/icon/checked.png);
+}

+ 32 - 5
SettingLibrary/setinfomanager.cpp

@@ -49,6 +49,13 @@ int SetInfoManager::Init(const stInitData* pData)
         return -1;
     }
 
+    /* 获取系统中的参数设置 */
+    if(!getSystemConfig())
+    {
+        SPDLOG_ERROR("获取系统配置失败");
+        return -1;
+    }
+
     /* 从数据库获取对比项信息 */
     QList<CompareItemInfo_t> listItems;
     if(!m_fromWebAPI->getCompareItemInfo(listItems))
@@ -75,6 +82,8 @@ int SetInfoManager::CreateWindow(int nSkinType, QWidget* parent)
             parent->layout()->addWidget(m_pWgtSet);
         }
         m_pWgtSet->setWebAPI(m_fromWebAPI);
+        /* 获取最外层的window指针 */
+        GInfo.setTopWindow(parent->window());
     }
     return 0;
 }
@@ -195,6 +204,7 @@ bool SetInfoManager::getSystemConfig()
     /* 将获取到的配置转换成结构体 */
     for(auto it = mapConfig.begin(); it != mapConfig.end(); ++it)
     {
+
         if(Config_Base == it.key())
         {
             if(!SysConfig.getBaseConfigFromJson(it.value()))
@@ -204,20 +214,37 @@ bool SetInfoManager::getSystemConfig()
         }
         else if(Config_CompareAI == it.key())
         {
+            if(!SysConfig.getAICompareConfigFromJson(it.value()))
+            {
+                SPDLOG_ERROR("获取AI对比配置失败");
+            }
+        }
+        else if(Config_NoiseBase == it.key())
+        {
+            if(!SysConfig.getNoiseDetectBaseConfigFromJson(it.value()))
+            {
+                SPDLOG_ERROR("获取噪音检测基础配置失败");
+            }
         }
-        else if(Config_NoiseDetect == it.key())
+        else if(Config_NoiseParam == it.key())
         {
+            if(!SysConfig.getNoiseDetectParamFromJson(it.value()))
+            {
+                SPDLOG_ERROR("获取噪音检测参数失败");
+            }
         }
         else if(Config_Database == it.key())
         {
+            if(!SysConfig.getDatabaseConfigFromJson(it.value()))
+            {
+                SPDLOG_ERROR("获取数据库设置失败");
+            }
         }
         else if(Config_DetectPeriod == it.key())
         {
-        }
-        else
+        } else
         {
-            SPDLOG_ERROR("未知的系统配置项: {}", it.key());
-            return false;
+            SPDLOG_DEBUG("未知的系统配置项: {}", it.key());
         }
     }
 

+ 55 - 2
SettingLibrary/setinfowidget.cpp

@@ -3,7 +3,8 @@
 
 
 #include "UIStyleManager.h"
-
+#include "tipwidget.h"
+#include "GLobalInfo.h"
 
 SetInfoWidget::SetInfoWidget(QWidget *parent) :
     QWidget(parent),
@@ -38,6 +39,24 @@ void SetInfoWidget::setWebAPI(FromWebAPI* api)
     {
         basicWidget->setWebAPI(m_fromWebAPI);
     }
+    /* 设置ai对比项的webapi指针 */
+    AICompareWidget* aiCompareWidget = qobject_cast<AICompareWidget*>(ui->tabWidget->widget(1));
+    if(aiCompareWidget)
+    {
+        aiCompareWidget->setWebAPI(m_fromWebAPI);
+    }
+    /* 设置噪音检测的webapi */
+    NoiseWidget* noiseWidget = qobject_cast<NoiseWidget*>(ui->tabWidget->widget(2));
+    if(noiseWidget)
+    {
+        noiseWidget->setWebAPI(m_fromWebAPI);
+    }
+    /* 设置数据库配置的WebAPI */
+    DatabaseWidget* databaseWidget = qobject_cast<DatabaseWidget*>(ui->tabWidget->widget(3));
+    if(databaseWidget)
+    {
+        databaseWidget->setWebAPI(m_fromWebAPI);
+    }
 }
 
 
@@ -60,6 +79,7 @@ void SetInfoWidget::saveData()
     int currentIndex = ui->tabWidget->currentIndex();
     QWidget* currentWidget = ui->tabWidget->currentWidget();
     
+    bool isSuccess = false;
     switch(currentIndex)
     {
         case 0:     /* 基础信息 */
@@ -68,21 +88,54 @@ void SetInfoWidget::saveData()
                 if(widget)
                 {
                     /* 保存基础信息 */
-                    widget->saveBasicInfo();
+                    isSuccess = widget->saveBasicInfo();
                 }
             }
             break;
         case 1:     /* 对比项 */
+            {
+                AICompareWidget* widget = qobject_cast<AICompareWidget*>(currentWidget);
+                if(widget)
+                {
+                    /* 保存对比项信息 */
+                    isSuccess = widget->saveConfig();
+                }
+            }
             break;
         case 2:     /* 噪音检测 */
+            {
+                NoiseWidget* widget = qobject_cast<NoiseWidget*>(currentWidget);
+                if(widget)
+                {
+                    /* 保存噪音检测信息 */
+                    isSuccess = widget->saveConfig();
+                }
+            }
             break;
         case 3:     /* 数据库 */
+            {
+                DatabaseWidget* widget = qobject_cast<DatabaseWidget*>(currentWidget);
+                if(widget)
+                {
+                    /* 保存数据库信息 */
+                    isSuccess = widget->saveParams();
+                }
+            }
             break;
         case 4:     /* 检测时段 */
             break;
         default:
             break;
     }
+
+    if(isSuccess)
+    {
+        /* 保存成功 */
+        TipWidget::display(TipWidget::OPERATOR_OK, "设置保存成功", GInfo.getTopWindow());
+    }else {
+        /* 保存失败 */
+        TipWidget::display(TipWidget::OPERATOR_FAIL, "设置保存失败", GInfo.getTopWindow());
+    }
 }