Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
replay_manager.h
Go to the documentation of this file.
1#ifndef COCKATRICE_REPLAY_MANAGER_H
2#define COCKATRICE_REPLAY_MANAGER_H
3
5
6#include <QList>
7#include <QObject>
8#include <QtGlobal>
9#include <qtmetamacros.h>
10
11class GameReplay;
12class QTimer;
14
18class ReplayManager : public QObject
19{
20 Q_OBJECT
21
28
32
33 QTimer *replayTimer;
35
36 qreal timeScaleFactor = 1.0;
37 bool skipEmptySections = false;
38
42 int currentEvent = 0;
43
44 void skipToTime(int newTime, bool doRewindBuffering);
45 void handleBackwardsSkip(bool doRewindBuffering);
46 void processRewind();
47 void processNewEvents(PlaybackMode playbackMode);
49
50private slots:
51 void replayTimerTimeout();
52
53public:
54 static constexpr int SMALL_SKIP_MS = 1000;
55 static constexpr int BIG_SKIP_MS = 10000;
56
61 explicit ReplayManager(QObject *parent, GameReplay *replay);
62
63 ~ReplayManager() override;
64
66 {
67 return replayTimeline;
68 }
69
70 void setTimeScaleFactor(qreal _timeScaleFactor);
71 void setSkipEmptySections(bool value);
72
73public slots:
74 void startReplay();
75 void stopReplay();
76 void setTime(int time);
77 void skipByAmount(int amount); // use a negative amount to skip backwards
78
79signals:
80 void timeChanged(int time);
81 void eventReplayed(const GameEventContainer &cont, EventProcessingOptions options);
83 void rewound();
84};
85
86#endif // COCKATRICE_REPLAY_MANAGER_H
Definition remote_connection_controller.h:20
bool skipEmptySections
Definition replay_manager.h:37
void processNewEvents(PlaybackMode playbackMode)
Processes all unprocessed events up to the current time.
Definition replay_manager.cpp:137
void replayFinished()
PlaybackMode
Definition replay_manager.h:23
@ BACKWARD_SKIP
Definition replay_manager.h:26
@ NORMAL_PLAYBACK
Definition replay_manager.h:24
@ FORWARD_SKIP
Definition replay_manager.h:25
GameReplay * replay
Definition replay_manager.h:29
static constexpr int SMALL_SKIP_MS
Definition replay_manager.h:54
QTimer * rewindBufferingTimer
Definition replay_manager.h:34
void handleSkipEmptySection()
Definition replay_manager.cpp:181
const QList< int > & getReplayTimeline() const
Definition replay_manager.h:65
void timeChanged(int time)
int maxTime
Definition replay_manager.h:31
qreal timeScaleFactor
Definition replay_manager.h:36
void skipToTime(int newTime, bool doRewindBuffering)
Definition replay_manager.cpp:68
static constexpr int BIG_SKIP_MS
Definition replay_manager.h:55
int currentEvent
current event's index
Definition replay_manager.h:42
void skipByAmount(int amount)
Definition replay_manager.cpp:239
QTimer * replayTimer
Definition replay_manager.h:33
void handleBackwardsSkip(bool doRewindBuffering)
Handles a backwards skip in the replay timeline.
Definition replay_manager.cpp:98
void processRewind()
Definition replay_manager.cpp:112
void setSkipEmptySections(bool value)
Definition replay_manager.cpp:218
void setTimeScaleFactor(qreal _timeScaleFactor)
Definition replay_manager.cpp:211
void setTime(int time)
Definition replay_manager.cpp:233
int currentProcessedTime
Definition replay_manager.h:40
void replayTimerTimeout()
Definition replay_manager.cpp:123
int currentVisualTime
time currently displayed by the timeline
Definition replay_manager.h:39
void startReplay()
Definition replay_manager.cpp:223
void stopReplay()
Definition replay_manager.cpp:228
void eventReplayed(const GameEventContainer &cont, EventProcessingOptions options)
ReplayManager(QObject *parent, GameReplay *replay)
Definition replay_manager.cpp:49
QList< int > replayTimeline
timestamp of each event, with the indexes corresponding
Definition replay_manager.h:30
Definition game_event_container.proto:4
Definition game_replay.proto:4