mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
New preference to save the search results limit in arbitration mode
This commit is contained in:
parent
05a51101db
commit
9160e6bc99
4 changed files with 56 additions and 7 deletions
|
@ -40,9 +40,7 @@ void Arbitration::search()
|
|||
// Search for the current player
|
||||
const Rack &rack = m_players[m_currPlayer]->getCurrentRack().getRack();
|
||||
LOG_DEBUG("Performing search for rack " + lfw(rack.toString()));
|
||||
// FIXME arbitration begin
|
||||
int limit = Settings::Instance().getInt("training.search-limit");
|
||||
// FIXME arbitration end
|
||||
int limit = Settings::Instance().getInt("arbitration.search-limit");
|
||||
m_results.setLimit(limit);
|
||||
m_results.search(getDic(), getBoard(), rack, getHistory().beforeFirstRound());
|
||||
LOG_DEBUG("Found " << m_results.size() << " results");
|
||||
|
|
|
@ -177,6 +177,12 @@ Settings::Settings()
|
|||
// be rejected in any case.
|
||||
freegame.add("reject-invalid", Setting::TypeBoolean) = true;
|
||||
|
||||
// ============== Arbitration mode options ==============
|
||||
Setting &arbitration = m_conf->getRoot().add("arbitration", Setting::TypeGroup);
|
||||
|
||||
// Number of search results kept in a search
|
||||
arbitration.add("search-limit", Setting::TypeInt) = 100;
|
||||
|
||||
// Try to read the values from the configuration file
|
||||
try
|
||||
{
|
||||
|
@ -190,6 +196,7 @@ Settings::Settings()
|
|||
copySetting<int>(tmpConf, *m_conf, "duplicate.solo-value");
|
||||
copySetting<bool>(tmpConf, *m_conf, "duplicate.reject-invalid");
|
||||
copySetting<bool>(tmpConf, *m_conf, "freegame.reject-invalid");
|
||||
copySetting<int>(tmpConf, *m_conf, "arbitration.search-limit");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -272,6 +279,8 @@ int Settings::getInt(const string &iName) const
|
|||
return 16;
|
||||
else if (iName == "duplicate.solo-value")
|
||||
return 10;
|
||||
else if (iName == "arbitration.search-limit")
|
||||
return 100;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -70,6 +70,11 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
|
|||
checkBoxArbitAutoMaster->setToolTip(_q("If checked, a Master move will be selected "
|
||||
"by default when searching the results.\n"
|
||||
"It is still possible to change the Master move afterwards."));
|
||||
spinBoxTrainSearchLimit->setToolTip(_q("Maximum number of results returned by a search.\n"
|
||||
"The returned results will always be the best ones.\n"
|
||||
"Use 0 to disable the limit (warning: searches yielding many "
|
||||
"results could be very slow in this case!)."));
|
||||
spinBoxArbitSearchLimit->setToolTip(spinBoxTrainSearchLimit->toolTip());
|
||||
|
||||
// Auto-completion on the dictionary path
|
||||
QCompleter *completer = new QCompleter(this);
|
||||
|
@ -115,6 +120,7 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
|
|||
checkBoxArbitAutoMaster->setChecked(autoAssignMaster);
|
||||
bool linkArbit7P1 = qs.value(kARBIT_LINK_7P1, false).toBool();
|
||||
checkBoxArbitLink7P1->setChecked(linkArbit7P1);
|
||||
spinBoxArbitSearchLimit->setValue(Settings::Instance().getInt("arbitration.search-limit"));
|
||||
}
|
||||
catch (GameException &e)
|
||||
{
|
||||
|
@ -214,6 +220,8 @@ void PrefsDialog::updateSettings()
|
|||
shouldEmitUpdate = true;
|
||||
qs.setValue(kARBIT_LINK_7P1, checkBoxArbitLink7P1->isChecked());
|
||||
}
|
||||
Settings::Instance().setInt("arbitration.search-limit",
|
||||
spinBoxArbitSearchLimit->value());
|
||||
}
|
||||
catch (GameException &e)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>443</width>
|
||||
<height>693</height>
|
||||
<height>756</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -299,9 +299,6 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxTrainSearchLimit">
|
||||
<property name="toolTip">
|
||||
<string>_("Maximum number of results returned by a search. The returned results will always be the best ones. Use 0 to disable the limit (warning: searches yielding many results can be extremely slow in this case!).")</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
|
@ -354,6 +351,40 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>_("Search results limit:")</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxArbitSearchLimit">
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -385,6 +416,9 @@
|
|||
<tabstop>checkBoxFreeRefuseInvalid</tabstop>
|
||||
<tabstop>checkBoxIntfLinkTraining7P1</tabstop>
|
||||
<tabstop>spinBoxTrainSearchLimit</tabstop>
|
||||
<tabstop>checkBoxArbitAutoMaster</tabstop>
|
||||
<tabstop>checkBoxArbitLink7P1</tabstop>
|
||||
<tabstop>spinBoxArbitSearchLimit</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
|
Loading…
Reference in a new issue