mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-29 20:34:56 +01:00
Arbitration: allow selecting all the players directly from the players/results tables
This commit is contained in:
parent
4fe2cf3469
commit
537d00714b
3 changed files with 35 additions and 0 deletions
|
@ -67,6 +67,11 @@ ArbitAssignments::ArbitAssignments(QWidget *parent, PublicGame *iGame)
|
||||||
treeViewPlayers->setColumnWidth(3, 40);
|
treeViewPlayers->setColumnWidth(3, 40);
|
||||||
treeViewPlayers->setColumnWidth(4, 50);
|
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);
|
KeyEventFilter *filter = new KeyEventFilter(this, Qt::Key_T);
|
||||||
QObject::connect(filter, SIGNAL(keyPressed(int, int)),
|
QObject::connect(filter, SIGNAL(keyPressed(int, int)),
|
||||||
this, SLOT(assignTopMove()));
|
this, SLOT(assignTopMove()));
|
||||||
|
@ -245,6 +250,14 @@ void ArbitAssignments::populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint)
|
||||||
iMenu.addAction(assignSelMoveAction);
|
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
|
// Action to assign the top move
|
||||||
QAction *assignTopMoveAction = new QAction(_q("Assign top move"), this);
|
QAction *assignTopMoveAction = new QAction(_q("Assign top move"), this);
|
||||||
assignTopMoveAction->setStatusTip(_q("Assign the top move (if unique) to the selected player(s)"));
|
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()
|
void ArbitAssignments::assignMasterMove()
|
||||||
{
|
{
|
||||||
if (m_game->isFinished())
|
if (m_game->isFinished())
|
||||||
|
|
|
@ -63,6 +63,7 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
void refresh();
|
void refresh();
|
||||||
void enableAssignmentButtons();
|
void enableAssignmentButtons();
|
||||||
|
void selectAllPlayers();
|
||||||
void assignMasterMove();
|
void assignMasterMove();
|
||||||
void assignSelectedMove();
|
void assignSelectedMove();
|
||||||
void assignDefaultMasterMove();
|
void assignDefaultMasterMove();
|
||||||
|
|
|
@ -112,6 +112,11 @@ ArbitrationWidget::ArbitrationWidget(QWidget *parent,
|
||||||
m_assignmentsWidget, SLOT(assignMasterMove()));
|
m_assignmentsWidget, SLOT(assignMasterMove()));
|
||||||
treeViewResults->installEventFilter(masterFilter);
|
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);
|
KeyEventFilter *numFilter = new KeyEventFilter(this, Qt::Key_0);
|
||||||
numFilter->addKey(Qt::Key_1);
|
numFilter->addKey(Qt::Key_1);
|
||||||
numFilter->addKey(Qt::Key_2);
|
numFilter->addKey(Qt::Key_2);
|
||||||
|
@ -485,6 +490,15 @@ void ArbitrationWidget::populateResultsMenu(QMenu &iMenu, const QPoint &iPoint)
|
||||||
if (move.getType() != Move::VALID_ROUND)
|
if (move.getType() != Move::VALID_ROUND)
|
||||||
setAsMasterAction->setEnabled(false);
|
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
|
// Action to assign the selected move
|
||||||
QAction *assignSelMoveAction =
|
QAction *assignSelMoveAction =
|
||||||
new QAction(_q("Assign selected move (%1)").arg(formatMove(move)), this);
|
new QAction(_q("Assign selected move (%1)").arg(formatMove(move)), this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue