@@ -97,6 +97,7 @@ void Config::SetDefaults()
|
||||
SetEntryInternal(QStringLiteral("UseSliderLadders"), NodeValue::kBoolean, true);
|
||||
SetEntryInternal(QStringLiteral("ShowWelcomeDialog"), NodeValue::kBoolean, true);
|
||||
SetEntryInternal(QStringLiteral("ShowClipWhileDragging"), NodeValue::kBoolean, true);
|
||||
SetEntryInternal(QStringLiteral("StopPlaybackOnLastFrame"), NodeValue::kBoolean, false);
|
||||
|
||||
SetEntryInternal(QStringLiteral("AutoCacheDelay"), NodeValue::kInt, 1000);
|
||||
|
||||
|
||||
@@ -556,11 +556,12 @@ void ViewerWidget::PlayInternal(int speed, bool in_to_out_only)
|
||||
}
|
||||
|
||||
// If the playhead is beyond the end, restart at 0
|
||||
if (!in_to_out_only && GetTime() >= GetConnectedNode()->GetLength()) {
|
||||
rational last_frame = GetConnectedNode()->GetLength() - timebase();
|
||||
if (!in_to_out_only && GetTime() >= last_frame) {
|
||||
if (speed > 0) {
|
||||
SetTimeAndSignal(0);
|
||||
} else {
|
||||
SetTimeAndSignal(GetConnectedNode()->GetLength());
|
||||
SetTimeAndSignal(last_frame);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1036,6 +1037,17 @@ void ViewerWidget::ShowContextMenu(const QPoint &pos)
|
||||
menu.addSeparator();
|
||||
}
|
||||
|
||||
{
|
||||
QAction *stop_playback_on_last_frame = menu.addAction(tr("Stop Playback On Last Frame"));
|
||||
stop_playback_on_last_frame->setCheckable(true);
|
||||
stop_playback_on_last_frame->setChecked(Config::Current()[QStringLiteral("StopPlaybackOnLastFrame")].toBool());
|
||||
connect(stop_playback_on_last_frame, &QAction::triggered, this, [](bool e){
|
||||
Config::Current()[QStringLiteral("StopPlaybackOnLastFrame")] = e;
|
||||
});
|
||||
|
||||
menu.addSeparator();
|
||||
}
|
||||
|
||||
{
|
||||
QAction* show_waveform_action = menu.addAction(tr("Show Audio Waveform"));
|
||||
show_waveform_action->setCheckable(true);
|
||||
@@ -1164,6 +1176,12 @@ void ViewerWidget::PlaybackTimerUpdate()
|
||||
|
||||
}
|
||||
|
||||
// If we're stopping playback on the last frame rather than after it, subtract our max time
|
||||
// by one timebase unit
|
||||
if (Config::Current()[QStringLiteral("StopPlaybackOnLastFrame")].toBool()) {
|
||||
max_time = qMax(min_time, max_time - timebase());
|
||||
}
|
||||
|
||||
if ((playback_speed_ < 0 && current_time <= min_time)
|
||||
|| (playback_speed_ > 0 && current_time >= max_time)) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user