mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 17:44:01 -07:00
* Refactor player menus into helper classes. Took 2 hours 6 minutes Took 11 minutes * Lint. Took 6 minutes Took 22 seconds * Refactor card and move menu. Took 1 hour 6 minutes Took 36 seconds Took 52 seconds * Set active shortcuts, move player info stuff to card menu. Took 25 minutes Took 18 seconds * Refactor say and utility menu. Took 54 minutes Took 2 minutes Took 5 minutes Took 11 minutes * Rename folder. Took 24 minutes Took 6 minutes * Refactor sideboard menu. Took 26 minutes * Remove unused variable in constructor. Took 42 seconds * Lint. Took 11 minutes * Nullptr check Took 8 minutes * Use localOrJudge check Took 6 minutes * Fix the build. Took 7 minutes Took 35 seconds * PlayerList things. Took 16 minutes * Retranslate and set shortcuts for everything. Took 10 minutes * Correctly nullptr out sayMenu if not local Took 3 minutes * Don't check playerInfo in sbMenu shortcutsActive Took 3 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.h"
|
|
|
|
CustomZoneMenu::CustomZoneMenu(Player *_player) : player(_player)
|
|
{
|
|
menuAction()->setVisible(false);
|
|
|
|
connect(player, &Player::clearCustomZonesMenu, this, &CustomZoneMenu::clearCustomZonesMenu);
|
|
connect(player, &Player::addViewCustomZoneActionToCustomZoneMenu, this,
|
|
&CustomZoneMenu::addViewCustomZoneActionToCustomZoneMenu);
|
|
|
|
retranslateUi();
|
|
}
|
|
|
|
void CustomZoneMenu::retranslateUi()
|
|
{
|
|
setTitle(tr("C&ustom Zones"));
|
|
|
|
if (player->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, zoneName, -1); });
|
|
} |