basicwidget.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. private:
  34. /* 判断基础信息有没有修改 */
  35. bool isDataChangedBasicInfo();
  36. /* 判断对比项信息有没有修改 */
  37. bool isDataChangedCompareItem();
  38. /* 设置声卡信息 */
  39. void setSoundCardInfo();
  40. /* 保存基础信息 */
  41. bool saveBasicSettingInfo();
  42. /* 保存对比项信息 */
  43. bool saveCompareItemInfo();
  44. /* 查找新增的对比项信息 */
  45. void findInsertCompareItem(const QList<CompareItemInfo_t>& srcItems, const QList<CompareItemInfo_t>& nowItems, QList<CompareItemInfo_t>& insertItems);
  46. /* 查找删除的对比项信息 */
  47. void findDeleteCompareItem(const QList<CompareItemInfo_t>& srcItems, const QList<CompareItemInfo_t>& nowItems, QList<int>& deleteIDs);
  48. /* 查找修改的对比项 */
  49. void findUpdateCompareItem(const QList<CompareItemInfo_t>& srcItems, const QList<CompareItemInfo_t>& nowItems,
  50. QList<CompareItemInfo_t>& baseUpdateItems, QList<CompareItemInfo_t>& roadUpdateItems);
  51. /* 恢复基础信息 */
  52. void restoreBasicSettingInfo();
  53. /* 恢复对比项信息 */
  54. bool restoreCompareItemInfo();
  55. private:
  56. Ui::BasicWidget *ui;
  57. std::shared_ptr<spdlog::logger> m_logger = nullptr;
  58. FromWebAPI* m_fromWebAPI = nullptr;
  59. bool m_isModify = false; /* 是否有修改过的设置 */
  60. BaseConfig_t m_baseConfig; /* 基础配置信息 */
  61. };
  62. #endif // BASICWIDGET_H