mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-29 18:13:55 -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);
|
aSelectAll = new QAction(this);
|
||||||
connect(aSelectAll, SIGNAL(triggered()), this, SLOT(actSelectAll()));
|
connect(aSelectAll, SIGNAL(triggered()), this, SLOT(actSelectAll()));
|
||||||
|
aSelectRow = new QAction(this);
|
||||||
|
connect(aSelectRow, SIGNAL(triggered()), this, SLOT(actSelectRow()));
|
||||||
aSelectColumn = new QAction(this);
|
aSelectColumn = new QAction(this);
|
||||||
connect(aSelectColumn, SIGNAL(triggered()), this, SLOT(actSelectColumn()));
|
connect(aSelectColumn, SIGNAL(triggered()), this, SLOT(actSelectColumn()));
|
||||||
|
|
||||||
|
|
@ -843,6 +845,7 @@ void Player::retranslateUi()
|
||||||
}
|
}
|
||||||
|
|
||||||
aSelectAll->setText(tr("&Select All"));
|
aSelectAll->setText(tr("&Select All"));
|
||||||
|
aSelectRow->setText(tr("S&elect Row"));
|
||||||
aSelectColumn->setText(tr("S&elect Column"));
|
aSelectColumn->setText(tr("S&elect Column"));
|
||||||
|
|
||||||
aPlay->setText(tr("&Play"));
|
aPlay->setText(tr("&Play"));
|
||||||
|
|
@ -933,6 +936,7 @@ void Player::setShortcutsActive()
|
||||||
aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile"));
|
aMoveToExile->setShortcuts(shortcuts.getShortcut("Player/aMoveToExile"));
|
||||||
|
|
||||||
aSelectAll->setShortcuts(shortcuts.getShortcut("Player/aSelectAll"));
|
aSelectAll->setShortcuts(shortcuts.getShortcut("Player/aSelectAll"));
|
||||||
|
aSelectRow->setShortcuts(shortcuts.getShortcut("Player/aSelectRow"));
|
||||||
aSelectColumn->setShortcuts(shortcuts.getShortcut("Player/aSelectColumn"));
|
aSelectColumn->setShortcuts(shortcuts.getShortcut("Player/aSelectColumn"));
|
||||||
|
|
||||||
QList<QKeySequence> addCCShortCuts;
|
QList<QKeySequence> addCCShortCuts;
|
||||||
|
|
@ -1604,6 +1608,19 @@ void Player::actSelectAll()
|
||||||
selectCardsInZone(card->getZone());
|
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()
|
void Player::actSelectColumn()
|
||||||
{
|
{
|
||||||
const CardItem *card = game->getActiveCard();
|
const CardItem *card = game->getActiveCard();
|
||||||
|
|
@ -3750,6 +3767,7 @@ void Player::updateCardMenu(const CardItem *card)
|
||||||
cardMenu->addMenu(moveMenu);
|
cardMenu->addMenu(moveMenu);
|
||||||
cardMenu->addSeparator();
|
cardMenu->addSeparator();
|
||||||
cardMenu->addAction(aSelectAll);
|
cardMenu->addAction(aSelectAll);
|
||||||
|
cardMenu->addAction(aSelectRow);
|
||||||
|
|
||||||
for (int i = 0; i < aAddCounter.size(); ++i) {
|
for (int i = 0; i < aAddCounter.size(); ++i) {
|
||||||
cardMenu->addSeparator();
|
cardMenu->addSeparator();
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,7 @@ public slots:
|
||||||
void actMoveBottomCardToTop();
|
void actMoveBottomCardToTop();
|
||||||
|
|
||||||
void actSelectAll();
|
void actSelectAll();
|
||||||
|
void actSelectRow();
|
||||||
void actSelectColumn();
|
void actSelectColumn();
|
||||||
|
|
||||||
void actViewLibrary();
|
void actViewLibrary();
|
||||||
|
|
@ -267,7 +268,7 @@ private:
|
||||||
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
||||||
*aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aFlowP, *aFlowT, *aSetAnnotation, *aFlip, *aPeek, *aClone,
|
*aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aFlowP, *aFlowT, *aSetAnnotation, *aFlip, *aPeek, *aClone,
|
||||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile,
|
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile,
|
||||||
*aMoveToXfromTopOfLibrary, *aSelectAll, *aSelectColumn;
|
*aMoveToXfromTopOfLibrary, *aSelectAll, *aSelectRow, *aSelectColumn;
|
||||||
|
|
||||||
bool movingCardsUntil;
|
bool movingCardsUntil;
|
||||||
QTimer *moveTopCardTimer;
|
QTimer *moveTopCardTimer;
|
||||||
|
|
|
||||||
|
|
@ -456,6 +456,9 @@ private:
|
||||||
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
|
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
|
||||||
parseSequenceString("Ctrl+A"),
|
parseSequenceString("Ctrl+A"),
|
||||||
ShortcutGroup::Playing_Area)},
|
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"),
|
{"Player/aSelectColumn", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Column"),
|
||||||
parseSequenceString("Ctrl+Shift+C"),
|
parseSequenceString("Ctrl+Shift+C"),
|
||||||
ShortcutGroup::Playing_Area)},
|
ShortcutGroup::Playing_Area)},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue