asdfjkl / jfxchess

JFXChess - Chess Program
https://asdfjkl.github.io/jfxchess
GNU General Public License v2.0
100 stars 22 forks source link

save_engine_prefs #116

Closed TTorell closed 3 years ago

TTorell commented 3 years ago

Hello, My name is Torsten Torell. (TTorell on github) I'm using your Jerry-GUI to run a chessengine I've been working on now and then. Nice program you have there. I like the "Full game analysis" and "Play out position" modes for instance.

I added a few other engines, tried them for a while and then removed them from the Mode->Engines... dialog. When I closed jerry and restarted it, the "removed" engines were still in the list. It seems that the preference values for the engines weren't removed once they had been saved.

To repeat the issue: add a few engines, exit jerry so they will be saved in the preferences, open jerry again, Remove one or more engines, exit jerry and restart it. All the engines are still in the list in DialogEngines. (At least that was the case for me.)

This pull request seems to fix that problem.

I introduced a MAX_N_ENGINES = 10 constant in GameModel. (I saw that in GameModel restoreEngines() the loop index went to 99, but there is a limit of 10 engines in the DialogEngines class before the add-button is inactivated.) I use the constant directly in DialogEngines, perhaps it should better be sent in via the constructor or the show-method. I leave that up to you. Didn't want to change too much.

I've only tried the fix in Ubuntu 20.04 I found a few more "issues" so maybe there'll be further pull requests, or at least some issue reports.

I'm kind of new to Github, so i hope i did this the right way. (Couldn't create the branch directly in your jerry repository, so I forked it first.)

Best regards, Torsten.