add action to select all cards in table row (#5280)

This commit is contained in:
RickyRister 2024-12-21 10:52:19 -08:00 committed by GitHub
parent 2bd06ff0fd
commit 3cf0904651
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 1 deletions

View file

@ -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();