feat: 完善结果回放期间的控制条锁定

- 统一使用 PlaybackController 播放状态控制底部控件
- 播放期间禁用属性、颜色、时间、帧导航和动画设置
- 保持暂停按钮可用并持续同步当前播放时间
- 暂停、自然结束或播放失败后按当前帧恢复控件状态
- 为手动操作槽增加播放状态防御,避免排队信号中断回放
- 同步颜色设置和动画设置入口的行为注释
feature/nmNum-postprocessing-view-20260910
lh 2 weeks ago
parent b565039240
commit 8ff688e0e6

@ -53,7 +53,7 @@ private slots:
void onPropertyIndexChanged(int nIndex); void onPropertyIndexChanged(int nIndex);
/** @brief 用户选择时间时提交 itemData 中的零基帧。 */ /** @brief 用户选择时间时提交 itemData 中的零基帧。 */
void onTimeIndexChanged(int nIndex); void onTimeIndexChanged(int nIndex);
/** @brief 暂停后打开当前属性的 Saphir 风格颜色设置对话框。 */ /** @brief 仅在非播放状态下打开当前属性的 Saphir 风格颜色设置对话框。 */
void onColorSettingsClicked(); void onColorSettingsClicked();
/** @brief 响应首帧按钮。 */ /** @brief 响应首帧按钮。 */
void onFirstFrameClicked(); void onFirstFrameClicked();
@ -65,7 +65,7 @@ private slots:
void onLastFrameClicked(); void onLastFrameClicked();
/** @brief 切换播放或暂停图标对应的回放状态。 */ /** @brief 切换播放或暂停图标对应的回放状态。 */
void onPlayPauseClicked(); void onPlayPauseClicked();
/** @brief 暂停后打开当前窗口独立的动画设置对话框。 */ /** @brief 仅在非播放状态下打开当前窗口独立的动画设置对话框。 */
void onAnimationSettingsClicked(); void onAnimationSettingsClicked();
/** @brief 从 Controller getter 重建或刷新控件镜像状态。 */ /** @brief 从 Controller getter 重建或刷新控件镜像状态。 */
void refreshFromController(); void refreshFromController();

