Arbitration: always show the context menu entry to assign the selected move.

Even if no move is selected, it can help the user to become aware of the
keyboard shortcuts.
This commit is contained in:
Olivier Teulière 2013-01-15 20:13:47 +01:00
parent e4338547e5
commit 9ad9b02d57

View file

@ -280,18 +280,22 @@ void ArbitAssignments::populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint)
return;
// Action to assign the selected move
QString selMoveString = _q("none");
if (isAssignMoveAllowed())
{
const Move &move = m_selectedMove;
QAction *assignSelMoveAction =
new QAction(_q("Assign selected move (%1)").arg(formatMove(move)), this);
assignSelMoveAction->setStatusTip(_q("Assign move (%1) to the selected player(s)")
.arg(formatMove(move)));
assignSelMoveAction->setShortcut(Qt::Key_Enter);
QObject::connect(assignSelMoveAction, SIGNAL(triggered()),
this, SLOT(assignSelectedMove()));
iMenu.addAction(assignSelMoveAction);
selMoveString = formatMove(move);
}
QAction *assignSelMoveAction =
new QAction(_q("Assign selected move (%1)").arg(selMoveString), this);
assignSelMoveAction->setStatusTip(_q("Assign move (%1) to the selected player(s)")
.arg(selMoveString));
assignSelMoveAction->setShortcut(Qt::Key_Enter);
QObject::connect(assignSelMoveAction, SIGNAL(triggered()),
this, SLOT(assignSelectedMove()));
iMenu.addAction(assignSelMoveAction);
if (!isAssignMoveAllowed())
assignSelMoveAction->setEnabled(false);
// Action to assign the top move
QAction *assignTopMoveAction = new QAction(_q("Assign top move (if unique)"), this);