Preferences: add a checkbox for the new automatic solos handling option

This commit is contained in:
Olivier Teulière 2012-12-05 23:55:44 +01:00
parent 19a93988ad
commit 2cc0b2bc39
2 changed files with 78 additions and 34 deletions

View file

@ -96,6 +96,8 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
"It is still possible to change the master move afterwards."));
checkBoxArbitFillRack->setToolTip(_q("If checked, the rack will be completed with random letters.\n"
"Uncheck this option if you prefer to choose the letters yourself."));
checkBoxArbitSoloAuto->setToolTip(_q("If checked, solos are given automatically, when appropriate.\n"
"Uncheck this option if you prefer to do it manually."));
spinBoxArbitSearchLimit->setToolTip(spinBoxTrainSearchLimit->toolTip());
spinBoxArbitWarnLimit->setToolTip(_q("Maximal number of \"acceptable\" warnings.\n"
"Any additional warning will give a penalty to the player."));
@ -107,6 +109,13 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
completer->setModel(model);
lineEditIntfDicPath->setCompleter(completer);
// The "arbitration.solo-players" setting is meaningful only
// when "arbitration.solo-auto" is true
QObject::connect(checkBoxArbitSoloAuto, SIGNAL(toggled(bool)),
labelArbitSoloPlayers, SLOT(setEnabled(bool)));
QObject::connect(checkBoxArbitSoloAuto, SIGNAL(toggled(bool)),
spinBoxArbitSoloPlayers, SLOT(setEnabled(bool)));
try
{
// Interface settings
@ -143,10 +152,12 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
checkBoxArbitFillRack->setChecked(Settings::Instance().getBool("arbitration.fill-rack"));
bool linkArbit7P1 = qs.value(kARBIT_LINK_7P1, false).toBool();
checkBoxArbitLink7P1->setChecked(linkArbit7P1);
spinBoxArbitSearchLimit->setValue(Settings::Instance().getInt("arbitration.search-limit"));
checkBoxArbitSoloAuto->setChecked(Settings::Instance().getBool("arbitration.solo-auto"));
spinBoxArbitSoloPlayers->setValue(Settings::Instance().getInt("arbitration.solo-players"));
spinBoxArbitSoloValue->setValue(Settings::Instance().getInt("arbitration.solo-value"));
spinBoxArbitPenaltyValue->setValue(Settings::Instance().getInt("arbitration.penalty-value"));
spinBoxArbitWarnLimit->setValue(Settings::Instance().getInt("arbitration.warnings-limit"));
spinBoxArbitSoloValue->setValue(Settings::Instance().getInt("arbitration.solo-value"));
spinBoxArbitSearchLimit->setValue(Settings::Instance().getInt("arbitration.search-limit"));
// Confirmations
bool confoStartGame = qs.value(kCONFO_START_GAME, true).toBool();
@ -267,14 +278,18 @@ void PrefsDialog::updateSettings()
shouldEmitUpdate = true;
qs.setValue(kARBIT_LINK_7P1, checkBoxArbitLink7P1->isChecked());
}
Settings::Instance().setBool("arbitration.solo-auto",
checkBoxArbitSoloAuto->isChecked());
Settings::Instance().setInt("arbitration.solo-players",
spinBoxArbitSoloPlayers->value());
Settings::Instance().setInt("arbitration.solo-value",
spinBoxArbitSoloValue->value());
Settings::Instance().setInt("arbitration.search-limit",
spinBoxArbitSearchLimit->value());
Settings::Instance().setInt("arbitration.penalty-value",
spinBoxArbitPenaltyValue->value());
Settings::Instance().setInt("arbitration.warnings-limit",
spinBoxArbitWarnLimit->value());
Settings::Instance().setInt("arbitration.solo-value",
spinBoxArbitSoloValue->value());
// Confirmations settings
qs.setValue(kCONFO_START_GAME, checkBoxConfoStartGame->isChecked());

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>474</width>
<height>622</height>
<height>630</height>
</rect>
</property>
<property name="windowTitle">
@ -371,40 +371,50 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxArbitSoloAuto">
<property name="text">
<string>_(&quot;Handle solos automatically&quot;)</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="1">
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxArbitSoloPlayers">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>_(&quot;Minimum number of players needed to take into account the solo bonus&quot;)</string>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="spinBoxArbitWarnLimit">
<property name="value">
<number>3</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBoxArbitSearchLimit">
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>_(&quot;Penalty value:&quot;)</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>_(&quot;Warnings limit:&quot;)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QSpinBox" name="spinBoxArbitPenaltyValue">
<property name="toolTip">
<string>_(&quot;Default number of points for a penalty&quot;)</string>
@ -417,7 +427,34 @@
</property>
</widget>
</item>
<item row="0" column="2">
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>_(&quot;Solo value:&quot;)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBoxArbitSoloValue">
<property name="toolTip">
<string>_(&quot;Value of the solo bonus. Set it to 0 if you don't want solo bonus&quot;)</string>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelArbitSoloPlayers">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>_(&quot;Min. players for a solo:&quot;)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -430,27 +467,20 @@
</property>
</spacer>
</item>
<item row="0" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>_(&quot;Search results limit:&quot;)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>_(&quot;Solo value:&quot;)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxArbitSoloValue">
<property name="toolTip">
<string>_(&quot;Value of the solo bonus. Set it to 0 if you don't want solo bonus&quot;)</string>
<item row="5" column="1">
<widget class="QSpinBox" name="spinBoxArbitSearchLimit">
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>10</number>
<number>100</number>
</property>
</widget>
</item>
@ -628,7 +658,6 @@
<tabstop>checkBoxArbitAutoMaster</tabstop>
<tabstop>checkBoxArbitFillRack</tabstop>
<tabstop>checkBoxArbitLink7P1</tabstop>
<tabstop>spinBoxArbitSearchLimit</tabstop>
<tabstop>spinBoxArbitPenaltyValue</tabstop>
<tabstop>checkBoxConfoStartGame</tabstop>
<tabstop>checkBoxConfoLoadGame</tabstop>