From c850ae98d8735db06f36b22a29359ca6a7e4858f Mon Sep 17 00:00:00 2001 From: Zach H Date: Sat, 4 Mar 2017 11:03:39 -0500 Subject: [PATCH] add player numbers to in game (#2435) --- cockatrice/src/tab_game.cpp | 10 +++++++++- cockatrice/src/tab_game.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index b6867451..0ad2e32e 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -430,6 +430,7 @@ void TabGame::addMentionTag(QString value) { void TabGame::emitUserEvent() { bool globalEvent = !spectator || settingsCache->getSpectatorNotificationsEnabled(); emit userEvent(globalEvent); + updatePlayerListDockTitle(); } TabGame::~TabGame() @@ -445,12 +446,19 @@ TabGame::~TabGame() emit gameClosing(this); } +void TabGame::updatePlayerListDockTitle() +{ + QString tabText = " | " + (replay ? tr("Replay") : tr("Game")) + " #" + QString::number(gameInfo.game_id()); + QString userCountInfo = QString(" %1/%2").arg(players.size()).arg(gameInfo.max_players()); + playerListDock->setWindowTitle(tr("Player List") + userCountInfo + (playerListDock->isWindow() ? tabText : QString())); +} + void TabGame::retranslateUi() { QString tabText = " | " + (replay ? tr("Replay") : tr("Game")) + " #" + QString::number(gameInfo.game_id()); + updatePlayerListDockTitle(); cardInfoDock->setWindowTitle(tr("Card Info") + (cardInfoDock->isWindow() ? tabText : QString())); - playerListDock->setWindowTitle(tr("Player List") + (playerListDock->isWindow() ? tabText : QString())); messageLayoutDock->setWindowTitle(tr("Messages") + (messageLayoutDock->isWindow() ? tabText : QString())); if(replayDock) replayDock->setWindowTitle(tr("Replay Timeline") + (replayDock->isWindow() ? tabText : QString())); diff --git a/cockatrice/src/tab_game.h b/cockatrice/src/tab_game.h index 2db2e067..631c5578 100644 --- a/cockatrice/src/tab_game.h +++ b/cockatrice/src/tab_game.h @@ -237,6 +237,7 @@ public: TabGame(TabSupervisor *_tabSupervisor, GameReplay *replay); ~TabGame(); void retranslateUi(); + void updatePlayerListDockTitle(); void closeRequest(); const QMap &getPlayers() const { return players; } CardItem *getCard(int playerId, const QString &zoneName, int cardId) const;