mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-16 03:45:39 +01:00
Arbitration: new popup menu entry to suppress an assigned move
This commit is contained in:
parent
a800863c1f
commit
56028c8651
1 changed files with 31 additions and 13 deletions
|
@ -68,12 +68,17 @@ 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);
|
KeyEventFilter *filter = new KeyEventFilter(this, Qt::Key_A);
|
||||||
QObject::connect(selectAllFilter, SIGNAL(keyPressed(int, int)),
|
QObject::connect(filter, SIGNAL(keyPressed(int, int)),
|
||||||
this, SLOT(selectAllPlayers()));
|
this, SLOT(selectAllPlayers()));
|
||||||
treeViewPlayers->installEventFilter(selectAllFilter);
|
treeViewPlayers->installEventFilter(filter);
|
||||||
|
|
||||||
KeyEventFilter *filter = new KeyEventFilter(this, Qt::Key_T);
|
filter = new KeyEventFilter(this, Qt::Key_Delete);
|
||||||
|
QObject::connect(filter, SIGNAL(keyPressed(int, int)),
|
||||||
|
this, SLOT(suppressMove()));
|
||||||
|
treeViewPlayers->installEventFilter(filter);
|
||||||
|
|
||||||
|
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()));
|
||||||
treeViewPlayers->installEventFilter(filter);
|
treeViewPlayers->installEventFilter(filter);
|
||||||
|
@ -260,14 +265,6 @@ 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 (if unique)"), this);
|
QAction *assignTopMoveAction = new QAction(_q("Assign top move (if unique)"), 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)"));
|
||||||
|
@ -276,6 +273,24 @@ void ArbitAssignments::populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint)
|
||||||
this, SLOT(assignTopMove()));
|
this, SLOT(assignTopMove()));
|
||||||
iMenu.addAction(assignTopMoveAction);
|
iMenu.addAction(assignTopMoveAction);
|
||||||
|
|
||||||
|
// Action to suppress an assigned move
|
||||||
|
QAction *suppressMoveAction = new QAction(_q("Suppress assigned move"), this);
|
||||||
|
suppressMoveAction->setStatusTip(_q("Suppress the currently assigned move for the selected player(s)"));
|
||||||
|
suppressMoveAction->setShortcut(Qt::Key_Delete);
|
||||||
|
QObject::connect(suppressMoveAction, SIGNAL(triggered()),
|
||||||
|
this, SLOT(suppressMove()));
|
||||||
|
iMenu.addAction(suppressMoveAction);
|
||||||
|
if (!isSuppressMoveAllowed())
|
||||||
|
suppressMoveAction->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()),
|
||||||
|
this, SLOT(selectAllPlayers()));
|
||||||
|
iMenu.addAction(selectAllAction);
|
||||||
|
|
||||||
// Action to give or remove a solo to players
|
// Action to give or remove a solo to players
|
||||||
QAction *soloAction = new QAction(_q("Give (or remove) a solo"), this);
|
QAction *soloAction = new QAction(_q("Give (or remove) a solo"), this);
|
||||||
soloAction->setStatusTip(_q("Give a solo to the selected player, or remove it if (s)he already has one"));
|
soloAction->setStatusTip(_q("Give a solo to the selected player, or remove it if (s)he already has one"));
|
||||||
|
@ -604,7 +619,10 @@ void ArbitAssignments::helperAssignMove(const Move &iMove)
|
||||||
// Assign the move
|
// Assign the move
|
||||||
m_game->arbitrationAssign(id, iMove);
|
m_game->arbitrationAssign(id, iMove);
|
||||||
}
|
}
|
||||||
emit notifyInfo(_q("Move assigned to player(s)"));
|
if (iMove.isNull())
|
||||||
|
emit notifyInfo(_q("Move assignment suppressed"));
|
||||||
|
else
|
||||||
|
emit notifyInfo(_q("Move assigned to player(s)"));
|
||||||
emit gameUpdated();
|
emit gameUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue