Took 6 minutes

Took 22 seconds
This commit is contained in:
Lukas Brübach 2025-09-12 00:42:57 +02:00
parent cce6a9d663
commit 5401efe245
8 changed files with 97 additions and 79 deletions

View file

@ -7,27 +7,28 @@
#include <QMenu>
class Player;
class GraveyardMenu : public TearOffMenu {
class GraveyardMenu : public TearOffMenu
{
Q_OBJECT
public:
explicit GraveyardMenu(Player* player, QWidget* parent = nullptr);
explicit GraveyardMenu(Player *player, QWidget *parent = nullptr);
void createMoveActions();
void createViewActions();
void retranslateUi();
void setShortcutsActive();
void setShortcutsInactive();
QMenu * mRevealRandomGraveyardCard = nullptr;
QMenu* moveGraveMenu = nullptr;
QMenu *mRevealRandomGraveyardCard = nullptr;
QMenu *moveGraveMenu = nullptr;
QAction* aViewGraveyard = nullptr;
QAction* aMoveGraveToTopLibrary = nullptr;
QAction* aMoveGraveToBottomLibrary = nullptr;
QAction* aMoveGraveToHand = nullptr;
QAction* aMoveGraveToRfg = nullptr;
QAction *aViewGraveyard = nullptr;
QAction *aMoveGraveToTopLibrary = nullptr;
QAction *aMoveGraveToBottomLibrary = nullptr;
QAction *aMoveGraveToHand = nullptr;
QAction *aMoveGraveToRfg = nullptr;
private:
Player* player;
Player *player;
};
#endif // COCKATRICE_GRAVE_MENU_H

View file

@ -13,32 +13,40 @@ class HandMenu : public TearOffMenu
{
Q_OBJECT
public:
explicit HandMenu(Player* player, PlayerActions* actions, QWidget* parent = nullptr);
explicit HandMenu(Player *player, PlayerActions *actions, QWidget *parent = nullptr);
void retranslateUi();
void setShortcutsActive();
void setShortcutsInactive();
// expose useful actions/menus if PlayerMenu needs them
QMenu* revealHandMenu() const { return mRevealHand; }
QMenu* revealRandomHandCardMenu() const { return mRevealRandomHandCard; }
QMenu* moveHandMenu() const { return mMoveHandMenu; }
QMenu *revealHandMenu() const
{
return mRevealHand;
}
QMenu *revealRandomHandCardMenu() const
{
return mRevealRandomHandCard;
}
QMenu *moveHandMenu() const
{
return mMoveHandMenu;
}
private:
Player *player;
QAction* aViewHand = nullptr;
QAction* aSortHand = nullptr;
QAction* aMulligan = nullptr;
QAction *aViewHand = nullptr;
QAction *aSortHand = nullptr;
QAction *aMulligan = nullptr;
QMenu* mRevealHand = nullptr;
QMenu* mRevealRandomHandCard = nullptr;
QMenu* mMoveHandMenu = nullptr;
QMenu *mRevealHand = nullptr;
QMenu *mRevealRandomHandCard = nullptr;
QMenu *mMoveHandMenu = nullptr;
QAction* aMoveHandToTopLibrary = nullptr;
QAction* aMoveHandToBottomLibrary = nullptr;
QAction* aMoveHandToGrave = nullptr;
QAction* aMoveHandToRfg = nullptr;
QAction *aMoveHandToTopLibrary = nullptr;
QAction *aMoveHandToBottomLibrary = nullptr;
QAction *aMoveHandToGrave = nullptr;
QAction *aMoveHandToRfg = nullptr;
};
#endif // COCKATRICE_HAND_MENU_H

View file

@ -37,9 +37,18 @@ public:
}
// expose useful actions/menus if PlayerMenu needs them
QMenu* revealLibrary() const { return mRevealLibrary; }
QMenu* lendLibraryMenu() const { return mLendLibrary; }
QMenu* revealTopCardMenu() const { return mRevealTopCard; }
QMenu *revealLibrary() const
{
return mRevealLibrary;
}
QMenu *lendLibraryMenu() const
{
return mLendLibrary;
}
QMenu *revealTopCardMenu() const
{
return mRevealTopCard;
}
QMenu *topLibraryMenu = nullptr;
QMenu *bottomLibraryMenu = nullptr;

View file

