Set menu for sideboard again, translate some menu titles, reimplement actIncPT action

Took 54 seconds
This commit is contained in:
Lukas Brübach 2025-09-10 09:20:02 +02:00
parent 45eaf3f072
commit 1c3021028b
3 changed files with 25 additions and 16 deletions

View file

@ -5,10 +5,10 @@
PlayerGraphicsItem::PlayerGraphicsItem(Player *_player) : player(_player)
{
/*connect(&SettingsCache::instance(), &SettingsCache::horizontalHandChanged, this,
connect(&SettingsCache::instance(), &SettingsCache::horizontalHandChanged, this,
&PlayerGraphicsItem::rearrangeZones);
connect(&SettingsCache::instance(), &SettingsCache::handJustificationChanged, this,
&PlayerGraphicsItem::rearrangeZones);*/
&PlayerGraphicsItem::rearrangeZones);
connect(player, &Player::rearrangeCounters, this, &PlayerGraphicsItem::rearrangeCounters);
playerArea = new PlayerArea(this);
@ -29,18 +29,17 @@ PlayerGraphicsItem::PlayerGraphicsItem(Player *_player) : player(_player)
void PlayerGraphicsItem::retranslateUi()
{
player->getPlayerMenu()->retranslateUi();
player->getPlayerMenu()->retranslateUi();
QMapIterator<QString, CardZoneLogic *> zoneIterator(player->getZones());
while (zoneIterator.hasNext()) {
emit zoneIterator.next().value()->retranslateUi();
}
QMapIterator<int, AbstractCounter *> counterIterator(player->getCounters());
while (counterIterator.hasNext()) {
counterIterator.next().value()->retranslateUi();
}
QMapIterator<QString, CardZoneLogic *> zoneIterator(player->getZones());
while (zoneIterator.hasNext()) {
emit zoneIterator.next().value()->retranslateUi();
}
QMapIterator<int, AbstractCounter *> counterIterator(player->getCounters());
while (counterIterator.hasNext()) {
counterIterator.next().value()->retranslateUi();
}
}
void PlayerGraphicsItem::onPlayerActiveChanged(bool _active)
@ -57,6 +56,9 @@ void PlayerGraphicsItem::initializeZones()
qreal h = deckZoneGraphicsItem->boundingRect().width() + 5;
sideboardGraphicsItem = new PileZone(player->getSideboardZone(), this);
player->getSideboardZone()->setGraphicsVisibility(false);
auto *handCounter = new HandCounter(playerArea);
handCounter->setPos(base + QPointF(0, h + 10));
qreal h2 = handCounter->boundingRect().height();

View file

@ -68,6 +68,11 @@ public:
return deckZoneGraphicsItem;
}
[[nodiscard]] PileZone *getSideboardZoneGraphicsItem() const
{
return sideboardGraphicsItem;
}
[[nodiscard]] PileZone *getGraveyardZoneGraphicsItem() const
{
return graveyardZoneGraphicsItem;
@ -102,6 +107,7 @@ private:
PlayerArea *playerArea;
PlayerTarget *playerTarget;
PileZone *deckZoneGraphicsItem;
PileZone *sideboardGraphicsItem;
PileZone *graveyardZoneGraphicsItem;
PileZone *rfgZoneGraphicsItem;
TableZone *tableZoneGraphicsItem;

View file

@ -271,7 +271,8 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
sbMenu = playerMenu->addMenu(QString());
sbMenu->addAction(aViewSideboard);
// sb->setMenu(sbMenu, aViewSideboard);
player->getGraphicsItem()->getSideboardZoneGraphicsItem()->setMenu(sbMenu);
mCustomZones = playerMenu->addMenu(QString());
mCustomZones->menuAction()->setVisible(false);
@ -359,7 +360,7 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
aDecT = new QAction(this);
connect(aDecT, &QAction::triggered, playerActions, &PlayerActions::actDecT);
aIncPT = new QAction(this);
// connect(aIncPT, &QAction::triggered, playerActions, [this] { actIncPT(); });
connect(aIncPT, &QAction::triggered, playerActions, [playerActions] { playerActions->actIncPT(); });
aDecPT = new QAction(this);
connect(aDecPT, &QAction::triggered, playerActions, &PlayerActions::actDecPT);
aFlowP = new QAction(this);
@ -757,7 +758,7 @@ QMenu *PlayerMenu::updateCardMenu(const CardItem *card)
QMenu *PlayerMenu::createPtMenu() const
{
QMenu *ptMenu = new QMenu("Power / toughness");
QMenu *ptMenu = new QMenu(tr("Power / toughness"));
ptMenu->addAction(aIncP);
ptMenu->addAction(aDecP);
ptMenu->addAction(aFlowP);
@ -776,7 +777,7 @@ QMenu *PlayerMenu::createPtMenu() const
QMenu *PlayerMenu::createMoveMenu() const
{
QMenu *moveMenu = new QMenu("Move to");
QMenu *moveMenu = new QMenu(tr("Move to"));
moveMenu->addAction(aMoveToTopLibrary);
moveMenu->addAction(aMoveToXfromTopOfLibrary);
moveMenu->addAction(aMoveToBottomLibrary);