Arbitration: allow selecting all the players directly from the players/results tables

This commit is contained in:
Olivier Teulière 2012-04-05 21:54:22 +02:00
parent 4fe2cf3469
commit 537d00714b
3 changed files with 35 additions and 0 deletions

View file

@ -67,6 +67,11 @@ ArbitAssignments::ArbitAssignments(QWidget *parent, PublicGame *iGame)
treeViewPlayers->setColumnWidth(3, 40);
treeViewPlayers->setColumnWidth(4, 50);
KeyEventFilter *selectAllFilter = new KeyEventFilter(this, Qt::Key_A);
QObject::connect(selectAllFilter, SIGNAL(keyPressed(int, int)),
this, SLOT(selectAllPlayers()));
treeViewPlayers->installEventFilter(selectAllFilter);
KeyEventFilter *filter = new KeyEventFilter(this, Qt::Key_T);
QObject::connect(filter, SIGNAL(keyPressed(int, int)),
this, SLOT(assignTopMove()));
@ -245,6 +250,14 @@ void ArbitAssignments::populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint)
iMenu.addAction(assignSelMoveAction);
}
// Action to select all the players
QAction *selectAllAction = new QAction(_q("Select all players"), this);
selectAllAction->setStatusTip(_q("Select all the players"));
selectAllAction->setShortcut(Qt::Key_A);
QObject::connect(selectAllAction, SIGNAL(triggered()),
this, SLOT(selectAllPlayers()));
iMenu.addAction(selectAllAction);
// Action to assign the top move
QAction *assignTopMoveAction = new QAction(_q("Assign top move"), this);
assignTopMoveAction->setStatusTip(_q("Assign the top move (if unique) to the selected player(s)"));
@ -345,6 +358,13 @@ void ArbitAssignments::showMasterPreview()
}
void ArbitAssignments::selectAllPlayers()
{
treeViewPlayers->selectAll();
emit notifyInfo(_q("All players selected"));
}
void ArbitAssignments::assignMasterMove()
{
if (m_game->isFinished())

View file

@ -63,6 +63,7 @@ signals:
public slots:
void refresh();
void enableAssignmentButtons();
void selectAllPlayers();
void assignMasterMove();
void assignSelectedMove();
void assignDefaultMasterMove();

View file

@ -112,6 +112,11 @@ ArbitrationWidget::ArbitrationWidget(QWidget *parent,
m_assignmentsWidget, SLOT(assignMasterMove()));
treeViewResults->installEventFilter(masterFilter);
KeyEventFilter *selectAllFilter = new KeyEventFilter(this, Qt::Key_A);
QObject::connect(selectAllFilter, SIGNAL(keyPressed(int, int)),
m_assignmentsWidget, SLOT(selectAllPlayers()));
treeViewResults->installEventFilter(selectAllFilter);
KeyEventFilter *numFilter = new KeyEventFilter(this, Qt::Key_0);
numFilter->addKey(Qt::Key_1);
numFilter->addKey(Qt::Key_2);
@ -485,6 +490,15 @@ void ArbitrationWidget::populateResultsMenu(QMenu &iMenu, const QPoint &iPoint)
if (move.getType() != Move::VALID_ROUND)
setAsMasterAction->setEnabled(false);
// Action to select all the players
QAction *selectAllAction =
new QAction(_q("Select all players"), this);
selectAllAction->setStatusTip(_q("Select all the players"));
selectAllAction->setShortcut(Qt::Key_A);
QObject::connect(selectAllAction, SIGNAL(triggered()),
m_assignmentsWidget, SLOT(selectAllPlayers()));
iMenu.addAction(selectAllAction);
// Action to assign the selected move
QAction *assignSelMoveAction =
new QAction(_q("Assign selected move (%1)").arg(formatMove(move)), this);