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

View file

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

View file

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

View file

@ -211,8 +211,8 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
void PlayerMenu::setMenusForGraphicItems() void PlayerMenu::setMenusForGraphicItems()
{ {
player->getGraphicsItem()->getTableZoneGraphicsItem()->setMenu(playerMenu); player->getGraphicsItem()->getTableZoneGraphicsItem()->setMenu(playerMenu);
//player->getGraphicsItem()->getGraveyardZoneGraphicsItem()->setMenu(graveMenu, aViewGraveyard); // player->getGraphicsItem()->getGraveyardZoneGraphicsItem()->setMenu(graveMenu, aViewGraveyard);
//player->getGraphicsItem()->getRfgZoneGraphicsItem()->setMenu(rfgMenu, aViewRfg); // player->getGraphicsItem()->getRfgZoneGraphicsItem()->setMenu(rfgMenu, aViewRfg);
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) { if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
player->getGraphicsItem()->getHandZoneGraphicsItem()->setMenu(handMenu); player->getGraphicsItem()->getHandZoneGraphicsItem()->setMenu(handMenu);
// player->getGraphicsItem()->getDeckZoneGraphicsItem()->setMenu(libraryMenu, aDrawCard); // player->getGraphicsItem()->getDeckZoneGraphicsItem()->setMenu(libraryMenu, aDrawCard);

View file

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

View file

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

View file

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