mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48: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>
63 lines
No EOL
2.6 KiB
C++
63 lines
No EOL
2.6 KiB
C++
#include "move_menu.h"
|
|
|
|
#include "../card_menu_action_type.h"
|
|
#include "../player.h"
|
|
#include "../player_actions.h"
|
|
|
|
MoveMenu::MoveMenu(Player *player) : QMenu(tr("Move to"))
|
|
{
|
|
aMoveToTopLibrary = new QAction(this);
|
|
aMoveToTopLibrary->setData(cmMoveToTopLibrary);
|
|
aMoveToBottomLibrary = new QAction(this);
|
|
aMoveToBottomLibrary->setData(cmMoveToBottomLibrary);
|
|
aMoveToXfromTopOfLibrary = new QAction(this);
|
|
aMoveToGraveyard = new QAction(this);
|
|
aMoveToHand = new QAction(this);
|
|
aMoveToHand->setData(cmMoveToHand);
|
|
aMoveToGraveyard->setData(cmMoveToGraveyard);
|
|
aMoveToExile = new QAction(this);
|
|
aMoveToExile->setData(cmMoveToExile);
|
|
|
|
connect(aMoveToTopLibrary, &QAction::triggered, player->getPlayerActions(), &PlayerActions::cardMenuAction);
|
|
connect(aMoveToBottomLibrary, &QAction::triggered, player->getPlayerActions(), &PlayerActions::cardMenuAction);
|
|
connect(aMoveToXfromTopOfLibrary, &QAction::triggered, player->getPlayerActions(),
|
|
&PlayerActions::actMoveCardXCardsFromTop);
|
|
connect(aMoveToHand, &QAction::triggered, player->getPlayerActions(), &PlayerActions::cardMenuAction);
|
|
connect(aMoveToGraveyard, &QAction::triggered, player->getPlayerActions(), &PlayerActions::cardMenuAction);
|
|
connect(aMoveToExile, &QAction::triggered, player->getPlayerActions(), &PlayerActions::cardMenuAction);
|
|
|
|
addAction(aMoveToTopLibrary);
|
|
addAction(aMoveToXfromTopOfLibrary);
|
|
addAction(aMoveToBottomLibrary);
|
|
addSeparator();
|
|
addAction(aMoveToHand);
|
|
addSeparator();
|
|
addAction(aMoveToGraveyard);
|
|
addSeparator();
|
|
addAction(aMoveToExile);
|
|
|
|
setShortcutsActive();
|
|
|
|
retranslateUi();
|
|
}
|
|
|
|
void MoveMenu::setShortcutsActive()
|
|
{
|
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
|
|
|
aMoveToTopLibrary->setShortcuts(shortcuts.getShortcut("Player/aMoveToTopLibrary"));
|
|
aMoveToBottomLibrary->setShortcuts(shortcuts.getShortcut("Player/aMoveToBottomLibrary"));
|
|
aMoveToHand->setShortcuts(shortcuts.getShortcut("Player/aMoveToHand"));
|
|
aMoveToGraveyard->setShortcuts(shortcuts.getShortcut("Player/aMoveToGraveyard"));
|
|
aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile"));
|
|
}
|
|
|
|
void MoveMenu::retranslateUi()
|
|
{
|
|
aMoveToTopLibrary->setText(tr("&Top of library in random order"));
|
|
aMoveToXfromTopOfLibrary->setText(tr("X cards from the top of library..."));
|
|
aMoveToBottomLibrary->setText(tr("&Bottom of library in random order"));
|
|
aMoveToHand->setText(tr("&Hand"));
|
|
aMoveToGraveyard->setText(tr("&Graveyard"));
|
|
aMoveToExile->setText(tr("&Exile"));
|
|
} |