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()
{
bool globalEvent = !game->getPlayerManager()->isSpectator() || SettingsCache::instance().getSpectatorNotificationsEnabled();
bool globalEvent =
!game->getPlayerManager()->isSpectator() || SettingsCache::instance().getSpectatorNotificationsEnabled();
emit userEvent(globalEvent);
updatePlayerListDockTitle();
}
@ -267,15 +268,16 @@ void TabGame::updatePlayerListDockTitle()
{
QString tabText = " | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" +
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->isWindow() ? tabText : QString()));
}
void TabGame::retranslateUi()
{
QString tabText =
" | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" + QString::number(game->getGameMetaInfo()->gameId());
QString tabText = " | " + (replayManager->replay ? tr("Replay") : tr("Game")) + " #" +
QString::number(game->getGameMetaInfo()->gameId());
updatePlayerListDockTitle();
cardInfoDock->setWindowTitle(tr("Card Info") + (cardInfoDock->isWindow() ? tabText : QString()));
@ -668,7 +670,8 @@ Player *TabGame::addPlayer(Player *newPlayer)
messageLog->connectToPlayerEventHandler(newPlayer->getPlayerEventHandler());
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());
}
@ -924,7 +927,8 @@ void TabGame::createMenuItems()
connect(aReverseTurn, &QAction::triggered, game->getGameEventHandler(), &GameEventHandler::handleReverseTurn);
aRemoveLocalArrows = new QAction(this);
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);
connect(aRotateViewCW, &QAction::triggered, this, &TabGame::actRotateViewCW);
aRotateViewCCW = new QAction(this);

View file

@ -323,7 +323,8 @@ void PlayerActions::actDrawCards()
int deckSize = player->getDeckZone()->getCards().size();
bool ok;
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) {
defaultNumberTopCards = number;
Command_DrawCards cmd;
@ -747,7 +748,8 @@ void PlayerActions::actDrawBottomCards()
bool ok;
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) {
return;
} 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();
}
PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor,
AbstractClient *_client, Game *_game, QWidget *parent)
PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, Game *_game, QWidget *parent)
: QTreeWidget(parent), tabSupervisor(_tabSupervisor), client(_client), game(_game), gameStarted(false)
{
readyIcon = QPixmap("theme:icons/ready_start");

View file

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