LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LRC-LIB-PEOPLE: a double click on an unnamed face opens its photo in the loupe (part of #1664)
Marco Arnulfo61b4007c2e5b
diff --git a/crates/ui-egui/src/headless.rs b/crates/ui-egui/src/headless.rsindex 3ce1331a2..630b2aa76 100644--- a/crates/ui-egui/src/headless.rs+++ b/crates/ui-egui/src/headless.rs@@ -1441,6 +1441,56 @@ mod tests {assert_eq!(named(&h, ids[1], 0), None);}+ /// A double click on an unnamed face opens its photo in the loupe, as in the grid (#1664); a single click still only+ /// selects it, and Escape from that photo goes back to the People view.+ #[test]+ fn double_clicking_an_unnamed_face_opens_its_photo() {+ use crate::state::ViewMode;+ use lightcraft_catalog::Op;+ let mut h = demo([1400.0, 900.0]);+ let t = Duration::from_secs(10);+ let ids: Vec<_> = h.app.session.catalog.photos().map(|p| p.id).take(2).collect();+ for id in &ids {+ let mut meta = h.app.session.catalog.photo(*id).unwrap().meta.clone();+ meta.regions = vec![lightcraft_meta::Region {+ rect: lightcraft_geom::Rect { x0: 0.3, y0: 0.2, x1: 0.5, y1: 0.55 },+ kind: lightcraft_meta::RegionKind::Face,+ name: None,+ description: None,+ }];+ h.app.session.commit("setup", Op::SetMeta { id: *id, meta: Box::new(meta) }).unwrap();+ }+ h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [ids[0].0]}}), t);+ h.request("engine.execute", json!({"command": "view.people"}), t);+ h.settle(SETTLE);+ h.step();+ h.step();+ let tile = format!("unnamed-face:{}:0", ids[1].0);+ // one click selects the face and stays in People+ let r = h.request("ui.clickWidget", json!({"id": tile}), t);+ assert_eq!(r["ok"], true, "{r}");+ h.step();+ h.step();+ assert_eq!((h.app.ui.view, h.app.session.active()), (ViewMode::People, Some(ids[0])));+ assert_eq!(h.app.ui.unnamed_selected.len(), 1);+ h.request("ui.clickWidget", json!({"id": "unnamed:clear"}), t);+ // half a second of frames, so egui does not count the next two clicks as the third and fourth of one burst+ for _ in 0..30 {+ h.step();+ }+ // two open the photo the face is in+ let r = h.request("ui.clickWidget", json!({"id": tile, "count": 2}), t);+ assert_eq!(r["ok"], true, "{r}");+ h.step();+ h.step();+ assert_eq!((h.app.ui.view, h.app.session.active()), (ViewMode::Detail, Some(ids[1])));+ assert_eq!(h.app.session.catalog.photo(ids[1]).unwrap().meta.regions[0].name, None, "nothing is named");+ // Escape goes back to the faces, not to the grid+ h.request("ui.key", json!({"key": "escape"}), t);+ h.step();+ assert_eq!((h.app.ui.view, h.app.ui.person_page.clone()), (ViewMode::People, None));+ }+/// The name field under the unnamed faces is a shared text field: right-click ▸ Paste puts the/// clipboard's name in, and Esc leaves the field and clears the selection, as Clear does.#[test]diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex 141d6d782..7d66b09d4 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -568,11 +568,11 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re} else if matches!(app.ui.view, ViewMode::Compare | ViewMode::Survey) {app.ui.view = ViewMode::Detail;} else if app.ui.view == ViewMode::Detail {- // a photo opened from a person's page goes back to that page, any other to the grid+ // a photo opened from a person's page (or the unnamed faces) goes back there, any other to the gridmatch app.ui.person_from.take() {Some((name, photo)) if app.session.active().is_some_and(|a| a.0 == photo) => {app.ui.view = ViewMode::People;- app.ui.person_page = Some(name);+ app.ui.person_page = name;}_ => app.ui.view = ViewMode::PhotoGrid,}diff --git a/crates/ui-egui/src/panels/person.rs b/crates/ui-egui/src/panels/person.rsindex 9ebf09a64..d63074903 100644--- a/crates/ui-egui/src/panels/person.rs+++ b/crates/ui-egui/src/panels/person.rs@@ -209,7 +209,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, name: &str) {let _ = app.run("library.select", json!({"ids": [f.photo], "active": f.photo}));let _ = app.run("view.detail", json!({}));// Escape comes back to this page; the People button to everyone, with this person next to its title- app.ui.person_from = Some((shown_name.clone(), f.photo));+ app.ui.person_from = Some((Some(shown_name.clone()), f.photo));app.ui.last_person = Some(shown_name.clone());app.ui.person_page = None;}diff --git a/crates/ui-egui/src/panels/unnamed.rs b/crates/ui-egui/src/panels/unnamed.rsindex 0b730db78..ff7939ee5 100644--- a/crates/ui-egui/src/panels/unnamed.rs+++ b/crates/ui-egui/src/panels/unnamed.rs@@ -266,7 +266,13 @@ pub fn tile(app: &mut LightcraftApp, ui: &mut egui::Ui, list: &Unnamed, i: usizename(app, &[key], who);return;}- if resp.clicked() {+ // a double click opens the photo, as in the grid; its second click must not undo the first one's selection+ if resp.double_clicked() {+ let _ = app.run("library.select", json!({"ids": [f.photo], "active": f.photo}));+ let _ = app.run("view.detail", json!({}));+ // Escape comes back to the faces+ app.ui.person_from = Some((None, f.photo));+ } else if resp.clicked() {let shift = ui.input(|i| i.modifiers.shift);click(app, list, i, shift);}diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rsindex 6c4dd3f6a..ff94aa1f4 100644--- a/crates/ui-egui/src/state.rs+++ b/crates/ui-egui/src/state.rs@@ -575,9 +575,10 @@ pub struct UiState {/// The person whose page the People view shows (their faces and the faces that look like them); `None`: everyone.#[serde(skip)]pub person_page: Option<String>,- /// The person page a photo in the loupe was opened from, and that photo: Escape goes back to the page (not the grid).+ /// The person page a photo in the loupe was opened from (`None`: the People view's unnamed faces), and that photo:+ /// Escape goes back there (not to the grid).#[serde(skip)]- pub person_from: Option<(String, u64)>,+ pub person_from: Option<(Option<String>, u64)>,/// The last person page left: the People view offers a way back to it next to its title.#[serde(skip)]pub last_person: Option<String>,diff --git a/docs/parity-checklist.md b/docs/parity-checklist.mdindex 76d91ba3e..cb15d6d86 100644--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@ -706,7 +706,7 @@ From `08-lightroom-classic-extras.md` (Classic-only features) and part 2 of `06-| LRC-LIB-KEYWORDS | Hierarchical keywords, sets, painter, Keyword List | P1 | ✅ | `crates/catalog/src/keywords.rs`, `crates/ui-egui/src/panels/keyword_list.rs`, `cmd:keyword.list`, `cmd:keyword.create`, `cmd:keyword.edit`, `cmd:keyword.move`, `cmd:keyword.info`, `cmd:keyword.purgeUnused`, `cmd:keyword.setDefaultParent`, `cmd:keyword.sets`, `cmd:keyword.toggleFromSet`, `cmd:keyword.saveSet`, `cmd:tool.keywordPainter` | hierarchical `a\|b\|c` keywords (tree, parent filters include children, rename moves children); keyword sets + Recent Keywords (⌥1–⌥9); keyword painter (Keywords panel ▸ Paint: click photos in the grid to toggle a keyword, Esc stops). Keyword List (Keywords panel): every keyword, those without photos too (a keyword list in the catalog, format version 4), with counts, a filter box, a tri-state tick box for the selection and an arrow to show its photos; + / Create Keyword Tag (name, synonyms, put inside, add to selected photos), double-click / Edit Keyword Tag, − / Delete with confirmation, context menu (create inside, Put New Keywords Inside This Keyword, purge unused keywords); drag a keyword onto another to nest it or onto the list's title for the top level (a merge asks first), drag photos onto a keyword to tag them. The list is there without a selection too; Put New Keywords Inside This Keyword (kept with the keyword in the library, undoable) also places new keywords typed in the Keywords panel. Keyword tag options include on export, export containing keywords and export synonyms shape exported files (names in `dc:subject`, paths in `lr:hierarchicalSubject`), and files' `lr:hierarchicalSubject` paths come back as keywords on import and from sidecars; Person is stored only. Keywording box (`crates/ui-egui/src/panels/keywording.rs`): the selection's keywords as chips (one only some selected photos have marked with an asterisk; × only removes, from every selected photo; with no selection, the active photo's), a Keywords / & Containing / Will Export switch (Lightroom Classic's Keyword Tags views: the keywords to edit, them with their parents, what exported files carry), keyword-set buttons and suggestions that follow the selection, shared text fields for typing and painting. Edit Keyword Set (Keyword Set ▸ Edit Set…): a set's name and nine slots typed in place, empty slots kept so each keyword stays on its ⌥ key, a set renamed in place (`cmd:keyword.saveSet` `replace`) or saved as a new set (`new`, a taken name refused). File ▸ Import Keywords… / Export Keywords… (`cmd:keyword.import`, `cmd:keyword.export`): keyword list files in Lightroom Classic's format (tab-indented, `{synonym}`, `[left out of export]`), which Capture One, darktable, Bridge and Photo Supreme (its Formatted Vocabulary File) read and write too; import adds what is missing in one undo step, export names the keywords Capture One refuses (; , < >). Not yet: synonyms in search, person keywords tied to faces, Keyword Shortcut, IPTC keywords in exported files (Piwigo, RawTherapee), hierarchy from digiKam / ACDSee / Microsoft XMP fields || LRC-LIB-METADATA | Metadata panel & presets | P1 | ✅ | `cmd:photo.setMeta`, `cmd:metadata.savePreset`, `cmd:metadata.applyPreset`, `cmd:metadata.presets`, `cmd:metadata.deletePreset`, `cmd:dialog.captureTime` | IPTC core, accessibility, place, capture-time edit; copyright status (unknown / copyrighted / public domain), rights usage terms and copyright info URL (`photo.setMeta` `copyrightStatus`, `usageTerms`, `copyrightUrl`; XMP Rights Management fields, kept by "copyright only" exports, a smart-album rule); metadata presets (Photo → Metadata Preset, Save Metadata Preset… from the active photo; applied on import from Settings) || LRC-LIB-QUICKDEV | Quick develop | P2 | ✅ | `cmd:develop.quickAdjust`, `crates/ui-egui/src/panels/edit.rs` (`quick_develop`) | grid with several photos selected: Edit panel ▸ Quick Develop steps (exposure ⅓ / 1 stop, contrast, highlights, shadows, whites, blacks, clarity, vibrance, temperature) added to each photo's own value, one undo step |-| LRC-LIB-PEOPLE | People view | P2 | 🟡 | `cmd:view.people`, `cmd:view.person`, `cmd:faces.person`, `cmd:faces.unnamed`, `cmd:faces.nameFaces`, `crates/ui-egui/src/panels/people.rs`, `crates/ui-egui/src/panels/person.rs`, `crates/ui-egui/src/panels/unnamed.rs` | Named People cards (face close-up, the photo count on the picture, name) for the photos the active filters let through, with the filter chips shown above them, sized by the thumbnail slider. Below them the **Unnamed faces**: every face nobody has named as a cropped picture, look-alikes next to each other once recognition has looked at them, a suggested name on a face the named ones recognise; click or Shift-click to select, type a name, Enter names the whole group in one undo step. A click on a person opens their page: only cropped faces, then **More** (unnamed faces that look like them, best first; click to confirm, × to hide). Every face is shown by the detector's box where the scan has one, so faces are equally close. Until recognition is set up a line at the top offers the next step (Settings ▸ Faces, or Turn on), as does the loupe's name box. No clusters with separators between groups, no persistent reject, no merge of two people+| LRC-LIB-PEOPLE | People view | P2 | 🟡 | `cmd:view.people`, `cmd:view.person`, `cmd:faces.person`, `cmd:faces.unnamed`, `cmd:faces.nameFaces`, `crates/ui-egui/src/panels/people.rs`, `crates/ui-egui/src/panels/person.rs`, `crates/ui-egui/src/panels/unnamed.rs` | Named People cards (face close-up, the photo count on the picture, name) for the photos the active filters let through, with the filter chips shown above them, sized by the thumbnail slider. Below them the **Unnamed faces**: every face nobody has named as a cropped picture, look-alikes next to each other once recognition has looked at them, a suggested name on a face the named ones recognise; click or Shift-click to select, type a name, Enter names the whole group in one undo step; a double click opens the face's photo in the loupe, and Escape comes back. A click on a person opens their page: only cropped faces, then **More** (unnamed faces that look like them, best first; click to confirm, × to hide). Every face is shown by the detector's box where the scan has one, so faces are equally close. Until recognition is set up a line at the top offers the next step (Settings ▸ Faces, or Turn on), as does the loupe's name box. No clusters with separators between groups, no persistent reject, no merge of two people| LRC-LIB-COMMENTS | Comments panel | P2 | ⬜ | | || LRC-LIB-VISUALSEARCH | Find similar photos | P2 | ✅ | `cmd:library.findSimilar`, `crates/pipeline/src/cull.rs` (`signature`) | photo menu / Photo ▸ Find Similar Photos: look-alike photos (composition and tones), most similar first, as a filter (`only`) || LRC-LIB-MISSING | Missing files & relink | P1 | ✅ | `cmd:library.missing`, `cmd:photo.relink`, `cmd:library.findMissing`, `cmd:file.findMissing`, `cmd:photo.locate`, `crates/engine/src/cmd/missing.rs` (`checked_path`), `crates/ui-egui/src/panels/left.rs` (`locate_missing_item`) | File → Find Missing Photos… (anywhere in a folder: same name, size and content hash; renamed files by size + content hash; same name and size alone only when unambiguous — look-alikes are skipped and reported; searched on a worker thread, one undo step), photo menu → Locate Missing File…; a folder or disk row's Locate Missing Files… chooses its new location and scopes the same recursive background finder to that folder and its subfolders. Unreadable files show "!" in the grid and a reason in the loupe; undo never moves files. Missing Photos in the sidebar (counted on a worker thread; the view, the Info panel, the grid's context menu and thumbnails read file availability from a cache a worker thread fills, so an offline NAS never stalls a frame); it covers library photos only — Local browse records are never checked, for the count, the view, `library.missing` and Find Missing alike |