diff --git a/Bin/Config/Lang/cn/nmNum_cn.qm b/Bin/Config/Lang/cn/nmNum_cn.qm index 75bee651..08e3a20f 100644 Binary files a/Bin/Config/Lang/cn/nmNum_cn.qm and b/Bin/Config/Lang/cn/nmNum_cn.qm differ diff --git a/Bin/Config/Lang/cn/nmNum_cn.ts b/Bin/Config/Lang/cn/nmNum_cn.ts index 513cea33..07006ac0 100644 --- a/Bin/Config/Lang/cn/nmNum_cn.ts +++ b/Bin/Config/Lang/cn/nmNum_cn.ts @@ -2836,7 +2836,7 @@ Reason: %1 Result playback is unavailable.结果回放不可用。 The selected result property is unavailable.所选结果属性不可用。 The selected result frame is unavailable.所选结果帧不可用。 - Playback speed must be between 1 and 60 steps per second.回放速度必须介于每秒 1 到 60 步之间。 + Playback speed must be a positive integer.播放速度必须为正整数。 nmWxPebiResultControlBar diff --git a/Include/nmNum/nmSubWxs/nmPebiResultPlaybackController.h b/Include/nmNum/nmSubWxs/nmPebiResultPlaybackController.h index 771a4552..09f2f25c 100644 --- a/Include/nmNum/nmSubWxs/nmPebiResultPlaybackController.h +++ b/Include/nmNum/nmSubWxs/nmPebiResultPlaybackController.h @@ -22,11 +22,10 @@ class NM_SUB_WXS_EXPORT nmPebiResultPlaybackController : public QObject Q_OBJECT public: - /** @brief 回放速度的合法下限、上限和窗口默认值,单位均为步/秒。 */ + /** @brief 回放速度的合法下限和窗口默认值,单位均为步/秒。 */ enum { MinimumPlaybackSpeed = 1, - MaximumPlaybackSpeed = 60, DefaultPlaybackSpeed = 5 }; diff --git a/Include/nmNum/nmSubWxs/nmWxPebiResultAnimationSettingsDlg.h b/Include/nmNum/nmSubWxs/nmWxPebiResultAnimationSettingsDlg.h index 7409e9aa..6888c76b 100644 --- a/Include/nmNum/nmSubWxs/nmWxPebiResultAnimationSettingsDlg.h +++ b/Include/nmNum/nmSubWxs/nmWxPebiResultAnimationSettingsDlg.h @@ -6,6 +6,7 @@ #include class QCheckBox; +class QShowEvent; class QSpinBox; /** @@ -22,7 +23,7 @@ class NM_SUB_WXS_EXPORT nmWxPebiResultAnimationSettingsDlg public: /** * @brief 使用当前窗口偏好初始化临时编辑值。 - * @param nStepsPerSecond 初始速度,防御性限制到 1~60 步/秒。 + * @param nStepsPerSecond 初始速度,防御性限制为正整数步/秒。 * @param bLoopEnabled 初始循环开关。 * @param pParent 所属窗口,用于 Qt 对象树和模态定位。 */ @@ -38,10 +39,14 @@ public: /** @brief 返回尚未提交的循环播放选择。 */ bool isLoopEnabled() const; +protected: + /** @brief 显示后聚焦并延迟全选当前速度,便于直接覆盖输入。 */ + virtual void showEvent(QShowEvent* pEvent); + private: Q_DISABLE_COPY(nmWxPebiResultAnimationSettingsDlg) - /** @brief 限制在 1~60 步/秒的速度输入框。 */ + /** @brief 限制为正整数步/秒的速度输入框。 */ QSpinBox* m_pSpeedSpin; /** @brief 是否在末帧之后回到第 0 帧。 */ QCheckBox* m_pLoopCheck; diff --git a/Src/nmNum/nmSubWxs/nmPebiResultPlaybackController.cpp b/Src/nmNum/nmSubWxs/nmPebiResultPlaybackController.cpp index 427bbb35..9365579d 100644 --- a/Src/nmNum/nmSubWxs/nmPebiResultPlaybackController.cpp +++ b/Src/nmNum/nmSubWxs/nmPebiResultPlaybackController.cpp @@ -20,7 +20,7 @@ static const char* const s_pPlaybackTranslationMarkers[] = QT_TRANSLATE_NOOP("nmPebiResultPlaybackController", "The selected result frame is unavailable."), QT_TRANSLATE_NOOP("nmPebiResultPlaybackController", - "Playback speed must be between 1 and 60 steps per second.") + "Playback speed must be a positive integer.") }; QString playbackText(const char* pText) @@ -244,11 +244,10 @@ bool nmPebiResultPlaybackController::setPlaybackSettings( int nStepsPerSecond, bool bLoopEnabled) { - if(nStepsPerSecond < MinimumPlaybackSpeed || - nStepsPerSecond > MaximumPlaybackSpeed) { + if(nStepsPerSecond < MinimumPlaybackSpeed) { // 公开接口不能依赖设置对话框兜底;非法参数也执行统一失败收尾。 return finishFailedOperation(playbackText( - "Playback speed must be between 1 and 60 steps per second.")); + "Playback speed must be a positive integer.")); } if(m_nStepsPerSecond == nStepsPerSecond && m_bLoopEnabled == bLoopEnabled) { diff --git a/Src/nmNum/nmSubWxs/nmWxPebiResultAnimationSettingsDlg.cpp b/Src/nmNum/nmSubWxs/nmWxPebiResultAnimationSettingsDlg.cpp index 222ec490..47b55c38 100644 --- a/Src/nmNum/nmSubWxs/nmWxPebiResultAnimationSettingsDlg.cpp +++ b/Src/nmNum/nmSubWxs/nmWxPebiResultAnimationSettingsDlg.cpp @@ -3,12 +3,32 @@ #include "nmPebiResultPlaybackController.h" #include +#include #include #include +#include +#include +#include +#include +#include #include +#include #include #include +#include + +namespace { + +QString resultAnimationIconPath(const QString& sFileName) +{ + const QString sApplicationDir = QCoreApplication::applicationDirPath(); + return sApplicationDir.section('/', 0, -2) + + "/Res/Icon/" + sFileName; +} + +} + nmWxPebiResultAnimationSettingsDlg:: nmWxPebiResultAnimationSettingsDlg( int nStepsPerSecond, @@ -19,17 +39,16 @@ nmWxPebiResultAnimationSettingsDlg( m_pLoopCheck(new QCheckBox(tr("Loop enabled"), this)) { setWindowTitle(tr("Animation settings")); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setModal(true); m_pSpeedSpin->setRange( nmPebiResultPlaybackController::MinimumPlaybackSpeed, - nmPebiResultPlaybackController::MaximumPlaybackSpeed); - m_pSpeedSpin->setValue(qBound( + INT_MAX); + m_pSpeedSpin->setValue(qMax( static_cast( nmPebiResultPlaybackController::MinimumPlaybackSpeed), - nStepsPerSecond, - static_cast( - nmPebiResultPlaybackController::MaximumPlaybackSpeed))); + nStepsPerSecond)); m_pLoopCheck->setChecked(bLoopEnabled); QFormLayout* pFormLayout = new QFormLayout(); @@ -39,6 +58,21 @@ nmWxPebiResultAnimationSettingsDlg( QDialogButtonBox* pButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); + QPushButton* pOkButton = pButtonBox->button(QDialogButtonBox::Ok); + QPushButton* pCancelButton = + pButtonBox->button(QDialogButtonBox::Cancel); + const QSize oButtonIconSize(16, 16); + pOkButton->setIcon(QIcon(resultAnimationIconPath( + QString::fromLatin1("OK.png")))); + pCancelButton->setIcon(QIcon(resultAnimationIconPath( + QString::fromLatin1("Cancel.png")))); + pOkButton->setIconSize(oButtonIconSize); + pCancelButton->setIconSize(oButtonIconSize); + pOkButton->setMinimumWidth(72); + pCancelButton->setMinimumWidth(72); + if(pButtonBox->layout() != nullptr) { + pButtonBox->layout()->setSpacing(6); + } connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())); @@ -62,3 +96,10 @@ bool nmWxPebiResultAnimationSettingsDlg::isLoopEnabled() const { return m_pLoopCheck->isChecked(); } + +void nmWxPebiResultAnimationSettingsDlg::showEvent(QShowEvent* pEvent) +{ + QDialog::showEvent(pEvent); + m_pSpeedSpin->setFocus(Qt::OtherFocusReason); + QTimer::singleShot(0, m_pSpeedSpin, SLOT(selectAll())); +}