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 58 seconds Took 2 minutes * [Game][Menus] Make Menus accept PlayerGraphicsItem instead of PlayerLogic Took 7 minutes Took 4 minutes Took 9 seconds Took 2 minutes Took 5 minutes Took 58 seconds --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
71 lines
No EOL
2.5 KiB
C++
71 lines
No EOL
2.5 KiB
C++
#include "rfg_menu.h"
|
|
|
|
#include "../player_actions.h"
|
|
#include "../player_logic.h"
|
|
|
|
#include <libcockatrice/utility/zone_names.h>
|
|
|
|
RfgMenu::RfgMenu(PlayerGraphicsItem *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
|
|
{
|
|
createMoveActions();
|
|
createViewActions();
|
|
|
|
addAction(aViewRfg);
|
|
|
|
if (player->getLogic()->getPlayerInfo()->getLocalOrJudge()) {
|
|
addSeparator();
|
|
moveRfgMenu = addTearOffMenu(QString());
|
|
moveRfgMenu->addAction(aMoveRfgToTopLibrary);
|
|
moveRfgMenu->addAction(aMoveRfgToBottomLibrary);
|
|
moveRfgMenu->addSeparator();
|
|
moveRfgMenu->addAction(aMoveRfgToHand);
|
|
moveRfgMenu->addSeparator();
|
|
moveRfgMenu->addAction(aMoveRfgToGrave);
|
|
}
|
|
|
|
retranslateUi();
|
|
}
|
|
|
|
void RfgMenu::createMoveActions()
|
|
{
|
|
if (player->getLogic()->getPlayerInfo()->getLocalOrJudge()) {
|
|
auto rfg = player->getLogic()->getRfgZone();
|
|
|
|
aMoveRfgToTopLibrary = new QAction(this);
|
|
aMoveRfgToTopLibrary->setData(QList<QVariant>() << ZoneNames::DECK << 0);
|
|
aMoveRfgToBottomLibrary = new QAction(this);
|
|
aMoveRfgToBottomLibrary->setData(QList<QVariant>() << ZoneNames::DECK << -1);
|
|
aMoveRfgToHand = new QAction(this);
|
|
aMoveRfgToHand->setData(QList<QVariant>() << ZoneNames::HAND << 0);
|
|
aMoveRfgToGrave = new QAction(this);
|
|
aMoveRfgToGrave->setData(QList<QVariant>() << ZoneNames::GRAVE << 0);
|
|
|
|
connect(aMoveRfgToTopLibrary, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
|
connect(aMoveRfgToBottomLibrary, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
|
connect(aMoveRfgToHand, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
|
connect(aMoveRfgToGrave, &QAction::triggered, rfg, &PileZoneLogic::moveAllToZone);
|
|
}
|
|
}
|
|
|
|
void RfgMenu::createViewActions()
|
|
{
|
|
PlayerActions *playerActions = player->getLogic()->getPlayerActions();
|
|
|
|
aViewRfg = new QAction(this);
|
|
connect(aViewRfg, &QAction::triggered, playerActions, &PlayerActions::actViewRfg);
|
|
}
|
|
|
|
void RfgMenu::retranslateUi()
|
|
{
|
|
setTitle(tr("&Exile"));
|
|
|
|
aViewRfg->setText(tr("&View exile"));
|
|
|
|
if (player->getLogic()->getPlayerInfo()->getLocalOrJudge()) {
|
|
moveRfgMenu->setTitle(tr("&Move exile to..."));
|
|
aMoveRfgToTopLibrary->setText(tr("&Top of library"));
|
|
aMoveRfgToBottomLibrary->setText(tr("&Bottom of library"));
|
|
aMoveRfgToHand->setText(tr("&Hand"));
|
|
aMoveRfgToGrave->setText(tr("&Graveyard"));
|
|
}
|
|
} |