mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 16:13:54 -07:00
* [Game][Player] Split Player into PlayerLogic/PlayerGraphicsItem Took 4 minutes Took 48 seconds * Drop early return. Took 1 hour 13 minutes Took 2 minutes Took 1 minute * Delete player view. Took 37 seconds * Restore card counter color in menu. Took 5 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
41 lines
No EOL
1.2 KiB
C++
41 lines
No EOL
1.2 KiB
C++
#include "custom_zone_menu.h"
|
|
|
|
#include "../player_logic.h"
|
|
|
|
CustomZoneMenu::CustomZoneMenu(PlayerGraphicsItem *_player) : player(_player)
|
|
{
|
|
menuAction()->setVisible(false);
|
|
|
|
connect(player->getLogic(), &PlayerLogic::clearCustomZonesMenu, this, &CustomZoneMenu::clearCustomZonesMenu);
|
|
connect(player->getLogic(), &PlayerLogic::addViewCustomZoneActionToCustomZoneMenu, this,
|
|
&CustomZoneMenu::addViewCustomZoneActionToCustomZoneMenu);
|
|
|
|
retranslateUi();
|
|
}
|
|
|
|
void CustomZoneMenu::retranslateUi()
|
|
{
|
|
setTitle(tr("C&ustom Zones"));
|
|
|
|
if (player->getLogic()->getPlayerInfo()->getLocalOrJudge()) {
|
|
|
|
for (auto aViewZone : actions()) {
|
|
aViewZone->setText(tr("View custom zone '%1'").arg(aViewZone->data().toString()));
|
|
}
|
|
}
|
|
}
|
|
|
|
void CustomZoneMenu::clearCustomZonesMenu()
|
|
{
|
|
clear();
|
|
menuAction()->setVisible(false);
|
|
}
|
|
|
|
void CustomZoneMenu::addViewCustomZoneActionToCustomZoneMenu(QString zoneName)
|
|
{
|
|
menuAction()->setVisible(true);
|
|
QAction *aViewZone = addAction(tr("View custom zone '%1'").arg(zoneName));
|
|
aViewZone->setData(zoneName);
|
|
connect(aViewZone, &QAction::triggered, this,
|
|
[zoneName, this]() { player->getGameScene()->toggleZoneView(player->getLogic(), zoneName, -1); });
|
|
} |