@ -211,8 +211,8 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
void PlayerMenu::setMenusForGraphicItems()
{
player->getGraphicsItem()->getTableZoneGraphicsItem()->setMenu(playerMenu);
//player->getGraphicsItem()->getGraveyardZoneGraphicsItem()->setMenu(graveMenu, aViewGraveyard);
//player->getGraphicsItem()->getRfgZoneGraphicsItem()->setMenu(rfgMenu, aViewRfg);
// 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);

View file

@ -84,8 +84,7 @@ public:
private:
Player *player;
QMenu *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu, *mCustomZones,
*mCardCounters;
QMenu *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu, *mCustomZones, *mCardCounters;
HandMenu *handMenu;
LibraryMenu *libraryMenu;
GraveyardMenu *graveMenu;
@ -98,9 +97,9 @@ private:
QAction *aViewSideboard, *aUntapAll, *aRollDie, *aCreateToken, *aCreateAnotherToken;
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetAnnotation, *aFlip, *aPeek, *aClone,
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile,
*aMoveToXfromTopOfLibrary, *aSelectAll, *aSelectRow, *aSelectColumn, *aIncrementAllCardCounters;
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetAnnotation,
*aFlip, *aPeek, *aClone, *aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard,
*aMoveToExile, *aMoveToXfromTopOfLibrary, *aSelectAll, *aSelectRow, *aSelectColumn, *aIncrementAllCardCounters;
bool shortcutsActive;
QStringList predefinedTokens;

View file

@ -7,40 +7,40 @@ PtMenu::PtMenu(Player *player) : QMenu(tr("Power / toughness"))
{
PlayerActions *playerActions = player->getPlayerActions();
aIncP = new QAction(this);
connect(aIncP, &QAction::triggered, playerActions, &PlayerActions::actIncP);
aDecP = new QAction(this);
connect(aDecP, &QAction::triggered, playerActions, &PlayerActions::actDecP);
aIncT = new QAction(this);
connect(aIncT, &QAction::triggered, playerActions, &PlayerActions::actIncT);
aDecT = new QAction(this);
connect(aDecT, &QAction::triggered, playerActions, &PlayerActions::actDecT);
aIncPT = new QAction(this);
connect(aIncPT, &QAction::triggered, playerActions, [playerActions] { playerActions->actIncPT(); });
aDecPT = new QAction(this);
connect(aDecPT, &QAction::triggered, playerActions, &PlayerActions::actDecPT);
aFlowP = new QAction(this);
connect(aFlowP, &QAction::triggered, playerActions, &PlayerActions::actFlowP);
aFlowT = new QAction(this);
connect(aFlowT, &QAction::triggered, playerActions, &PlayerActions::actFlowT);
aSetPT = new QAction(this);
connect(aSetPT, &QAction::triggered, playerActions, &PlayerActions::actSetPT);
aResetPT = new QAction(this);
connect(aResetPT, &QAction::triggered, playerActions, &PlayerActions::actResetPT);
aIncP = new QAction(this);
connect(aIncP, &QAction::triggered, playerActions, &PlayerActions::actIncP);
aDecP = new QAction(this);
connect(aDecP, &QAction::triggered, playerActions, &PlayerActions::actDecP);
aIncT = new QAction(this);
connect(aIncT, &QAction::triggered, playerActions, &PlayerActions::actIncT);
aDecT = new QAction(this);
connect(aDecT, &QAction::triggered, playerActions, &PlayerActions::actDecT);
aIncPT = new QAction(this);
connect(aIncPT, &QAction::triggered, playerActions, [playerActions] { playerActions->actIncPT(); });
aDecPT = new QAction(this);
connect(aDecPT, &QAction::triggered, playerActions, &PlayerActions::actDecPT);
aFlowP = new QAction(this);
connect(aFlowP, &QAction::triggered, playerActions, &PlayerActions::actFlowP);
aFlowT = new QAction(this);
connect(aFlowT, &QAction::triggered, playerActions, &PlayerActions::actFlowT);
aSetPT = new QAction(this);
connect(aSetPT, &QAction::triggered, playerActions, &PlayerActions::actSetPT);
aResetPT = new QAction(this);
connect(aResetPT, &QAction::triggered, playerActions, &PlayerActions::actResetPT);
addAction(aIncP);
addAction(aDecP);
addAction(aFlowP);
addSeparator();
addAction(aIncT);
addAction(aDecT);
addAction(aFlowT);
addSeparator();
addAction(aIncPT);
addAction(aDecPT);
addSeparator();
addAction(aSetPT);
addAction(aResetPT);
addAction(aIncP);
addAction(aDecP);
addAction(aFlowP);
addSeparator();
addAction(aIncT);
addAction(aDecT);
addAction(aFlowT);
addSeparator();
addAction(aIncPT);
addAction(aDecPT);
addSeparator();
addAction(aSetPT);
addAction(aResetPT);
retranslateUi();
}

View file

@ -3,7 +3,8 @@
#include <QMenu>
class Player;
class PtMenu : public QMenu {
class PtMenu : public QMenu
{
Q_OBJECT
@ -23,7 +24,6 @@ public:
QAction *aDecPT = nullptr;
QAction *aSetPT = nullptr;
QAction *aResetPT = nullptr;
};
#endif // COCKATRICE_PT_MENU_H

View file

@ -7,24 +7,25 @@
#include <QMenu>
class Player;
class RfgMenu : public TearOffMenu {
class RfgMenu : public TearOffMenu
{
Q_OBJECT
public:
explicit RfgMenu(Player* player, QWidget* parent = nullptr);
explicit RfgMenu(Player *player, QWidget *parent = nullptr);
void createMoveActions();
void createViewActions();
void retranslateUi();
QMenu * moveRfgMenu = nullptr;
QMenu *moveRfgMenu = nullptr;
QAction* aViewRfg = nullptr;
QAction* aMoveRfgToTopLibrary = nullptr;
QAction* aMoveRfgToBottomLibrary = nullptr;
QAction* aMoveRfgToHand = nullptr;
QAction* aMoveRfgToGrave = nullptr;
QAction *aViewRfg = nullptr;
QAction *aMoveRfgToTopLibrary = nullptr;
QAction *aMoveRfgToBottomLibrary = nullptr;
QAction *aMoveRfgToHand = nullptr;
QAction *aMoveRfgToGrave = nullptr;
private:
Player* player;
Player *player;
};
#endif // COCKATRICE_RFG_MENU_H