#ifndef NMWXPEBIRESULTANIMATIONEXPORTDLG_H #define NMWXPEBIRESULTANIMATIONEXPORTDLG_H #include "nmSubWxs_global.h" #include "nmPebiResultAnimationExportSettings.h" #include "iDlgBase.h" #include #include #include class QButtonGroup; class QComboBox; class QLabel; class QLineEdit; class QRadioButton; class QSpinBox; /** @brief 编辑当前动态结果的动画导出参数和目标视频文件。 */ class NM_SUB_WXS_EXPORT nmWxPebiResultAnimationExportDlg : public iDlgBase { Q_OBJECT public: /** * @brief 创建动画导出参数对话框。 * @param vecFrameTimesHours 动态属性各帧对应的小时值。 * @param oCurrentViewportSize 当前QVTK视口的像素尺寸。 * @param pParent Qt父窗口。 */ explicit nmWxPebiResultAnimationExportDlg( const QVector& vecFrameTimesHours, const QSize& oCurrentViewportSize, QWidget* pParent = nullptr); /** @brief 返回用户确认后的参数;仅在对话框Accepted后使用。 */ nmPebiResultAnimationExportSettings getSettings() const; /** @brief 返回用户确认后的绝对目标文件路径;仅在对话框Accepted后使用。 */ QString getTargetFilePath() const; private slots: /** @brief 保证结束帧不早于起始帧,并刷新采样上限和摘要。 */ void onFrameRangeChanged(); /** @brief 切换输出尺寸模式并刷新自定义输入可用状态和摘要。 */ void onResolutionPresetChanged(int nPresetId); /** @brief 在输入完成后把自定义宽高向上规范为偶数。 */ void normalizeCustomDimensions(); /** @brief 按当前参数刷新输出帧数和预计时长。 */ void updateSummary(); /** @brief 按稳定扩展名同步已选路径,并清除旧错误。 */ void onVideoFormatChanged(int nIndex); /** @brief 使用当前格式打开不负责覆盖确认的系统保存窗口。 */ void browseTargetFile(); /** @brief 规范化并严格校验参数和目标文件,成功后接受对话框。 */ void acceptSettings(); private: Q_DISABLE_COPY(nmWxPebiResultAnimationExportDlg) /** @brief 对话框内置的输出分辨率来源。 */ enum ResolutionPreset { /** 使用打开对话框时记录的QVTK视口尺寸。 */ Resolution_CurrentView = 0, /** 固定输出1280x720。 */ Resolution_720p, /** 固定输出1920x1080。 */ Resolution_1080p, /** 使用用户输入的宽度和高度。 */ Resolution_Custom }; /** @brief 创建全部控件并建立信号连接。 */ void createUi(); /** @brief 将小时值及其零基帧下标填入起止帧下拉框。 */ void populateFrameItems(); /** @brief 填入正式支持的视频格式及其稳定扩展名。 */ void populateVideoFormats(); /** @brief 从控件收集一份不改变界面状态的规范化参数。 */ nmPebiResultAnimationExportSettings collectSettings() const; /** @brief 返回当前尺寸模式对应的最终偶数输出尺寸。 */ QSize getSelectedOutputSize() const; /** @brief 返回当前格式下拉项保存的不带点扩展名。 */ QString getSelectedVideoExtension() const; /** @brief 返回当前格式对应的单一系统文件过滤器。 */ QString getSelectedVideoFilter() const; /** @brief 按当前格式追加或替换路径扩展名。 */ QString normalizeTargetFilePath(const QString& sPath) const; /** @brief 返回用户目录下与当前格式匹配的建议文件路径。 */ QString getSuggestedTargetFilePath() const; /** @brief 更新只读路径框,并同步完整路径Tooltip。 */ void setTargetFilePath(const QString& sPath); /** @brief 显示一条阻止导出的对话框内错误。 */ void showError(const QString& sError); /** @brief 清空并隐藏旧错误。 */ void clearError(); /** @brief 将像素尺寸限制到2~8192并向上修正为偶数。 */ static int normalizeEvenDimension(int nValue); /** @brief 各零基帧下标对应的时间,单位为小时。 */ QVector m_vecFrameTimesHours; /** @brief 打开对话框时完成回退和偶数规范化的QVTK视口像素尺寸。 */ QSize m_oEffectiveCurrentViewportSize; /** @brief 用户确认后保存的规范化导出参数。 */ nmPebiResultAnimationExportSettings m_oAcceptedSettings; /** @brief 用户确认覆盖后保存的绝对目标视频路径。 */ QString m_sAcceptedTargetFilePath; /** @brief 目标视频帧率输入框。 */ QSpinBox* m_pFpsSpinBox; /** @brief 导出闭区间的起始帧下拉框。 */ QComboBox* m_pStartFrameCombo; /** @brief 导出闭区间的结束帧下拉框。 */ QComboBox* m_pEndFrameCombo; /** @brief 原始结果帧采样间隔输入框。 */ QSpinBox* m_pSamplingIntervalSpinBox; /** @brief 管理四种互斥输出尺寸模式及其稳定枚举ID。 */ QButtonGroup* m_pResolutionButtonGroup; /** @brief 使用冻结后的有效当前画面尺寸。 */ QRadioButton* m_pCurrentSizeRadioButton; /** @brief 使用固定1280x720输出尺寸。 */ QRadioButton* m_p720pRadioButton; /** @brief 使用固定1920x1080输出尺寸。 */ QRadioButton* m_p1080pRadioButton; /** @brief 使用用户输入并规范化后的自定义尺寸。 */ QRadioButton* m_pCustomSizeRadioButton; /** @brief 输出宽度输入框,界面最终显示偶数像素值。 */ QSpinBox* m_pWidthSpinBox; /** @brief 输出高度输入框,界面最终显示偶数像素值。 */ QSpinBox* m_pHeightSpinBox; /** @brief 显示正式视频格式并以itemData保存稳定扩展名。 */ QComboBox* m_pVideoFormatCombo; /** @brief 显示浏览窗口选定的只读目标文件路径。 */ QLineEdit* m_pTargetPathEdit; /** @brief 按当前帧范围和采样间隔计算的输出帧数。 */ QLabel* m_pOutputFrameCountLabel; /** @brief 按输出帧数和帧率计算的预计视频时长。 */ QLabel* m_pEstimatedDurationLabel; /** @brief 参数校验失败时显示的错误文字。 */ QLabel* m_pErrorLabel; }; #endif // NMWXPEBIRESULTANIMATIONEXPORTDLG_H