Connect tax counter state signals to menu

This commit is contained in:
DawnFire42 2026-08-10 19:35:59 -04:00
parent 314b56d176
commit 876a14758e
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
3 changed files with 13 additions and 1 deletions

View file

@ -42,11 +42,13 @@ private:
QAction *aTogglePartnerTaxCounter = nullptr; ///< Toggles partner commander tax counter visibility QAction *aTogglePartnerTaxCounter = nullptr; ///< Toggles partner commander tax counter visibility
QAction *aToggleMinimized = nullptr; ///< Toggles command zone minimized state QAction *aToggleMinimized = nullptr; ///< Toggles command zone minimized state
public slots:
void updateTaxCounterActionStates();
private slots: private slots:
void actToggleMinimized(); void actToggleMinimized();
private: private:
void updateTaxCounterActionStates();
PlayerGraphicsItem *player; PlayerGraphicsItem *player;
QString incTaxShortcutKey; QString incTaxShortcutKey;

View file

@ -71,6 +71,11 @@ public:
return utilityMenu; return utilityMenu;
} }
[[nodiscard]] CommandZoneMenu *getCommandZoneMenu() const
{
return commandZoneMenu;
}
[[nodiscard]] bool getShortcutsActive() const [[nodiscard]] bool getShortcutsActive() const
{ {
return shortcutsActive; return shortcutsActive;

View file

@ -241,6 +241,11 @@ void PlayerGraphicsItem::onCounterAdded(CounterState *state)
widget = new CommanderTaxCounter(state, player, commandZoneGraphicsItem); widget = new CommanderTaxCounter(state, player, commandZoneGraphicsItem);
widget->setActive(state->isActive()); widget->setActive(state->isActive());
commandZoneGraphicsItem->registerTaxCounter(widget); commandZoneGraphicsItem->registerTaxCounter(widget);
if (auto *menu = playerMenu->getCommandZoneMenu()) {
connect(state, &CounterState::activeChanged, menu, &CommandZoneMenu::updateTaxCounterActionStates);
connect(state, &CounterState::valueChanged, menu, &CommandZoneMenu::updateTaxCounterActionStates);
}
} else { } else {
widget = new GeneralCounter(state, player, true, this); widget = new GeneralCounter(state, player, true, this);
} }