Automatically add multiple selected engines at once #708
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides a speedy method for automatically adding new engines to the list of engine configurations of the GUI.
The user presses the new "auto add"-button and selects a set of engine binaries from a working directory. After clicking "OK" all selected engines are tested against all supported protocols. On success the configuration is added to the list of installed engines.
Only engines with at least one option are added. Engines without options must be added in the traditional way.
Name collisions are avoided automatically by appending the protocol name (and a number if necessary).
Technically, to accomplish this a new "auto add"-button to
EngineManagementWidget
is used to invoke the newmethod
EngineManagementWidge::addEngines
. This method provides a file dialog which lets the user select multiple eingine executables. After the user confirmed his selectionon a list is genetrated. Each entry is the combination of target file name and protocol (currently UCI and xboard). After the list is complete a timer is started.The timer regularly calls the method
EngineManagementWidget:::onDetectionTimer
, which uses the first entry of the list to set arguments for invokingEngineManagementWidget::detectEngine
. Thie first entry is then removed from the list. When the list is empty the timer is stopped .EngineManagementWidget::detectEngine
uses a hiddenEngineConfigurationDialog
for work. A list of reserved names which contains all existing configuration names is set up to prevent name collisions. Then the methodprobe(file, proto)
ofEngineConfigurationDialog
is used to start the engine detection.The method
EngineConfigurationDialog::probe
contains some statements to avoid name collisions. It then calls the methodEngineConfigurationDialog::detectEngineOptions
.When the
EngineConfigurationDialog::finished
signal is emitted the connected lambda defined inEngineManagementWidget::detectEngine
adds the detected engine configuration to the list of installed engines. The hiddenEngineConfigurationDialog
is closed immediately after that.The auto detection uses much of the methods already used in the existing manual configuration. It only adds the
method
probe
and signalhasError()
toEngineConfigurationDialog
.The implementation avoids showing warnings by
QMessageBox
when auto probing.Resolves #687
Resolves #669
HTH
A new "auto add"-button (first on the left) " is pressed. The engine list is empty in this example.
Here a whole collection of stockfish binaries is selected.
The selection is confirmed with "OK". The selection can be facilitated, e.g. on Linux by using the SHIFT and the CTRL-Buttons.
After about 10 seconds, several entries have been added to the list of installed engine configurations.
After 15 seconds the list is complete. The detection still runs for about 30 seconds but is working on xboard detection without further success.
The user has to avoid selecting binaries that are not chess engines.
Those would be started, clobber the screen and use CPU time.
Three engines that support both UCI and xboard protocol. Name collisions are resolved automatically by adding the protocol and a counter. A second level check resolves occasional name collisions - for concurrent configurations that entered the detection stage with the same name. The protocol name and a random hex value is appended (here for arasanx-64-popcount ) .
Repeat detection with the same engines. Name collisions are avoided again.