basicwidget.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef BASICWIDGET_H
  2. #define BASICWIDGET_H
  3. #include <QWidget>
  4. #include "FromWebAPI.h"
  5. #include "spdlog/spdlog.h"
  6. #include "SystemConfigStruct.h"
  7. namespace Ui {
  8. class BasicWidget;
  9. }
  10. /**
  11. * @brief 这个页面的基础信息从mqtt获取
  12. *
  13. */
  14. class BasicWidget : public QWidget
  15. {
  16. Q_OBJECT
  17. public:
  18. explicit BasicWidget(QWidget *parent = nullptr);
  19. ~BasicWidget();
  20. /* 判断数据是否修改了 */
  21. bool isDataChanged();
  22. /* 保存数据 */
  23. bool saveBasicInfo();
  24. /* 设置WebAPI指针 */
  25. void setWebAPI(FromWebAPI* api) { m_fromWebAPI = api; }
  26. private slots:
  27. /* 对比项配置 */
  28. void do_pBtn_CompareItemClicked();
  29. /* 修改了选择了声卡 */
  30. void do_soundCardChanged(int nIndex);
  31. /* 恢复配置项 */
  32. void do_pBtn_restore_clicked();
  33. /* 点击了显示声卡通道名的checkBox */
  34. void do_checkBox_showSoundCardDesc_clicked(bool checked);
  35. private:
  36. /* 判断基础信息有没有修改 */
  37. bool isDataChangedBasicInfo();
  38. /* 判断对比项信息有没有修改 */
  39. bool isDataChangedCompareItem();
  40. /* 设置声卡信息 */
  41. void setSoundCardInfo();
  42. /* 保存基础信息 */
  43. bool saveBasicSettingInfo();
  44. /* 保存对比项信息 */
  45. bool saveCompareItemInfo();
  46. /* 查找新增的对比项信息 */
  47. void findInsertCompareItem(const QList<CompareItemInfo_t>& srcItems, const QList<CompareItemInfo_t>& nowItems, QList<CompareItemInfo_t>& insertItems);
  48. /* 查找删除的对比项信息 */
  49. void findDeleteCompareItem(const QList<CompareItemInfo_t>& srcItems, const QList<CompareItemInfo_t>& nowItems, QList<int>& deleteIDs);
  50. /* 查找修改的对比项 */
  51. void findUpdateCompareItem(const QList<CompareItemInfo_t>& srcItems, const QList<CompareItemInfo_t>& nowItems,
  52. QList<CompareItemInfo_t>& baseUpdateItems, QList<CompareItemInfo_t>& roadUpdateItems);
  53. /* 恢复基础信息 */
  54. void restoreBasicSettingInfo();
  55. /* 恢复对比项信息 */
  56. bool restoreCompareItemInfo();
  57. private:
  58. Ui::BasicWidget *ui;
  59. std::shared_ptr<spdlog::logger> m_logger = nullptr;
  60. FromWebAPI* m_fromWebAPI = nullptr;
  61. bool m_isModify = false; /* 是否有修改过的设置 */
  62. BaseConfig_t m_baseConfig; /* 基础配置信息 */
  63. };
  64. #endif // BASICWIDGET_H