mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
change action's text to "unconcede" when player is conceded (#5351)
This commit is contained in:
parent
8bc5a9d581
commit
37b78a9a4c
2 changed files with 16 additions and 1 deletions
|
|
@ -536,6 +536,12 @@ void TabGame::updatePlayerListDockTitle()
|
||||||
(playerListDock->isWindow() ? tabText : QString()));
|
(playerListDock->isWindow() ? tabText : QString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TabGame::isMainPlayerConceded() const
|
||||||
|
{
|
||||||
|
Player *player = players.value(localPlayerId, nullptr);
|
||||||
|
return player && player->getConceded();
|
||||||
|
}
|
||||||
|
|
||||||
void TabGame::retranslateUi()
|
void TabGame::retranslateUi()
|
||||||
{
|
{
|
||||||
QString tabText = " | " + (replay ? tr("Replay") : tr("Game")) + " #" + QString::number(gameInfo.game_id());
|
QString tabText = " | " + (replay ? tr("Replay") : tr("Game")) + " #" + QString::number(gameInfo.game_id());
|
||||||
|
|
@ -577,7 +583,11 @@ void TabGame::retranslateUi()
|
||||||
if (aGameInfo)
|
if (aGameInfo)
|
||||||
aGameInfo->setText(tr("Game &information"));
|
aGameInfo->setText(tr("Game &information"));
|
||||||
if (aConcede) {
|
if (aConcede) {
|
||||||
aConcede->setText(tr("&Concede"));
|
if (isMainPlayerConceded()) {
|
||||||
|
aConcede->setText(tr("Un&concede"));
|
||||||
|
} else {
|
||||||
|
aConcede->setText(tr("&Concede"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (aLeaveGame) {
|
if (aLeaveGame) {
|
||||||
aLeaveGame->setText(tr("&Leave game"));
|
aLeaveGame->setText(tr("&Leave game"));
|
||||||
|
|
@ -874,6 +884,9 @@ Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update menu text when player concedes so that "concede" gets updated to "unconcede"
|
||||||
|
connect(newPlayer, &Player::playerCountChanged, this, &TabGame::retranslateUi);
|
||||||
|
|
||||||
emit playerAdded(newPlayer);
|
emit playerAdded(newPlayer);
|
||||||
return newPlayer;
|
return newPlayer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,8 @@ private:
|
||||||
|
|
||||||
Player *addPlayer(int playerId, const ServerInfo_User &info);
|
Player *addPlayer(int playerId, const ServerInfo_User &info);
|
||||||
|
|
||||||
|
bool isMainPlayerConceded() const;
|
||||||
|
|
||||||
void startGame(bool resuming);
|
void startGame(bool resuming);
|
||||||
void stopGame();
|
void stopGame();
|
||||||
void closeGame();
|
void closeGame();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue