mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
Add menu option and hotkey to sort hand (#6057)
* Add sort hand shortcut * add function to sort hand by type and name * rig up the sort hand to the player * fix sorting param * use getShortcut instead of getSingleShortcut * use correct method * change default sorting --------- Co-authored-by: Zach H <zahalpern+github@gmail.com>
This commit is contained in:
parent
d6243a2dd2
commit
06738cae93
5 changed files with 26 additions and 2 deletions
|
|
@ -210,6 +210,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
connect(aViewLibrary, &QAction::triggered, this, &Player::actViewLibrary);
|
||||
aViewHand = new QAction(this);
|
||||
connect(aViewHand, &QAction::triggered, this, &Player::actViewHand);
|
||||
aSortHand = new QAction(this);
|
||||
connect(aSortHand, &QAction::triggered, this, &Player::actSortHand);
|
||||
|
||||
aViewTopCards = new QAction(this);
|
||||
connect(aViewTopCards, &QAction::triggered, this, &Player::actViewTopCards);
|
||||
|
|
@ -298,6 +300,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
if (local || judge) {
|
||||
handMenu = playerMenu->addTearOffMenu(QString());
|
||||
handMenu->addAction(aViewHand);
|
||||
handMenu->addAction(aSortHand);
|
||||
playerLists.append(mRevealHand = handMenu->addMenu(QString()));
|
||||
playerLists.append(mRevealRandomHandCard = handMenu->addMenu(QString()));
|
||||
handMenu->addSeparator();
|
||||
|
|
@ -795,6 +798,7 @@ void Player::retranslateUi()
|
|||
|
||||
aViewLibrary->setText(tr("&View library"));
|
||||
aViewHand->setText(tr("&View hand"));
|
||||
aSortHand->setText(tr("&Sort hand"));
|
||||
aViewTopCards->setText(tr("View &top cards of library..."));
|
||||
aViewBottomCards->setText(tr("View bottom cards of library..."));
|
||||
mRevealLibrary->setTitle(tr("Reveal &library to..."));
|
||||
|
|
@ -959,6 +963,7 @@ void Player::setShortcutsActive()
|
|||
aMoveToHand->setShortcuts(shortcuts.getShortcut("Player/aMoveToHand"));
|
||||
aMoveToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveToGraveyard"));
|
||||
aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile"));
|
||||
aSortHand->setShortcuts(shortcuts.getShortcut("Player/aSortHand"));
|
||||
|
||||
aSelectAll->setShortcuts(shortcuts.getShortcut("Player/aSelectAll"));
|
||||
aSelectRow->setShortcuts(shortcuts.getShortcut("Player/aSelectRow"));
|
||||
|
|
@ -1064,6 +1069,7 @@ void Player::setShortcutsInactive()
|
|||
aMoveBottomCardToExile->setShortcut(QKeySequence());
|
||||
aMoveBottomCardsToExile->setShortcut(QKeySequence());
|
||||
aIncrementAllCardCounters->setShortcut(QKeySequence());
|
||||
aSortHand->setShortcut(QKeySequence());
|
||||
|
||||
QMapIterator<int, AbstractCounter *> counterIterator(counters);
|
||||
while (counterIterator.hasNext()) {
|
||||
|
|
@ -1134,6 +1140,11 @@ void Player::actViewHand()
|
|||
static_cast<GameScene *>(scene())->toggleZoneView(this, "hand", -1);
|
||||
}
|
||||
|
||||
void Player::actSortHand()
|
||||
{
|
||||
hand->sortHand();
|
||||
}
|
||||
|
||||
void Player::actViewTopCards()
|
||||
{
|
||||
int deckSize = zones.value("deck")->getCards().size();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue