mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-28 11:50:25 -07:00
[Replay] Refactor: rename ReplayManager to ReplayWidget (#7059)
Some checks are pending
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 15 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker Image / amd64 & arm64 (push) Waiting to run
Some checks are pending
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 15 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker Image / amd64 & arm64 (push) Waiting to run
This commit is contained in:
parent
6260bd1ed1
commit
be6a783c12
5 changed files with 34 additions and 30 deletions
|
|
@ -229,9 +229,9 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/printing_selector/set_name_and_collectors_number_display_widget.cpp
|
src/interface/widgets/printing_selector/set_name_and_collectors_number_display_widget.cpp
|
||||||
src/interface/widgets/quick_settings/settings_button_widget.cpp
|
src/interface/widgets/quick_settings/settings_button_widget.cpp
|
||||||
src/interface/widgets/quick_settings/settings_popup_widget.cpp
|
src/interface/widgets/quick_settings/settings_popup_widget.cpp
|
||||||
src/interface/widgets/replay/replay_manager.cpp
|
|
||||||
src/interface/widgets/replay/replay_quick_settings_widget.cpp
|
src/interface/widgets/replay/replay_quick_settings_widget.cpp
|
||||||
src/interface/widgets/replay/replay_timeline_widget.cpp
|
src/interface/widgets/replay/replay_timeline_widget.cpp
|
||||||
|
src/interface/widgets/replay/replay_widget.cpp
|
||||||
src/interface/widgets/server/chat_view/chat_view.cpp
|
src/interface/widgets/server/chat_view/chat_view.cpp
|
||||||
src/interface/widgets/server/game_filter_configs.cpp
|
src/interface/widgets/server/game_filter_configs.cpp
|
||||||
src/interface/widgets/server/game_selector.cpp
|
src/interface/widgets/server/game_selector.cpp
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "replay_manager.h"
|
#include "replay_widget.h"
|
||||||
|
|
||||||
#include "../../../client/settings/shortcuts_settings.h"
|
#include "../../../client/settings/shortcuts_settings.h"
|
||||||
#include "../interface/widgets/tabs/tab_game.h"
|
#include "../interface/widgets/tabs/tab_game.h"
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
ReplayManager::ReplayManager(TabGame *parent, GameReplay *_replay)
|
ReplayWidget::ReplayWidget(TabGame *parent, GameReplay *_replay)
|
||||||
: QWidget(parent), game(parent), replay(_replay), replayPlayButton(nullptr), replayFastForwardButton(nullptr),
|
: QWidget(parent), game(parent), replay(_replay), replayPlayButton(nullptr), replayFastForwardButton(nullptr),
|
||||||
aReplaySkipForward(nullptr), aReplaySkipBackward(nullptr), aReplaySkipForwardBig(nullptr),
|
aReplaySkipForward(nullptr), aReplaySkipBackward(nullptr), aReplaySkipForwardBig(nullptr),
|
||||||
aReplaySkipBackwardBig(nullptr)
|
aReplaySkipBackwardBig(nullptr)
|
||||||
|
|
@ -41,9 +41,9 @@ ReplayManager::ReplayManager(TabGame *parent, GameReplay *_replay)
|
||||||
// timeline widget
|
// timeline widget
|
||||||
timelineWidget = new ReplayTimelineWidget;
|
timelineWidget = new ReplayTimelineWidget;
|
||||||
timelineWidget->setTimeline(replayTimeline);
|
timelineWidget->setTimeline(replayTimeline);
|
||||||
connect(timelineWidget, &ReplayTimelineWidget::processNextEvent, this, &ReplayManager::replayNextEvent);
|
connect(timelineWidget, &ReplayTimelineWidget::processNextEvent, this, &ReplayWidget::replayNextEvent);
|
||||||
connect(timelineWidget, &ReplayTimelineWidget::replayFinished, this, &ReplayManager::replayFinished);
|
connect(timelineWidget, &ReplayTimelineWidget::replayFinished, this, &ReplayWidget::replayFinished);
|
||||||
connect(timelineWidget, &ReplayTimelineWidget::rewound, this, &ReplayManager::replayRewind);
|
connect(timelineWidget, &ReplayTimelineWidget::rewound, this, &ReplayWidget::replayRewind);
|
||||||
|
|
||||||
// timeline skip shortcuts
|
// timeline skip shortcuts
|
||||||
aReplaySkipForward = new QAction(timelineWidget);
|
aReplaySkipForward = new QAction(timelineWidget);
|
||||||
|
|
@ -74,13 +74,13 @@ ReplayManager::ReplayManager(TabGame *parent, GameReplay *_replay)
|
||||||
playButtonIcon.addPixmap(QPixmap("theme:replay/pause"), QIcon::Normal, QIcon::On);
|
playButtonIcon.addPixmap(QPixmap("theme:replay/pause"), QIcon::Normal, QIcon::On);
|
||||||
replayPlayButton->setIcon(playButtonIcon);
|
replayPlayButton->setIcon(playButtonIcon);
|
||||||
replayPlayButton->setCheckable(true);
|
replayPlayButton->setCheckable(true);
|
||||||
connect(replayPlayButton, &QToolButton::toggled, this, &ReplayManager::replayPlayButtonToggled);
|
connect(replayPlayButton, &QToolButton::toggled, this, &ReplayWidget::replayPlayButtonToggled);
|
||||||
|
|
||||||
replayFastForwardButton = new QToolButton;
|
replayFastForwardButton = new QToolButton;
|
||||||
replayFastForwardButton->setIconSize(QSize(32, 32));
|
replayFastForwardButton->setIconSize(QSize(32, 32));
|
||||||
replayFastForwardButton->setIcon(QPixmap("theme:replay/fastforward"));
|
replayFastForwardButton->setIcon(QPixmap("theme:replay/fastforward"));
|
||||||
replayFastForwardButton->setCheckable(true);
|
replayFastForwardButton->setCheckable(true);
|
||||||
connect(replayFastForwardButton, &QToolButton::toggled, this, &ReplayManager::updateTimeScaleFactor);
|
connect(replayFastForwardButton, &QToolButton::toggled, this, &ReplayWidget::updateTimeScaleFactor);
|
||||||
|
|
||||||
settingsWidget = new ReplayQuickSettingsWidget(this);
|
settingsWidget = new ReplayQuickSettingsWidget(this);
|
||||||
settingsWidget->setFixedSize(QSize(32, 32));
|
settingsWidget->setFixedSize(QSize(32, 32));
|
||||||
|
|
@ -97,24 +97,24 @@ ReplayManager::ReplayManager(TabGame *parent, GameReplay *_replay)
|
||||||
setObjectName("replayControlWidget");
|
setObjectName("replayControlWidget");
|
||||||
setLayout(replayControlLayout);
|
setLayout(replayControlLayout);
|
||||||
|
|
||||||
connect(this, &ReplayManager::requestChatAndPhaseReset, game, &TabGame::resetChatAndPhase);
|
connect(this, &ReplayWidget::requestChatAndPhaseReset, game, &TabGame::resetChatAndPhase);
|
||||||
|
|
||||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||||
&ReplayManager::refreshShortcuts);
|
&ReplayWidget::refreshShortcuts);
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReplayManager::replayNextEvent(EventProcessingOptions options)
|
void ReplayWidget::replayNextEvent(EventProcessingOptions options)
|
||||||
{
|
{
|
||||||
emit eventReplayed(replay->event_list(timelineWidget->getCurrentEvent()), options);
|
emit eventReplayed(replay->event_list(timelineWidget->getCurrentEvent()), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReplayManager::replayFinished()
|
void ReplayWidget::replayFinished()
|
||||||
{
|
{
|
||||||
replayPlayButton->setChecked(false);
|
replayPlayButton->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReplayManager::replayPlayButtonToggled(bool checked)
|
void ReplayWidget::replayPlayButtonToggled(bool checked)
|
||||||
{
|
{
|
||||||
if (checked) { // start replay
|
if (checked) { // start replay
|
||||||
timelineWidget->startReplay();
|
timelineWidget->startReplay();
|
||||||
|
|
@ -123,7 +123,7 @@ void ReplayManager::replayPlayButtonToggled(bool checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReplayManager::updateTimeScaleFactor(bool isFastForward)
|
void ReplayWidget::updateTimeScaleFactor(bool isFastForward)
|
||||||
{
|
{
|
||||||
qreal factor = isFastForward ? SettingsCache::instance().interface().getFastForwardSpeed() : 1.0;
|
qreal factor = isFastForward ? SettingsCache::instance().interface().getFastForwardSpeed() : 1.0;
|
||||||
timelineWidget->setTimeScaleFactor(factor);
|
timelineWidget->setTimeScaleFactor(factor);
|
||||||
|
|
@ -132,12 +132,12 @@ void ReplayManager::updateTimeScaleFactor(bool isFastForward)
|
||||||
/**
|
/**
|
||||||
* @brief Handles everything that needs to be reset when doing a replay rewind.
|
* @brief Handles everything that needs to be reset when doing a replay rewind.
|
||||||
*/
|
*/
|
||||||
void ReplayManager::replayRewind()
|
void ReplayWidget::replayRewind()
|
||||||
{
|
{
|
||||||
emit requestChatAndPhaseReset();
|
emit requestChatAndPhaseReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReplayManager::refreshShortcuts()
|
void ReplayWidget::refreshShortcuts()
|
||||||
{
|
{
|
||||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
if (aReplaySkipForward) {
|
if (aReplaySkipForward) {
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
/**
|
/**
|
||||||
* @file replay_manager.h
|
* @file replay_widget.h
|
||||||
* @ingroup Core
|
* @ingroup Core
|
||||||
* @ingroup Replay
|
* @ingroup Replay
|
||||||
*/
|
*/
|
||||||
//! \todo Document this file.
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef REPLAY_MANAGER_H
|
#ifndef REPLAY_WIDGET_H
|
||||||
#define REPLAY_MANAGER_H
|
#define REPLAY_WIDGET_H
|
||||||
|
|
||||||
#include "replay_timeline_widget.h"
|
#include "replay_timeline_widget.h"
|
||||||
|
|
||||||
|
|
@ -17,12 +17,16 @@
|
||||||
class ReplayQuickSettingsWidget;
|
class ReplayQuickSettingsWidget;
|
||||||
class TabGame;
|
class TabGame;
|
||||||
|
|
||||||
class ReplayManager : public QWidget
|
/**
|
||||||
|
* @brief The top-level that is put in the replay dock widget.
|
||||||
|
* Contains the replay timeline as well as the buttons.
|
||||||
|
*/
|
||||||
|
class ReplayWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ReplayManager(TabGame *parent, GameReplay *replay);
|
ReplayWidget(TabGame *parent, GameReplay *replay);
|
||||||
TabGame *game;
|
TabGame *game;
|
||||||
GameReplay *replay;
|
GameReplay *replay;
|
||||||
|
|
||||||
|
|
@ -48,4 +52,4 @@ private slots:
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // REPLAY_MANAGER_H
|
#endif // REPLAY_WIDGET_H
|
||||||
|
|
@ -265,8 +265,8 @@ void TabGame::emitUserEvent()
|
||||||
|
|
||||||
TabGame::~TabGame()
|
TabGame::~TabGame()
|
||||||
{
|
{
|
||||||
if (replayManager) {
|
if (replayWidget) {
|
||||||
delete replayManager->replay;
|
delete replayWidget->replay;
|
||||||
}
|
}
|
||||||
for (auto &player : game->getPlayerManager()->getPlayers()) {
|
for (auto &player : game->getPlayerManager()->getPlayers()) {
|
||||||
player->clear();
|
player->clear();
|
||||||
|
|
@ -1174,16 +1174,16 @@ void TabGame::createPlayAreaWidget(bool bReplay)
|
||||||
|
|
||||||
void TabGame::createReplayDock(GameReplay *replay)
|
void TabGame::createReplayDock(GameReplay *replay)
|
||||||
{
|
{
|
||||||
replayManager = new ReplayManager(this, replay);
|
replayWidget = new ReplayWidget(this, replay);
|
||||||
|
|
||||||
replayDock = new QDockWidget(this);
|
replayDock = new QDockWidget(this);
|
||||||
replayDock->setObjectName("replayDock");
|
replayDock->setObjectName("replayDock");
|
||||||
replayDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable |
|
replayDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable |
|
||||||
QDockWidget::DockWidgetMovable);
|
QDockWidget::DockWidgetMovable);
|
||||||
replayDock->setWidget(replayManager);
|
replayDock->setWidget(replayWidget);
|
||||||
replayDock->setFloating(false);
|
replayDock->setFloating(false);
|
||||||
|
|
||||||
connect(replayManager, &ReplayManager::eventReplayed, game->getGameEventHandler(),
|
connect(replayWidget, &ReplayWidget::eventReplayed, game->getGameEventHandler(),
|
||||||
[this](const auto &event, auto options) {
|
[this](const auto &event, auto options) {
|
||||||
game->getGameEventHandler()->processGameEventContainer(event, nullptr, options);
|
game->getGameEventHandler()->processGameEventContainer(event, nullptr, options);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#include "../game/player/player_logic.h"
|
#include "../game/player/player_logic.h"
|
||||||
#include "../game_graphics/log/message_log_widget.h"
|
#include "../game_graphics/log/message_log_widget.h"
|
||||||
#include "../interface/widgets/menus/tearoff_menu.h"
|
#include "../interface/widgets/menus/tearoff_menu.h"
|
||||||
#include "../interface/widgets/replay/replay_manager.h"
|
#include "../interface/widgets/replay/replay_widget.h"
|
||||||
#include "tab.h"
|
#include "tab.h"
|
||||||
|
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
|
|
@ -31,7 +31,7 @@ class AbstractClient;
|
||||||
class CardDatabase;
|
class CardDatabase;
|
||||||
class GameView;
|
class GameView;
|
||||||
class GameScene;
|
class GameScene;
|
||||||
class ReplayManager;
|
class ReplayWidget;
|
||||||
class CardInfoFrameWidget;
|
class CardInfoFrameWidget;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
|
|
@ -59,7 +59,7 @@ class TabGame : public Tab
|
||||||
private:
|
private:
|
||||||
AbstractGame *game;
|
AbstractGame *game;
|
||||||
const UserListProxy *userListProxy;
|
const UserListProxy *userListProxy;
|
||||||
ReplayManager *replayManager = nullptr;
|
ReplayWidget *replayWidget = nullptr;
|
||||||
QStringList gameTypes;
|
QStringList gameTypes;
|
||||||
QCompleter *completer;
|
QCompleter *completer;
|
||||||
QStringList autocompleteUserList;
|
QStringList autocompleteUserList;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue