mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 02:53:56 -07:00
Fix Command Zone graphics/logic layers separation
1. CommandZoneMenu: Changed to take PlayerGraphicsItem* instead of
PlayerLogic*, accessing logic via player->getLogic()
2. Removed getCounterWidget() from PlayerLogic;
method already exists correctly in PlayerGraphicsItem
3. PlayerMenu: CommandZoneMenu, fixed signal
connection to use player->getLogic() for commandZoneSupportChanged
4. AbstractCounter: Connects to CounterState::activeChanged signal,
removing direct graphics calls from PlayerEventHandler
5. CommandZone: Explicit tax counter registration via registerTaxCounter()
with auto-cleanup, replacing childItems()/dynamic_cast iteration
Also fixed PlayerActions to query CounterState instead of AbstractCounter
for proper layer separation.
This commit is contained in:
parent
8447c73ec5
commit
07229c85bf
11 changed files with 55 additions and 56 deletions
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
class AbstractCounter;
|
||||
|
||||
inline Q_LOGGING_CATEGORY(CommandZoneLog, "command_zone");
|
||||
|
||||
/**
|
||||
|
|
@ -50,9 +52,10 @@ public:
|
|||
|
||||
private:
|
||||
static constexpr double MINIMIZED_HEIGHT_RATIO = 0.25;
|
||||
int zoneHeight; ///< Full height in pixels when expanded
|
||||
bool minimized = false; ///< Whether zone is at 25% height
|
||||
int minimumHeight = 0; ///< Floor for minimized height (e.g. to fit tax counters)
|
||||
int zoneHeight; ///< Full height in pixels when expanded
|
||||
bool minimized = false; ///< Whether zone is at 25% height
|
||||
int minimumHeight = 0; ///< Floor for minimized height (e.g. to fit tax counters)
|
||||
QList<AbstractCounter *> taxCounters; ///< Registered tax counter widgets
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
@ -86,6 +89,8 @@ public:
|
|||
[[nodiscard]] qreal currentHeight() const;
|
||||
/** @brief Sets the minimum height floor, e.g. to ensure tax counters remain visible. */
|
||||
void setMinimumHeight(int height);
|
||||
/** @brief Registers a tax counter widget for layout management. */
|
||||
void registerTaxCounter(AbstractCounter *counter);
|
||||
/** @brief Lays out visible tax counters vertically in the top-left corner of the command zone. */
|
||||
void rearrangeTaxCounters();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue