mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
Instantiate menu before graphics item.
Took 1 hour 5 minutes Took 55 minutes
This commit is contained in:
parent
bc9d2f4cbd
commit
0e33187388
3 changed files with 375 additions and 253 deletions
|
|
@ -36,8 +36,9 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, G
|
||||||
{
|
{
|
||||||
initializeZones();
|
initializeZones();
|
||||||
|
|
||||||
graphicsItem = new PlayerGraphicsItem(this);
|
|
||||||
playerMenu = new PlayerMenu(this);
|
playerMenu = new PlayerMenu(this);
|
||||||
|
graphicsItem = new PlayerGraphicsItem(this);
|
||||||
|
playerMenu->setMenusForGraphicItems();
|
||||||
|
|
||||||
connect(this, &Player::activeChanged, graphicsItem, &PlayerGraphicsItem::onPlayerActiveChanged);
|
connect(this, &Player::activeChanged, graphicsItem, &PlayerGraphicsItem::onPlayerActiveChanged);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,147 +24,13 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerActions *playerActions = player->getPlayerActions();
|
PlayerActions *playerActions = player->getPlayerActions();
|
||||||
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
|
||||||
aMoveHandToTopLibrary = new QAction(this);
|
|
||||||
aMoveHandToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
|
||||||
aMoveHandToBottomLibrary = new QAction(this);
|
|
||||||
aMoveHandToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
|
||||||
aMoveHandToGrave = new QAction(this);
|
|
||||||
aMoveHandToGrave->setData(QList<QVariant>() << "grave" << 0);
|
|
||||||
aMoveHandToRfg = new QAction(this);
|
|
||||||
aMoveHandToRfg->setData(QList<QVariant>() << "rfg" << 0);
|
|
||||||
|
|
||||||
auto hand = player->getHandZone();
|
createDrawActions();
|
||||||
auto grave = player->getGraveZone();
|
createShuffleActions();
|
||||||
auto rfg = player->getRfgZone();
|
createMoveActions();
|
||||||
|
createViewActions();
|
||||||
connect(aMoveHandToTopLibrary, &QAction::triggered, hand, &HandZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveHandToBottomLibrary, &QAction::triggered, hand, &HandZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveHandToGrave, &QAction::triggered, hand, &HandZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveHandToRfg, &QAction::triggered, hand, &HandZoneLogic::moveAllToZone);
|
|
||||||
|
|
||||||
aMoveGraveToTopLibrary = new QAction(this);
|
|
||||||
aMoveGraveToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
|
||||||
aMoveGraveToBottomLibrary = new QAction(this);
|
|
||||||
aMoveGraveToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
|
||||||
aMoveGraveToHand = new QAction(this);
|
|
||||||
aMoveGraveToHand->setData(QList<QVariant>() << "hand" << 0);
|
|
||||||
aMoveGraveToRfg = new QAction(this);
|
|
||||||
aMoveGraveToRfg->setData(QList<QVariant>() << "rfg" << 0);
|
|
||||||
|
|
||||||
connect(aMoveGraveToTopLibrary, &QAction::triggered, grave, &PileZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveGraveToBottomLibrary, &QAction::triggered, grave, &PileZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveGraveToHand, &QAction::triggered, grave, &PileZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveGraveToRfg, &QAction::triggered, grave, &PileZoneLogic::moveAllToZone);
|
|
||||||
|
|
||||||
aMoveRfgToTopLibrary = new QAction(this);
|
|
||||||
aMoveRfgToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
|
||||||
aMoveRfgToBottomLibrary = new QAction(this);
|
|
||||||
aMoveRfgToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
|
||||||
aMoveRfgToHand = new QAction(this);
|
|
||||||
aMoveRfgToHand->setData(QList<QVariant>() << "hand" << 0);
|
|
||||||
aMoveRfgToGrave = new QAction(this);
|
|
||||||
aMoveRfgToGrave->setData(QList<QVariant>() << "grave" << 0);
|
|
||||||
|
|
||||||
connect(aMoveRfgToTopLibrary, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveRfgToBottomLibrary, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveRfgToHand, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
|
||||||
connect(aMoveRfgToGrave, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
|
||||||
|
|
||||||
aViewLibrary = new QAction(this);
|
|
||||||
connect(aViewLibrary, &QAction::triggered, playerActions, &PlayerActions::actViewLibrary);
|
|
||||||
aViewHand = new QAction(this);
|
|
||||||
connect(aViewHand, &QAction::triggered, playerActions, &PlayerActions::actViewHand);
|
|
||||||
aSortHand = new QAction(this);
|
|
||||||
connect(aSortHand, &QAction::triggered, playerActions, &PlayerActions::actSortHand);
|
|
||||||
|
|
||||||
aViewTopCards = new QAction(this);
|
|
||||||
connect(aViewTopCards, &QAction::triggered, playerActions, &PlayerActions::actViewTopCards);
|
|
||||||
aViewBottomCards = new QAction(this);
|
|
||||||
connect(aViewBottomCards, &QAction::triggered, playerActions, &PlayerActions::actViewBottomCards);
|
|
||||||
aAlwaysRevealTopCard = new QAction(this);
|
|
||||||
aAlwaysRevealTopCard->setCheckable(true);
|
|
||||||
connect(aAlwaysRevealTopCard, &QAction::triggered, playerActions, &PlayerActions::actAlwaysRevealTopCard);
|
|
||||||
aAlwaysLookAtTopCard = new QAction(this);
|
|
||||||
aAlwaysLookAtTopCard->setCheckable(true);
|
|
||||||
connect(aAlwaysLookAtTopCard, &QAction::triggered, playerActions, &PlayerActions::actAlwaysLookAtTopCard);
|
|
||||||
aOpenDeckInDeckEditor = new QAction(this);
|
|
||||||
aOpenDeckInDeckEditor->setEnabled(false);
|
|
||||||
connect(aOpenDeckInDeckEditor, &QAction::triggered, playerActions, &PlayerActions::actOpenDeckInDeckEditor);
|
|
||||||
}
|
|
||||||
|
|
||||||
aViewGraveyard = new QAction(this);
|
|
||||||
connect(aViewGraveyard, &QAction::triggered, playerActions, &PlayerActions::actViewGraveyard);
|
|
||||||
|
|
||||||
aViewRfg = new QAction(this);
|
|
||||||
connect(aViewRfg, &QAction::triggered, playerActions, &PlayerActions::actViewRfg);
|
|
||||||
|
|
||||||
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
|
||||||
aViewSideboard = new QAction(this);
|
|
||||||
connect(aViewSideboard, &QAction::triggered, playerActions, &PlayerActions::actViewSideboard);
|
|
||||||
|
|
||||||
aDrawCard = new QAction(this);
|
|
||||||
connect(aDrawCard, &QAction::triggered, playerActions, &PlayerActions::actDrawCard);
|
|
||||||
aDrawCards = new QAction(this);
|
|
||||||
connect(aDrawCards, &QAction::triggered, playerActions, &PlayerActions::actDrawCards);
|
|
||||||
aUndoDraw = new QAction(this);
|
|
||||||
connect(aUndoDraw, &QAction::triggered, playerActions, &PlayerActions::actUndoDraw);
|
|
||||||
|
|
||||||
aShuffle = new QAction(this);
|
|
||||||
connect(aShuffle, &QAction::triggered, playerActions, &PlayerActions::actShuffle);
|
|
||||||
|
|
||||||
aMulligan = new QAction(this);
|
|
||||||
connect(aMulligan, &QAction::triggered, playerActions, &PlayerActions::actMulligan);
|
|
||||||
|
|
||||||
aMoveTopToPlay = new QAction(this);
|
|
||||||
connect(aMoveTopToPlay, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardToPlay);
|
|
||||||
aMoveTopToPlayFaceDown = new QAction(this);
|
|
||||||
connect(aMoveTopToPlayFaceDown, &QAction::triggered, playerActions,
|
|
||||||
&PlayerActions::actMoveTopCardToPlayFaceDown);
|
|
||||||
aMoveTopCardToGraveyard = new QAction(this);
|
|
||||||
connect(aMoveTopCardToGraveyard, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardToGrave);
|
|
||||||
aMoveTopCardToExile = new QAction(this);
|
|
||||||
connect(aMoveTopCardToExile, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardToExile);
|
|
||||||
aMoveTopCardsToGraveyard = new QAction(this);
|
|
||||||
connect(aMoveTopCardsToGraveyard, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardsToGrave);
|
|
||||||
aMoveTopCardsToExile = new QAction(this);
|
|
||||||
connect(aMoveTopCardsToExile, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardsToExile);
|
|
||||||
aMoveTopCardsUntil = new QAction(this);
|
|
||||||
connect(aMoveTopCardsUntil, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardsUntil);
|
|
||||||
aMoveTopCardToBottom = new QAction(this);
|
|
||||||
connect(aMoveTopCardToBottom, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardToBottom);
|
|
||||||
|
|
||||||
aShuffleTopCards = new QAction(this);
|
|
||||||
connect(aShuffleTopCards, &QAction::triggered, playerActions, &PlayerActions::actShuffleTop);
|
|
||||||
|
|
||||||
aDrawBottomCard = new QAction(this);
|
|
||||||
connect(aDrawBottomCard, &QAction::triggered, playerActions, &PlayerActions::actDrawBottomCard);
|
|
||||||
aDrawBottomCards = new QAction(this);
|
|
||||||
connect(aDrawBottomCards, &QAction::triggered, playerActions, &PlayerActions::actDrawBottomCards);
|
|
||||||
aMoveBottomToPlay = new QAction(this);
|
|
||||||
connect(aMoveBottomToPlay, &QAction::triggered, playerActions, &PlayerActions::actMoveBottomCardToPlay);
|
|
||||||
aMoveBottomToPlayFaceDown = new QAction(this);
|
|
||||||
connect(aMoveBottomToPlayFaceDown, &QAction::triggered, playerActions,
|
|
||||||
&PlayerActions::actMoveBottomCardToPlayFaceDown);
|
|
||||||
aMoveBottomCardToGraveyard = new QAction(this);
|
|
||||||
connect(aMoveBottomCardToGraveyard, &QAction::triggered, playerActions,
|
|
||||||
&PlayerActions::actMoveBottomCardToGrave);
|
|
||||||
aMoveBottomCardToExile = new QAction(this);
|
|
||||||
connect(aMoveBottomCardToExile, &QAction::triggered, playerActions, &PlayerActions::actMoveBottomCardToExile);
|
|
||||||
aMoveBottomCardsToGraveyard = new QAction(this);
|
|
||||||
connect(aMoveBottomCardsToGraveyard, &QAction::triggered, playerActions,
|
|
||||||
&PlayerActions::actMoveBottomCardsToGrave);
|
|
||||||
aMoveBottomCardsToExile = new QAction(this);
|
|
||||||
connect(aMoveBottomCardsToExile, &QAction::triggered, playerActions, &PlayerActions::actMoveBottomCardsToExile);
|
|
||||||
aMoveBottomCardToTop = new QAction(this);
|
|
||||||
connect(aMoveBottomCardToTop, &QAction::triggered, playerActions, &PlayerActions::actMoveBottomCardToTop);
|
|
||||||
|
|
||||||
aShuffleBottomCards = new QAction(this);
|
|
||||||
connect(aShuffleBottomCards, &QAction::triggered, playerActions, &PlayerActions::actShuffleBottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
playerMenu = new TearOffMenu();
|
playerMenu = new TearOffMenu();
|
||||||
player->getGraphicsItem()->getTableZoneGraphicsItem()->setMenu(playerMenu);
|
|
||||||
|
|
||||||
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
||||||
handMenu = playerMenu->addTearOffMenu(QString());
|
handMenu = playerMenu->addTearOffMenu(QString());
|
||||||
|
|
@ -182,7 +48,6 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
moveHandMenu->addAction(aMoveHandToGrave);
|
moveHandMenu->addAction(aMoveHandToGrave);
|
||||||
moveHandMenu->addSeparator();
|
moveHandMenu->addSeparator();
|
||||||
moveHandMenu->addAction(aMoveHandToRfg);
|
moveHandMenu->addAction(aMoveHandToRfg);
|
||||||
player->getGraphicsItem()->getHandZoneGraphicsItem()->setMenu(handMenu);
|
|
||||||
|
|
||||||
libraryMenu = playerMenu->addTearOffMenu(QString());
|
libraryMenu = playerMenu->addTearOffMenu(QString());
|
||||||
libraryMenu->addAction(aDrawCard);
|
libraryMenu->addAction(aDrawCard);
|
||||||
|
|
@ -205,7 +70,6 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
bottomLibraryMenu = libraryMenu->addTearOffMenu(QString());
|
bottomLibraryMenu = libraryMenu->addTearOffMenu(QString());
|
||||||
libraryMenu->addSeparator();
|
libraryMenu->addSeparator();
|
||||||
libraryMenu->addAction(aOpenDeckInDeckEditor);
|
libraryMenu->addAction(aOpenDeckInDeckEditor);
|
||||||
player->getGraphicsItem()->getDeckZoneGraphicsItem()->setMenu(libraryMenu, aDrawCard);
|
|
||||||
topLibraryMenu->addAction(aMoveTopToPlay);
|
topLibraryMenu->addAction(aMoveTopToPlay);
|
||||||
topLibraryMenu->addAction(aMoveTopToPlayFaceDown);
|
topLibraryMenu->addAction(aMoveTopToPlayFaceDown);
|
||||||
topLibraryMenu->addAction(aMoveTopCardToBottom);
|
topLibraryMenu->addAction(aMoveTopCardToBottom);
|
||||||
|
|
@ -244,11 +108,9 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
allPlayersActions.append(newAction);
|
allPlayersActions.append(newAction);
|
||||||
mRevealRandomGraveyardCard->addSeparator();
|
mRevealRandomGraveyardCard->addSeparator();
|
||||||
}
|
}
|
||||||
player->getGraphicsItem()->getGraveyardZoneGraphicsItem()->setMenu(graveMenu, aViewGraveyard);
|
|
||||||
|
|
||||||
rfgMenu = playerMenu->addTearOffMenu(QString());
|
rfgMenu = playerMenu->addTearOffMenu(QString());
|
||||||
rfgMenu->addAction(aViewRfg);
|
rfgMenu->addAction(aViewRfg);
|
||||||
player->getGraphicsItem()->getRfgZoneGraphicsItem()->setMenu(rfgMenu, aViewRfg);
|
|
||||||
|
|
||||||
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
||||||
graveMenu->addSeparator();
|
graveMenu->addSeparator();
|
||||||
|
|
@ -272,8 +134,6 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
sbMenu = playerMenu->addMenu(QString());
|
sbMenu = playerMenu->addMenu(QString());
|
||||||
sbMenu->addAction(aViewSideboard);
|
sbMenu->addAction(aViewSideboard);
|
||||||
|
|
||||||
player->getGraphicsItem()->getSideboardZoneGraphicsItem()->setMenu(sbMenu);
|
|
||||||
|
|
||||||
mCustomZones = playerMenu->addMenu(QString());
|
mCustomZones = playerMenu->addMenu(QString());
|
||||||
mCustomZones->menuAction()->setVisible(false);
|
mCustomZones->menuAction()->setVisible(false);
|
||||||
|
|
||||||
|
|
@ -330,6 +190,8 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We have to explicitly not-instantiate a bunch of things if we are not local or a judge or else we have to
|
||||||
|
// consider it everywhere instead of just null-checking
|
||||||
if (!player->getPlayerInfo()->local && !player->getPlayerInfo()->judge) {
|
if (!player->getPlayerInfo()->local && !player->getPlayerInfo()->judge) {
|
||||||
countersMenu = nullptr;
|
countersMenu = nullptr;
|
||||||
sbMenu = nullptr;
|
sbMenu = nullptr;
|
||||||
|
|
@ -337,6 +199,73 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
aCreateAnotherToken = nullptr;
|
aCreateAnotherToken = nullptr;
|
||||||
createPredefinedTokenMenu = nullptr;
|
createPredefinedTokenMenu = nullptr;
|
||||||
mCardCounters = nullptr;
|
mCardCounters = nullptr;
|
||||||
|
moveHandMenu = nullptr;
|
||||||
|
aMoveHandToTopLibrary = nullptr;
|
||||||
|
aMoveHandToBottomLibrary = nullptr;
|
||||||
|
aMoveHandToGrave = nullptr;
|
||||||
|
aMoveHandToRfg = nullptr;
|
||||||
|
|
||||||
|
moveGraveMenu = nullptr;
|
||||||
|
aMoveGraveToTopLibrary = nullptr;
|
||||||
|
aMoveGraveToBottomLibrary = nullptr;
|
||||||
|
aMoveGraveToHand = nullptr;
|
||||||
|
aMoveGraveToRfg = nullptr;
|
||||||
|
|
||||||
|
moveRfgMenu = nullptr;
|
||||||
|
aMoveRfgToTopLibrary = nullptr;
|
||||||
|
aMoveRfgToBottomLibrary = nullptr;
|
||||||
|
aMoveRfgToHand = nullptr;
|
||||||
|
aMoveRfgToGrave = nullptr;
|
||||||
|
|
||||||
|
aViewLibrary = nullptr;
|
||||||
|
aViewHand = nullptr;
|
||||||
|
aSortHand = nullptr;
|
||||||
|
aViewTopCards = nullptr;
|
||||||
|
aViewBottomCards = nullptr;
|
||||||
|
mRevealLibrary = nullptr;
|
||||||
|
mLendLibrary = nullptr;
|
||||||
|
mRevealTopCard = nullptr;
|
||||||
|
topLibraryMenu = nullptr;
|
||||||
|
bottomLibraryMenu = nullptr;
|
||||||
|
aAlwaysRevealTopCard = nullptr;
|
||||||
|
aAlwaysLookAtTopCard = nullptr;
|
||||||
|
aOpenDeckInDeckEditor = nullptr;
|
||||||
|
aViewSideboard = nullptr;
|
||||||
|
aDrawCard = nullptr;
|
||||||
|
aDrawCards = nullptr;
|
||||||
|
aUndoDraw = nullptr;
|
||||||
|
aMulligan = nullptr;
|
||||||
|
|
||||||
|
aShuffle = nullptr;
|
||||||
|
aMoveTopToPlay = nullptr;
|
||||||
|
aMoveTopToPlayFaceDown = nullptr;
|
||||||
|
aMoveTopCardToBottom = nullptr;
|
||||||
|
aMoveTopCardToGraveyard = nullptr;
|
||||||
|
aMoveTopCardToExile = nullptr;
|
||||||
|
aMoveTopCardsToGraveyard = nullptr;
|
||||||
|
aMoveTopCardsToExile = nullptr;
|
||||||
|
aMoveTopCardsUntil = nullptr;
|
||||||
|
aShuffleTopCards = nullptr;
|
||||||
|
|
||||||
|
aDrawBottomCard = nullptr;
|
||||||
|
aDrawBottomCards = nullptr;
|
||||||
|
aMoveBottomToPlay = nullptr;
|
||||||
|
aMoveBottomToPlayFaceDown = nullptr;
|
||||||
|
aMoveBottomCardToGraveyard = nullptr;
|
||||||
|
aMoveBottomCardToExile = nullptr;
|
||||||
|
aMoveBottomCardsToGraveyard = nullptr;
|
||||||
|
aMoveBottomCardsToExile = nullptr;
|
||||||
|
aMoveBottomCardToTop = nullptr;
|
||||||
|
aShuffleBottomCards = nullptr;
|
||||||
|
|
||||||
|
handMenu = nullptr;
|
||||||
|
mRevealHand = nullptr;
|
||||||
|
mRevealRandomHandCard = nullptr;
|
||||||
|
mRevealRandomGraveyardCard = nullptr;
|
||||||
|
sbMenu = nullptr;
|
||||||
|
libraryMenu = nullptr;
|
||||||
|
countersMenu = nullptr;
|
||||||
|
mCustomZones = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
aTap = new QAction(this);
|
aTap = new QAction(this);
|
||||||
|
|
@ -441,6 +370,177 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerMenu::setMenusForGraphicItems(){
|
||||||
|
player->getGraphicsItem()->getTableZoneGraphicsItem()->setMenu(playerMenu);
|
||||||
|
player->getGraphicsItem()->getGraveyardZoneGraphicsItem()->setMenu(graveMenu, aViewGraveyard);
|
||||||
|
player->getGraphicsItem()->getRfgZoneGraphicsItem()->setMenu(rfgMenu, aViewRfg);
|
||||||
|
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
||||||
|
player->getGraphicsItem()->getHandZoneGraphicsItem()->setMenu(handMenu);
|
||||||
|
player->getGraphicsItem()->getDeckZoneGraphicsItem()->setMenu(libraryMenu, aDrawCard);
|
||||||
|
player->getGraphicsItem()->getSideboardZoneGraphicsItem()->setMenu(sbMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerMenu::createDrawActions()
|
||||||
|
{
|
||||||
|
PlayerActions *playerActions = player->getPlayerActions();
|
||||||
|
|
||||||
|
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
||||||
|
aDrawCard = new QAction(this);
|
||||||
|
connect(aDrawCard, &QAction::triggered, playerActions, &PlayerActions::actDrawCard);
|
||||||
|
aDrawCards = new QAction(this);
|
||||||
|
connect(aDrawCards, &QAction::triggered, playerActions, &PlayerActions::actDrawCards);
|
||||||
|
aUndoDraw = new QAction(this);
|
||||||
|
connect(aUndoDraw, &QAction::triggered, playerActions, &PlayerActions::actUndoDraw);
|
||||||
|
aMulligan = new QAction(this);
|
||||||
|
connect(aMulligan, &QAction::triggered, playerActions, &PlayerActions::actMulligan);
|
||||||
|
aDrawBottomCard = new QAction(this);
|
||||||
|
connect(aDrawBottomCard, &QAction::triggered, playerActions, &PlayerActions::actDrawBottomCard);
|
||||||
|
aDrawBottomCards = new QAction(this);
|
||||||
|
connect(aDrawBottomCards, &QAction::triggered, playerActions, &PlayerActions::actDrawBottomCards);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerMenu::createShuffleActions()
|
||||||
|
{
|
||||||
|
PlayerActions *playerActions = player->getPlayerActions();
|
||||||
|
|
||||||
|
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
||||||
|
aShuffle = new QAction(this);
|
||||||
|
connect(aShuffle, &QAction::triggered, playerActions, &PlayerActions::actShuffle);
|
||||||
|
aShuffleTopCards = new QAction(this);
|
||||||
|
connect(aShuffleTopCards, &QAction::triggered, playerActions, &PlayerActions::actShuffleTop);
|
||||||
|
aShuffleBottomCards = new QAction(this);
|
||||||
|
connect(aShuffleBottomCards, &QAction::triggered, playerActions, &PlayerActions::actShuffleBottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerMenu::createMoveActions()
|
||||||
|
{
|
||||||
|
PlayerActions *playerActions = player->getPlayerActions();
|
||||||
|
|
||||||
|
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
||||||
|
aMoveHandToTopLibrary = new QAction(this);
|
||||||
|
aMoveHandToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
||||||
|
aMoveHandToBottomLibrary = new QAction(this);
|
||||||
|
aMoveHandToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
||||||
|
aMoveHandToGrave = new QAction(this);
|
||||||
|
aMoveHandToGrave->setData(QList<QVariant>() << "grave" << 0);
|
||||||
|
aMoveHandToRfg = new QAction(this);
|
||||||
|
aMoveHandToRfg->setData(QList<QVariant>() << "rfg" << 0);
|
||||||
|
|
||||||
|
auto hand = player->getHandZone();
|
||||||
|
auto grave = player->getGraveZone();
|
||||||
|
auto rfg = player->getRfgZone();
|
||||||
|
|
||||||
|
connect(aMoveHandToTopLibrary, &QAction::triggered, hand, &HandZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveHandToBottomLibrary, &QAction::triggered, hand, &HandZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveHandToGrave, &QAction::triggered, hand, &HandZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveHandToRfg, &QAction::triggered, hand, &HandZoneLogic::moveAllToZone);
|
||||||
|
|
||||||
|
aMoveGraveToTopLibrary = new QAction(this);
|
||||||
|
aMoveGraveToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
||||||
|
aMoveGraveToBottomLibrary = new QAction(this);
|
||||||
|
aMoveGraveToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
||||||
|
aMoveGraveToHand = new QAction(this);
|
||||||
|
aMoveGraveToHand->setData(QList<QVariant>() << "hand" << 0);
|
||||||
|
aMoveGraveToRfg = new QAction(this);
|
||||||
|
aMoveGraveToRfg->setData(QList<QVariant>() << "rfg" << 0);
|
||||||
|
|
||||||
|
connect(aMoveGraveToTopLibrary, &QAction::triggered, grave, &PileZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveGraveToBottomLibrary, &QAction::triggered, grave, &PileZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveGraveToHand, &QAction::triggered, grave, &PileZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveGraveToRfg, &QAction::triggered, grave, &PileZoneLogic::moveAllToZone);
|
||||||
|
|
||||||
|
aMoveRfgToTopLibrary = new QAction(this);
|
||||||
|
aMoveRfgToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
||||||
|
aMoveRfgToBottomLibrary = new QAction(this);
|
||||||
|
aMoveRfgToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
||||||
|
aMoveRfgToHand = new QAction(this);
|
||||||
|
aMoveRfgToHand->setData(QList<QVariant>() << "hand" << 0);
|
||||||
|
aMoveRfgToGrave = new QAction(this);
|
||||||
|
aMoveRfgToGrave->setData(QList<QVariant>() << "grave" << 0);
|
||||||
|
|
||||||
|
connect(aMoveRfgToTopLibrary, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveRfgToBottomLibrary, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveRfgToHand, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
||||||
|
connect(aMoveRfgToGrave, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
||||||
|
|
||||||
|
aMoveTopToPlay = new QAction(this);
|
||||||
|
connect(aMoveTopToPlay, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardToPlay);
|
||||||
|
aMoveTopToPlayFaceDown = new QAction(this);
|
||||||
|
connect(aMoveTopToPlayFaceDown, &QAction::triggered, playerActions,
|
||||||
|
&PlayerActions::actMoveTopCardToPlayFaceDown);
|
||||||
|
aMoveTopCardToGraveyard = new QAction(this);
|
||||||
|
connect(aMoveTopCardToGraveyard, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardToGrave);
|
||||||
|
aMoveTopCardToExile = new QAction(this);
|
||||||
|
connect(aMoveTopCardToExile, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardToExile);
|
||||||
|
aMoveTopCardsToGraveyard = new QAction(this);
|
||||||
|
connect(aMoveTopCardsToGraveyard, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardsToGrave);
|
||||||
|
aMoveTopCardsToExile = new QAction(this);
|
||||||
|
connect(aMoveTopCardsToExile, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardsToExile);
|
||||||
|
aMoveTopCardsUntil = new QAction(this);
|
||||||
|
connect(aMoveTopCardsUntil, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardsUntil);
|
||||||
|
aMoveTopCardToBottom = new QAction(this);
|
||||||
|
connect(aMoveTopCardToBottom, &QAction::triggered, playerActions, &PlayerActions::actMoveTopCardToBottom);
|
||||||
|
|
||||||
|
aMoveBottomToPlay = new QAction(this);
|
||||||
|
connect(aMoveBottomToPlay, &QAction::triggered, playerActions, &PlayerActions::actMoveBottomCardToPlay);
|
||||||
|
aMoveBottomToPlayFaceDown = new QAction(this);
|
||||||
|
connect(aMoveBottomToPlayFaceDown, &QAction::triggered, playerActions,
|
||||||
|
&PlayerActions::actMoveBottomCardToPlayFaceDown);
|
||||||
|
aMoveBottomCardToGraveyard = new QAction(this);
|
||||||
|
connect(aMoveBottomCardToGraveyard, &QAction::triggered, playerActions,
|
||||||
|
&PlayerActions::actMoveBottomCardToGrave);
|
||||||
|
aMoveBottomCardToExile = new QAction(this);
|
||||||
|
connect(aMoveBottomCardToExile, &QAction::triggered, playerActions, &PlayerActions::actMoveBottomCardToExile);
|
||||||
|
aMoveBottomCardsToGraveyard = new QAction(this);
|
||||||
|
connect(aMoveBottomCardsToGraveyard, &QAction::triggered, playerActions,
|
||||||
|
&PlayerActions::actMoveBottomCardsToGrave);
|
||||||
|
aMoveBottomCardsToExile = new QAction(this);
|
||||||
|
connect(aMoveBottomCardsToExile, &QAction::triggered, playerActions, &PlayerActions::actMoveBottomCardsToExile);
|
||||||
|
aMoveBottomCardToTop = new QAction(this);
|
||||||
|
connect(aMoveBottomCardToTop, &QAction::triggered, playerActions, &PlayerActions::actMoveBottomCardToTop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerMenu::createViewActions()
|
||||||
|
{
|
||||||
|
PlayerActions *playerActions = player->getPlayerActions();
|
||||||
|
|
||||||
|
aViewGraveyard = new QAction(this);
|
||||||
|
connect(aViewGraveyard, &QAction::triggered, playerActions, &PlayerActions::actViewGraveyard);
|
||||||
|
|
||||||
|
aViewRfg = new QAction(this);
|
||||||
|
connect(aViewRfg, &QAction::triggered, playerActions, &PlayerActions::actViewRfg);
|
||||||
|
|
||||||
|
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
|
||||||
|
aViewLibrary = new QAction(this);
|
||||||
|
connect(aViewLibrary, &QAction::triggered, playerActions, &PlayerActions::actViewLibrary);
|
||||||
|
aViewSideboard = new QAction(this);
|
||||||
|
connect(aViewSideboard, &QAction::triggered, playerActions, &PlayerActions::actViewSideboard);
|
||||||
|
|
||||||
|
aViewHand = new QAction(this);
|
||||||
|
connect(aViewHand, &QAction::triggered, playerActions, &PlayerActions::actViewHand);
|
||||||
|
aSortHand = new QAction(this);
|
||||||
|
connect(aSortHand, &QAction::triggered, playerActions, &PlayerActions::actSortHand);
|
||||||
|
|
||||||
|
aViewTopCards = new QAction(this);
|
||||||
|
connect(aViewTopCards, &QAction::triggered, playerActions, &PlayerActions::actViewTopCards);
|
||||||
|
aViewBottomCards = new QAction(this);
|
||||||
|
connect(aViewBottomCards, &QAction::triggered, playerActions, &PlayerActions::actViewBottomCards);
|
||||||
|
aAlwaysRevealTopCard = new QAction(this);
|
||||||
|
aAlwaysRevealTopCard->setCheckable(true);
|
||||||
|
connect(aAlwaysRevealTopCard, &QAction::triggered, playerActions, &PlayerActions::actAlwaysRevealTopCard);
|
||||||
|
aAlwaysLookAtTopCard = new QAction(this);
|
||||||
|
aAlwaysLookAtTopCard->setCheckable(true);
|
||||||
|
connect(aAlwaysLookAtTopCard, &QAction::triggered, playerActions, &PlayerActions::actAlwaysLookAtTopCard);
|
||||||
|
aOpenDeckInDeckEditor = new QAction(this);
|
||||||
|
aOpenDeckInDeckEditor->setEnabled(false);
|
||||||
|
connect(aOpenDeckInDeckEditor, &QAction::triggered, playerActions, &PlayerActions::actOpenDeckInDeckEditor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerMenu::refreshShortcuts()
|
void PlayerMenu::refreshShortcuts()
|
||||||
{
|
{
|
||||||
if (shortcutsActive) {
|
if (shortcutsActive) {
|
||||||
|
|
@ -1108,48 +1208,62 @@ void PlayerMenu::retranslateUi()
|
||||||
aMoveToExile->setText(tr("&Exile"));
|
aMoveToExile->setText(tr("&Exile"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerMenu::setShortcutIfItExists(QAction *action, ShortcutKey shortcut)
|
||||||
|
{
|
||||||
|
if (action) {
|
||||||
|
action->setShortcuts(shortcut);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerMenu::clearShortcutIfItExists(QAction *action)
|
||||||
|
{
|
||||||
|
if (action) {
|
||||||
|
action->setShortcut(QKeySequence());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerMenu::setShortcutsActive()
|
void PlayerMenu::setShortcutsActive()
|
||||||
{
|
{
|
||||||
shortcutsActive = true;
|
shortcutsActive = true;
|
||||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
|
|
||||||
aHide->setShortcuts(shortcuts.getShortcut("Player/aHide"));
|
setShortcutIfItExists(aHide, shortcuts.getShortcut("Player/aHide"));
|
||||||
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
|
setShortcutIfItExists(aPlay, shortcuts.getShortcut("Player/aPlay"));
|
||||||
aTap->setShortcuts(shortcuts.getShortcut("Player/aTap"));
|
setShortcutIfItExists(aTap, shortcuts.getShortcut("Player/aTap"));
|
||||||
aDoesntUntap->setShortcuts(shortcuts.getShortcut("Player/aDoesntUntap"));
|
setShortcutIfItExists(aDoesntUntap, shortcuts.getShortcut("Player/aDoesntUntap"));
|
||||||
aFlip->setShortcuts(shortcuts.getShortcut("Player/aFlip"));
|
setShortcutIfItExists(aFlip, shortcuts.getShortcut("Player/aFlip"));
|
||||||
aPeek->setShortcuts(shortcuts.getShortcut("Player/aPeek"));
|
setShortcutIfItExists(aPeek, shortcuts.getShortcut("Player/aPeek"));
|
||||||
aClone->setShortcuts(shortcuts.getShortcut("Player/aClone"));
|
setShortcutIfItExists(aClone, shortcuts.getShortcut("Player/aClone"));
|
||||||
aAttach->setShortcuts(shortcuts.getShortcut("Player/aAttach"));
|
setShortcutIfItExists(aAttach, shortcuts.getShortcut("Player/aAttach"));
|
||||||
aUnattach->setShortcuts(shortcuts.getShortcut("Player/aUnattach"));
|
setShortcutIfItExists(aUnattach, shortcuts.getShortcut("Player/aUnattach"));
|
||||||
aDrawArrow->setShortcuts(shortcuts.getShortcut("Player/aDrawArrow"));
|
setShortcutIfItExists(aDrawArrow, shortcuts.getShortcut("Player/aDrawArrow"));
|
||||||
aIncP->setShortcuts(shortcuts.getShortcut("Player/aIncP"));
|
setShortcutIfItExists(aIncP, shortcuts.getShortcut("Player/aIncP"));
|
||||||
aDecP->setShortcuts(shortcuts.getShortcut("Player/aDecP"));
|
setShortcutIfItExists(aDecP, shortcuts.getShortcut("Player/aDecP"));
|
||||||
aIncT->setShortcuts(shortcuts.getShortcut("Player/aIncT"));
|
setShortcutIfItExists(aIncT, shortcuts.getShortcut("Player/aIncT"));
|
||||||
aDecT->setShortcuts(shortcuts.getShortcut("Player/aDecT"));
|
setShortcutIfItExists(aDecT, shortcuts.getShortcut("Player/aDecT"));
|
||||||
aIncPT->setShortcuts(shortcuts.getShortcut("Player/aIncPT"));
|
setShortcutIfItExists(aIncPT, shortcuts.getShortcut("Player/aIncPT"));
|
||||||
aDecPT->setShortcuts(shortcuts.getShortcut("Player/aDecPT"));
|
setShortcutIfItExists(aDecPT, shortcuts.getShortcut("Player/aDecPT"));
|
||||||
aFlowP->setShortcuts(shortcuts.getShortcut("Player/aFlowP"));
|
setShortcutIfItExists(aFlowP, shortcuts.getShortcut("Player/aFlowP"));
|
||||||
aFlowT->setShortcuts(shortcuts.getShortcut("Player/aFlowT"));
|
setShortcutIfItExists(aFlowT, shortcuts.getShortcut("Player/aFlowT"));
|
||||||
aSetPT->setShortcuts(shortcuts.getShortcut("Player/aSetPT"));
|
setShortcutIfItExists(aSetPT, shortcuts.getShortcut("Player/aSetPT"));
|
||||||
aResetPT->setShortcuts(shortcuts.getShortcut("Player/aResetPT"));
|
setShortcutIfItExists(aResetPT, shortcuts.getShortcut("Player/aResetPT"));
|
||||||
aSetAnnotation->setShortcuts(shortcuts.getShortcut("Player/aSetAnnotation"));
|
setShortcutIfItExists(aSetAnnotation, shortcuts.getShortcut("Player/aSetAnnotation"));
|
||||||
aMoveToTopLibrary->setShortcuts(shortcuts.getShortcut("Player/aMoveToTopLibrary"));
|
setShortcutIfItExists(aMoveToTopLibrary, shortcuts.getShortcut("Player/aMoveToTopLibrary"));
|
||||||
aMoveToBottomLibrary->setShortcuts(shortcuts.getShortcut("Player/aMoveToBottomLibrary"));
|
setShortcutIfItExists(aMoveToBottomLibrary, shortcuts.getShortcut("Player/aMoveToBottomLibrary"));
|
||||||
aMoveToHand->setShortcuts(shortcuts.getShortcut("Player/aMoveToHand"));
|
setShortcutIfItExists(aMoveToHand, shortcuts.getShortcut("Player/aMoveToHand"));
|
||||||
aMoveToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveToGraveyard"));
|
setShortcutIfItExists(aMoveToGraveyard, shortcuts.getShortcut("Player/aMoveToGraveyard"));
|
||||||
aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile"));
|
setShortcutIfItExists(aMoveToExile, shortcuts.getShortcut("Player/aMoveToExile"));
|
||||||
aSortHand->setShortcuts(shortcuts.getShortcut("Player/aSortHand"));
|
setShortcutIfItExists(aSortHand, shortcuts.getShortcut("Player/aSortHand"));
|
||||||
|
|
||||||
aSelectAll->setShortcuts(shortcuts.getShortcut("Player/aSelectAll"));
|
setShortcutIfItExists(aSelectAll, shortcuts.getShortcut("Player/aSelectAll"));
|
||||||
aSelectRow->setShortcuts(shortcuts.getShortcut("Player/aSelectRow"));
|
setShortcutIfItExists(aSelectRow, shortcuts.getShortcut("Player/aSelectRow"));
|
||||||
aSelectColumn->setShortcuts(shortcuts.getShortcut("Player/aSelectColumn"));
|
setShortcutIfItExists(aSelectColumn, shortcuts.getShortcut("Player/aSelectColumn"));
|
||||||
|
|
||||||
static const QStringList colorWords = {"Red", "Yellow", "Green", "Cyan", "Purple", "Magenta"};
|
static const QStringList colorWords = {"Red", "Yellow", "Green", "Cyan", "Purple", "Magenta"};
|
||||||
for (int i = 0; i < aAddCounter.size(); i++) {
|
for (int i = 0; i < aAddCounter.size(); i++) {
|
||||||
aAddCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aCC" + colorWords[i]));
|
setShortcutIfItExists(aAddCounter[i], shortcuts.getShortcut("Player/aCC" + colorWords[i]));
|
||||||
aRemoveCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aRC" + colorWords[i]));
|
setShortcutIfItExists(aRemoveCounter[i], shortcuts.getShortcut("Player/aRC" + colorWords[i]));
|
||||||
aSetCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aSC" + colorWords[i]));
|
setShortcutIfItExists(aSetCounter[i], shortcuts.getShortcut("Player/aSC" + colorWords[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
QMapIterator<int, AbstractCounter *> counterIterator(player->getCounters());
|
QMapIterator<int, AbstractCounter *> counterIterator(player->getCounters());
|
||||||
|
|
@ -1157,45 +1271,45 @@ void PlayerMenu::setShortcutsActive()
|
||||||
counterIterator.next().value()->setShortcutsActive();
|
counterIterator.next().value()->setShortcutsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
aIncrementAllCardCounters->setShortcuts(shortcuts.getShortcut("Player/aIncrementAllCardCounters"));
|
setShortcutIfItExists(aIncrementAllCardCounters, shortcuts.getShortcut("Player/aIncrementAllCardCounters"));
|
||||||
aViewSideboard->setShortcuts(shortcuts.getShortcut("Player/aViewSideboard"));
|
setShortcutIfItExists(aViewSideboard, shortcuts.getShortcut("Player/aViewSideboard"));
|
||||||
aViewLibrary->setShortcuts(shortcuts.getShortcut("Player/aViewLibrary"));
|
setShortcutIfItExists(aViewLibrary, shortcuts.getShortcut("Player/aViewLibrary"));
|
||||||
aViewHand->setShortcuts(shortcuts.getShortcut("Player/aViewHand"));
|
setShortcutIfItExists(aViewHand, shortcuts.getShortcut("Player/aViewHand"));
|
||||||
aViewTopCards->setShortcuts(shortcuts.getShortcut("Player/aViewTopCards"));
|
setShortcutIfItExists(aViewTopCards, shortcuts.getShortcut("Player/aViewTopCards"));
|
||||||
aViewBottomCards->setShortcuts(shortcuts.getShortcut("Player/aViewBottomCards"));
|
setShortcutIfItExists(aViewBottomCards, shortcuts.getShortcut("Player/aViewBottomCards"));
|
||||||
aViewGraveyard->setShortcuts(shortcuts.getShortcut("Player/aViewGraveyard"));
|
setShortcutIfItExists(aViewGraveyard, shortcuts.getShortcut("Player/aViewGraveyard"));
|
||||||
aDrawCard->setShortcuts(shortcuts.getShortcut("Player/aDrawCard"));
|
setShortcutIfItExists(aDrawCard, shortcuts.getShortcut("Player/aDrawCard"));
|
||||||
aDrawCards->setShortcuts(shortcuts.getShortcut("Player/aDrawCards"));
|
setShortcutIfItExists(aDrawCards, shortcuts.getShortcut("Player/aDrawCards"));
|
||||||
aUndoDraw->setShortcuts(shortcuts.getShortcut("Player/aUndoDraw"));
|
setShortcutIfItExists(aUndoDraw, shortcuts.getShortcut("Player/aUndoDraw"));
|
||||||
aMulligan->setShortcuts(shortcuts.getShortcut("Player/aMulligan"));
|
setShortcutIfItExists(aMulligan, shortcuts.getShortcut("Player/aMulligan"));
|
||||||
aShuffle->setShortcuts(shortcuts.getShortcut("Player/aShuffle"));
|
setShortcutIfItExists(aShuffle, shortcuts.getShortcut("Player/aShuffle"));
|
||||||
aShuffleTopCards->setShortcuts(shortcuts.getShortcut("Player/aShuffleTopCards"));
|
setShortcutIfItExists(aShuffleTopCards, shortcuts.getShortcut("Player/aShuffleTopCards"));
|
||||||
aShuffleBottomCards->setShortcuts(shortcuts.getShortcut("Player/aShuffleBottomCards"));
|
setShortcutIfItExists(aShuffleBottomCards, shortcuts.getShortcut("Player/aShuffleBottomCards"));
|
||||||
aUntapAll->setShortcuts(shortcuts.getShortcut("Player/aUntapAll"));
|
setShortcutIfItExists(aUntapAll, shortcuts.getShortcut("Player/aUntapAll"));
|
||||||
aRollDie->setShortcuts(shortcuts.getShortcut("Player/aRollDie"));
|
setShortcutIfItExists(aRollDie, shortcuts.getShortcut("Player/aRollDie"));
|
||||||
aCreateToken->setShortcuts(shortcuts.getShortcut("Player/aCreateToken"));
|
setShortcutIfItExists(aCreateToken, shortcuts.getShortcut("Player/aCreateToken"));
|
||||||
aCreateAnotherToken->setShortcuts(shortcuts.getShortcut("Player/aCreateAnotherToken"));
|
setShortcutIfItExists(aCreateAnotherToken, shortcuts.getShortcut("Player/aCreateAnotherToken"));
|
||||||
aAlwaysRevealTopCard->setShortcuts(shortcuts.getShortcut("Player/aAlwaysRevealTopCard"));
|
setShortcutIfItExists(aAlwaysRevealTopCard, shortcuts.getShortcut("Player/aAlwaysRevealTopCard"));
|
||||||
aAlwaysLookAtTopCard->setShortcuts(shortcuts.getShortcut("Player/aAlwaysLookAtTopCard"));
|
setShortcutIfItExists(aAlwaysLookAtTopCard, shortcuts.getShortcut("Player/aAlwaysLookAtTopCard"));
|
||||||
aMoveTopToPlay->setShortcuts(shortcuts.getShortcut("Player/aMoveTopToPlay"));
|
setShortcutIfItExists(aMoveTopToPlay, shortcuts.getShortcut("Player/aMoveTopToPlay"));
|
||||||
aMoveTopToPlayFaceDown->setShortcuts(shortcuts.getShortcut("Player/aMoveTopToPlayFaceDown"));
|
setShortcutIfItExists(aMoveTopToPlayFaceDown, shortcuts.getShortcut("Player/aMoveTopToPlayFaceDown"));
|
||||||
aMoveTopCardToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveTopCardToGraveyard"));
|
setShortcutIfItExists(aMoveTopCardToGraveyard, shortcuts.getShortcut("Player/aMoveTopCardToGraveyard"));
|
||||||
aMoveTopCardsToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveTopCardsToGraveyard"));
|
setShortcutIfItExists(aMoveTopCardsToGraveyard, shortcuts.getShortcut("Player/aMoveTopCardsToGraveyard"));
|
||||||
aMoveTopCardToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveTopCardToExile"));
|
setShortcutIfItExists(aMoveTopCardToExile, shortcuts.getShortcut("Player/aMoveTopCardToExile"));
|
||||||
aMoveTopCardsToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveTopCardsToExile"));
|
setShortcutIfItExists(aMoveTopCardsToExile, shortcuts.getShortcut("Player/aMoveTopCardsToExile"));
|
||||||
aMoveTopCardsUntil->setShortcuts(shortcuts.getShortcut("Player/aMoveTopCardsUntil"));
|
setShortcutIfItExists(aMoveTopCardsUntil, shortcuts.getShortcut("Player/aMoveTopCardsUntil"));
|
||||||
aMoveTopCardToBottom->setShortcuts(shortcuts.getShortcut("Player/aMoveTopCardToBottom"));
|
setShortcutIfItExists(aMoveTopCardToBottom, shortcuts.getShortcut("Player/aMoveTopCardToBottom"));
|
||||||
aDrawBottomCard->setShortcuts(shortcuts.getShortcut("Player/aDrawBottomCard"));
|
setShortcutIfItExists(aDrawBottomCard, shortcuts.getShortcut("Player/aDrawBottomCard"));
|
||||||
aDrawBottomCards->setShortcuts(shortcuts.getShortcut("Player/aDrawBottomCards"));
|
setShortcutIfItExists(aDrawBottomCards, shortcuts.getShortcut("Player/aDrawBottomCards"));
|
||||||
aMoveBottomToPlay->setShortcuts(shortcuts.getShortcut("Player/aMoveBottomToPlay"));
|
setShortcutIfItExists(aMoveBottomToPlay, shortcuts.getShortcut("Player/aMoveBottomToPlay"));
|
||||||
aMoveBottomToPlayFaceDown->setShortcuts(shortcuts.getShortcut("Player/aMoveBottomToPlayFaceDown"));
|
setShortcutIfItExists(aMoveBottomToPlayFaceDown, shortcuts.getShortcut("Player/aMoveBottomToPlayFaceDown"));
|
||||||
aMoveBottomCardToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveBottomCardToGrave"));
|
setShortcutIfItExists(aMoveBottomCardToGraveyard, shortcuts.getShortcut("Player/aMoveBottomCardToGrave"));
|
||||||
aMoveBottomCardsToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveBottomCardsToGrave"));
|
setShortcutIfItExists(aMoveBottomCardsToGraveyard, shortcuts.getShortcut("Player/aMoveBottomCardsToGrave"));
|
||||||
aMoveBottomCardToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveBottomCardToExile"));
|
setShortcutIfItExists(aMoveBottomCardToExile, shortcuts.getShortcut("Player/aMoveBottomCardToExile"));
|
||||||
aMoveBottomCardsToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveBottomCardsToExile"));
|
setShortcutIfItExists(aMoveBottomCardsToExile, shortcuts.getShortcut("Player/aMoveBottomCardsToExile"));
|
||||||
aMoveBottomCardToTop->setShortcuts(shortcuts.getShortcut("Player/aMoveBottomCardToTop"));
|
setShortcutIfItExists(aMoveBottomCardToTop, shortcuts.getShortcut("Player/aMoveBottomCardToTop"));
|
||||||
aPlayFacedown->setShortcuts(shortcuts.getShortcut("Player/aPlayFacedown"));
|
setShortcutIfItExists(aPlayFacedown, shortcuts.getShortcut("Player/aPlayFacedown"));
|
||||||
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
|
setShortcutIfItExists(aPlay, shortcuts.getShortcut("Player/aPlay"));
|
||||||
|
|
||||||
// Don't enable always-active shortcuts in local games, since it causes keyboard shortcuts to work inconsistently
|
// Don't enable always-active shortcuts in local games, since it causes keyboard shortcuts to work inconsistently
|
||||||
// when there are more than 1 player.
|
// when there are more than 1 player.
|
||||||
|
|
@ -1210,42 +1324,42 @@ void PlayerMenu::setShortcutsInactive()
|
||||||
{
|
{
|
||||||
shortcutsActive = false;
|
shortcutsActive = false;
|
||||||
|
|
||||||
aViewSideboard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aViewSideboard);
|
||||||
aViewLibrary->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aViewLibrary);
|
||||||
aViewHand->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aViewHand);
|
||||||
aViewTopCards->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aViewTopCards);
|
||||||
aViewBottomCards->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aViewBottomCards);
|
||||||
aViewGraveyard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aViewGraveyard);
|
||||||
aDrawCard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aDrawCard);
|
||||||
aDrawCards->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aDrawCards);
|
||||||
aUndoDraw->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aUndoDraw);
|
||||||
aMulligan->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMulligan);
|
||||||
aShuffle->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aShuffle);
|
||||||
aShuffleTopCards->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aShuffleTopCards);
|
||||||
aShuffleBottomCards->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aShuffleBottomCards);
|
||||||
aUntapAll->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aUntapAll);
|
||||||
aRollDie->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aRollDie);
|
||||||
aCreateToken->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aCreateToken);
|
||||||
aCreateAnotherToken->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aCreateAnotherToken);
|
||||||
aAlwaysRevealTopCard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aAlwaysRevealTopCard);
|
||||||
aAlwaysLookAtTopCard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aAlwaysLookAtTopCard);
|
||||||
aMoveTopToPlay->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveTopToPlay);
|
||||||
aMoveTopToPlayFaceDown->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveTopToPlayFaceDown);
|
||||||
aMoveTopCardToGraveyard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveTopCardToGraveyard);
|
||||||
aMoveTopCardsToGraveyard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveTopCardsToGraveyard);
|
||||||
aMoveTopCardToExile->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveTopCardToExile);
|
||||||
aMoveTopCardsToExile->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveTopCardsToExile);
|
||||||
aMoveTopCardsUntil->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveTopCardsUntil);
|
||||||
aDrawBottomCard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aDrawBottomCard);
|
||||||
aDrawBottomCards->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aDrawBottomCards);
|
||||||
aMoveBottomToPlay->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveBottomToPlay);
|
||||||
aMoveBottomToPlayFaceDown->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveBottomToPlayFaceDown);
|
||||||
aMoveBottomCardToGraveyard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveBottomCardToGraveyard);
|
||||||
aMoveBottomCardsToGraveyard->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveBottomCardsToGraveyard);
|
||||||
aMoveBottomCardToExile->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveBottomCardToExile);
|
||||||
aMoveBottomCardsToExile->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aMoveBottomCardsToExile);
|
||||||
aIncrementAllCardCounters->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aIncrementAllCardCounters);
|
||||||
aSortHand->setShortcut(QKeySequence());
|
clearShortcutIfItExists(aSortHand);
|
||||||
|
|
||||||
QMapIterator<int, AbstractCounter *> counterIterator(player->getCounters());
|
QMapIterator<int, AbstractCounter *> counterIterator(player->getCounters());
|
||||||
while (counterIterator.hasNext()) {
|
while (counterIterator.hasNext()) {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ public slots:
|
||||||
QMenu *createMoveMenu() const;
|
QMenu *createMoveMenu() const;
|
||||||
void enableOpenInDeckEditorAction() const;
|
void enableOpenInDeckEditorAction() const;
|
||||||
void populatePredefinedTokensMenu();
|
void populatePredefinedTokensMenu();
|
||||||
|
void setMenusForGraphicItems();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addPlayer(Player *playerToAdd);
|
void addPlayer(Player *playerToAdd);
|
||||||
|
|
@ -31,6 +32,10 @@ private slots:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlayerMenu(Player *player);
|
PlayerMenu(Player *player);
|
||||||
|
void createDrawActions();
|
||||||
|
void createShuffleActions();
|
||||||
|
void createMoveActions();
|
||||||
|
void createViewActions();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
void addPlayerToList(QMenu *playerList, Player *playerToAdd);
|
void addPlayerToList(QMenu *playerList, Player *playerToAdd);
|
||||||
|
|
@ -80,6 +85,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void setShortcutsActive();
|
void setShortcutsActive();
|
||||||
|
void setShortcutIfItExists(QAction *action, ShortcutKey shortcut);
|
||||||
|
void clearShortcutIfItExists(QAction *action);
|
||||||
void setShortcutsInactive();
|
void setShortcutsInactive();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue