mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 19:47:46 -07:00
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.
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
/**
|
|
* @file grave_menu.h
|
|
* @ingroup GameMenusZones
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef COCKATRICE_GRAVE_MENU_H
|
|
#define COCKATRICE_GRAVE_MENU_H
|
|
|
|
#include "../../../interface/widgets/menus/tearoff_menu.h"
|
|
#include "abstract_player_component.h"
|
|
|
|
#include <QAction>
|
|
#include <QMenu>
|
|
|
|
class Player;
|
|
class GraveyardMenu : public TearOffMenu, public AbstractPlayerComponent
|
|
{
|
|
Q_OBJECT
|
|
signals:
|
|
void newPlayerActionCreated(QAction *action);
|
|
|
|
public:
|
|
explicit GraveyardMenu(Player *player, QWidget *parent = nullptr);
|
|
void createMoveActions();
|
|
void createViewActions();
|
|
void populateRevealRandomMenuWithActivePlayers();
|
|
void onRevealRandomTriggered();
|
|
void retranslateUi() override;
|
|
void setShortcutsActive() override;
|
|
void setShortcutsInactive() override;
|
|
|
|
QMenu *mRevealRandomGraveyardCard = nullptr;
|
|
QMenu *moveGraveMenu = nullptr;
|
|
|
|
QAction *aViewGraveyard = nullptr;
|
|
QAction *aMoveGraveToTopLibrary = nullptr;
|
|
QAction *aMoveGraveToBottomLibrary = nullptr;
|
|
QAction *aMoveGraveToHand = nullptr;
|
|
QAction *aMoveGraveToRfg = nullptr;
|
|
|
|
private:
|
|
Player *player;
|
|
};
|
|
|
|
#endif // COCKATRICE_GRAVE_MENU_H
|