mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Add action to select all cards in zone (#5246)
* rip shortcut for aDrawArrow * implement thing * add separator below hide * shorten text by 1 word * move shortcut to under Playing_Area * rebind draw arrow shortcut to Alt+A * remove auto hotkey * shorten to "Select All" * add back auto-hotkey
This commit is contained in:
parent
5f8bcbd02d
commit
ac16206ddb
3 changed files with 43 additions and 2 deletions
|
|
@ -513,6 +513,9 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
connect(aMoveToGraveyard, SIGNAL(triggered()), this, SLOT(cardMenuAction()));
|
||||
connect(aMoveToExile, SIGNAL(triggered()), this, SLOT(cardMenuAction()));
|
||||
|
||||
aSelectAll = new QAction(this);
|
||||
connect(aSelectAll, SIGNAL(triggered()), this, SLOT(actSelectAll()));
|
||||
|
||||
aPlay = new QAction(this);
|
||||
connect(aPlay, SIGNAL(triggered()), this, SLOT(actPlay()));
|
||||
aHide = new QAction(this);
|
||||
|
|
@ -836,6 +839,8 @@ void Player::retranslateUi()
|
|||
sayMenu->setTitle(tr("S&ay"));
|
||||
}
|
||||
|
||||
aSelectAll->setText(tr("&Select All"));
|
||||
|
||||
aPlay->setText(tr("&Play"));
|
||||
aHide->setText(tr("&Hide"));
|
||||
aPlayFacedown->setText(tr("Play &Face Down"));
|
||||
|
|
@ -923,6 +928,8 @@ void Player::setShortcutsActive()
|
|||
aMoveToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveToGraveyard"));
|
||||
aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile"));
|
||||
|
||||
aSelectAll->setShortcuts(shortcuts.getShortcut("Player/aSelectAll"));
|
||||
|
||||
QList<QKeySequence> addCCShortCuts;
|
||||
addCCShortCuts.append(shortcuts.getSingleShortcut("Player/aCCRed"));
|
||||
addCCShortCuts.append(shortcuts.getSingleShortcut("Player/aCCYellow"));
|
||||
|
|
@ -1537,6 +1544,22 @@ void Player::actMoveBottomCardToTop()
|
|||
sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void Player::actSelectAll()
|
||||
{
|
||||
const CardItem *card = game->getActiveCard();
|
||||
if (!card) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (const auto *zone = card->getZone()) {
|
||||
for (auto &cardItem : zone->getCards()) {
|
||||
if (cardItem) {
|
||||
cardItem->setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::actDrawBottomCard()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
|
|
@ -3540,6 +3563,8 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
|
||||
if (revealedCard) {
|
||||
cardMenu->addAction(aHide);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSelectAll);
|
||||
addRelatedCardView(card, cardMenu);
|
||||
} else if (writeableCard) {
|
||||
if (moveMenu->isEmpty()) {
|
||||
|
|
@ -3596,6 +3621,8 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aClone);
|
||||
cardMenu->addMenu(moveMenu);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSelectAll);
|
||||
|
||||
for (int i = 0; i < aAddCounter.size(); ++i) {
|
||||
cardMenu->addSeparator();
|
||||
|
|
@ -3612,16 +3639,21 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aClone);
|
||||
cardMenu->addMenu(moveMenu);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSelectAll);
|
||||
|
||||
addRelatedCardView(card, cardMenu);
|
||||
addRelatedCardActions(card, cardMenu);
|
||||
} else if (card->getZone()->getName() == "rfg" || card->getZone()->getName() == "grave") {
|
||||
// Card is in the graveyard or exile
|
||||
cardMenu->addAction(aSelectAll);
|
||||
cardMenu->addAction(aPlay);
|
||||
cardMenu->addAction(aPlayFacedown);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aClone);
|
||||
cardMenu->addMenu(moveMenu);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSelectAll);
|
||||
|
||||
addRelatedCardView(card, cardMenu);
|
||||
addRelatedCardActions(card, cardMenu);
|
||||
|
|
@ -3635,6 +3667,8 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
connect(revealMenu, &QMenu::triggered, this, &Player::actReveal);
|
||||
|
||||
cardMenu->addMenu(moveMenu);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSelectAll);
|
||||
addRelatedCardView(card, cardMenu);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -3648,6 +3682,8 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
addRelatedCardActions(card, cardMenu);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aClone);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSelectAll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,6 +180,8 @@ public slots:
|
|||
void actMoveBottomCardsToExile();
|
||||
void actMoveBottomCardToTop();
|
||||
|
||||
void actSelectAll();
|
||||
|
||||
void actViewLibrary();
|
||||
void actViewHand();
|
||||
void actViewTopCards();
|
||||
|
|
@ -262,7 +264,7 @@ private:
|
|||
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
||||
*aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aFlowP, *aFlowT, *aSetAnnotation, *aFlip, *aPeek, *aClone,
|
||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile,
|
||||
*aMoveToXfromTopOfLibrary;
|
||||
*aMoveToXfromTopOfLibrary, *aSelectAll;
|
||||
|
||||
bool movingCardsUntil;
|
||||
QTimer *moveTopCardTimer;
|
||||
|
|
|
|||
|
|
@ -453,6 +453,9 @@ private:
|
|||
{"Player/aSetAnnotation", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Annotation..."),
|
||||
parseSequenceString("Alt+N"),
|
||||
ShortcutGroup::Playing_Area)},
|
||||
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
|
||||
parseSequenceString("Ctrl+A"),
|
||||
ShortcutGroup::Playing_Area)},
|
||||
{"Player/aMoveToBottomLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Bottom of Library"),
|
||||
parseSequenceString("Ctrl+B"),
|
||||
ShortcutGroup::Move_selected)},
|
||||
|
|
@ -539,7 +542,7 @@ private:
|
|||
parseSequenceString(""),
|
||||
ShortcutGroup::Move_bottom)},
|
||||
{"Player/aDrawArrow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Arrow..."),
|
||||
parseSequenceString("Ctrl+A"),
|
||||
parseSequenceString("Alt+A"),
|
||||
ShortcutGroup::Gameplay)},
|
||||
{"Player/aRemoveLocalArrows", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Local Arrows"),
|
||||
parseSequenceString("Ctrl+R"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue