Cockatrice/cockatrice/src/game/player/menu/sideboard_menu.h
DawnFire42 70b41c2095
refactor: extract AbstractPlayerComponent interface for polymorphic player component management. (#6696)
Non-QObject polymorphic interface with setShortcutsActive(), setShortcutsInactive(), and retranslateUi(). Uses regular multiple inheritance to avoid diamond inheritance with Qt's MOC.

All zone menus, SayMenu, and AbstractCounter implement this interface. PlayerMenu manages them via a managedComponents list with two template helpers (addManagedMenu/registerManagedComponent), replacing individual if-guarded lifecycle calls with a single polymorphic loop.

SayMenu now owns its shortcut and translation lifecycle instead of having PlayerMenu manage its title and shortcuts externally.
Counters are iterated via Player::getCounters() rather than managedComponents to avoid duplicating the authoritative owner's map.
2026-03-24 12:31:34 -07:00

31 lines
611 B
C++

/**
* @file sideboard_menu.h
* @ingroup GameMenusZones
* @brief TODO: Document this.
*/
#ifndef COCKATRICE_SIDEBOARD_MENU_H
#define COCKATRICE_SIDEBOARD_MENU_H
#include "abstract_player_component.h"
#include <QMenu>
class Player;
class SideboardMenu : public QMenu, public AbstractPlayerComponent
{
Q_OBJECT
public:
explicit SideboardMenu(Player *player, QMenu *playerMenu);
void retranslateUi() override;
void setShortcutsActive() override;
void setShortcutsInactive() override;
private:
Player *player;
QAction *aViewSideboard;
};
#endif // COCKATRICE_SIDEBOARD_MENU_H