mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 17:02:15 -07:00
implement thing
This commit is contained in:
parent
290509d8ad
commit
e4b4f6cfa8
3 changed files with 41 additions and 1 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 Cards in Zone"));
|
||||
|
||||
aPlay->setText(tr("&Play"));
|
||||
aHide->setText(tr("&Hide"));
|
||||
aPlayFacedown->setText(tr("Play &Face Down"));
|
||||
|
|
@ -922,6 +927,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"));
|
||||
|
|
@ -1536,6 +1543,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()) {
|
||||
|
|
@ -3539,6 +3562,7 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
|
||||
if (revealedCard) {
|
||||
cardMenu->addAction(aHide);
|
||||
cardMenu->addAction(aSelectAll);
|
||||
addRelatedCardView(card, cardMenu);
|
||||
} else if (writeableCard) {
|
||||
if (moveMenu->isEmpty()) {
|
||||
|
|
@ -3595,6 +3619,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();
|
||||
|
|
@ -3611,16 +3637,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);
|
||||
|
|
@ -3634,6 +3665,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 {
|
||||
|
|
@ -3647,6 +3680,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;
|
||||
|
|
|
|||
|
|
@ -552,6 +552,9 @@ private:
|
|||
{"Player/aShuffle", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Shuffle Library"),
|
||||
parseSequenceString("Ctrl+S"),
|
||||
ShortcutGroup::Gameplay)},
|
||||
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
|
||||
parseSequenceString("Ctrl+A"),
|
||||
ShortcutGroup::Gameplay)},
|
||||
{"Player/aMulligan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Mulligan"),
|
||||
parseSequenceString("Ctrl+M"),
|
||||
ShortcutGroup::Drawing)},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue