mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 11:38:49 -07:00
remove shortcut workaround; always add card menu to player (#5337)
* remove workaround * make aCardMenu less innocuous * make card menus active for all players
This commit is contained in:
parent
d5ae4eed26
commit
956c12eb32
2 changed files with 10 additions and 19 deletions
|
|
@ -426,14 +426,10 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
initSayMenu();
|
initSayMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local || judge) {
|
aCardMenu = new QAction(this);
|
||||||
aCardMenu = new QAction(this);
|
aCardMenu->setEnabled(false);
|
||||||
aCardMenu->setEnabled(false);
|
playerMenu->addSeparator();
|
||||||
playerMenu->addSeparator();
|
playerMenu->addAction(aCardMenu);
|
||||||
playerMenu->addAction(aCardMenu);
|
|
||||||
} else {
|
|
||||||
aCardMenu = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (local || judge) {
|
if (local || judge) {
|
||||||
|
|
||||||
|
|
@ -833,13 +829,13 @@ void Player::retranslateUi()
|
||||||
counterIterator.next().value()->retranslateUi();
|
counterIterator.next().value()->retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
aCardMenu->setText(tr("Selec&ted cards"));
|
|
||||||
|
|
||||||
for (auto &allPlayersAction : allPlayersActions) {
|
for (auto &allPlayersAction : allPlayersActions) {
|
||||||
allPlayersAction->setText(tr("&All players"));
|
allPlayersAction->setText(tr("&All players"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aCardMenu->setText(tr("Selec&ted cards"));
|
||||||
|
|
||||||
if (local) {
|
if (local) {
|
||||||
sayMenu->setTitle(tr("S&ay"));
|
sayMenu->setTitle(tr("S&ay"));
|
||||||
}
|
}
|
||||||
|
|
@ -1005,15 +1001,9 @@ void Player::setShortcutsActive()
|
||||||
aPlayFacedown->setShortcut(shortcuts.getSingleShortcut("Player/aPlayFacedown"));
|
aPlayFacedown->setShortcut(shortcuts.getSingleShortcut("Player/aPlayFacedown"));
|
||||||
aPlay->setShortcut(shortcuts.getSingleShortcut("Player/aPlay"));
|
aPlay->setShortcut(shortcuts.getSingleShortcut("Player/aPlay"));
|
||||||
|
|
||||||
|
// Don't enable always-active shortcuts in local games, since it causes keyboard shortcuts to work inconsistently
|
||||||
|
// when there are more than 1 player.
|
||||||
if (!game->getIsLocalGame()) {
|
if (!game->getIsLocalGame()) {
|
||||||
/* Attach all card menu actions that also work on the opponent's cards to the TabGame object so that those
|
|
||||||
* shortcuts will be active regardless of whether your card menu currently exists.
|
|
||||||
* Added as a workaround to get the clone keyboard shortcut to work on opponent's cards.
|
|
||||||
*/
|
|
||||||
game->addAction(aClone);
|
|
||||||
game->addAction(aDrawArrow);
|
|
||||||
game->addAction(aSelectAll);
|
|
||||||
|
|
||||||
// unattach action is only active in card menu if the active card is attached.
|
// unattach action is only active in card menu if the active card is attached.
|
||||||
// make unattach shortcut always active so that it consistently works when multiple cards are selected.
|
// make unattach shortcut always active so that it consistently works when multiple cards are selected.
|
||||||
game->addAction(aUnattach);
|
game->addAction(aUnattach);
|
||||||
|
|
|
||||||
|
|
@ -260,10 +260,11 @@ private:
|
||||||
*aMoveTopCardToExile, *aMoveTopCardsToGraveyard, *aMoveTopCardsToExile, *aMoveTopCardsUntil,
|
*aMoveTopCardToExile, *aMoveTopCardsToGraveyard, *aMoveTopCardsToExile, *aMoveTopCardsUntil,
|
||||||
*aMoveTopCardToBottom, *aViewGraveyard, *aViewRfg, *aViewSideboard, *aDrawCard, *aDrawCards, *aUndoDraw,
|
*aMoveTopCardToBottom, *aViewGraveyard, *aViewRfg, *aViewSideboard, *aDrawCard, *aDrawCards, *aUndoDraw,
|
||||||
*aMulligan, *aShuffle, *aMoveTopToPlay, *aMoveTopToPlayFaceDown, *aUntapAll, *aRollDie, *aCreateToken,
|
*aMulligan, *aShuffle, *aMoveTopToPlay, *aMoveTopToPlayFaceDown, *aUntapAll, *aRollDie, *aCreateToken,
|
||||||
*aCreateAnotherToken, *aCardMenu, *aMoveBottomToPlay, *aMoveBottomToPlayFaceDown, *aMoveBottomCardToTop,
|
*aCreateAnotherToken, *aMoveBottomToPlay, *aMoveBottomToPlayFaceDown, *aMoveBottomCardToTop,
|
||||||
*aMoveBottomCardToGraveyard, *aMoveBottomCardToExile, *aMoveBottomCardsToGraveyard, *aMoveBottomCardsToExile,
|
*aMoveBottomCardToGraveyard, *aMoveBottomCardToExile, *aMoveBottomCardsToGraveyard, *aMoveBottomCardsToExile,
|
||||||
*aDrawBottomCard, *aDrawBottomCards;
|
*aDrawBottomCard, *aDrawBottomCards;
|
||||||
|
|
||||||
|
QAction *aCardMenu;
|
||||||
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
||||||
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
||||||
*aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aFlowP, *aFlowT, *aSetAnnotation, *aFlip, *aPeek, *aClone,
|
*aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aFlowP, *aFlowT, *aSetAnnotation, *aFlip, *aPeek, *aClone,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue