feat(command-zone): add context menu system

Implement CommandZoneMenu - context menu for interacting with cards
in the command zone.

Menu actions include:
- Cast commander (move to stack)
- Return to command zone
- View/reveal zone contents
- Commander-specific actions (tax reset, etc.)

Integration with existing menu system:
- CardMenuActionType: new action types for command zone
- CardMenu: command zone action routing
- MoveMenu: command zone as move destination
- PlayerMenu: command zone menu integration
- Zone menus: inherit from AbstractZoneMenu

This provides the right-click interaction layer for command zones.
This commit is contained in:
DawnFire42 2026-02-25 13:37:41 -05:00
parent 54e7ee1b42
commit 1ae1d876b1
15 changed files with 648 additions and 85 deletions

View file

@ -1,7 +1,7 @@
/**
* @file player_menu.h
* @ingroup GameMenusPlayers
* @brief TODO: Document this.
* @brief Aggregates all zone-related menus for a player.
*/
#ifndef COCKATRICE_PLAYER_MENU_H
@ -9,6 +9,8 @@
#include "../../../interface/widgets/menus/tearoff_menu.h"
#include "../player.h"
#include "abstract_zone_menu.h"
#include "command_zone_menu.h"
#include "custom_zone_menu.h"
#include "grave_menu.h"
#include "hand_menu.h"
@ -20,8 +22,26 @@
#include <QMenu>
#include <QObject>
#include <QVector>
class CardItem;
/**
* @class PlayerMenu
* @brief Central manager for a player's zone context menus.
*
* PlayerMenu creates and coordinates all zone-specific context menus for a player,
* including hand, library, graveyard, exile, sideboard, and command zones.
* It attaches menus to their corresponding graphics items and manages keyboard
* shortcut activation/deactivation.
*
* For Commander format games, PlayerMenu creates two CommandZoneMenu instances:
* one for the primary command zone and one for the partner zone. It also connects
* the partner zone's expansion state to the command zone menu's toggle action.
*
* @see CommandZoneMenu
* @see CardMenu
*/
class PlayerMenu : public QObject
{
Q_OBJECT
@ -81,8 +101,14 @@ private:
UtilityMenu *utilityMenu;
SayMenu *sayMenu;
CustomZoneMenu *customZonesMenu;
CommandZoneMenu *commandZoneMenu;
CommandZoneMenu *partnerZoneMenu;
CommandZoneMenu *companionZoneMenu;
CommandZoneMenu *backgroundZoneMenu;
bool shortcutsActive;
QVector<AbstractZoneMenu *> allZoneMenus;
bool shortcutsActive = false;
void initSayMenu();
};