Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
ReplayManager Class Reference

This class handles all logic to do with playing back replays. More...

#include <replay_manager.h>

Inheritance diagram for ReplayManager:
[legend]
Collaboration diagram for ReplayManager:
[legend]

Public Slots

void startReplay ()
void stopReplay ()
void setTime (int time)
void skipByAmount (int amount)

Signals

void timeChanged (int time)
void eventReplayed (const GameEventContainer &cont, EventProcessingOptions options)
void replayFinished ()
void rewound ()

Public Member Functions

 ReplayManager (QObject *parent, GameReplay *replay)
 ~ReplayManager () override
const QList< int > & getReplayTimeline () const
void setTimeScaleFactor (qreal _timeScaleFactor)
void setSkipEmptySections (bool value)

Static Public Attributes

static constexpr int SMALL_SKIP_MS = 1000
static constexpr int BIG_SKIP_MS = 10000

Private Types

enum  PlaybackMode { NORMAL_PLAYBACK , FORWARD_SKIP , BACKWARD_SKIP }

Private Slots

void replayTimerTimeout ()

Private Member Functions

void skipToTime (int newTime, bool doRewindBuffering)
void handleBackwardsSkip (bool doRewindBuffering)
 Handles a backwards skip in the replay timeline.
void processRewind ()
void processNewEvents (PlaybackMode playbackMode)
 Processes all unprocessed events up to the current time.
void handleSkipEmptySection ()

Private Attributes

GameReplayreplay
QList< int > replayTimeline
 timestamp of each event, with the indexes corresponding
int maxTime
QTimer * replayTimer
QTimer * rewindBufferingTimer
qreal timeScaleFactor = 1.0
bool skipEmptySections = false
int currentVisualTime = 0
 time currently displayed by the timeline
int currentProcessedTime = 0
int currentEvent = 0
 current event's index

Detailed Description

This class handles all logic to do with playing back replays.

Member Enumeration Documentation

◆ PlaybackMode

Enumerator
NORMAL_PLAYBACK 
FORWARD_SKIP 
BACKWARD_SKIP 

Constructor & Destructor Documentation

◆ ReplayManager()

ReplayManager::ReplayManager ( QObject * parent,
GameReplay * replay )
explicit
Parameters
parentThe parent QObject
replayCannot be null. Takes ownership of the object.
Here is the call graph for this function:

◆ ~ReplayManager()

ReplayManager::~ReplayManager ( )
override

Member Function Documentation

◆ eventReplayed

void ReplayManager::eventReplayed ( const GameEventContainer & cont,
EventProcessingOptions options )
signal
Here is the caller graph for this function:

◆ getReplayTimeline()

const QList< int > & ReplayManager::getReplayTimeline ( ) const
inline

◆ handleBackwardsSkip()

void ReplayManager::handleBackwardsSkip ( bool doRewindBuffering)
private

Handles a backwards skip in the replay timeline.

Parameters
doRewindBufferingWhen true, if multiple backward skips are made in quick succession, only a single rewind is processed at the end. When false, the backwards skip will always cause an immediate rewind.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSkipEmptySection()

void ReplayManager::handleSkipEmptySection ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processNewEvents()

void ReplayManager::processNewEvents ( PlaybackMode playbackMode)
private

Processes all unprocessed events up to the current time.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processRewind()

void ReplayManager::processRewind ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ replayFinished

void ReplayManager::replayFinished ( )
signal
Here is the caller graph for this function:

◆ replayTimerTimeout

void ReplayManager::replayTimerTimeout ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rewound

void ReplayManager::rewound ( )
signal
Here is the caller graph for this function:

◆ setSkipEmptySections()

void ReplayManager::setSkipEmptySections ( bool value)
Here is the caller graph for this function:

◆ setTime

void ReplayManager::setTime ( int time)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTimeScaleFactor()

void ReplayManager::setTimeScaleFactor ( qreal _timeScaleFactor)

◆ skipByAmount

void ReplayManager::skipByAmount ( int amount)
slot
Here is the call graph for this function:

◆ skipToTime()

void ReplayManager::skipToTime ( int newTime,
bool doRewindBuffering )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ startReplay

void ReplayManager::startReplay ( )
slot

◆ stopReplay

void ReplayManager::stopReplay ( )
slot

◆ timeChanged

void ReplayManager::timeChanged ( int time)
signal
Here is the caller graph for this function:

Member Data Documentation

◆ BIG_SKIP_MS

int ReplayManager::BIG_SKIP_MS = 10000
staticconstexpr

◆ currentEvent

int ReplayManager::currentEvent = 0
private

current event's index

◆ currentProcessedTime

int ReplayManager::currentProcessedTime = 0
private

time that events are currently processed up to. Could differ from visual time due to rewind buffering

◆ currentVisualTime

int ReplayManager::currentVisualTime = 0
private

time currently displayed by the timeline

◆ maxTime

int ReplayManager::maxTime
private

◆ replay

GameReplay* ReplayManager::replay
private

◆ replayTimeline

QList<int> ReplayManager::replayTimeline
private

timestamp of each event, with the indexes corresponding

◆ replayTimer

QTimer* ReplayManager::replayTimer
private

◆ rewindBufferingTimer

QTimer* ReplayManager::rewindBufferingTimer
private

◆ skipEmptySections

bool ReplayManager::skipEmptySections = false
private

◆ SMALL_SKIP_MS

int ReplayManager::SMALL_SKIP_MS = 1000
staticconstexpr

◆ timeScaleFactor

qreal ReplayManager::timeScaleFactor = 1.0
private

The documentation for this class was generated from the following files: