#ifndef BASICWIDGET_H #define BASICWIDGET_H #include #include "FromWebAPI.h" #include "spdlog/spdlog.h" #include "SystemConfigStruct.h" namespace Ui { class BasicWidget; } /** * @brief 这个页面的基础信息从mqtt获取 * */ class BasicWidget : public QWidget { Q_OBJECT public: explicit BasicWidget(QWidget *parent = nullptr); ~BasicWidget(); /* 判断数据是否修改了 */ bool isDataChanged(); /* 保存数据 */ bool saveBasicInfo(); /* 设置WebAPI指针 */ void setWebAPI(FromWebAPI* api) { m_fromWebAPI = api; } private slots: /* 对比项配置 */ void do_pBtn_CompareItemClicked(); /* 修改了选择了声卡 */ void do_soundCardChanged(int nIndex); /* 恢复配置项 */ void do_pBtn_restore_clicked(); /* 点击了显示声卡通道名的checkBox */ void do_checkBox_showSoundCardDesc_clicked(bool checked); private: /* 判断基础信息有没有修改 */ bool isDataChangedBasicInfo(); /* 判断对比项信息有没有修改 */ bool isDataChangedCompareItem(); /* 设置声卡信息 */ void setSoundCardInfo(); /* 保存基础信息 */ bool saveBasicSettingInfo(); /* 保存对比项信息 */ bool saveCompareItemInfo(); /* 查找新增的对比项信息 */ void findInsertCompareItem(const QList& srcItems, const QList& nowItems, QList& insertItems); /* 查找删除的对比项信息 */ void findDeleteCompareItem(const QList& srcItems, const QList& nowItems, QList& deleteIDs); /* 查找修改的对比项 */ void findUpdateCompareItem(const QList& srcItems, const QList& nowItems, QList& baseUpdateItems, QList& roadUpdateItems); /* 恢复基础信息 */ void restoreBasicSettingInfo(); /* 恢复对比项信息 */ bool restoreCompareItemInfo(); /* 设置报警 */ void setWarn(QWidget* widget, bool isWarn); /* 取消全部报警 */ void cancelAllWarn(); private: Ui::BasicWidget *ui; std::shared_ptr m_logger = nullptr; FromWebAPI* m_fromWebAPI = nullptr; bool m_isModify = false; /* 是否有修改过的设置 */ BaseConfig_t m_baseConfig; /* 基础配置信息 */ }; #endif // BASICWIDGET_H