综合平台编程器项目的远程存储
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

105 строки
3.1 KiB

  1. #pragma once
  2. #include "domain/hmi_model.h"
  3. #include "domain/runtime_state.h"
  4. #include <QString>
  5. #include <functional>
  6. #include <string>
  7. class HmiEditorService;
  8. class HmiEditorWidget;
  9. class HmiNavigationService;
  10. class LogicEditorService;
  11. class LogicEditorWidget;
  12. class ProjectService;
  13. class RuntimeModeService;
  14. class RuntimeMonitorWidget;
  15. class QWidget;
  16. class QAction;
  17. namespace Ui {
  18. class MainWindow;
  19. }
  20. // 组织工程树、当前页面/逻辑选择和工程对象的界面刷新
  21. class ProjectWorkspaceController final
  22. {
  23. public:
  24. using ResultReporter = std::function<void(
  25. const QString &action, const QString &message, bool succeeded)>;
  26. using StatusReporter = std::function<void(
  27. const QString &message, int timeout_ms)>;
  28. ProjectWorkspaceController(
  29. QWidget &parent,
  30. Ui::MainWindow &ui,
  31. ProjectService &project_service,
  32. HmiEditorService &hmi_editor_service,
  33. LogicEditorService &logic_editor_service,
  34. RuntimeModeService &runtime_mode_service,
  35. HmiNavigationService &hmi_navigation_service,
  36. HmiEditorWidget &hmi_editor_widget,
  37. LogicEditorWidget &logic_editor_widget,
  38. RuntimeMonitorWidget &runtime_monitor_widget,
  39. std::string &current_hmi_page_id,
  40. std::string &current_logic_id,
  41. std::function<void(const std::string &)> show_control_properties,
  42. std::function<void(const std::string &)> show_logic_properties,
  43. ResultReporter result_reporter,
  44. StatusReporter status_reporter);
  45. void configure();
  46. void refresh();
  47. void updateActions();
  48. void addPage();
  49. void addLogic();
  50. void renameSelectedItem();
  51. void deleteSelectedItem();
  52. void moveSelectedItem(int offset);
  53. void setSelectedPageAsInitial();
  54. void toggleSelectedLogicEnabled();
  55. const std::string &currentHmiPageId() const;
  56. const std::string &currentLogicId() const;
  57. private:
  58. enum class ItemKind
  59. {
  60. Root = 0,
  61. HmiPage = 1,
  62. ControlLogic = 2
  63. };
  64. void handleSelectionChanged();
  65. void reportFailure(
  66. const QString &action, const std::string &message) const;
  67. QWidget &parent_;
  68. Ui::MainWindow &ui_;
  69. ProjectService &project_service_;
  70. HmiEditorService &hmi_editor_service_;
  71. LogicEditorService &logic_editor_service_;
  72. RuntimeModeService &runtime_mode_service_;
  73. HmiNavigationService &hmi_navigation_service_;
  74. HmiEditorWidget &hmi_editor_widget_;
  75. LogicEditorWidget &logic_editor_widget_;
  76. RuntimeMonitorWidget &runtime_monitor_widget_;
  77. std::string &current_hmi_page_id_;
  78. std::string &current_logic_id_;
  79. std::function<void(const std::string &)> show_control_properties_;
  80. std::function<void(const std::string &)> show_logic_properties_;
  81. ResultReporter result_reporter_;
  82. StatusReporter status_reporter_;
  83. QAction *add_page_action_ = nullptr;
  84. QAction *add_logic_action_ = nullptr;
  85. QAction *rename_item_action_ = nullptr;
  86. QAction *delete_item_action_ = nullptr;
  87. QAction *move_item_up_action_ = nullptr;
  88. QAction *move_item_down_action_ = nullptr;
  89. QAction *set_initial_page_action_ = nullptr;
  90. QAction *toggle_logic_enabled_action_ = nullptr;
  91. };