From 9ad9b02d57f59feda74920351c611d91c0fee321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Tue, 15 Jan 2013 20:13:47 +0100 Subject: [PATCH] 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. --- qt/arbit_assignments.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/qt/arbit_assignments.cpp b/qt/arbit_assignments.cpp index 30d2021..de63157 100644 --- a/qt/arbit_assignments.cpp +++ b/qt/arbit_assignments.cpp @@ -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);