综合平台编程器项目的远程存储
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

57 line
1.6 KiB

  1. /**
  2. * @file alarm_configuration_dialog.h
  3. * @brief 定义报警定义配置对话框
  4. * @version 1.0.0
  5. * @author suyu
  6. * @date 2026-08-22
  7. */
  8. #pragma once
  9. #include <QDialog>
  10. #include <memory>
  11. #include <string>
  12. namespace Ui {
  13. class AlarmConfigurationDialog;
  14. }
  15. class AlarmEditorService;
  16. struct AlarmDefinition;
  17. /** 报警定义编辑对话框;保存、更新和删除都委托 AlarmEditorService */
  18. class AlarmConfigurationDialog final : public QDialog
  19. {
  20. public:
  21. /** 创建报警配置对话框并绑定报警编辑服务 */
  22. explicit AlarmConfigurationDialog(
  23. AlarmEditorService &service,
  24. QWidget *parent = nullptr);
  25. /** 释放 Designer 界面对象 */
  26. ~AlarmConfigurationDialog() override;
  27. private:
  28. /** 刷新左侧列表并尽量恢复原选中项 */
  29. void reloadDefinitions(const std::string &selected_id = {});
  30. /** 将当前选中报警加载到编辑区 */
  31. void loadSelectedDefinition();
  32. /** 根据报警类型更新条件输入项 */
  33. void updateConditionOptions();
  34. /** 新增一条报警定义 */
  35. void addDefinition();
  36. /** 更新当前选中的报警定义 */
  37. void updateDefinition();
  38. /** 删除当前选中的报警定义 */
  39. void removeDefinition();
  40. /** 从输入框读取报警定义 */
  41. AlarmDefinition definitionFromInputs() const;
  42. /** 返回当前选中的报警标识 */
  43. std::string selectedId() const;
  44. /** Qt Designer 生成的界面对象 */
  45. std::unique_ptr<Ui::AlarmConfigurationDialog> ui_;
  46. /** 报警定义服务,不由对话框拥有 */
  47. AlarmEditorService &service_;
  48. };