Cockatrice/cockatrice/src/interface/widgets/replay/replay_widget.h
Lukas Brübach fecf10e2b1 [Replay] Seek to the exact time of an event
Timeline seeks only expose whole timer intervals, so jumping to an event could leave that event unprocessed until the next tick. Add an event-time seek that also applies events at the target timestamp.
2026-11-02 15:40:58 +01:00

64 lines
1.5 KiB
C++

/**
* @file replay_widget.h
* @ingroup Core
* @ingroup Replay
*/
//! \todo Document this file.
#ifndef REPLAY_WIDGET_H
#define REPLAY_WIDGET_H
#include <QList>
#include <QWidget>
#include <libcockatrice/game/player/event_processing_options.h>
#include <qtmetamacros.h>
class ReplayManager;
class ReplayQuickSettingsWidget;
class GameEventContainer;
class GameReplay;
class QAction;
class QToolButton;
class ReplayTimelineWidget;
/**
* @brief The top-level widget that is put in the replay dock widget.
* Contains the replay timeline as well as the buttons.
*/
class ReplayWidget : public QWidget
{
Q_OBJECT
public:
/**
* @param parent The parent widget
* @param replay Cannot be null. Takes ownership of the replay.
*/
ReplayWidget(QWidget *parent, GameReplay *replay);
[[nodiscard]] const QList<int> &getReplayTimeline() const;
public slots:
void seekToEvent(int eventIndex);
signals:
void rewound();
void timeChanged(int time);
void eventReplayed(const GameEventContainer &cont, EventProcessingOptions options);
private:
ReplayManager *replayManager;
ReplayTimelineWidget *timelineWidget;
QToolButton *replayPlayButton, *replayFastForwardButton;
ReplayQuickSettingsWidget *settingsWidget;
QAction *aReplaySkipForward, *aReplaySkipBackward, *aReplaySkipForwardBig, *aReplaySkipBackwardBig;
private slots:
void replayFinished();
void replayPlayButtonToggled(bool checked);
void updateTimeScaleFactor(bool checked);
void refreshShortcuts();
};
#endif // REPLAY_WIDGET_H