Took 3 minutes
This commit is contained in:
Lukas Brübach 2025-09-09 21:32:33 +02:00
parent b478026f6c
commit 27580f1d4a
4 changed files with 16 additions and 14 deletions

View file

@ -253,7 +253,8 @@ void TabGame::resetChatAndPhase()
void TabGame::emitUserEvent() void TabGame::emitUserEvent()
{ {
bool globalEvent = !game->getPlayerManager()->isSpectator() || SettingsCache::instance().getSpectatorNotificationsEnabled(); bool globalEvent =
!game->getPlayerManager()->isSpectator() || SettingsCache::instance().getSpectatorNotificationsEnabled();
emit userEvent(globalEvent); emit userEvent(globalEvent);
updatePlayerListDockTitle(); updatePlayerListDockTitle();
} }
@ -267,15 +268,16 @@ void TabGame::updatePlayerListDockTitle()
{ {
QString tabText = " | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" + QString tabText = " | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" +
QString::number(game->getGameMetaInfo()->gameId()); QString::number(game->getGameMetaInfo()->gameId());
QString userCountInfo = QString(" %1/%2").arg(game->getPlayerManager()->getPlayerCount()).arg(game->getGameMetaInfo()->maxPlayers()); QString userCountInfo =
QString(" %1/%2").arg(game->getPlayerManager()->getPlayerCount()).arg(game->getGameMetaInfo()->maxPlayers());
playerListDock->setWindowTitle(tr("Player List") + userCountInfo + playerListDock->setWindowTitle(tr("Player List") + userCountInfo +
(playerListDock->isWindow() ? tabText : QString())); (playerListDock->isWindow() ? tabText : QString()));
} }
void TabGame::retranslateUi() void TabGame::retranslateUi()
{ {
QString tabText = QString tabText = " | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" +
" | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" + QString::number(game->getGameMetaInfo()->gameId()); QString::number(game->getGameMetaInfo()->gameId());
updatePlayerListDockTitle(); updatePlayerListDockTitle();
cardInfoDock->setWindowTitle(tr("Card Info") + (cardInfoDock->isWindow() ? tabText : QString())); cardInfoDock->setWindowTitle(tr("Card Info") + (cardInfoDock->isWindow() ? tabText : QString()));
@ -668,7 +670,8 @@ Player *TabGame::addPlayer(Player *newPlayer)
messageLog->connectToPlayerEventHandler(newPlayer->getPlayerEventHandler()); messageLog->connectToPlayerEventHandler(newPlayer->getPlayerEventHandler());
if (game->getGameState()->getIsLocalGame() || if (game->getGameState()->getIsLocalGame() ||
(game->getPlayerManager()->isLocalPlayer(newPlayer->getPlayerInfo()->getId()) && !game->getPlayerManager()->isSpectator())) { (game->getPlayerManager()->isLocalPlayer(newPlayer->getPlayerInfo()->getId()) &&
!game->getPlayerManager()->isSpectator())) {
addLocalPlayer(newPlayer, newPlayer->getPlayerInfo()->getId()); addLocalPlayer(newPlayer, newPlayer->getPlayerInfo()->getId());
} }
@ -924,7 +927,8 @@ void TabGame::createMenuItems()
connect(aReverseTurn, &QAction::triggered, game->getGameEventHandler(), &GameEventHandler::handleReverseTurn); connect(aReverseTurn, &QAction::triggered, game->getGameEventHandler(), &GameEventHandler::handleReverseTurn);
aRemoveLocalArrows = new QAction(this); aRemoveLocalArrows = new QAction(this);
connect(aRemoveLocalArrows, &QAction::triggered, this, &TabGame::actRemoveLocalArrows); connect(aRemoveLocalArrows, &QAction::triggered, this, &TabGame::actRemoveLocalArrows);
connect(this, &TabGame::arrowDeletionRequested, game->getGameEventHandler(), &GameEventHandler::handleArrowDeletion); connect(this, &TabGame::arrowDeletionRequested, game->getGameEventHandler(),
&GameEventHandler::handleArrowDeletion);
aRotateViewCW = new QAction(this); aRotateViewCW = new QAction(this);
connect(aRotateViewCW, &QAction::triggered, this, &TabGame::actRotateViewCW); connect(aRotateViewCW, &QAction::triggered, this, &TabGame::actRotateViewCW);
aRotateViewCCW = new QAction(this); aRotateViewCCW = new QAction(this);

View file

@ -323,7 +323,8 @@ void PlayerActions::actDrawCards()
int deckSize = player->getDeckZone()->getCards().size(); int deckSize = player->getDeckZone()->getCards().size();
bool ok; bool ok;
int number = QInputDialog::getInt(/* player->getGame() */ nullptr, tr("Draw cards"), int number = QInputDialog::getInt(/* player->getGame() */ nullptr, tr("Draw cards"),
tr("Number of cards: (max. %1)").arg(deckSize), defaultNumberTopCards, 1, deckSize, 1, &ok); tr("Number of cards: (max. %1)").arg(deckSize), defaultNumberTopCards, 1,
deckSize, 1, &ok);
if (ok) { if (ok) {
defaultNumberTopCards = number; defaultNumberTopCards = number;
Command_DrawCards cmd; Command_DrawCards cmd;
@ -747,7 +748,8 @@ void PlayerActions::actDrawBottomCards()
bool ok; bool ok;
int number = QInputDialog::getInt(/* player->getGame() */ nullptr, tr("Draw bottom cards"), int number = QInputDialog::getInt(/* player->getGame() */ nullptr, tr("Draw bottom cards"),
tr("Number of cards: (max. %1)").arg(maxCards), defaultNumberBottomCards, 1, maxCards, 1, &ok); tr("Number of cards: (max. %1)").arg(maxCards), defaultNumberBottomCards, 1,
maxCards, 1, &ok);
if (!ok) { if (!ok) {
return; return;
} else if (number > maxCards) { } else if (number > maxCards) {

View file

@ -54,8 +54,7 @@ bool PlayerListTWI::operator<(const QTreeWidgetItem &other) const
return data(4, Qt::UserRole + 1).toInt() < other.data(4, Qt::UserRole + 1).toInt(); return data(4, Qt::UserRole + 1).toInt() < other.data(4, Qt::UserRole + 1).toInt();
} }
PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, Game *_game, QWidget *parent)
AbstractClient *_client, Game *_game, QWidget *parent)
: QTreeWidget(parent), tabSupervisor(_tabSupervisor), client(_client), game(_game), gameStarted(false) : QTreeWidget(parent), tabSupervisor(_tabSupervisor), client(_client), game(_game), gameStarted(false)
{ {
readyIcon = QPixmap("theme:icons/ready_start"); readyIcon = QPixmap("theme:icons/ready_start");

View file

@ -9,10 +9,7 @@
#include <QPixmapCache> #include <QPixmapCache>
#include <QtMath> #include <QtMath>
PlayerCounter::PlayerCounter(Player *_player, PlayerCounter::PlayerCounter(Player *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent)
int _id,
const QString &_name,
int _value, QGraphicsItem *parent)
: AbstractCounter(_player, _id, _name, false, _value, false, parent) : AbstractCounter(_player, _id, _name, false, _value, false, parent)
{ {
} }