rig up the sort hand to the player

This commit is contained in:
Paul Carroll 2025-07-30 16:47:42 -04:00
parent eb3ae97ac1
commit 580fcb53ce
2 changed files with 13 additions and 2 deletions

View file

@ -210,6 +210,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
connect(aViewLibrary, &QAction::triggered, this, &Player::actViewLibrary); connect(aViewLibrary, &QAction::triggered, this, &Player::actViewLibrary);
aViewHand = new QAction(this); aViewHand = new QAction(this);
connect(aViewHand, &QAction::triggered, this, &Player::actViewHand); connect(aViewHand, &QAction::triggered, this, &Player::actViewHand);
aSortHand = new QAction(this);
connect(aSortHand, &QAction::triggered, this, &Player::actSortHand);
aViewTopCards = new QAction(this); aViewTopCards = new QAction(this);
connect(aViewTopCards, &QAction::triggered, this, &Player::actViewTopCards); 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) { if (local || judge) {
handMenu = playerMenu->addTearOffMenu(QString()); handMenu = playerMenu->addTearOffMenu(QString());
handMenu->addAction(aViewHand); handMenu->addAction(aViewHand);
handMenu->addAction(aSortHand);
playerLists.append(mRevealHand = handMenu->addMenu(QString())); playerLists.append(mRevealHand = handMenu->addMenu(QString()));
playerLists.append(mRevealRandomHandCard = handMenu->addMenu(QString())); playerLists.append(mRevealRandomHandCard = handMenu->addMenu(QString()));
handMenu->addSeparator(); handMenu->addSeparator();
@ -791,6 +794,7 @@ void Player::retranslateUi()
aViewLibrary->setText(tr("&View library")); aViewLibrary->setText(tr("&View library"));
aViewHand->setText(tr("&View hand")); aViewHand->setText(tr("&View hand"));
aSortHand->setText(tr("&Sort hand"));
aViewTopCards->setText(tr("View &top cards of library...")); aViewTopCards->setText(tr("View &top cards of library..."));
aViewBottomCards->setText(tr("View bottom cards of library...")); aViewBottomCards->setText(tr("View bottom cards of library..."));
mRevealLibrary->setTitle(tr("Reveal &library to...")); mRevealLibrary->setTitle(tr("Reveal &library to..."));
@ -954,6 +958,7 @@ void Player::setShortcutsActive()
aMoveToHand->setShortcuts(shortcuts.getShortcut("Player/aMoveToHand")); aMoveToHand->setShortcuts(shortcuts.getShortcut("Player/aMoveToHand"));
aMoveToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveToGraveyard")); aMoveToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveToGraveyard"));
aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile")); aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile"));
aSortHand->setShortcut(shortcuts.getSingleShortcut("Player/aSortHand"));
aSelectAll->setShortcuts(shortcuts.getShortcut("Player/aSelectAll")); aSelectAll->setShortcuts(shortcuts.getShortcut("Player/aSelectAll"));
aSelectRow->setShortcuts(shortcuts.getShortcut("Player/aSelectRow")); aSelectRow->setShortcuts(shortcuts.getShortcut("Player/aSelectRow"));
@ -1084,6 +1089,7 @@ void Player::setShortcutsInactive()
aMoveBottomCardsToGraveyard->setShortcut(QKeySequence()); aMoveBottomCardsToGraveyard->setShortcut(QKeySequence());
aMoveBottomCardToExile->setShortcut(QKeySequence()); aMoveBottomCardToExile->setShortcut(QKeySequence());
aMoveBottomCardsToExile->setShortcut(QKeySequence()); aMoveBottomCardsToExile->setShortcut(QKeySequence());
aSortHand->setShortcut(QKeySequence());
QMapIterator<int, AbstractCounter *> counterIterator(counters); QMapIterator<int, AbstractCounter *> counterIterator(counters);
while (counterIterator.hasNext()) { while (counterIterator.hasNext()) {
@ -1154,6 +1160,11 @@ void Player::actViewHand()
static_cast<GameScene *>(scene())->toggleZoneView(this, "hand", -1); static_cast<GameScene *>(scene())->toggleZoneView(this, "hand", -1);
} }
void Player::actSortHand()
{
hand->sortHand();
}
void Player::actViewTopCards() void Player::actViewTopCards()
{ {
int deckSize = zones.value("deck")->getCards().size(); int deckSize = zones.value("deck")->getCards().size();

View file

@ -239,7 +239,7 @@ private slots:
void actSetAnnotation(); void actSetAnnotation();
void actReveal(QAction *action); void actReveal(QAction *action);
void refreshShortcuts(); void refreshShortcuts();
void actSortHand();
void initSayMenu(); void initSayMenu();
public: public:
@ -276,7 +276,7 @@ private:
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,
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile, *aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile,
*aMoveToXfromTopOfLibrary, *aSelectAll, *aSelectRow, *aSelectColumn; *aMoveToXfromTopOfLibrary, *aSelectAll, *aSelectRow, *aSelectColumn, *aSortHand;
bool movingCardsUntil; bool movingCardsUntil;
QTimer *moveTopCardTimer; QTimer *moveTopCardTimer;