Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
//! Settings window: engines, board & pieces, sound, interface, about.
2026-10-18 01:54:06 +03:00
2026-10-18 11:53:30 +03:00
use crate ::i18n ::{ Lang , tr , trf } ;
2026-10-18 01:54:06 +03:00
use egui ::{ RichText , Sense , Ui , vec2 } ;
use shakmaty ::{ Color , Piece , Role } ;
use crate ::assets ::{ BoardThemeId , PieceSet , SoundSet } ;
use crate ::settings ::Settings ;
#[ derive(Clone, Copy, PartialEq, Eq, Default) ]
pub enum Tab {
#[ default ]
Engines ,
Board ,
Sound ,
Interface ,
Translation of game comments
When a game's comments are in another language, ChessPenguin offers to translate
them into the reader's: with the ChatGPT Plus/Pro subscription (Sign in with
ChatGPT: OAuth with PKCE in the browser, a loopback callback, tokens refreshed
one at a time), or an OpenAI-compatible API key (DeepSeek, OpenAI, Gemini, a
model on this computer with Ollama or LM Studio, another address). After the
first consent, games in other languages are translated as they are opened;
[Original | Translation] (Ctrl+Shift+T) switches back.
Only comment text is sent; the model gets strict instructions and a glossary,
and every answer must keep the moves and squares of the original, or the
comment stays in the original with a mark. Translations are never written to
the PGN; a cache keeps them per language. Keys and tokens live in a 0600 file
apart from the settings. Settings › Translation holds the target language,
when to translate, the connection, permissions and the cache.
Also: the monospace font and three glyphs of Noto Sans Math are text fallbacks,
so arrows and the evaluation signs ⩲ ⩱ ⌓ no longer show as boxes.
Reviewed by the designer and the tester agents (two rounds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:03:03 +03:00
Translation ,
Web version, stage 2: Stockfish 19 in workers, live analysis, game review on N workers, My games, files, keys
game-review: what the job does for one target (the full search, the second
best without the move played, the shallow ones) becomes a machine without I/O
(job/work.rs), driven by the engine processes on a computer (job/engines.rs,
the same searches as before) and by Web Workers in a browser
(job/workers.rs: a dispatcher polled from the frames, never blocking). The
analysis cache goes through a CacheStore (a folder, or the program's files of
the platform).
The browser's engine: Stockfish.js 19.0.1 (npm stockfish, GPL-3.0), its
single-threaded build served beside /app/ (engine/, build.sh checks the
package's sha512), its 99 MB wasm downloaded only through the engine offer,
checked against its SHA-256 and kept in Cache Storage; workers get it as a
blob: address. Live analysis (lines, arrows, the bar) and the review run on it;
the review uses one worker per logical CPU, at most 8.
My games (the web version): a PGN in the browser's storage, always on the
shelf; Ctrl+S puts a game there (its own record, or a new one); deleting with
undo. chess-core's store gives the bytes of append/replace/remove/restore, so
the platform writes them into the browser's files; on a computer the files
are written as before. Settings: Browser data (used and free space, keeping
the data for good, Download all as PGN, deleting the engine).
Files: a file of the last visit offers Choose the file again; Keep a copy in
the browser (refused with the room it needs when the browser gives too
little); files over 1 GB are not opened, with a word on why. No reference tab
and no search by position in the web version. Keys: Alt+Left, plain 1-6,
Ctrl+C, N in the library (the browser keeps Ctrl+W/N/1-6/Shift+C).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:35:16 +03:00
/// What the web version keeps in the browser.
#[ cfg(web) ]
BrowserData ,
Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
About ,
2026-10-18 01:54:06 +03:00
}
pub enum SettingsAction {
Web version, stage 2: Stockfish 19 in workers, live analysis, game review on N workers, My games, files, keys
game-review: what the job does for one target (the full search, the second
best without the move played, the shallow ones) becomes a machine without I/O
(job/work.rs), driven by the engine processes on a computer (job/engines.rs,
the same searches as before) and by Web Workers in a browser
(job/workers.rs: a dispatcher polled from the frames, never blocking). The
analysis cache goes through a CacheStore (a folder, or the program's files of
the platform).
The browser's engine: Stockfish.js 19.0.1 (npm stockfish, GPL-3.0), its
single-threaded build served beside /app/ (engine/, build.sh checks the
package's sha512), its 99 MB wasm downloaded only through the engine offer,
checked against its SHA-256 and kept in Cache Storage; workers get it as a
blob: address. Live analysis (lines, arrows, the bar) and the review run on it;
the review uses one worker per logical CPU, at most 8.
My games (the web version): a PGN in the browser's storage, always on the
shelf; Ctrl+S puts a game there (its own record, or a new one); deleting with
undo. chess-core's store gives the bytes of append/replace/remove/restore, so
the platform writes them into the browser's files; on a computer the files
are written as before. Settings: Browser data (used and free space, keeping
the data for good, Download all as PGN, deleting the engine).
Files: a file of the last visit offers Choose the file again; Keep a copy in
the browser (refused with the room it needs when the browser gives too
little); files over 1 GB are not opened, with a word on why. No reference tab
and no search by position in the web version. Keys: Alt+Left, plain 1-6,
Ctrl+C, N in the library (the browser keeps Ctrl+W/N/1-6/Shift+C).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:35:16 +03:00
/// All of «My games» as a downloaded PGN.
#[ cfg(web) ]
DownloadMyGames ,
/// Ask the browser to keep the site's data for good.
#[ cfg(web) ]
KeepData ,
Web version, stage 1: the interface as a library over a platform layer; apps/web
apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.
The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.
What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).
apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
#[ cfg(not(web)) ]
2026-10-18 01:54:06 +03:00
AddEngine ,
2026-10-19 09:33:37 +03:00
/// Download the official Stockfish (decision 14).
DownloadEngine ,
CancelDownload ,
/// Delete the downloaded Stockfish from the disk (it was removed from the list).
RemoveDownloaded ,
2026-10-18 01:54:06 +03:00
TestSound ,
/// The active engine (or its options) changed; a running analysis should restart.
EngineChanged ,
2026-10-20 07:55:59 +03:00
/// Ask now whether a newer version is out.
Web version, stage 1: the interface as a library over a platform layer; apps/web
apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.
The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.
What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).
apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
#[ cfg(not(web)) ]
2026-10-20 07:55:59 +03:00
CheckUpdates ,
Own databases: create PGN bases, add, save, delete games; library logging
Desktop: «✚ New database» on the shelf (Ctrl+Shift+N), «Add to database…»
(Ctrl+Shift+S, 💾, ☰) for any game — new, pasted, from a ChessBase, online or
legacy-encoded database — into a PGN of the user's choice; Ctrl+S saves the
changes back into the game's own PGN (its record is replaced) or adds the game
when the source is read-only; the game data editor (F2, the title, ☰) asked once
when a new game is first added; duplicate check (same players, date, moves →
replace / add as new, no Enter); delete from the table with a question and Undo
(Ctrl+Z, 6 s, waits under the mouse); UTF-8 copy for legacy-encoded files with
the restored letters; online and ChessBase stay read-only. Writes are explicit:
append, or an atomic rewrite through a temporary file and a rename (through a
symlink, keeping the mode, syncing the folder), refused when the file changed on
the disk. chess_core::pgn::store: append/replace/remove/restore/write_utf8_copy,
find_same_game, pgn_date; Game::remove_tag and order_roster. Settings: your
name (annotator), the folder for new databases, the last target. Nine languages.
Also: library warnings (wgpu, winit) go to chesspenguin.log, CP_LOG_FRAMES=1
traces egui_wgpu frames (the GNOME hang hunt); dev hooks CP_OWN, CP_PASTE,
CP_COMMENT, CP_KEYS with Ctrl+, CP_SETTINGS=interface.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 00:46:47 +03:00
/// Choose the folder for new databases.
Web version, stage 1: the interface as a library over a platform layer; apps/web
apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.
The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.
What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).
apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
#[ cfg(not(web)) ]
Own databases: create PGN bases, add, save, delete games; library logging
Desktop: «✚ New database» on the shelf (Ctrl+Shift+N), «Add to database…»
(Ctrl+Shift+S, 💾, ☰) for any game — new, pasted, from a ChessBase, online or
legacy-encoded database — into a PGN of the user's choice; Ctrl+S saves the
changes back into the game's own PGN (its record is replaced) or adds the game
when the source is read-only; the game data editor (F2, the title, ☰) asked once
when a new game is first added; duplicate check (same players, date, moves →
replace / add as new, no Enter); delete from the table with a question and Undo
(Ctrl+Z, 6 s, waits under the mouse); UTF-8 copy for legacy-encoded files with
the restored letters; online and ChessBase stay read-only. Writes are explicit:
append, or an atomic rewrite through a temporary file and a rename (through a
symlink, keeping the mode, syncing the folder), refused when the file changed on
the disk. chess_core::pgn::store: append/replace/remove/restore/write_utf8_copy,
find_same_game, pgn_date; Game::remove_tag and order_roster. Settings: your
name (annotator), the folder for new databases, the last target. Nine languages.
Also: library warnings (wgpu, winit) go to chesspenguin.log, CP_LOG_FRAMES=1
traces egui_wgpu frames (the GNOME hang hunt); dev hooks CP_OWN, CP_PASTE,
CP_COMMENT, CP_KEYS with Ctrl+, CP_SETTINGS=interface.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 00:46:47 +03:00
PickBaseFolder ,
2026-10-20 07:55:59 +03:00
/// Open the update window.
Web version, stage 1: the interface as a library over a platform layer; apps/web
apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.
The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.
What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).
apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
#[ cfg(not(web)) ]
2026-10-20 07:55:59 +03:00
OpenUpdate ,
2026-10-18 01:54:06 +03:00
}
pub struct SettingsWindow {
pub open : bool ,
pub tab : Tab ,
pub checking_engine : bool ,
2026-10-19 09:33:37 +03:00
/// The running (or last) Stockfish download, set by the application every frame.
pub download : Option < crate ::engine_download ::Stage > ,
/// Engine whose removal (with its downloaded files) waits for confirmation.
confirm_remove : Option < usize > ,
2026-10-20 07:55:59 +03:00
/// What the update check found, set by the application every frame, and the newer
/// version if there is one.
pub update_status : Option < String > ,
pub update_available : Option < String > ,
2026-10-18 01:54:06 +03:00
}
impl SettingsWindow {
pub fn new ( ) -> Self {
Self {
open : false ,
tab : Tab ::default ( ) ,
checking_engine : false ,
2026-10-19 09:33:37 +03:00
download : None ,
confirm_remove : None ,
2026-10-20 07:55:59 +03:00
update_status : None ,
update_available : None ,
2026-10-18 01:54:06 +03:00
}
}
/// Returns actions and whether settings changed (to be saved).
Translation of game comments
When a game's comments are in another language, ChessPenguin offers to translate
them into the reader's: with the ChatGPT Plus/Pro subscription (Sign in with
ChatGPT: OAuth with PKCE in the browser, a loopback callback, tokens refreshed
one at a time), or an OpenAI-compatible API key (DeepSeek, OpenAI, Gemini, a
model on this computer with Ollama or LM Studio, another address). After the
first consent, games in other languages are translated as they are opened;
[Original | Translation] (Ctrl+Shift+T) switches back.
Only comment text is sent; the model gets strict instructions and a glossary,
and every answer must keep the moves and squares of the original, or the
comment stays in the original with a mark. Translations are never written to
the PGN; a cache keeps them per language. Keys and tokens live in a 0600 file
apart from the settings. Settings › Translation holds the target language,
when to translate, the connection, permissions and the cache.
Also: the monospace font and three glyphs of Noto Sans Math are text fallbacks,
so arrows and the evaluation signs ⩲ ⩱ ⌓ no longer show as boxes.
Reviewed by the designer and the tester agents (two rounds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:03:03 +03:00
pub fn show (
& mut self ,
ctx : & egui ::Context ,
s : & mut Settings ,
translation : & mut crate ::translate_ui ::Hub ,
) -> ( Vec < SettingsAction > , bool ) {
2026-10-18 01:54:06 +03:00
let mut actions = Vec ::new ( ) ;
let mut changed = false ;
let mut open = self . open ;
egui ::Window ::new ( tr ( " Settings " ) )
. open ( & mut open )
. default_size ( vec2 ( 560.0 , 680.0 ) )
// Open at the right edge so the board stays visible for live preview.
. pivot ( egui ::Align2 ::RIGHT_TOP )
. default_pos ( ctx . content_rect ( ) . right_top ( ) + vec2 ( - 16.0 , 60.0 ) )
. collapsible ( false )
. show ( ctx , | ui | {
ui . horizontal ( | ui | {
ui . selectable_value ( & mut self . tab , Tab ::Engines , tr ( " Engines " ) ) ;
ui . selectable_value ( & mut self . tab , Tab ::Board , tr ( " Board & pieces " ) ) ;
ui . selectable_value ( & mut self . tab , Tab ::Sound , tr ( " Sound " ) ) ;
ui . selectable_value ( & mut self . tab , Tab ::Interface , tr ( " Interface " ) ) ;
Web version: what the browser lacks is not offered, files dropped on the window, checks, docs
The interface hides what the platform does not have (platform::CAPS): play,
new databases, adding to a database, preparation, translation, their
shortcuts and the Translation tab. Files dropped on the window open like
chosen ones (in a browser; the desktop program takes no drops, as before),
with «Release to open» while they are dragged over it.
/app/: ?phone=android and ?phone=ios show those variants of the device page.
apps/web/check: device.test.mjs (14 devices: computer, iPhone, iPad as a Mac,
Android phone and tablet, desktop-site modes, Chromebook, touch laptop) and
app.mjs (headless Firefox: the device page in three languages without the
program, the program, a PGN opened by Ctrl+O and the file chooser, a dropped
PGN, a game of the classics, moves, «Download PGN», e2-e4 on the board, the
settings after a reload). All pass.
docs/dev/web.md: the architecture, the platform layer, what is not built for
a browser, the build and the checks, what comes next; docs/dev/uci.md and
desktop.md updated, web/README.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:18:45 +03:00
if crate ::platform ::CAPS . translation {
ui . selectable_value ( & mut self . tab , Tab ::Translation , tr ( " Translation " ) ) ;
}
Web version, stage 2: Stockfish 19 in workers, live analysis, game review on N workers, My games, files, keys
game-review: what the job does for one target (the full search, the second
best without the move played, the shallow ones) becomes a machine without I/O
(job/work.rs), driven by the engine processes on a computer (job/engines.rs,
the same searches as before) and by Web Workers in a browser
(job/workers.rs: a dispatcher polled from the frames, never blocking). The
analysis cache goes through a CacheStore (a folder, or the program's files of
the platform).
The browser's engine: Stockfish.js 19.0.1 (npm stockfish, GPL-3.0), its
single-threaded build served beside /app/ (engine/, build.sh checks the
package's sha512), its 99 MB wasm downloaded only through the engine offer,
checked against its SHA-256 and kept in Cache Storage; workers get it as a
blob: address. Live analysis (lines, arrows, the bar) and the review run on it;
the review uses one worker per logical CPU, at most 8.
My games (the web version): a PGN in the browser's storage, always on the
shelf; Ctrl+S puts a game there (its own record, or a new one); deleting with
undo. chess-core's store gives the bytes of append/replace/remove/restore, so
the platform writes them into the browser's files; on a computer the files
are written as before. Settings: Browser data (used and free space, keeping
the data for good, Download all as PGN, deleting the engine).
Files: a file of the last visit offers Choose the file again; Keep a copy in
the browser (refused with the room it needs when the browser gives too
little); files over 1 GB are not opened, with a word on why. No reference tab
and no search by position in the web version. Keys: Alt+Left, plain 1-6,
Ctrl+C, N in the library (the browser keeps Ctrl+W/N/1-6/Shift+C).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:35:16 +03:00
#[ cfg(web) ]
ui . selectable_value ( & mut self . tab , Tab ::BrowserData , tr ( " Browser data " ) ) ;
Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
ui . selectable_value ( & mut self . tab , Tab ::About , tr ( " About " ) ) ;
2026-10-18 01:54:06 +03:00
} ) ;
ui . separator ( ) ;
egui ::ScrollArea ::vertical ( ) . show ( ui , | ui | match self . tab {
Tab ::Engines = > self . engines ( ui , s , & mut actions , & mut changed ) ,
Tab ::Board = > board_tab ( ui , s , & mut changed ) ,
Translation of game comments
When a game's comments are in another language, ChessPenguin offers to translate
them into the reader's: with the ChatGPT Plus/Pro subscription (Sign in with
ChatGPT: OAuth with PKCE in the browser, a loopback callback, tokens refreshed
one at a time), or an OpenAI-compatible API key (DeepSeek, OpenAI, Gemini, a
model on this computer with Ollama or LM Studio, another address). After the
first consent, games in other languages are translated as they are opened;
[Original | Translation] (Ctrl+Shift+T) switches back.
Only comment text is sent; the model gets strict instructions and a glossary,
and every answer must keep the moves and squares of the original, or the
comment stays in the original with a mark. Translations are never written to
the PGN; a cache keeps them per language. Keys and tokens live in a 0600 file
apart from the settings. Settings › Translation holds the target language,
when to translate, the connection, permissions and the cache.
Also: the monospace font and three glyphs of Noto Sans Math are text fallbacks,
so arrows and the evaluation signs ⩲ ⩱ ⌓ no longer show as boxes.
Reviewed by the designer and the tester agents (two rounds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:03:03 +03:00
Tab ::Translation = > changed | = translation . settings_tab ( ui , s ) ,
Web version, stage 2: Stockfish 19 in workers, live analysis, game review on N workers, My games, files, keys
game-review: what the job does for one target (the full search, the second
best without the move played, the shallow ones) becomes a machine without I/O
(job/work.rs), driven by the engine processes on a computer (job/engines.rs,
the same searches as before) and by Web Workers in a browser
(job/workers.rs: a dispatcher polled from the frames, never blocking). The
analysis cache goes through a CacheStore (a folder, or the program's files of
the platform).
The browser's engine: Stockfish.js 19.0.1 (npm stockfish, GPL-3.0), its
single-threaded build served beside /app/ (engine/, build.sh checks the
package's sha512), its 99 MB wasm downloaded only through the engine offer,
checked against its SHA-256 and kept in Cache Storage; workers get it as a
blob: address. Live analysis (lines, arrows, the bar) and the review run on it;
the review uses one worker per logical CPU, at most 8.
My games (the web version): a PGN in the browser's storage, always on the
shelf; Ctrl+S puts a game there (its own record, or a new one); deleting with
undo. chess-core's store gives the bytes of append/replace/remove/restore, so
the platform writes them into the browser's files; on a computer the files
are written as before. Settings: Browser data (used and free space, keeping
the data for good, Download all as PGN, deleting the engine).
Files: a file of the last visit offers Choose the file again; Keep a copy in
the browser (refused with the room it needs when the browser gives too
little); files over 1 GB are not opened, with a word on why. No reference tab
and no search by position in the web version. Keys: Alt+Left, plain 1-6,
Ctrl+C, N in the library (the browser keeps Ctrl+W/N/1-6/Shift+C).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:35:16 +03:00
#[ cfg(web) ]
Tab ::BrowserData = > browser_data ( ui , & mut actions ) ,
2026-10-18 01:54:06 +03:00
Tab ::Sound = > sound_tab ( ui , s , & mut actions , & mut changed ) ,
2026-10-20 07:55:59 +03:00
Tab ::About = > {
let ( status , available ) =
( self . update_status . clone ( ) , self . update_available . clone ( ) ) ;
about_tab ( ui , s . language , | ui | {
Web version, stage 1: the interface as a library over a platform layer; apps/web
apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.
The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.
What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).
apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
// Updates, right under the version (the web version is
// always the latest: a reload brings it).
#[ cfg(not(web)) ]
updates ( ui , s , & status , & available , & mut actions , & mut changed ) ;
#[ cfg(web) ]
let _ = ( ui , & status , & available ) ;
2026-10-20 07:55:59 +03:00
} ) ;
}
2026-10-18 01:54:06 +03:00
Tab ::Interface = > {
ui . horizontal ( | ui | {
ui . label ( tr ( " Language: " ) ) ;
egui ::ComboBox ::from_id_salt ( " language " )
. selected_text ( s . language . label ( ) )
. show_ui ( ui , | ui | {
for lang in Lang ::ALL {
if ui
. selectable_value ( & mut s . language , lang , lang . label ( ) )
. changed ( )
{
crate ::i18n ::set_lang ( lang ) ;
changed = true ;
}
}
} ) ;
} ) ;
ui . horizontal ( | ui | {
ui . label ( tr ( " Theme: " ) ) ;
changed | = ui
. selectable_value ( & mut s . dark_mode , true , tr ( " Dark " ) )
. changed ( ) ;
changed | = ui
. selectable_value ( & mut s . dark_mode , false , tr ( " Light " ) )
. changed ( ) ;
} ) ;
Own databases: create PGN bases, add, save, delete games; library logging
Desktop: «✚ New database» on the shelf (Ctrl+Shift+N), «Add to database…»
(Ctrl+Shift+S, 💾, ☰) for any game — new, pasted, from a ChessBase, online or
legacy-encoded database — into a PGN of the user's choice; Ctrl+S saves the
changes back into the game's own PGN (its record is replaced) or adds the game
when the source is read-only; the game data editor (F2, the title, ☰) asked once
when a new game is first added; duplicate check (same players, date, moves →
replace / add as new, no Enter); delete from the table with a question and Undo
(Ctrl+Z, 6 s, waits under the mouse); UTF-8 copy for legacy-encoded files with
the restored letters; online and ChessBase stay read-only. Writes are explicit:
append, or an atomic rewrite through a temporary file and a rename (through a
symlink, keeping the mode, syncing the folder), refused when the file changed on
the disk. chess_core::pgn::store: append/replace/remove/restore/write_utf8_copy,
find_same_game, pgn_date; Game::remove_tag and order_roster. Settings: your
name (annotator), the folder for new databases, the last target. Nine languages.
Also: library warnings (wgpu, winit) go to chesspenguin.log, CP_LOG_FRAMES=1
traces egui_wgpu frames (the GNOME hang hunt); dev hooks CP_OWN, CP_PASTE,
CP_COMMENT, CP_KEYS with Ctrl+, CP_SETTINGS=interface.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 00:46:47 +03:00
ui . add_space ( 12.0 ) ;
ui . label ( RichText ::new ( tr ( " Your databases " ) ) . strong ( ) ) ;
ui . horizontal ( | ui | {
ui . label ( tr ( " Your name: " ) ) ;
changed | = ui
. add (
egui ::TextEdit ::singleline ( & mut s . your_name )
. desired_width ( 220.0 ) ,
)
. changed ( ) ;
} ) ;
ui . label (
RichText ::new ( tr ( " Written as the annotator of the games you add " ) )
. weak ( ) ,
) ;
2026-10-30 16:43:28 +03:00
// A browser has no folders for databases.
#[ cfg(not(web)) ]
Own databases: create PGN bases, add, save, delete games; library logging
Desktop: «✚ New database» on the shelf (Ctrl+Shift+N), «Add to database…»
(Ctrl+Shift+S, 💾, ☰) for any game — new, pasted, from a ChessBase, online or
legacy-encoded database — into a PGN of the user's choice; Ctrl+S saves the
changes back into the game's own PGN (its record is replaced) or adds the game
when the source is read-only; the game data editor (F2, the title, ☰) asked once
when a new game is first added; duplicate check (same players, date, moves →
replace / add as new, no Enter); delete from the table with a question and Undo
(Ctrl+Z, 6 s, waits under the mouse); UTF-8 copy for legacy-encoded files with
the restored letters; online and ChessBase stay read-only. Writes are explicit:
append, or an atomic rewrite through a temporary file and a rename (through a
symlink, keeping the mode, syncing the folder), refused when the file changed on
the disk. chess_core::pgn::store: append/replace/remove/restore/write_utf8_copy,
find_same_game, pgn_date; Game::remove_tag and order_roster. Settings: your
name (annotator), the folder for new databases, the last target. Nine languages.
Also: library warnings (wgpu, winit) go to chesspenguin.log, CP_LOG_FRAMES=1
traces egui_wgpu frames (the GNOME hang hunt); dev hooks CP_OWN, CP_PASTE,
CP_COMMENT, CP_KEYS with Ctrl+, CP_SETTINGS=interface.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 00:46:47 +03:00
ui . horizontal ( | ui | {
ui . label ( tr ( " Folder for new databases: " ) ) ;
let dir =
crate ::own_db ::default_base_dir ( s . new_database_dir . as_deref ( ) ) ;
// Short, under the home folder; the whole path on hover.
Web version, stage 1: the interface as a library over a platform layer; apps/web
apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.
The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.
What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).
apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
let home =
directories ::UserDirs ::new ( ) . map ( | u | u . home_dir ( ) . to_path_buf ( ) ) ;
let short = match home . as_ref ( ) . and_then ( | h | dir . strip_prefix ( h ) . ok ( ) ) {
Some ( rest ) = > {
format! ( " ~ {} {} " , std ::path ::MAIN_SEPARATOR , rest . display ( ) )
}
Own databases: create PGN bases, add, save, delete games; library logging
Desktop: «✚ New database» on the shelf (Ctrl+Shift+N), «Add to database…»
(Ctrl+Shift+S, 💾, ☰) for any game — new, pasted, from a ChessBase, online or
legacy-encoded database — into a PGN of the user's choice; Ctrl+S saves the
changes back into the game's own PGN (its record is replaced) or adds the game
when the source is read-only; the game data editor (F2, the title, ☰) asked once
when a new game is first added; duplicate check (same players, date, moves →
replace / add as new, no Enter); delete from the table with a question and Undo
(Ctrl+Z, 6 s, waits under the mouse); UTF-8 copy for legacy-encoded files with
the restored letters; online and ChessBase stay read-only. Writes are explicit:
append, or an atomic rewrite through a temporary file and a rename (through a
symlink, keeping the mode, syncing the folder), refused when the file changed on
the disk. chess_core::pgn::store: append/replace/remove/restore/write_utf8_copy,
find_same_game, pgn_date; Game::remove_tag and order_roster. Settings: your
name (annotator), the folder for new databases, the last target. Nine languages.
Also: library warnings (wgpu, winit) go to chesspenguin.log, CP_LOG_FRAMES=1
traces egui_wgpu frames (the GNOME hang hunt); dev hooks CP_OWN, CP_PASTE,
CP_COMMENT, CP_KEYS with Ctrl+, CP_SETTINGS=interface.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 00:46:47 +03:00
None = > dir . display ( ) . to_string ( ) ,
} ;
ui . label ( RichText ::new ( short ) . weak ( ) )
. on_hover_text ( dir . display ( ) . to_string ( ) ) ;
if ui . button ( tr ( " Change… " ) ) . clicked ( ) {
actions . push ( SettingsAction ::PickBaseFolder ) ;
}
} ) ;
Play: games against the computer go by themselves into the player's database
docs/research/player-games-db.md, docs/design/player-games.md, decisions
«Партии игрока записываются сами» (desktop; Android next):
- «Roman — games against the computer» (without a name, «Games against the
computer»), made at the first game in the folder of new databases; only
new records are appended.
- During a game a journal after every move (a lock held while the program
runs); a crash leaves it to the next start, which writes the game once,
unfinished. A failed write keeps the journal until the game is saved
elsewhere or left.
- The play dialog says where the games go (wraps under the name), a ▾ list of
the computer's players with their ratings (↓/↑ in the field); a toast when
the database is made; the result strip «Written to the database, No. n ·
Open» instead of «Save to a database…»; the leave question names it.
- ♞ on the player's card and in the folded shelf; a checkbox in Settings →
Interface → Your databases (on).
Checked by the tester (crash, failed write, two instances, names, files of
the same name) and the designer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 15:33:35 +03:00
changed | = ui
. checkbox (
& mut s . record_games ,
tr ( " Write games against the computer to the player's database " ) ,
)
. changed ( ) ;
2026-10-18 01:54:06 +03:00
}
} ) ;
} ) ;
self . open = open ;
( actions , changed )
}
fn engines (
& mut self ,
ui : & mut Ui ,
s : & mut Settings ,
actions : & mut Vec < SettingsAction > ,
changed : & mut bool ,
) {
ui . label (
RichText ::new ( tr ( " UCI engines. The active one is used for game analysis. Time, lines, threads and memory are set with ⚙ in the analysis panel. " ) ) . weak ( ) ,
) ;
ui . add_space ( 6.0 ) ;
2026-10-19 09:33:37 +03:00
let downloading = self . download . as_ref ( ) . is_some_and ( | d | {
matches! (
d ,
crate ::engine_download ::Stage ::Downloading { .. }
| crate ::engine_download ::Stage ::Unpacking
)
} ) ;
// No engine yet: the two ways to get one, plainly.
if s . engines . is_empty ( ) {
egui ::Frame ::group ( ui . style ( ) ) . show ( ui , | ui | {
ui . set_width ( ui . available_width ( ) ) ;
ui . label ( RichText ::new ( tr ( " No engine yet " ) ) . strong ( ) ) ;
ui . label (
RichText ::new ( tr ( " An engine evaluates positions and suggests moves. Stockfish is the strongest free one. " ) )
. weak ( ) ,
) ;
ui . add_space ( 4.0 ) ;
ui . horizontal ( | ui | {
if downloading {
self . download_progress ( ui , actions ) ;
} else if crate ::engine_download ::available ( )
& & ui
. button ( RichText ::new ( tr ( " ⬇ Download Stockfish 19 " ) ) . strong ( ) )
. on_hover_text ( trf (
" {mb} MB from the official Stockfish page; installed for your account only " ,
& [ ( " mb " , & crate ::engine_download ::size_mb ( ) ) ] ,
) )
. clicked ( )
{
actions . push ( SettingsAction ::DownloadEngine ) ;
}
2026-10-30 16:43:28 +03:00
// A browser has no engine programs.
#[ cfg(not(web)) ]
2026-10-19 09:33:37 +03:00
if ui . button ( tr ( " Choose engine file… " ) ) . clicked ( ) {
actions . push ( SettingsAction ::AddEngine ) ;
}
} ) ;
} ) ;
}
2026-10-18 01:54:06 +03:00
let mut remove = None ;
for i in 0 .. s . engines . len ( ) {
let active = s . active_engine = = Some ( i ) ;
egui ::Frame ::group ( ui . style ( ) ) . show ( ui , | ui | {
ui . set_width ( ui . available_width ( ) ) ;
ui . horizontal ( | ui | {
if ui
. radio ( active , " " )
. on_hover_text ( tr ( " Make active " ) )
. clicked ( )
& & ! active
{
s . active_engine = Some ( i ) ;
* changed = true ;
actions . push ( SettingsAction ::EngineChanged ) ;
}
let e = & mut s . engines [ i ] ;
* changed | = ui
. add ( egui ::TextEdit ::singleline ( & mut e . name ) . desired_width ( 220.0 ) )
. changed ( ) ;
ui . with_layout ( egui ::Layout ::right_to_left ( egui ::Align ::Center ) , | ui | {
2026-10-19 09:33:37 +03:00
let downloaded =
s . engines [ i ] . builtin & & crate ::engines ::bundled_stockfish ( ) . is_none ( ) ;
let hint = if downloaded {
tr ( " Remove (and delete the downloaded files) " )
} else {
tr ( " Remove from list " )
} ;
if ui . button ( " 🗑 " ) . on_hover_text ( hint ) . clicked ( ) {
if downloaded & & crate ::engine_download ::installed ( ) . is_some ( ) {
self . confirm_remove = Some ( i ) ;
} else {
remove = Some ( i ) ;
}
2026-10-18 01:54:06 +03:00
}
} ) ;
} ) ;
2026-10-18 11:53:30 +03:00
let e = & s . engines [ i ] ;
2026-10-19 09:33:37 +03:00
if e . builtin {
if let Some ( p ) = crate ::engines ::bundled_stockfish ( ) {
ui . label (
RichText ::new ( tr ( " Included with ChessPenguin " ) )
. small ( )
. weak ( ) ,
)
. on_hover_text ( p . display ( ) . to_string ( ) ) ;
} else if let Some ( p ) = crate ::engine_download ::installed ( ) {
2026-10-30 17:35:30 +03:00
let mb = crate ::engine_download ::installed_mb ( ) ;
2026-10-19 09:33:37 +03:00
ui . label (
RichText ::new ( trf (
" Downloaded by ChessPenguin · {mb} MB " ,
& [ ( " mb " , & mb ) ] ,
) )
. small ( )
. weak ( ) ,
)
2026-10-30 17:35:30 +03:00
. on_hover_text ( p . to_string ( ) ) ;
2026-10-19 09:33:37 +03:00
} else {
ui . horizontal ( | ui | {
ui . label (
RichText ::new ( tr ( " ⚠ File not found " ) )
. small ( )
. color ( ui . visuals ( ) . warn_fg_color ) ,
) ;
if downloading {
self . download_progress ( ui , actions ) ;
} else if crate ::engine_download ::available ( )
& & ui . small_button ( tr ( " Download again " ) ) . clicked ( )
{
actions . push ( SettingsAction ::DownloadEngine ) ;
}
} ) ;
2026-10-18 11:53:30 +03:00
}
} else {
2026-10-19 09:33:37 +03:00
ui . label ( RichText ::new ( e . path . display ( ) . to_string ( ) ) . small ( ) . weak ( ) ) ;
}
2026-10-18 01:54:06 +03:00
} ) ;
}
2026-10-19 09:33:37 +03:00
if let Some ( i ) = self . confirm_remove {
let mut answer = None ;
let modal = egui ::Modal ::new ( egui ::Id ::new ( " remove_engine " ) ) . show ( ui . ctx ( ) , | ui | {
ui . set_width ( 360.0 ) ;
2026-10-30 17:35:30 +03:00
let mb = crate ::engine_download ::installed_mb ( ) ;
2026-10-19 09:33:37 +03:00
ui . label ( trf (
" Remove Stockfish 19? This frees {mb} MB. You can download it again at any time. " ,
& [ ( " mb " , & mb ) ] ,
) ) ;
ui . add_space ( 8.0 ) ;
ui . horizontal ( | ui | {
ui . with_layout ( egui ::Layout ::right_to_left ( egui ::Align ::Center ) , | ui | {
let cancel = ui . button ( tr ( " Cancel " ) ) ;
cancel . request_focus ( ) ;
if cancel . clicked ( ) {
answer = Some ( false ) ;
}
if ui . button ( tr ( " Remove " ) ) . clicked ( ) {
answer = Some ( true ) ;
}
} ) ;
} ) ;
} ) ;
if modal . should_close ( ) {
answer = Some ( false ) ;
}
match answer {
Some ( true ) = > {
remove = Some ( i ) ;
actions . push ( SettingsAction ::RemoveDownloaded ) ;
self . confirm_remove = None ;
}
Some ( false ) = > self . confirm_remove = None ,
None = > { }
}
}
2026-10-18 01:54:06 +03:00
if let Some ( i ) = remove {
s . engines . remove ( i ) ;
s . active_engine = match s . active_engine {
Some ( a ) if a = = i = > ( ! s . engines . is_empty ( ) ) . then_some ( 0 ) ,
Some ( a ) if a > i = > Some ( a - 1 ) ,
a = > a ,
} ;
* changed = true ;
actions . push ( SettingsAction ::EngineChanged ) ;
}
2026-10-18 11:53:30 +03:00
let found = crate ::engines ::suggestions ( s ) ;
if ! found . is_empty ( ) {
ui . add_space ( 6.0 ) ;
ui . label ( RichText ::new ( tr ( " Found on this computer: " ) ) . strong ( ) ) ;
for cfg in found {
ui . horizontal ( | ui | {
2026-10-30 17:35:30 +03:00
let path = cfg . executable ( ) . map ( | l | l . to_string ( ) ) . unwrap_or_default ( ) ;
ui . label ( & cfg . name ) . on_hover_text ( path ) ;
2026-10-18 11:53:30 +03:00
if ui . button ( tr ( " Add " ) ) . clicked ( ) {
s . engines . push ( cfg ) ;
if s . active_engine . is_none ( ) {
s . active_engine = Some ( s . engines . len ( ) - 1 ) ;
actions . push ( SettingsAction ::EngineChanged ) ;
}
* changed = true ;
}
} ) ;
}
}
2026-10-19 09:33:37 +03:00
// ChessPenguin's Stockfish can always be (re)downloaded from here.
2026-10-19 23:48:02 +03:00
// Not when a Stockfish of the user's is there already (it would be the same
// engine twice).
2026-10-19 09:33:37 +03:00
let own = crate ::engines ::own_stockfish ( ) . is_some ( ) ;
2026-10-19 23:48:02 +03:00
let has_stockfish = s
. engines
. iter ( )
. any ( | e | e . name . to_lowercase ( ) . contains ( " stockfish " ) & & e . executable ( ) . is_some ( ) ) ;
if ! s . engines . is_empty ( ) & & ! own & & ! has_stockfish & & crate ::engine_download ::available ( ) {
2026-10-19 09:33:37 +03:00
ui . add_space ( 6.0 ) ;
ui . horizontal ( | ui | {
if downloading {
self . download_progress ( ui , actions ) ;
} else if ui
. button ( trf (
" ⬇ Download Stockfish 19 · {mb} MB " ,
& [ ( " mb " , & crate ::engine_download ::size_mb ( ) ) ] ,
) )
. on_hover_text ( tr (
" From the official Stockfish page; installed for your account only " ,
) )
. clicked ( )
{
actions . push ( SettingsAction ::DownloadEngine ) ;
}
} ) ;
}
2026-10-18 01:54:06 +03:00
ui . add_space ( 6.0 ) ;
2026-10-30 16:43:28 +03:00
// A browser has no engine programs.
#[ cfg(not(web)) ]
2026-10-18 01:54:06 +03:00
ui . horizontal ( | ui | {
if ui
. add_enabled (
! self . checking_engine ,
2026-10-19 09:33:37 +03:00
egui ::Button ::new ( tr ( " + Choose engine file… " ) ) ,
2026-10-18 01:54:06 +03:00
)
. clicked ( )
{
actions . push ( SettingsAction ::AddEngine ) ;
}
if self . checking_engine {
ui . spinner ( ) ;
ui . label ( tr ( " Checking engine… " ) ) ;
}
} ) ;
}
}
2026-10-19 09:33:37 +03:00
impl SettingsWindow {
/// The download's progress in place of its button, with a cancel button.
fn download_progress ( & self , ui : & mut Ui , actions : & mut Vec < SettingsAction > ) {
match & self . download {
Some ( crate ::engine_download ::Stage ::Downloading { done , total } ) = > {
let frac = if * total > 0 {
* done as f32 / * total as f32
} else {
0.0
} ;
ui . add ( egui ::ProgressBar ::new ( frac ) . desired_width ( 200.0 ) . text ( trf (
" {done} of {total} MB " ,
& [
( " done " , & ( done / 1_000_000 ) ) ,
( " total " , & ( total / 1_000_000 ) ) ,
] ,
) ) ) ;
}
_ = > {
ui . spinner ( ) ;
ui . label ( tr ( " Checking and installing… " ) ) ;
}
}
if crate ::widgets ::small_close_button ( ui )
. on_hover_text ( tr ( " Cancel download " ) )
. clicked ( )
{
actions . push ( SettingsAction ::CancelDownload ) ;
}
}
}
2026-10-18 01:54:06 +03:00
fn board_tab ( ui : & mut Ui , s : & mut Settings , changed : & mut bool ) {
ui . label ( RichText ::new ( tr ( " Piece set " ) ) . strong ( ) ) ;
ui . horizontal_wrapped ( | ui | {
for set in PieceSet ::ALL {
let selected = s . piece_set = = set ;
let ( rect , resp ) = ui . allocate_exact_size ( vec2 ( 110.0 , 64.0 ) , Sense ::click ( ) ) ;
let v = ui . visuals ( ) ;
let fill = if selected {
v . selection . bg_fill
} else if resp . hovered ( ) {
v . widgets . hovered . weak_bg_fill
} else {
v . faint_bg_color
} ;
ui . painter ( ) . rect_filled ( rect , 6.0 , fill ) ;
let size = 44.0 ;
let board = s . board_theme . theme ( ) ;
for ( k , role ) in [ Role ::Knight , Role ::Queen ] . into_iter ( ) . enumerate ( ) {
let color = if k = = 0 { Color ::White } else { Color ::Black } ;
let r = egui ::Rect ::from_min_size (
rect . left_top ( ) + vec2 ( 8.0 + k as f32 * 48.0 , 2.0 ) ,
vec2 ( size , size ) ,
) ;
// Preview on the current board colours so dark sets stay readable.
let square = if k = = 0 { board . light } else { board . dark } ;
ui . painter ( ) . rect_filled ( r , 3.0 , square ) ;
set . paint ( ui , Piece { color , role } , r ) ;
}
ui . painter ( ) . text (
rect . center_bottom ( ) - vec2 ( 0.0 , 4.0 ) ,
egui ::Align2 ::CENTER_BOTTOM ,
set . name ( ) ,
egui ::FontId ::proportional ( 12.0 ) ,
v . text_color ( ) ,
) ;
if resp . clicked ( ) {
s . piece_set = set ;
* changed = true ;
}
}
} ) ;
ui . add_space ( 8.0 ) ;
Move notation: Latin letters, figurines or the interface language's letters
Settings › Board & pieces: Nf3, ♘f3 as on Lichess, or Кр Ф Л С К (German
K D T L S, French R D T F C, Spanish and Italian R D T A C; in English the
Latin letters), with a sample per option and a line of a game. Only the shown
label changes (san::show): the game, PGN, copied games, the analysis written
into a game, the reference cache and every comparison stay Latin SAN. Applied
in the move list, engine lines, the reference tab, board search and the
analysis report. The figurines are egui's chess glyphs cut out to a 4.7 KB
font, a little smaller and on the baseline. Latin remains the default.
Reviewed by the designer and the tester agents.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:18:53 +03:00
notation_section ( ui , s , changed ) ;
ui . add_space ( 8.0 ) ;
2026-10-18 01:54:06 +03:00
ui . label ( RichText ::new ( tr ( " Board " ) ) . strong ( ) ) ;
ui . horizontal_wrapped ( | ui | {
for id in BoardThemeId ::ALL {
let t = id . theme ( ) ;
let selected = s . board_theme = = id ;
let ( rect , resp ) = ui . allocate_exact_size ( vec2 ( 64.0 , 64.0 ) , Sense ::click ( ) ) ;
let sq = rect . width ( ) / 2.0 ;
if let Some ( uri ) = t . texture {
// A quarter of the full-board image = 2× 2 squares, like the flat swatches.
egui ::Image ::new ( uri )
. uv ( egui ::Rect ::from_min_max (
egui ::pos2 ( 0.0 , 0.75 ) ,
egui ::pos2 ( 0.25 , 1.0 ) ,
) )
. paint_at ( ui , rect ) ;
}
for ( k , c ) in [ t . light , t . dark , t . dark , t . light ]
. into_iter ( )
. enumerate ( )
. filter ( | _ | t . texture . is_none ( ) )
{
let r = egui ::Rect ::from_min_size (
rect . min + vec2 ( ( k % 2 ) as f32 * sq , ( k / 2 ) as f32 * sq ) ,
vec2 ( sq , sq ) ,
) ;
ui . painter ( ) . rect_filled ( r , 0.0 , c ) ;
}
if selected {
ui . painter ( ) . rect_stroke (
rect ,
2.0 ,
egui ::Stroke ::new ( 3.0 , ui . visuals ( ) . selection . bg_fill ) ,
egui ::StrokeKind ::Outside ,
) ;
}
if resp . on_hover_text ( id . label ( ) ) . clicked ( ) {
s . board_theme = id ;
* changed = true ;
}
}
} ) ;
ui . add_space ( 8.0 ) ;
2026-10-21 19:57:54 +03:00
ui . horizontal ( | ui | {
ui . label ( tr ( " Piece animation " ) ) ;
for a in crate ::settings ::Animation ::ALL {
* changed | = ui
. selectable_value ( & mut s . animation , a , a . label ( ) )
. changed ( ) ;
}
} ) ;
2026-10-18 01:54:06 +03:00
* changed | = ui
. checkbox ( & mut s . show_coords , tr ( " Show coordinates " ) )
. changed ( ) ;
Premoves, the auto-queen setting, the play dialog redone
Premoves in the game against Maia, as on Lichess: while she thinks, a move of
the user's piece by its pattern on an empty board (a pawn forward and both
diagonals, sliders through pieces, the king at home to castle with an own rook,
by the king's square or the rook's) is set and shown in dark blue; after her
move it is played at once when legal (a promotion as a queen), else dropped.
A right click or a click beside the own pieces cancels it; a take-back, the
leave question and the end drop it. A piece in hand stays there when Maia
moves, unless she took it.
Settings › Board: «Always promote to a queen», off by default — then the
piece is chosen, as before.
The dialog «Play against the computer» redone after the owner's review: You,
Opponent (the strength in the title, the slider edge to edge with 600/2600,
Weaker · As me · Stronger lit when they match, or a line asking for the
rating), Colour, Time; every choice a framed tile of one height, the tiles of a
row sharing its width; time 3+0…30+20 without category captions, Custom with
aligned sliders, Unlimited (no clocks) as a double tile; a solid scroll bar
in a low window, where the introduction is left out. Dev hook CP_PREMOVE.
Adjourning a game recorded as a task.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 12:12:35 +03:00
* changed | = ui
. checkbox ( & mut s . auto_queen , tr ( " Always promote to a queen " ) )
. on_hover_text ( tr (
" Off: a pawn on the last rank asks which piece it becomes " ,
) )
. changed ( ) ;
2026-10-18 01:54:06 +03:00
* changed | = ui
. checkbox ( & mut s . show_best_arrow , tr ( " Show engine best-move arrows " ) )
. changed ( ) ;
}
Move notation: Latin letters, figurines or the interface language's letters
Settings › Board & pieces: Nf3, ♘f3 as on Lichess, or Кр Ф Л С К (German
K D T L S, French R D T F C, Spanish and Italian R D T A C; in English the
Latin letters), with a sample per option and a line of a game. Only the shown
label changes (san::show): the game, PGN, copied games, the analysis written
into a game, the reference cache and every comparison stay Latin SAN. Applied
in the move list, engine lines, the reference tab, board search and the
analysis report. The figurines are egui's chess glyphs cut out to a 4.7 KB
font, a little smaller and on the baseline. Latin remains the default.
Reviewed by the designer and the tester agents.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:18:53 +03:00
/// "Move notation": Latin letters, figurines, the interface language's letters, with a
/// sample for each and a line of a game as it will look.
fn notation_section ( ui : & mut Ui , s : & mut Settings , changed : & mut bool ) {
use crate ::san ::{ MoveNotation , local_letters , show_in } ;
let lang = crate ::i18n ::current ( ) ;
ui . label ( RichText ::new ( tr ( " Move notation " ) ) . strong ( ) ) ;
// In English the language's letters are the Latin ones: that option is not shown.
let local = local_letters ( lang ) ;
let shown = if s . move_notation = = MoveNotation ::Local & & local . is_none ( ) {
MoveNotation ::Latin
} else {
s . move_notation
} ;
let sample = | m : MoveNotation | {
[ " Nf3 " , " Qxd8+ " , " e8=Q " ]
. map ( | x | show_in ( x , m , lang ) . into_owned ( ) )
. join ( " " )
} ;
let mut options = vec! [
(
MoveNotation ::Latin ,
tr ( " Letters (K Q R B N) " ) . to_owned ( ) ,
tr ( " International notation, as in PGN files and engine output " ) ,
) ,
(
MoveNotation ::Figurine ,
tr ( " Figurines " ) . to_owned ( ) ,
tr ( " Piece symbols, as on Lichess. They look the same in every language. " ) ,
) ,
] ;
if let Some ( l ) = local {
options . push ( (
MoveNotation ::Local ,
format! ( " {} ( {} ) " , tr ( " Interface language letters " ) , l . join ( " " ) ) ,
tr ( " Follows the interface language " ) ,
) ) ;
}
egui ::Grid ::new ( " move_notation " )
. num_columns ( 2 )
. spacing ( vec2 ( 24.0 , 4.0 ) )
. show ( ui , | ui | {
for ( mode , label , tip ) in options {
let r = ui . radio ( shown = = mode , label ) . on_hover_text ( tip ) ;
let r2 = ui
. add (
egui ::Label ::new ( RichText ::new ( sample ( mode ) ) . size ( 15.0 ) )
. sense ( Sense ::click ( ) ) ,
)
. on_hover_text ( tip ) ;
if ( r . clicked ( ) | | r2 . clicked ( ) ) & & s . move_notation ! = mode {
s . move_notation = mode ;
* changed = true ;
}
ui . end_row ( ) ;
}
} ) ;
// A line of a game, the current move highlighted as in the notation.
let line = " 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 " ;
let mode = shown ;
egui ::Frame ::group ( ui . style ( ) ) . show ( ui , | ui | {
ui . horizontal_wrapped ( | ui | {
ui . spacing_mut ( ) . item_spacing . x = 6.0 ;
for word in line . split ( ' ' ) {
let text = RichText ::new ( show_in ( word , mode , lang ) . into_owned ( ) ) . size ( 16.0 ) ;
if word = = " 3.Bb5 " {
let sel = ui . visuals ( ) . selection ;
let galley = egui ::Label ::new ( text . color ( sel . stroke . color ) . strong ( ) ) ;
egui ::Frame ::new ( )
. fill ( sel . bg_fill )
. corner_radius ( 2.0 )
. inner_margin ( egui ::Margin ::symmetric ( 3 , 0 ) )
. show ( ui , | ui | ui . add ( galley ) ) ;
} else {
ui . label ( text ) ;
}
}
} ) ;
} ) ;
ui . label (
RichText ::new ( tr (
" Only how moves look on screen. PGN files and copied games always use K Q R B N. " ,
) )
. weak ( ) ,
) ;
}
Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
const SITE : & str = " https://chess.vrubel.xyz " ;
const REPO : & str = " https://github.com/vrubelroman/chessPenguin " ;
2026-10-19 17:34:38 +03:00
const EMAIL : & str = " vrubelroman@gmail.com " ;
Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
2026-10-19 15:32:03 +03:00
/// Version, links to the website and the sources, support contacts.
2026-10-20 07:55:59 +03:00
fn about_tab ( ui : & mut Ui , lang : Lang , updates : impl FnOnce ( & mut Ui ) ) {
Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
let version = env! ( " CARGO_PKG_VERSION " ) ;
// The website page in the interface language.
let site = match lang {
Lang ::En = > format! ( " {SITE} / " ) ,
Lang ::Ru = > format! ( " {SITE} /ru/ " ) ,
Lang ::Fr = > format! ( " {SITE} /fr/ " ) ,
Lang ::De = > format! ( " {SITE} /de/ " ) ,
Lang ::Es = > format! ( " {SITE} /es/ " ) ,
Lang ::It = > format! ( " {SITE} /it/ " ) ,
2026-10-24 12:48:03 +03:00
Lang ::Pt = > format! ( " {SITE} /pt/ " ) ,
Lang ::Uz = > format! ( " {SITE} /uz/ " ) ,
Lang ::Kk = > format! ( " {SITE} /kk/ " ) ,
Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
} ;
ui . add_space ( 6.0 ) ;
ui . label ( RichText ::new ( " ChessPenguin " ) . size ( 22.0 ) . strong ( ) ) ;
ui . label ( format! ( " {} {version} " , tr ( " Version " ) ) ) ;
2026-10-20 07:55:59 +03:00
updates ( ui ) ;
Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
ui . label (
RichText ::new ( tr (
" Free chess database software for Windows, macOS and Linux. " ,
) )
. weak ( ) ,
) ;
ui . add_space ( 8.0 ) ;
ui . horizontal_wrapped ( | ui | {
ui . hyperlink_to ( tr ( " Website " ) , & site ) ;
ui . label ( " · " ) ;
ui . hyperlink_to ( tr ( " What's new " ) , format! ( " {REPO} /releases/tag/v {version} " ) ) ;
ui . label ( " · " ) ;
ui . hyperlink_to ( tr ( " Source code " ) , REPO ) ;
} ) ;
ui . add_space ( 14.0 ) ;
ui . label ( RichText ::new ( tr ( " Found a problem or have an idea? Write to us: " ) ) . strong ( ) ) ;
ui . horizontal_wrapped ( | ui | {
2026-10-19 17:34:38 +03:00
// Copied rather than opened: a mailto link does nothing useful without a mail app.
let copied_at = egui ::Id ::new ( " about_email_copied " ) ;
let now = ui . input ( | i | i . time ) ;
let copied = ui
. data ( | d | d . get_temp ::< f64 > ( copied_at ) )
. is_some_and ( | t | now - t < 2.0 ) ;
let link = ui
. link ( EMAIL )
. on_hover_text ( tr ( " Click to copy the address " ) ) ;
if link . clicked ( ) {
ui . ctx ( ) . copy_text ( EMAIL . to_owned ( ) ) ;
ui . data_mut ( | d | d . insert_temp ( copied_at , now ) ) ;
}
if copied {
ui . label ( RichText ::new ( tr ( " Copied " ) ) . weak ( ) ) ;
ui . ctx ( )
. request_repaint_after ( std ::time ::Duration ::from_millis ( 250 ) ) ;
}
Settings → About: version, website, release notes, sources, support, donations
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
ui . label ( " · " ) ;
ui . hyperlink_to ( " Telegram @vrubelr " , " https://t.me/vrubelr " ) ;
} ) ;
ui . add_space ( 14.0 ) ;
ui . label (
RichText ::new ( tr ( " Free software under GPL-3.0-or-later. Piece sets, boards and sounds come from Lichess under their own free licences. " ) )
. weak ( )
. small ( ) ,
) ;
}
2026-10-18 01:54:06 +03:00
fn sound_tab ( ui : & mut Ui , s : & mut Settings , actions : & mut Vec < SettingsAction > , changed : & mut bool ) {
* changed | = ui
. checkbox ( & mut s . sound_enabled , tr ( " Move sounds " ) )
. changed ( ) ;
ui . add_enabled_ui ( s . sound_enabled , | ui | {
ui . horizontal ( | ui | {
ui . label ( tr ( " Set: " ) ) ;
for set in SoundSet ::ALL {
if ui
. selectable_value ( & mut s . sound_set , set , set . label ( ) )
. changed ( )
{
* changed = true ;
actions . push ( SettingsAction ::TestSound ) ;
}
}
} ) ;
ui . horizontal ( | ui | {
ui . label ( tr ( " Volume: " ) ) ;
let r = ui . add ( egui ::Slider ::new ( & mut s . volume , 0. 0 ..= 1.0 ) . show_value ( false ) ) ;
* changed | = r . changed ( ) ;
if r . drag_stopped ( ) {
actions . push ( SettingsAction ::TestSound ) ;
}
if ui . button ( tr ( " ▶ Test " ) ) . clicked ( ) {
actions . push ( SettingsAction ::TestSound ) ;
}
} ) ;
} ) ;
}
Web version, stage 1: the interface as a library over a platform layer; apps/web
apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.
The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.
What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).
apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
/// Updates in the About tab: the version out, «Check now», the check at start.
#[ cfg(not(web)) ]
fn updates (
ui : & mut Ui ,
s : & mut Settings ,
status : & Option < String > ,
available : & Option < String > ,
actions : & mut Vec < SettingsAction > ,
changed : & mut bool ,
) {
ui . add_space ( 4.0 ) ;
ui . horizontal_wrapped ( | ui | {
match ( available , status ) {
( Some ( v ) , _ ) = > {
let label = RichText ::new ( trf ( " ⬆ Update to {v}… " , & [ ( " v " , v ) ] ) )
. color ( ui . visuals ( ) . hyperlink_color ) ;
if ui . button ( label ) . clicked ( ) {
actions . push ( SettingsAction ::OpenUpdate ) ;
}
}
( None , Some ( st ) ) = > {
ui . label ( RichText ::new ( st ) . weak ( ) ) ;
}
( None , None ) = > { }
}
if ui . button ( tr ( " Check now " ) ) . clicked ( ) {
actions . push ( SettingsAction ::CheckUpdates ) ;
}
} ) ;
* changed | = ui
. checkbox ( & mut s . check_updates , tr ( " Check for updates at start " ) )
. on_hover_text ( tr (
" ChessPenguin asks its site which version is the latest; the site counts installations that run: only a random number of this installation, the version and the system are sent " ,
) )
. changed ( ) ;
}
Web version, stage 2: Stockfish 19 in workers, live analysis, game review on N workers, My games, files, keys
game-review: what the job does for one target (the full search, the second
best without the move played, the shallow ones) becomes a machine without I/O
(job/work.rs), driven by the engine processes on a computer (job/engines.rs,
the same searches as before) and by Web Workers in a browser
(job/workers.rs: a dispatcher polled from the frames, never blocking). The
analysis cache goes through a CacheStore (a folder, or the program's files of
the platform).
The browser's engine: Stockfish.js 19.0.1 (npm stockfish, GPL-3.0), its
single-threaded build served beside /app/ (engine/, build.sh checks the
package's sha512), its 99 MB wasm downloaded only through the engine offer,
checked against its SHA-256 and kept in Cache Storage; workers get it as a
blob: address. Live analysis (lines, arrows, the bar) and the review run on it;
the review uses one worker per logical CPU, at most 8.
My games (the web version): a PGN in the browser's storage, always on the
shelf; Ctrl+S puts a game there (its own record, or a new one); deleting with
undo. chess-core's store gives the bytes of append/replace/remove/restore, so
the platform writes them into the browser's files; on a computer the files
are written as before. Settings: Browser data (used and free space, keeping
the data for good, Download all as PGN, deleting the engine).
Files: a file of the last visit offers Choose the file again; Keep a copy in
the browser (refused with the room it needs when the browser gives too
little); files over 1 GB are not opened, with a word on why. No reference tab
and no search by position in the web version. Keys: Alt+Left, plain 1-6,
Ctrl+C, N in the library (the browser keeps Ctrl+W/N/1-6/Shift+C).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:35:16 +03:00
/// Settings → Browser data (docs/design/web-version.md §2.3): what is kept only in this
/// browser, how much room it takes and is left, and the way to take «My games» along.
#[ cfg(web) ]
fn browser_data ( ui : & mut Ui , actions : & mut Vec < SettingsAction > ) {
use crate ::platform ::{ size_text , web } ;
ui . label ( tr (
" Everything below is stored only here, on this device. Files on disk are not changed. " ,
) ) ;
ui . add_space ( 6.0 ) ;
if let Some ( ( used , quota ) ) = web ::storage ::usage ( ) {
ui . label ( trf (
" Used {used} · free for the site {free} " ,
& [
( " used " , & size_text ( used ) ) ,
( " free " , & size_text ( quota . saturating_sub ( used ) ) ) ,
] ,
) ) ;
}
ui . horizontal ( | ui | match web ::storage ::persisted ( ) {
Some ( true ) = > {
ui . label ( tr ( " Persistent storage: on " ) ) ;
}
_ = > {
ui . label (
RichText ::new ( tr ( " Persistent storage: not allowed by the browser " ) )
. color ( ui . visuals ( ) . warn_fg_color ) ,
) ;
if ui . button ( tr ( " Ask the browser " ) ) . clicked ( ) {
actions . push ( SettingsAction ::KeepData ) ;
}
}
} ) ;
ui . add_space ( 8.0 ) ;
egui ::Grid ::new ( " browser data " )
. num_columns ( 3 )
. spacing ( [ 16.0 , 6.0 ] )
. show ( ui , | ui | {
ui . label ( trf (
" My games · {n} " ,
& [ ( " n " , & crate ::i18n ::games ( crate ::my_games ::count ( ) ) ) ] ,
) ) ;
ui . label ( size_text ( crate ::my_games ::size ( ) ) ) ;
if ui . button ( tr ( " Download all as PGN " ) ) . clicked ( ) {
actions . push ( SettingsAction ::DownloadMyGames ) ;
}
ui . end_row ( ) ;
if web ::engine ::ready ( ) {
ui . label ( tr ( " Stockfish 19 engine " ) ) ;
ui . label ( size_text ( web ::engine ::WASM_BYTES ) ) ;
if ui . button ( tr ( " Delete " ) ) . clicked ( ) {
actions . push ( SettingsAction ::RemoveDownloaded ) ;
}
ui . end_row ( ) ;
}
} ) ;
ui . add_space ( 8.0 ) ;
ui . label (
RichText ::new ( tr (
" If you clear the site's data in the browser, all of this is lost. Download your games as PGN to keep them. " ,
) )
. weak ( ) ,
) ;
}