From 96612e2f31c34e1c3cb0fb1a14f965a752d9d3cd Mon Sep 17 00:00:00 2001 From: RickyRister Date: Fri, 16 Jan 2026 04:11:19 -0800 Subject: [PATCH] use replayDock to determine if replay tab --- .../src/interface/widgets/tabs/tab_game.cpp | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cockatrice/src/interface/widgets/tabs/tab_game.cpp b/cockatrice/src/interface/widgets/tabs/tab_game.cpp index ebbea95b0..1ff653648 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_game.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_game.cpp @@ -255,13 +255,15 @@ void TabGame::emitUserEvent() TabGame::~TabGame() { - delete replayManager->replay; + if (replayDock) { + delete replayManager->replay; + } } void TabGame::updatePlayerListDockTitle() { - QString tabText = " | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" + - QString::number(game->getGameMetaInfo()->gameId()); + QString type = replayDock ? tr("Replay") : tr("Game"); + QString tabText = " | " + type + " #" + QString::number(game->getGameMetaInfo()->gameId()); QString userCountInfo = QString(" %1/%2").arg(game->getPlayerManager()->getPlayerCount()).arg(game->getGameMetaInfo()->maxPlayers()); playerListDock->setWindowTitle(tr("Player List") + userCountInfo + @@ -270,8 +272,8 @@ void TabGame::updatePlayerListDockTitle() void TabGame::retranslateUi() { - QString tabText = " | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" + - QString::number(game->getGameMetaInfo()->gameId()); + QString type = replayDock ? tr("Replay") : tr("Game"); + QString tabText = " | " + type + " #" + QString::number(game->getGameMetaInfo()->gameId()); updatePlayerListDockTitle(); cardInfoDock->setWindowTitle(tr("Card Info") + (cardInfoDock->isWindow() ? tabText : QString())); @@ -317,7 +319,7 @@ void TabGame::retranslateUi() } } if (aLeaveGame) { - if (replayManager->replay) { + if (replayDock) { aLeaveGame->setText(tr("C&lose replay")); } else { aLeaveGame->setText(tr("&Leave game")); @@ -516,7 +518,7 @@ bool TabGame::leaveGame() return false; } - if (!replayManager->replay) + if (!replayDock) emit gameLeft(); } return true; @@ -903,7 +905,7 @@ QString TabGame::getTabText() const QString gameId(QString::number(game->getGameMetaInfo()->gameId())); QString tabText; - if (replayManager->replay) + if (replayDock) tabText.append(tr("Replay") + " "); if (!gameTypeInfo.isEmpty()) tabText.append(gameTypeInfo + " "); @@ -1084,7 +1086,7 @@ void TabGame::createViewMenuItems() void TabGame::loadLayout() { LayoutsSettings &layouts = SettingsCache::instance().layouts(); - if (replayManager->replay) { + if (replayDock) { restoreGeometry(layouts.getReplayPlayAreaGeometry()); restoreState(layouts.getReplayPlayAreaLayoutState()); @@ -1120,7 +1122,7 @@ void TabGame::loadLayout() aMessageLayoutDockFloating->setChecked(messageLayoutDock->isFloating()); aPlayerListDockFloating->setChecked(playerListDock->isFloating()); - if (replayManager->replay) { + if (replayDock) { aReplayDockVisible->setChecked(replayDock->isVisible()); aReplayDockFloating->setEnabled(aReplayDockVisible->isChecked()); aReplayDockFloating->setChecked(replayDock->isFloating());