You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/nmNum/nmSubWxs/nmWxPebiResultControlBar.h

140 lines
6.2 KiB
C

#ifndef NMWXPEBIRESULTCONTROLBAR_H
#define NMWXPEBIRESULTCONTROLBAR_H
#include "nmSubWxs_global.h"
#include <QStringList>
#include <QWidget>
#include <QtGlobal>
class QAction;
class QComboBox;
class QToolButton;
class QVariant;
class nmPebiResultPlaybackController;
class nmPebiResultSceneController;
/**
* @brief 结果属性选择与时间回放底部控制条。
*
* 控件只镜像 PlaybackController/SceneController 状态,不创建 Renderer、
* Actor、Mapper、Adapter 或任何额外 VTK 管线。
*/
class NM_SUB_WXS_EXPORT nmWxPebiResultControlBar : public QWidget
{
Q_OBJECT
public:
/** @param pSceneController 非所有权指针,必须比控制条生命周期更长。 */
explicit nmWxPebiResultControlBar(
nmPebiResultSceneController* pSceneController,
QWidget* pParent = nullptr);
/** @brief 析构前停止回放,随后由 Qt 对象树释放控制器和子控件。 */
virtual ~nmWxPebiResultControlBar();
/** @brief 立即停止当前窗口播放,保留 Scene 已显示帧。 */
void stopPlayback();
/** @brief 在外部完成 Scene 快照提交或清理后同步全部控件。 */
void synchronizeFromScene();
/**
* @brief 返回本控制条独占的回放控制器。
* @note 仅供组合窗口查询或配置,调用方不得保存到控制条生命周期之外。
*/
nmPebiResultPlaybackController* getPlaybackController() const;
/** @brief 返回工具按钮和结果视图右键菜单共用的动画导出动作。 */
QAction* getExportAnimationAction() const;
/** @brief 设置当前窗口的导出锁定状态并立即刷新全部控件。 */
void setExportInProgress(bool bInProgress);
signals:
/** @brief 一次明确的用户操作已经成功提交,供组合窗口清除旧普通错误。 */
void operationSucceeded();
/** @brief 转发回放控制器错误,供后续组合窗口显示非阻塞提示。 */
void operationFailed(const QString& sError);
/** @brief 用户从共用QAction请求导出当前动态属性。 */
void exportAnimationRequested();
private slots:
/** @brief 用户选择属性时提交稳定属性 ID。 */
void onPropertyIndexChanged(int nIndex);
/** @brief 用户选择时间时提交 itemData 中的零基帧。 */
void onTimeIndexChanged(int nIndex);
/** @brief 仅在非播放状态下打开当前属性的 Saphir 风格颜色设置对话框。 */
void onColorSettingsClicked();
/** @brief 响应首帧按钮。 */
void onFirstFrameClicked();
/** @brief 响应上一帧按钮。 */
void onPreviousFrameClicked();
/** @brief 响应下一帧按钮。 */
void onNextFrameClicked();
/** @brief 响应末帧按钮。 */
void onLastFrameClicked();
/** @brief 切换播放或暂停图标对应的回放状态。 */
void onPlayPauseClicked();
/** @brief 仅在非播放状态下打开当前窗口独立的动画设置对话框。 */
void onAnimationSettingsClicked();
/** @brief 校验本地播放和导出状态后转发动画导出请求。 */
void onExportAnimationTriggered();
/** @brief 从 Controller getter 重建或刷新控件镜像状态。 */
void refreshFromController();
/** @brief 将控制器错误转发给后续组合窗口。 */
void forwardOperationFailure(const QString& sError);
private:
Q_DISABLE_COPY(nmWxPebiResultControlBar)
/** @brief 按固定顺序创建属性、导航、时间、播放和设置控件。 */
void createUi();
/** @brief 按快照属性顺序重建属性项,itemData 保存稳定 ID。 */
void rebuildPropertyItems(const QStringList& listPropertyIds);
/** @brief 按小时制时间轴重建时间项,itemData 保存零基帧。 */
void rebuildTimeItems(const QString& sPropertyId, int nFrameCount);
/** @brief 清空并禁用不适用于静态属性的时间下拉框。 */
void clearTimeItems();
/** @brief 使用 QVariant 精确匹配 ComboBox 的稳定业务数据。 */
int findItemByData(QComboBox* pComboBox,
const QVariant& oData) const;
/** @brief 本控制条独占的 QObject 子对象,负责全部回放业务状态。 */
nmPebiResultPlaybackController* m_pPlaybackController;
/** @brief 已渲染属性、帧和显示设置的唯一真源;本控件不拥有。 */
nmPebiResultSceneController* m_pSceneController;
/** @brief 属性选择框,条目数据保存稳定英文属性 ID。 */
QComboBox* m_pPropertyCombo;
/** @brief 使用固定色带图标打开颜色设置对话框。 */
QToolButton* m_pColorSettingsButton;
/** @brief 跳到第 0 帧的图标按钮。 */
QToolButton* m_pFirstButton;
/** @brief 跳到上一帧的图标按钮。 */
QToolButton* m_pPreviousButton;
/** @brief 小时制时间选择框,条目数据保存零基帧。 */
QComboBox* m_pTimeCombo;
/** @brief 跳到下一帧的图标按钮。 */
QToolButton* m_pNextButton;
/** @brief 跳到末帧的图标按钮。 */
QToolButton* m_pLastButton;
/** @brief 根据回放状态切换开始和停止图形。 */
QToolButton* m_pPlayPauseButton;
/** @brief 打开速度与循环设置对话框。 */
QToolButton* m_pSettingsButton;
/** @brief 工具按钮和右键菜单共用的动画导出动作。 */
QAction* m_pExportAction;
/** @brief 承载共用导出动作的底部图标按钮。 */
QToolButton* m_pExportButton;
/** @brief 当前窗口是否正在执行参数选择、编码或文件发布事务。 */
bool m_bExportInProgress;
/** @brief 当前属性项对应的 Snapshot ID,仅用于避免重复重建 UI。 */
QString m_sDisplayedSnapshotId;
/** @brief 属性和时间列表最近一次完整展示的 Scene 成功绑定序号。 */
quint64 m_nDisplayedBindingRevision;
/** @brief 当前属性框已展示的有序 ID,仅用于避免重复重建 UI。 */
QStringList m_listDisplayedPropertyIds;
/** @brief 当前时间框对应的动态属性 ID。 */
QString m_sDisplayedTimePropertyId;
/** @brief 当前时间框已完整构建的帧数,失败时为 -1。 */
int m_nDisplayedTimeFrameCount;
};
#endif // NMWXPEBIRESULTCONTROLBAR_H