basicwidget.h 1.9 KB

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