mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
* [Refactor] Move game logic into libcockatrice_game * [Refactor] Include card_state.h in player_actions.h * [Game] Inject settings providers into libcockatrice_game, drop Widgets * [Game] Follow base rename to createCardRequested after rebase * [Game] Drop unused CardItem forward declaration * [Game] Fix includes after moving game logic into libcockatrice_game --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
48 lines
No EOL
1.4 KiB
C++
48 lines
No EOL
1.4 KiB
C++
#include "custom_zone_menu.h"
|
|
|
|
#include "../../game_scene.h"
|
|
#include "../player_graphics_item.h"
|
|
|
|
#include <QAction>
|
|
#include <QList>
|
|
#include <QVariant>
|
|
#include <libcockatrice/game/player/player_info.h>
|
|
#include <libcockatrice/game/player/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); });
|
|
} |