mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-26 10:29:34 -05: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.
36 lines
709 B
C++
36 lines
709 B
C++
/**
|
|
* @file custom_zone_menu.h
|
|
* @ingroup GameMenusZones
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef COCKATRICE_CUSTOM_ZONE_MENU_H
|
|
#define COCKATRICE_CUSTOM_ZONE_MENU_H
|
|
|
|
#include "abstract_player_component.h"
|
|
|
|
#include <QMenu>
|
|
|
|
class Player;
|
|
class CustomZoneMenu : public QMenu, public AbstractPlayerComponent
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit CustomZoneMenu(Player *player);
|
|
void retranslateUi() override;
|
|
void setShortcutsActive() override
|
|
{
|
|
}
|
|
void setShortcutsInactive() override
|
|
{
|
|
}
|
|
|
|
private:
|
|
Player *player;
|
|
private slots:
|
|
void clearCustomZonesMenu();
|
|
void addViewCustomZoneActionToCustomZoneMenu(QString zoneName);
|
|
};
|
|
|
|
#endif // COCKATRICE_CUSTOM_ZONE_MENU_H
|