mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-30 20:34:27 +01:00
Arbitration: disable solo-related actions when automatic handling is active
This commit is contained in:
parent
2cc0b2bc39
commit
50a2ab7996
2 changed files with 15 additions and 0 deletions
|
@ -35,6 +35,7 @@
|
|||
#include "turn_data.h"
|
||||
#include "rack.h"
|
||||
#include "results.h"
|
||||
#include "settings.h"
|
||||
#include "debug.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -329,6 +330,8 @@ void ArbitAssignments::populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint)
|
|||
QObject::connect(soloAction, SIGNAL(triggered()),
|
||||
this, SLOT(addRemoveSolo()));
|
||||
iMenu.addAction(soloAction);
|
||||
if (useSoloAuto())
|
||||
soloAction->setEnabled(false);
|
||||
|
||||
// Action to give or remove a warning to players
|
||||
QAction *warningAction = new QAction(_q("Give (or remove) a warning"), this);
|
||||
|
@ -654,8 +657,17 @@ void ArbitAssignments::helperAssignMove(const Move &iMove)
|
|||
}
|
||||
|
||||
|
||||
bool ArbitAssignments::useSoloAuto() const
|
||||
{
|
||||
return Settings::Instance().getBool("arbitration.solo-auto");
|
||||
}
|
||||
|
||||
|
||||
void ArbitAssignments::addRemoveSolo()
|
||||
{
|
||||
if (useSoloAuto())
|
||||
return;
|
||||
|
||||
QSet<unsigned int> playersIdSet = getSelectedPlayers();
|
||||
// Only one player can have a solo
|
||||
if (playersIdSet.size() != 1)
|
||||
|
|
|
@ -100,6 +100,9 @@ private:
|
|||
// Move currently selected (in the Results table)
|
||||
Move m_selectedMove;
|
||||
|
||||
/// Return true iff the automatic solos handling is active
|
||||
bool useSoloAuto() const;
|
||||
|
||||
/// Helper method to return the ID of the selected player(s)
|
||||
QSet<unsigned int> getSelectedPlayers() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue