use replayDock to determine if replay tab

This commit is contained in:
RickyRister 2026-01-16 04:11:19 -08:00
parent d62a271f6a
commit 96612e2f31

View file

@ -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());