@ -108,7 +108,8 @@ nmWxPebiResultControlBar::getPlaybackController() const
void nmWxPebiResultControlBar::onPropertyIndexChanged(int nIndex) void nmWxPebiResultControlBar::onPropertyIndexChanged(int nIndex)
{ {
if(m_pPlaybackController == nullptr || nIndex < 0) { if(m_pPlaybackController == nullptr ||
m_pPlaybackController->isPlaying() || nIndex < 0) {
return; return;
} }
if(m_pPlaybackController->selectProperty( if(m_pPlaybackController->selectProperty(
@ -119,7 +120,8 @@ void nmWxPebiResultControlBar::onPropertyIndexChanged(int nIndex)
void nmWxPebiResultControlBar::onTimeIndexChanged(int nIndex) void nmWxPebiResultControlBar::onTimeIndexChanged(int nIndex)
{ {
if(m_pPlaybackController == nullptr || nIndex < 0) { if(m_pPlaybackController == nullptr ||
m_pPlaybackController->isPlaying() || nIndex < 0) {
return; return;
} }
if(m_pPlaybackController->selectFrame( if(m_pPlaybackController->selectFrame(
@ -131,12 +133,11 @@ void nmWxPebiResultControlBar::onTimeIndexChanged(int nIndex)
void nmWxPebiResultControlBar::onColorSettingsClicked() void nmWxPebiResultControlBar::onColorSettingsClicked()
{ {
if(m_pPlaybackController == nullptr || m_pSceneController == nullptr || if(m_pPlaybackController == nullptr || m_pSceneController == nullptr ||
m_pPlaybackController->isPlaying() ||
!m_pSceneController->hasSnapshot()) { !m_pSceneController->hasSnapshot()) {
return; return;
} }
// 打开任何结果设置都属于手动操作;关闭后不自动恢复播放。
m_pPlaybackController->pause();
nmWxPebiResultColorScaleSettingsDlg oDialog( nmWxPebiResultColorScaleSettingsDlg oDialog(
m_pSceneController, this); m_pSceneController, this);
connect(&oDialog, SIGNAL(displaySettingsApplied()), connect(&oDialog, SIGNAL(displaySettingsApplied()),
@ -148,6 +149,10 @@ void nmWxPebiResultControlBar::onColorSettingsClicked()
void nmWxPebiResultControlBar::onFirstFrameClicked() void nmWxPebiResultControlBar::onFirstFrameClicked()
{ {
if(m_pPlaybackController == nullptr ||
m_pPlaybackController->isPlaying()) {
return;
}
if(m_pPlaybackController->selectFirstFrame()) { if(m_pPlaybackController->selectFirstFrame()) {
emit operationSucceeded(); emit operationSucceeded();
} }
@ -155,6 +160,10 @@ void nmWxPebiResultControlBar::onFirstFrameClicked()
void nmWxPebiResultControlBar::onPreviousFrameClicked() void nmWxPebiResultControlBar::onPreviousFrameClicked()
{ {
if(m_pPlaybackController == nullptr ||
m_pPlaybackController->isPlaying()) {
return;
}
if(m_pPlaybackController->selectPreviousFrame()) { if(m_pPlaybackController->selectPreviousFrame()) {
emit operationSucceeded(); emit operationSucceeded();
} }
@ -162,6 +171,10 @@ void nmWxPebiResultControlBar::onPreviousFrameClicked()
void nmWxPebiResultControlBar::onNextFrameClicked() void nmWxPebiResultControlBar::onNextFrameClicked()
{ {
if(m_pPlaybackController == nullptr ||
m_pPlaybackController->isPlaying()) {
return;
}
if(m_pPlaybackController->selectNextFrame()) { if(m_pPlaybackController->selectNextFrame()) {
emit operationSucceeded(); emit operationSucceeded();
} }
@ -169,6 +182,10 @@ void nmWxPebiResultControlBar::onNextFrameClicked()
void nmWxPebiResultControlBar::onLastFrameClicked() void nmWxPebiResultControlBar::onLastFrameClicked()
{ {
if(m_pPlaybackController == nullptr ||
m_pPlaybackController->isPlaying()) {
return;
}
if(m_pPlaybackController->selectLastFrame()) { if(m_pPlaybackController->selectLastFrame()) {
emit operationSucceeded(); emit operationSucceeded();
} }
@ -176,6 +193,9 @@ void nmWxPebiResultControlBar::onLastFrameClicked()
void nmWxPebiResultControlBar::onPlayPauseClicked() void nmWxPebiResultControlBar::onPlayPauseClicked()
{ {
if(m_pPlaybackController == nullptr) {
return;
}
if(m_pPlaybackController->togglePlayback()) { if(m_pPlaybackController->togglePlayback()) {
emit operationSucceeded(); emit operationSucceeded();
} }
@ -183,8 +203,10 @@ void nmWxPebiResultControlBar::onPlayPauseClicked()
void nmWxPebiResultControlBar::onAnimationSettingsClicked() void nmWxPebiResultControlBar::onAnimationSettingsClicked()
{ {
// 打开设置属于明确的手动操作;关闭对话框后不自动恢复播放。 if(m_pPlaybackController == nullptr ||
m_pPlaybackController->pause(); m_pPlaybackController->isPlaying()) {
return;
}
nmWxPebiResultAnimationSettingsDlg oDialog( nmWxPebiResultAnimationSettingsDlg oDialog(
m_pPlaybackController->getPlaybackSpeed(), m_pPlaybackController->getPlaybackSpeed(),
m_pPlaybackController->isLoopEnabled(), this); m_pPlaybackController->isLoopEnabled(), this);
@ -254,9 +276,6 @@ void nmWxPebiResultControlBar::refreshFromController()
const bool bPropertyBlocked = m_pPropertyCombo->blockSignals(true); const bool bPropertyBlocked = m_pPropertyCombo->blockSignals(true);
m_pPropertyCombo->setCurrentIndex(nPropertyIndex); m_pPropertyCombo->setCurrentIndex(nPropertyIndex);
m_pPropertyCombo->blockSignals(bPropertyBlocked); m_pPropertyCombo->blockSignals(bPropertyBlocked);
m_pPropertyCombo->setEnabled(true);
m_pColorSettingsButton->setEnabled(true);
const bool bTimeDependent = const bool bTimeDependent =
m_pPlaybackController->isPropertyTimeDependent(sPropertyId); m_pPlaybackController->isPropertyTimeDependent(sPropertyId);
const int nFrameCount = bTimeDependent const int nFrameCount = bTimeDependent
@ -283,19 +302,23 @@ void nmWxPebiResultControlBar::refreshFromController()
const bool bHasTime = bHasCompleteTimeList; const bool bHasTime = bHasCompleteTimeList;
const bool bHasMultipleFrames = bHasCompleteTimeList && const bool bHasMultipleFrames = bHasCompleteTimeList &&
nFrameCount > 1; nFrameCount > 1;
m_pTimeCombo->setEnabled(bHasTime); const bool bPlaying = m_pPlaybackController->isPlaying();
m_pPropertyCombo->setEnabled(!bPlaying);
m_pColorSettingsButton->setEnabled(!bPlaying);
m_pTimeCombo->setEnabled(bHasTime && !bPlaying);
m_pFirstButton->setEnabled( m_pFirstButton->setEnabled(
bHasMultipleFrames && nCurrentFrame > 0); bHasMultipleFrames && nCurrentFrame > 0 && !bPlaying);
m_pPreviousButton->setEnabled( m_pPreviousButton->setEnabled(
bHasMultipleFrames && nCurrentFrame > 0); bHasMultipleFrames && nCurrentFrame > 0 && !bPlaying);
m_pNextButton->setEnabled( m_pNextButton->setEnabled(
bHasMultipleFrames && nCurrentFrame < nFrameCount - 1); bHasMultipleFrames &&
nCurrentFrame < nFrameCount - 1 && !bPlaying);
m_pLastButton->setEnabled( m_pLastButton->setEnabled(
bHasMultipleFrames && nCurrentFrame < nFrameCount - 1); bHasMultipleFrames &&
nCurrentFrame < nFrameCount - 1 && !bPlaying);
m_pPlayPauseButton->setEnabled(bHasMultipleFrames); m_pPlayPauseButton->setEnabled(bHasMultipleFrames);
m_pSettingsButton->setEnabled(bHasMultipleFrames); m_pSettingsButton->setEnabled(bHasMultipleFrames && !bPlaying);
const bool bPlaying = m_pPlaybackController->isPlaying();
m_pPlayPauseButton->setIcon(QIcon(resultControlIconPath( m_pPlayPauseButton->setIcon(QIcon(resultControlIconPath(
bPlaying ? QString::fromLatin1("NmStopAnimation.png") bPlaying ? QString::fromLatin1("NmStopAnimation.png")
: QString::fromLatin1("NmStartAnimation.png")))); : QString::fromLatin1("NmStartAnimation.png"))));

Loading…
Cancel
Save