Do not open card reveal windows when skipping in replays (#5157)

* create EventProcessingOption QFlag

* pass EventProcessingOption all the way down

* implement reveal skipping logic
This commit is contained in:
RickyRister 2024-11-08 17:06:23 -08:00 committed by GitHub
parent dd04c610ec
commit e894e78346
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 58 additions and 22 deletions

View file

@ -93,7 +93,7 @@ void ReplayTimelineWidget::skipToTime(int newTime, bool doRewindBuffering)
if (isBackwardsSkip) {
handleBackwardsSkip(doRewindBuffering);
} else {
processNewEvents();
processNewEvents(FORWARD_SKIP);
}
update();
@ -130,7 +130,7 @@ void ReplayTimelineWidget::processRewind()
// process the rewind
currentEvent = 0;
emit rewound();
processNewEvents();
processNewEvents(BACKWARD_SKIP);
}
QSize ReplayTimelineWidget::sizeHint() const
@ -147,17 +147,24 @@ void ReplayTimelineWidget::replayTimerTimeout()
{
currentTime += 200;
processNewEvents();
processNewEvents(NORMAL_PLAYBACK);
if (!(currentTime % 1000))
update();
}
/// Processes all unprocessed events up to the current time.
void ReplayTimelineWidget::processNewEvents()
void ReplayTimelineWidget::processNewEvents(PlaybackMode playbackMode)
{
while ((currentEvent < replayTimeline.size()) && (replayTimeline[currentEvent] < currentTime)) {
emit processNextEvent();
Player::EventProcessingOptions options;
// backwards skip => always skip reveal windows
// forwards skip => skip reveal windows that don't happen within 10 seconds of the target
if (playbackMode == BACKWARD_SKIP || currentTime - replayTimeline[currentEvent] > 10000)
options |= Player::EventProcessingOption::SKIP_REVEAL_WINDOW;
emit processNextEvent(options);
++currentEvent;
}
if (currentEvent == replayTimeline.size()) {