diff --git a/apps/desktop/src/app.rs b/apps/desktop/src/app.rs index 9e5da22..c4dc8a3 100644 --- a/apps/desktop/src/app.rs +++ b/apps/desktop/src/app.rs @@ -2041,7 +2041,18 @@ impl App { self.brilliant_start = Some(dialog); } + /// Starts the pass of `dialog` over its games not analysed yet (a browser has none: + /// `CAPS.great_moves`). + #[cfg(web)] + fn start_great_moves( + &mut self, + _ctx: &egui::Context, + _dialog: crate::brilliant_ui::StartDialog, + ) { + } + /// Starts the pass of `dialog` over its games not analysed yet. + #[cfg(not(web))] fn start_great_moves(&mut self, ctx: &egui::Context, dialog: crate::brilliant_ui::StartDialog) { let mut dialog = dialog; let Some(counted) = dialog.counted.take() else { @@ -4260,7 +4271,9 @@ impl eframe::App for App { self.applied_dark = Some(self.settings.dark_mode); } // The opening panel's dragged width: given to the panel, saved when dragged anew. + #[cfg(not(web))] let side_width = egui::Id::new(crate::opening_layout::SIDE_WIDTH_ID); + #[cfg(not(web))] match ctx.data(|d| d.get_temp::(side_width)) { None => { if let Some(width) = self.settings.opening_side_width { diff --git a/apps/desktop/src/brilliant.rs b/apps/desktop/src/brilliant.rs index 23ad03a..85313fc 100644 --- a/apps/desktop/src/brilliant.rs +++ b/apps/desktop/src/brilliant.rs @@ -402,6 +402,7 @@ pub struct PassEnd { /// The engine of a pass: started for each game that needs it. pub struct Engine { + #[cfg(not(web))] pub config: uci::EngineConfig, pub settings: JobSettings, /// Whether the engine, by the name it gives, is still the one checked. @@ -410,6 +411,35 @@ pub struct Engine { pub pause: std::time::Duration, } +/// The engine job over `targets` (on a computer; a browser has no pass, `CAPS`). +#[cfg(not(web))] +fn engine_run( + engine: &Engine, + targets: Vec, + cancel: &AtomicBool, + on_event: &mut dyn FnMut(JobEvent), +) -> Result<(), JobFailure> { + game_review::run( + engine.config.clone(), + &engine.settings, + targets, + cancel, + on_event, + ) +} + +#[cfg(web)] +fn engine_run( + _engine: &Engine, + _targets: Vec, + _cancel: &AtomicBool, + _on_event: &mut dyn FnMut(JobEvent), +) -> Result<(), JobFailure> { + Err(JobFailure::Start( + crate::i18n::tr("the engine did not start").to_owned(), + )) +} + /// Analyses `records` of `db` in this order: each from the analysis cache in `cache` /// when it is there (also one made with the engine settings of before), else with /// `engine`; after each game the cache and `index` are saved, so a stop or a crash @@ -494,24 +524,18 @@ pub fn run_pass( end.from_cache += 1; } else { let mut changed = false; - let result = game_review::run( - engine.config.clone(), - &engine.settings, - targets, - cancel, - &mut |e| { - if changed { - return; - } - if let JobEvent::Engine(name) = &e - && !(engine.fits)(name) - { - changed = true; - return; - } - analysis.apply(e); - }, - ); + let result = engine_run(engine, targets, cancel, &mut |e| { + if changed { + return; + } + if let JobEvent::Engine(name) = &e + && !(engine.fits)(name) + { + changed = true; + return; + } + analysis.apply(e); + }); if changed { end.outcome = Outcome::EngineFailed( crate::i18n::tr("the engine is no longer the Stockfish 19 that was checked") diff --git a/apps/desktop/src/large_db.rs b/apps/desktop/src/large_db.rs index dca514c..1e527dc 100644 --- a/apps/desktop/src/large_db.rs +++ b/apps/desktop/src/large_db.rs @@ -815,6 +815,9 @@ impl LargeView { /// «!! Find great moves»: the button, or Shift+A outside a field (a disabled button /// says why, also over an empty list). fn handle_find(&mut self, ui: &mut Ui, path: &Path, actions: &mut Vec) { + if !crate::platform::CAPS.great_moves { + return; + } let typing = ui.ctx().egui_wants_keyboard_input(); let shift_a = !typing && !crate::app::overlay_open_besides(ui.ctx(), &[egui::Id::new("filters_drawer")]) @@ -1776,6 +1779,9 @@ impl LargeView { /// its longest form for the line's width, whatever it shows: what stands left of it /// never moves. fn right_slot(&mut self, ui: &mut Ui) { + if !crate::platform::CAPS.great_moves { + return; + } let line = ui.available_width(); let form = if line >= 1100.0 { 2 diff --git a/apps/desktop/src/platform/mod.rs b/apps/desktop/src/platform/mod.rs index 1eff152..0e24de6 100644 --- a/apps/desktop/src/platform/mod.rs +++ b/apps/desktop/src/platform/mod.rs @@ -53,6 +53,8 @@ pub struct Caps { pub reference: bool, /// Several chosen games copied into a new database in the background (task 42). pub batch_copy: bool, + /// The search for great moves over a database's list (task 27). + pub great_moves: bool, } /// The features of this platform. @@ -69,6 +71,7 @@ pub const CAPS: Caps = Caps { download_pgn: false, reference: true, batch_copy: true, + great_moves: true, }; /// The features of this platform: the light web version (`docs/decisions.md`, «Веб-версия»). @@ -85,6 +88,7 @@ pub const CAPS: Caps = Caps { download_pgn: true, reference: false, batch_copy: false, + great_moves: false, }; /// The program's settings (`~/.config/chesspenguin`; in a browser, its storage).