diff --git a/game/arbitration.cpp b/game/arbitration.cpp index 65341f0..9cd4f98 100644 --- a/game/arbitration.cpp +++ b/game/arbitration.cpp @@ -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"); diff --git a/game/settings.cpp b/game/settings.cpp index d018c9c..9d5462b 100644 --- a/game/settings.cpp +++ b/game/settings.cpp @@ -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(tmpConf, *m_conf, "duplicate.solo-value"); copySetting(tmpConf, *m_conf, "duplicate.reject-invalid"); copySetting(tmpConf, *m_conf, "freegame.reject-invalid"); + copySetting(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 } diff --git a/qt/prefs_dialog.cpp b/qt/prefs_dialog.cpp index 7fa47b9..f80761a 100644 --- a/qt/prefs_dialog.cpp +++ b/qt/prefs_dialog.cpp @@ -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) { diff --git a/qt/ui/prefs_dialog.ui b/qt/ui/prefs_dialog.ui index 80c253d..3172ed3 100644 --- a/qt/ui/prefs_dialog.ui +++ b/qt/ui/prefs_dialog.ui @@ -7,7 +7,7 @@ 0 0 443 - 693 + 756 @@ -299,9 +299,6 @@ - - _("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!).") - 100000 @@ -354,6 +351,40 @@ + + + + + + _("Search results limit:") + + + + + + + 100000 + + + 100 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -385,6 +416,9 @@ checkBoxFreeRefuseInvalid checkBoxIntfLinkTraining7P1 spinBoxTrainSearchLimit + checkBoxArbitAutoMaster + checkBoxArbitLink7P1 + spinBoxArbitSearchLimit buttonBox