mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
Add more sort options to hand sort (#6279)
* Add more sort options to hand sort Took 14 minutes * Move defaultOptions up a level * Directly pass sort order as param * fix include * revert * fallback expandSortOption
This commit is contained in:
parent
6bc2293292
commit
757e9f3415
6 changed files with 74 additions and 14 deletions
|
|
@ -17,9 +17,22 @@ HandMenu::HandMenu(Player *_player, PlayerActions *actions, QWidget *parent) : T
|
|||
connect(aViewHand, &QAction::triggered, actions, &PlayerActions::actViewHand);
|
||||
addAction(aViewHand);
|
||||
|
||||
aSortHand = new QAction(this);
|
||||
connect(aSortHand, &QAction::triggered, actions, &PlayerActions::actSortHand);
|
||||
addAction(aSortHand);
|
||||
mSortHand = addMenu(QString());
|
||||
|
||||
aSortHandByName = new QAction(this);
|
||||
aSortHandByName->setData(CardList::SortByName);
|
||||
aSortHandByType = new QAction(this);
|
||||
aSortHandByType->setData(CardList::SortByMainType);
|
||||
aSortHandByManaValue = new QAction(this);
|
||||
aSortHandByManaValue->setData(CardList::SortByManaValue);
|
||||
|
||||
connect(aSortHandByType, &QAction::triggered, actions, &PlayerActions::actSortHand);
|
||||
connect(aSortHandByName, &QAction::triggered, actions, &PlayerActions::actSortHand);
|
||||
connect(aSortHandByManaValue, &QAction::triggered, actions, &PlayerActions::actSortHand);
|
||||
|
||||
mSortHand->addAction(aSortHandByName);
|
||||
mSortHand->addAction(aSortHandByType);
|
||||
mSortHand->addAction(aSortHandByManaValue);
|
||||
}
|
||||
|
||||
mRevealHand = addMenu(QString());
|
||||
|
|
@ -73,7 +86,12 @@ void HandMenu::retranslateUi()
|
|||
|
||||
if (player->getPlayerInfo()->getLocalOrJudge()) {
|
||||
aViewHand->setText(tr("&View hand"));
|
||||
aSortHand->setText(tr("&Sort hand"));
|
||||
|
||||
mSortHand->setTitle(tr("Sort hand by..."));
|
||||
aSortHandByName->setText(tr("Name"));
|
||||
aSortHandByType->setText(tr("Type"));
|
||||
aSortHandByManaValue->setText(tr("Mana Value"));
|
||||
|
||||
aMulligan->setText(tr("Take &mulligan"));
|
||||
|
||||
mMoveHandMenu->setTitle(tr("&Move hand to..."));
|
||||
|
|
@ -91,14 +109,18 @@ void HandMenu::setShortcutsActive()
|
|||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
aViewHand->setShortcuts(shortcuts.getShortcut("Player/aViewHand"));
|
||||
aSortHand->setShortcuts(shortcuts.getShortcut("Player/aSortHand"));
|
||||
aSortHandByName->setShortcuts(shortcuts.getShortcut("Player/aSortHandByName"));
|
||||
aSortHandByType->setShortcuts(shortcuts.getShortcut("Player/aSortHandByType"));
|
||||
aSortHandByManaValue->setShortcuts(shortcuts.getShortcut("Player/aSortHandByManaValue"));
|
||||
aMulligan->setShortcuts(shortcuts.getShortcut("Player/aMulligan"));
|
||||
}
|
||||
|
||||
void HandMenu::setShortcutsInactive()
|
||||
{
|
||||
aViewHand->setShortcut(QKeySequence());
|
||||
aSortHand->setShortcut(QKeySequence());
|
||||
aSortHandByName->setShortcut(QKeySequence());
|
||||
aSortHandByType->setShortcut(QKeySequence());
|
||||
aSortHandByManaValue->setShortcut(QKeySequence());
|
||||
aMulligan->setShortcut(QKeySequence());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue