This commit is contained in:
BruebachL 2026-04-23 06:36:51 +02:00 committed by GitHub
commit 3ab3b716e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 1 deletions

View file

@ -664,6 +664,9 @@ private:
{"Player/aRollDie", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Roll Dice..."),
parseSequenceString("Ctrl+I"),
ShortcutGroup::Gameplay)},
{"Player/aFlipCoin", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Flip Coin"),
parseSequenceString("Ctrl+Shift+I"),
ShortcutGroup::Gameplay)},
{"Player/aShuffle", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Shuffle Library"),
parseSequenceString("Ctrl+S"),
ShortcutGroup::Gameplay)},

View file

@ -19,6 +19,9 @@ UtilityMenu::UtilityMenu(Player *_player, QMenu *playerMenu) : QMenu(playerMenu)
aRollDie = new QAction(this);
connect(aRollDie, &QAction::triggered, playerActions, &PlayerActions::actRollDie);
aFlipCoin = new QAction(this);
connect(aFlipCoin, &QAction::triggered, playerActions, &PlayerActions::actFlipCoin);
aCreateToken = new QAction(this);
connect(aCreateToken, &QAction::triggered, playerActions, &PlayerActions::actCreateToken);
@ -38,6 +41,7 @@ UtilityMenu::UtilityMenu(Player *_player, QMenu *playerMenu) : QMenu(playerMenu)
playerMenu->addAction(aUntapAll);
playerMenu->addSeparator();
playerMenu->addAction(aRollDie);
playerMenu->addAction(aFlipCoin);
playerMenu->addSeparator();
playerMenu->addAction(aCreateToken);
playerMenu->addAction(aCreateAnotherToken);
@ -50,6 +54,7 @@ UtilityMenu::UtilityMenu(Player *_player, QMenu *playerMenu) : QMenu(playerMenu)
aIncrementAllCardCounters = nullptr;
aUntapAll = nullptr;
aRollDie = nullptr;
aFlipCoin = nullptr;
}
retranslateUi();
@ -89,6 +94,7 @@ void UtilityMenu::retranslateUi()
aIncrementAllCardCounters->setText(tr("Increment all card counters"));
aUntapAll->setText(tr("&Untap all permanents"));
aRollDie->setText(tr("R&oll die..."));
aFlipCoin->setText(tr("Flip coin"));
aCreateToken->setText(tr("&Create token..."));
aCreateAnotherToken->setText(tr("C&reate another token"));
createPredefinedTokenMenu->setTitle(tr("Cr&eate predefined token"));
@ -103,6 +109,7 @@ void UtilityMenu::setShortcutsActive()
aIncrementAllCardCounters->setShortcuts(shortcuts.getShortcut("Player/aIncrementAllCardCounters"));
aUntapAll->setShortcuts(shortcuts.getShortcut("Player/aUntapAll"));
aRollDie->setShortcuts(shortcuts.getShortcut("Player/aRollDie"));
aFlipCoin->setShortcuts(shortcuts.getShortcut("Player/aFlipCoin"));
aCreateToken->setShortcuts(shortcuts.getShortcut("Player/aCreateToken"));
aCreateAnotherToken->setShortcuts(shortcuts.getShortcut("Player/aCreateAnotherToken"));
}
@ -113,6 +120,7 @@ void UtilityMenu::setShortcutsInactive()
if (player->getPlayerInfo()->getLocalOrJudge()) {
aUntapAll->setShortcut(QKeySequence());
aRollDie->setShortcut(QKeySequence());
aFlipCoin->setShortcut(QKeySequence());
aCreateToken->setShortcut(QKeySequence());
aCreateAnotherToken->setShortcut(QKeySequence());
aIncrementAllCardCounters->setShortcut(QKeySequence());

View file

@ -47,7 +47,7 @@ private:
QMenu *createPredefinedTokenMenu;
QAction *aIncrementAllCardCounters;
QAction *aUntapAll, *aRollDie;
QAction *aUntapAll, *aRollDie, *aFlipCoin;
QAction *aCreateToken, *aCreateAnotherToken;
};

View file

@ -852,6 +852,14 @@ void PlayerActions::actRollDie()
sendGameCommand(cmd);
}
void PlayerActions::actFlipCoin()
{
Command_RollDie cmd;
cmd.set_sides(2);
cmd.set_count(1);
sendGameCommand(cmd);
}
void PlayerActions::actCreateToken()
{
DlgCreateToken dlg(player->getPlayerMenu()->getUtilityMenu()->getPredefinedTokens(), player->getGame()->getTab());

View file

@ -77,6 +77,7 @@ public slots:
void actUntapAll();
void actRollDie();
void actFlipCoin();
void actCreateToken();
void actCreateAnotherToken();
void actShuffle();