LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #1656
Brandon Thomas43f9d512073c
diff --cc crates/engine/src/library.rsindex 8cae76c88,be6fab1dd..5488ccdc0--- a/crates/engine/src/library.rs+++ b/crates/engine/src/library.rs@@@ -236,14 -232,8 +236,16 @@@ struct PrefsFile/// Days after which untouched Local records of unbrowsed folders are forgotten (missing =/// the default, 0 = never).forget_local_days: Option<u32>,+ /// Slideshow playback settings.+ slideshow: crate::slideshow::PlaybackSettings,+ /// Slideshow slide layout (margins, options, backdrop).+ slide_layout: crate::slide::SlideSettings,+ /// Slideshow overlays.+ slide_overlays: crate::slide_overlay::OverlaySettings,+ /// Slideshow intro and ending screens.+ slide_titles: crate::slide_title::TitleSettings,+ /// A view holds the photos it shows until it is refreshed (`library.holdView`).+ hold_view: bool,}fn presets_json(s: &Session) -> String {@@@ -500,11 -456,9 +502,13 @@@ impl Sessionself.recent_keywords = prefs.recent_keywords;self.import_defaults = prefs.import;self.cache_mb = prefs.cache_mb;+ self.slideshow = prefs.slideshow.sanitized();+ self.slide_layout = prefs.slide_layout.sanitized();+ self.slide_overlays = prefs.slide_overlays.sanitized();+ self.slide_titles = prefs.slide_titles.sanitized();self.forget_local_days = prefs.forget_local_days.unwrap_or(lightcraft_catalog::DEFAULT_FORGET_DAYS);+ self.hold_view = prefs.hold_view;+ self.refresh_view();self.smart_previews_dir = prefs.smart_previews_dir.filter(|_| on_disk).map(PathBuf::from);if let Some(d) = &self.smart_previews_dir {self.media.smart_dir = Some(d.clone());@@@ -752,10 -703,7 +756,11 @@@cache_mb: self.cache_mb,smart_previews_dir: self.smart_previews_dir.as_ref().map(|d| d.to_string_lossy().to_string()),forget_local_days: Some(self.forget_local_days),+ slideshow: self.slideshow.clone(),+ slide_layout: self.slide_layout.clone(),+ slide_overlays: self.slide_overlays.clone(),+ slide_titles: self.slide_titles.clone(),+ hold_view: self.hold_view,}).unwrap_or_default();let Some(lib) = self.library.as_mut() else { return Ok(()) };diff --cc crates/engine/src/tests_library.rsindex d06288678,131049d13..e642c57b6--- a/crates/engine/src/tests_library.rs+++ b/crates/engine/src/tests_library.rs@@@ -676,49 -676,26 +676,73 @@@ fn an_album_filter_loop_is_refused()assert_eq!(s.catalog.album(lightcraft_catalog::AlbumId(a)).unwrap().smart.as_ref().and_then(|f| f.album), None);}+/// Given a library whose thumbnail cache is from before (`.jpg` files in `thumbs`), when it is+/// opened, then the cache is tidied in the background with a row in the activity stack: the+/// thumbnails are taken over under a name that is no picture's, the folder is tagged as a+/// cache, and the next time the library opens there is nothing to tidy and no row.+#[test]+fn a_thumbnail_cache_from_before_is_tidied_in_the_background_when_the_library_opens() {+ let dir = temp_dir("tidy-thumbs");+ let mut s = Session::new().with_fs();+ s.open_library(&dir, true).unwrap();+ assert!(s.activity.list().is_empty(), "a new library has nothing to tidy");+ s.close_library().unwrap();+ drop(s);+ // the cache as an older build left it+ let thumbs = dir.join("thumbs");+ let _ = std::fs::remove_dir_all(&thumbs);+ let img = lightcraft_raster::Rgba8 { width: 32, height: 20, data: vec![[90, 120, 150, 255]; 640] };+ let jpeg = lightcraft_preview::encode_jpeg(&img).unwrap();+ let names: Vec<String> = (0..2000u16).map(|i| lightcraft_preview::hash_bytes(&i.to_le_bytes()).to_string()).collect();+ for hex in &names {+ std::fs::create_dir_all(thumbs.join(&hex[..2])).unwrap();+ std::fs::write(thumbs.join(&hex[..2]).join(format!("{hex}.jpg")), &jpeg).unwrap();+ }++ let mut s = Session::new().with_fs();+ s.open_library(&dir, true).unwrap();+ // (two thousand files to rename: the row is there when the library has just opened)+ let rows = s.activity.list();+ assert!(rows.iter().any(|r| r.kind == "cache" && r.label == "Tidying the thumbnail cache" && r.cancellable), "{rows:?}");+ let t0 = std::time::Instant::now();+ while !s.activity.list().is_empty() && t0.elapsed() < std::time::Duration::from_secs(20) {+ std::thread::sleep(std::time::Duration::from_millis(5));+ }+ assert!(s.activity.list().is_empty());+ for hex in &names {+ let shard = thumbs.join(&hex[..2]);+ assert!(shard.join(format!("{hex}.lcthumb")).is_file() && !shard.join(format!("{hex}.jpg")).exists(), "{hex}");+ }+ assert!(thumbs.join("CACHEDIR.TAG").is_file());+ s.close_library().unwrap();+ drop(s);+ let mut s = Session::new().with_fs();+ s.open_library(&dir, true).unwrap();+ assert!(s.activity.list().is_empty(), "tidied once");+ drop(s);+ let _ = std::fs::remove_dir_all(&dir);+}+++ #[test]+ fn the_hold_of_the_view_is_kept_with_the_library_and_holds_nothing_over_from_another() {+ let dir = temp_dir("holdview");+ let mut s = open(&dir, true);+ assert!(!s.hold_view, "off in a library that never asked for it");+ s.execute("library.holdView", &json!({"on": true})).unwrap();+ // a filter over the demo photos, and one of them edited out from under it: held+ s.execute("library.filter", &json!({"rating": 0, "flag": "none"})).unwrap();+ let shown = s.visible_cloned();+ let id = *shown.first().expect("the seeded library has unflagged photos");+ s.execute("library.select", &json!({"ids": [id.0]})).unwrap();+ s.execute("photo.flag", &json!({"flag": "pick"})).unwrap();+ assert!(s.visible_cloned().contains(&id));+ s.close_library().unwrap();+ drop(s);+ // opened again: the hold is on, and what was held is not (a library opens on what matches)+ let mut s = open(&dir, false);+ assert!(s.hold_view);+ s.execute("library.filter", &json!({"rating": 0, "flag": "none"})).unwrap();+ assert!(!s.visible_cloned().contains(&id));+ s.close_library().unwrap();+ let _ = std::fs::remove_dir_all(&dir);+ }diff --cc crates/ui-egui/src/menubar.rsindex 7378f298f,78996f409..c88ad7646--- a/crates/ui-egui/src/menubar.rs+++ b/crates/ui-egui/src/menubar.rs@@@ -341,9 -330,8 +343,10 @@@ pub fn checked(app: &LightcraftApp, id"view.beforeAfterSplit" => Some(u.before_after == crate::state::BeforeAfter::Split),"view.autoAdvance" => Some(u.auto_advance),"view.filterBar" => Some(u.filter_bar),+ "view.soloSections" => Some(u.single_panel),"view.navigator" => Some(u.navigator),+ "view.layoutImage" => Some(u.layout_image.show && !u.layout_image.path.trim().is_empty()),+ "library.holdView" => Some(app.session.hold_view),"view.fullScreenPreview" => Some(u.fullscreen),"view.lightsOut" => Some(u.lights_out != crate::state::LightsOut::On),"view.enterFullScreen" => Some(app.window_is_fullscreen),diff --cc docs/parity-checklist.mdindex 2b4190524,02416ec1a..12fa6b487--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -853,8 -822,5 +853,9 @@@ Latin stays upright. Advanced Japanese| 2026-10-11 | minor | LR-IMP-FORMATS and LR-IMP-CAMERA-COVERAGE: EOS R5 Mark II CR3 decodes from sensor data (57% of its C-RAW files opened as a preview: QP-map escape); status unchanged (π‘) || 2026-10-10 | patch | LR-BEHAV-UNDO: file/XMP repair retries and merged rename Undo/Redo evidence; status and summary counts unchanged. || 2026-10-10 | minor | Renamed from `parity.md` (progress-docs standard); Top gaps moved to gaps.md (its duplicated items 1β2 from a bad merge resolved there), shortcut notes moved to ui-parity.md. Rows unchanged; a recount of the rows gives 81.1% of 517 in-scope rows (P0 98.0%, P1 95.1%, P2 46.9%), so the generated summary above is due a `cargo xtask parity --write` |+| 2026-10-14 | minor | LR-IMP-CAMERA-COVERAGE: 97 Canon CR2, Pentax and Ricoh Adobe models verified on one CC0 file each; status unchanged (π‘) |+ | 2026-10-13 | minor | LR-LIB-SMARTALBUM: `cmd:library.holdView` and `cmd:library.refresh`: a view can hold the photos it shows until it is refreshed; status unchanged (β ) || 2026-09-30 β 2026-10-11 | β | Rows added and updated with each feature (see `git log -- docs/parity.md docs/parity-checklist.md`) |+| 2026-10-12 | minor | LRC-LIB-CATALOG-IMPORT: lasting destination/result, offline records and virtual copies count as added; redundant missing-file probes and staged photo copies removed. Status and summary counts unchanged. |+| 2026-10-13 | minor | LRC-LIB-CATALOG-IMPORT review: offline Local promotion and result dismissal across library switches covered; redundant operation/settings copies removed. Status and summary counts unchanged. |+| 2026-10-14 | patch | LRC-LIB-CATALOG-IMPORT: reconciled with upstream phased progress, cancellation kinds, WAL-only import, translations and current progress tracking. Status and summary counts unchanged. |