From 8682367b52c2229622574b78751f2a492778eea5 Mon Sep 17 00:00:00 2001 From: Rob Blanckaert Date: Fri, 31 May 2019 07:53:24 -0700 Subject: [PATCH] View hand window (#3731) * Roar * Add View Hand menu to player * Add shortcut * reorder right click menu --- cockatrice/src/player.cpp | 12 ++++++++++++ cockatrice/src/player.h | 3 ++- cockatrice/src/shortcutssettings.h | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 3313b8aaa..7a92b4ece 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -192,6 +192,9 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T aViewLibrary = new QAction(this); connect(aViewLibrary, SIGNAL(triggered()), this, SLOT(actViewLibrary())); + aViewHand = new QAction(this); + connect(aViewHand, SIGNAL(triggered()), this, SLOT(actViewHand())); + aViewTopCards = new QAction(this); connect(aViewTopCards, SIGNAL(triggered()), this, SLOT(actViewTopCards())); aAlwaysRevealTopCard = new QAction(this); @@ -243,6 +246,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T if (local || judge) { handMenu = playerMenu->addMenu(QString()); + handMenu->addAction(aViewHand); playerLists.append(mRevealHand = handMenu->addMenu(QString())); playerLists.append(mRevealRandomHandCard = handMenu->addMenu(QString())); handMenu->addSeparator(); @@ -672,6 +676,7 @@ void Player::retranslateUi() aMoveRfgToGrave->setText(tr("&Graveyard")); aViewLibrary->setText(tr("&View library")); + aViewHand->setText(tr("&View hand")); aViewTopCards->setText(tr("View &top cards of library...")); mRevealLibrary->setTitle(tr("Reveal &library to...")); mRevealTopCard->setTitle(tr("Reveal t&op cards to...")); @@ -839,6 +844,7 @@ void Player::setShortcutsActive() aViewSideboard->setShortcut(shortcuts.getSingleShortcut("Player/aViewSideboard")); aViewLibrary->setShortcut(shortcuts.getSingleShortcut("Player/aViewLibrary")); + aViewHand->setShortcut(shortcuts.getSingleShortcut("Player/aViewHand")); aViewTopCards->setShortcut(shortcuts.getSingleShortcut("Player/aViewTopCards")); aViewGraveyard->setShortcut(shortcuts.getSingleShortcut("Player/aViewGraveyard")); aDrawCard->setShortcut(shortcuts.getSingleShortcut("Player/aDrawCard")); @@ -864,6 +870,7 @@ void Player::setShortcutsInactive() aViewSideboard->setShortcut(QKeySequence()); aViewLibrary->setShortcut(QKeySequence()); + aViewHand->setShortcut(QKeySequence()); aViewTopCards->setShortcut(QKeySequence()); aViewGraveyard->setShortcut(QKeySequence()); aDrawCard->setShortcut(QKeySequence()); @@ -930,6 +937,11 @@ void Player::actViewLibrary() static_cast(scene())->toggleZoneView(this, "deck", -1); } +void Player::actViewHand() +{ + static_cast(scene())->toggleZoneView(this, "hand", -1); +} + void Player::actViewTopCards() { bool ok; diff --git a/cockatrice/src/player.h b/cockatrice/src/player.h index e5f06693b..7bc46c279 100644 --- a/cockatrice/src/player.h +++ b/cockatrice/src/player.h @@ -157,6 +157,7 @@ public slots: void actMoveBottomCardToGrave(); void actViewLibrary(); + void actViewHand(); void actViewTopCards(); void actAlwaysRevealTopCard(); void actViewGraveyard(); @@ -209,7 +210,7 @@ private: QList allPlayersActions; QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg, *aMoveGraveToTopLibrary, *aMoveGraveToBottomLibrary, *aMoveGraveToHand, *aMoveGraveToRfg, *aMoveRfgToTopLibrary, - *aMoveRfgToBottomLibrary, *aMoveRfgToHand, *aMoveRfgToGrave, *aViewLibrary, *aViewTopCards, + *aMoveRfgToBottomLibrary, *aMoveRfgToHand, *aMoveRfgToGrave, *aViewHand, *aViewLibrary, *aViewTopCards, *aAlwaysRevealTopCard, *aOpenDeckInDeckEditor, *aMoveTopCardToGraveyard, *aMoveTopCardToExile, *aMoveTopCardsToGraveyard, *aMoveTopCardsToExile, *aMoveTopCardToBottom, *aViewGraveyard, *aViewRfg, *aViewSideboard, *aDrawCard, *aDrawCards, *aUndoDraw, *aMulligan, *aShuffle, *aMoveTopToPlayFaceDown, diff --git a/cockatrice/src/shortcutssettings.h b/cockatrice/src/shortcutssettings.h index f59f37d53..6e8bfc503 100644 --- a/cockatrice/src/shortcutssettings.h +++ b/cockatrice/src/shortcutssettings.h @@ -419,6 +419,8 @@ private: {"Player/aMoveTopToPlayFaceDown", SK(QT_TRANSLATE_NOOP("shortcutsTab", "Play face down"), parseSequenceString("Ctrl+Shift+E"), ShortcutGroup::Move_selected)}, + {"Player/aViewHand", + SK(QT_TRANSLATE_NOOP("shortcutsTab", "Hand"), parseSequenceString(""), ShortcutGroup::View)}, {"Player/aViewGraveyard", SK(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"), parseSequenceString("F4"), ShortcutGroup::View)}, {"Player/aViewLibrary",