mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
add action to select all cards in table row (#5280)
This commit is contained in:
parent
2bd06ff0fd
commit
3cf0904651
3 changed files with 23 additions and 1 deletions
|
|
@ -516,6 +516,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
|
||||
aSelectAll = new QAction(this);
|
||||
connect(aSelectAll, SIGNAL(triggered()), this, SLOT(actSelectAll()));
|
||||
aSelectRow = new QAction(this);
|
||||
connect(aSelectRow, SIGNAL(triggered()), this, SLOT(actSelectRow()));
|
||||
aSelectColumn = new QAction(this);
|
||||
connect(aSelectColumn, SIGNAL(triggered()), this, SLOT(actSelectColumn()));
|
||||
|
||||
|
|
@ -843,6 +845,7 @@ void Player::retranslateUi()
|
|||
}
|
||||
|
||||
aSelectAll->setText(tr("&Select All"));
|
||||
aSelectRow->setText(tr("S&elect Row"));
|
||||
aSelectColumn->setText(tr("S&elect Column"));
|
||||
|
||||
aPlay->setText(tr("&Play"));
|
||||
|
|
@ -933,6 +936,7 @@ void Player::setShortcutsActive()
|
|||
aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile"));
|
||||
|
||||
aSelectAll->setShortcuts(shortcuts.getShortcut("Player/aSelectAll"));
|
||||
aSelectRow->setShortcuts(shortcuts.getShortcut("Player/aSelectRow"));
|
||||
aSelectColumn->setShortcuts(shortcuts.getShortcut("Player/aSelectColumn"));
|
||||
|
||||
QList<QKeySequence> addCCShortCuts;
|
||||
|
|
@ -1604,6 +1608,19 @@ void Player::actSelectAll()
|
|||
selectCardsInZone(card->getZone());
|
||||
}
|
||||
|
||||
void Player::actSelectRow()
|
||||
{
|
||||
const CardItem *card = game->getActiveCard();
|
||||
if (!card) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto isSameRow = [card](const CardItem *cardItem) {
|
||||
return qAbs(card->scenePos().y() - cardItem->scenePos().y()) < 50;
|
||||
};
|
||||
selectCardsInZone(card->getZone(), isSameRow);
|
||||
}
|
||||
|
||||
void Player::actSelectColumn()
|
||||
{
|
||||
const CardItem *card = game->getActiveCard();
|
||||
|
|
@ -3750,6 +3767,7 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
cardMenu->addMenu(moveMenu);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aSelectAll);
|
||||
cardMenu->addAction(aSelectRow);
|
||||
|
||||
for (int i = 0; i < aAddCounter.size(); ++i) {
|
||||
cardMenu->addSeparator();
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ public slots:
|
|||
void actMoveBottomCardToTop();
|
||||
|
||||
void actSelectAll();
|
||||
void actSelectRow();
|
||||
void actSelectColumn();
|
||||
|
||||
void actViewLibrary();
|
||||
|
|
@ -267,7 +268,7 @@ private:
|
|||
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
||||
*aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aFlowP, *aFlowT, *aSetAnnotation, *aFlip, *aPeek, *aClone,
|
||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile,
|
||||
*aMoveToXfromTopOfLibrary, *aSelectAll, *aSelectColumn;
|
||||
*aMoveToXfromTopOfLibrary, *aSelectAll, *aSelectRow, *aSelectColumn;
|
||||
|
||||
bool movingCardsUntil;
|
||||
QTimer *moveTopCardTimer;
|
||||
|
|
|
|||
|
|
@ -456,6 +456,9 @@ private:
|
|||
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
|
||||
parseSequenceString("Ctrl+A"),
|
||||
ShortcutGroup::Playing_Area)},
|
||||
{"Player/aSelectRow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Row"),
|
||||
parseSequenceString("Ctrl+Shift+X"),
|
||||
ShortcutGroup::Playing_Area)},
|
||||
{"Player/aSelectColumn", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Column"),
|
||||
parseSequenceString("Ctrl+Shift+C"),
|
||||
ShortcutGroup::Playing_Area)},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue