|
- #pragma once
-
- #include <string>
-
- class ProjectService;
-
- // HMI 页面跳转失败分类
- enum class HmiNavigationError
- {
- None,
- NoPages,
- PageNotFound
- };
-
- // 页面跳转结果;成功时 pageId 是当前页 ID
- struct HmiNavigationResult
- {
- bool succeeded = false;
- HmiNavigationError error = HmiNavigationError::None;
- std::string message;
- std::string pageId;
- };
-
- // 管理运行态当前页面,不直接操作 Qt 页面控件
- class HmiNavigationService
- {
- public:
- explicit HmiNavigationService(ProjectService &project_service);
-
- // 进入工程初始页面
- HmiNavigationResult start();
- // 跳转到指定页面;目标不存在时保留原页面
- HmiNavigationResult navigateTo(const std::string &page_id);
- // 结束运行会话并清空当前页
- void stop();
- // 返回当前运行页面 ID,未启动时为空
- const std::string ¤tPageId() const;
-
- private:
- ProjectService &project_service_;
- std::string current_page_id_;
- };
|