LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LRC-LIB-SMARTCOLL: mark smart albums with problems in the sidebar
Nathaniel Ledford3cd26848f359
diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.jsonindex 2ae0af114..ebd52e71d 100644--- a/crates/ui-egui/locales/de.json+++ b/crates/ui-egui/locales/de.json@@ -1899,5 +1899,6 @@"No Label": "Ohne Markierung","Choose an album…": "Album wählen…","No albums yet": "Noch keine Alben",- "Fix the marked rules to save this album.": "Korrigiere die markierten Regeln, um dieses Album zu speichern."+ "Fix the marked rules to save this album.": "Korrigiere die markierten Regeln, um dieses Album zu speichern.",+ "Some rules need fixing (Edit Smart Album…):": "Einige Regeln müssen korrigiert werden (Smart-Album bearbeiten…):"}diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.jsonindex 812841ab9..77e4959f1 100644--- a/crates/ui-egui/locales/es.json+++ b/crates/ui-egui/locales/es.json@@ -1744,5 +1744,6 @@"No Label": "Sin etiqueta","Choose an album…": "Elige un álbum…","No albums yet": "Aún no hay álbumes",- "Fix the marked rules to save this album.": "Corrige las reglas marcadas para guardar este álbum."+ "Fix the marked rules to save this album.": "Corrige las reglas marcadas para guardar este álbum.",+ "Some rules need fixing (Edit Smart Album…):": "Hay reglas que corregir (Editar álbum inteligente…):"}diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.jsonindex 84dce170d..94f96729b 100644--- a/crates/ui-egui/locales/ja.json+++ b/crates/ui-egui/locales/ja.json@@ -1748,5 +1748,6 @@"Cropped": "切り抜き","Choose an album…": "アルバムを選択…","No albums yet": "アルバムはまだありません",- "Fix the marked rules to save this album.": "このアルバムを保存するには、印の付いた条件を修正してください。"+ "Fix the marked rules to save this album.": "このアルバムを保存するには、印の付いた条件を修正してください。",+ "Some rules need fixing (Edit Smart Album…):": "修正が必要な条件があります(スマートアルバムを編集…):"}diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.jsonindex 230ca8af0..1abdf4e48 100644--- a/crates/ui-egui/locales/pt-br.json+++ b/crates/ui-egui/locales/pt-br.json@@ -1744,5 +1744,6 @@"No Label": "Sem rótulo","Choose an album…": "Escolha um álbum…","No albums yet": "Ainda não há álbuns",- "Fix the marked rules to save this album.": "Corrija as regras marcadas para salvar este álbum."+ "Fix the marked rules to save this album.": "Corrija as regras marcadas para salvar este álbum.",+ "Some rules need fixing (Edit Smart Album…):": "Algumas regras precisam ser corrigidas (Editar álbum inteligente…):"}diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.jsonindex 4a8da93bd..61fed8b4d 100644--- a/crates/ui-egui/locales/ru.json+++ b/crates/ui-egui/locales/ru.json@@ -1416,5 +1416,6 @@"No Label": "Без метки","Choose an album…": "Выберите альбом…","No albums yet": "Альбомов пока нет",- "Fix the marked rules to save this album.": "Исправьте отмеченные условия, чтобы сохранить альбом."+ "Fix the marked rules to save this album.": "Исправьте отмеченные условия, чтобы сохранить альбом.",+ "Some rules need fixing (Edit Smart Album…):": "Некоторые условия нужно исправить (Изменить смарт-альбом…):"}diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.jsonindex f9c093fda..65e9b1944 100644--- a/crates/ui-egui/locales/zh-hans.json+++ b/crates/ui-egui/locales/zh-hans.json@@ -1744,5 +1744,6 @@"No Label": "无标签","Choose an album…": "选择相册…","No albums yet": "还没有相册",- "Fix the marked rules to save this album.": "请修正标记的规则以保存此相册。"+ "Fix the marked rules to save this album.": "请修正标记的规则以保存此相册。",+ "Some rules need fixing (Edit Smart Album…):": "有些规则需要修正(编辑智能相册…):"}diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.jsonindex 1c13a96e1..12487b4b1 100644--- a/crates/ui-egui/locales/zh-hant.json+++ b/crates/ui-egui/locales/zh-hant.json@@ -1744,5 +1744,6 @@"No Label": "無標籤","Choose an album…": "選擇相簿…","No albums yet": "還沒有相簿",- "Fix the marked rules to save this album.": "請修正標記的規則以儲存此相簿。"+ "Fix the marked rules to save this album.": "請修正標記的規則以儲存此相簿。",+ "Some rules need fixing (Edit Smart Album…):": "有些規則需要修正(編輯智慧相簿…):"}diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rsindex 817a18e02..67ae99f3f 100644--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@ -328,6 +328,11 @@ pub fn filter_label(filter: &lightcraft_catalog::Filter, catalog: &lightcraft_ca}}+/// What people read for a smart-album rule problem (`rule 2: …`).+pub fn problem_text(problem: &lightcraft_catalog::rules::Problem) -> String {+ problem.to_string()+}+/// What people read for smart-album choice `id` of `field` ("Gemeinfrei" for `publicDomain` in/// German); an id the field doesn't know, as written.pub fn choice_text<'a>(field: &str, id: &'a str) -> &'a str {diff --git a/crates/ui-egui/src/panels/left.rs b/crates/ui-egui/src/panels/left.rsindex 8863e5d18..7b9584e7d 100644--- a/crates/ui-egui/src/panels/left.rs+++ b/crates/ui-egui/src/panels/left.rs@@ -727,7 +727,13 @@ fn albums_tree(app: &mut LightcraftApp, ui: &mut egui::Ui, all: &AlbumKids, parelet target =app.session.target_album.filter(|t| app.session.catalog.album(*t).is_some()).or_else(|| app.session.catalog.quick_collection());let label = if target == Some(a.id) { format!("{} +", a.name) } else { a.name.clone() };+ // a smart album whose rules no longer check (an album they test was deleted) says so+ let problems = app.session.catalog.smart_album_problems(a.id);+ let label = if problems.is_empty() { label } else { format!("⚠ {label}") };let mut resp = row_sensed(app, ui, &format!("album:{}", a.id.0), icon, &label, None, Some(n), sel, indent, Sense::click_and_drag());+ if !problems.is_empty() {+ crate::widgets::register(ui.ctx(), format!("albumProblem:{}", a.id.0), resp.rect);+ }if resp.drag_started() {app.ui.dragging_album = Some(a.id.0);}@@ -736,7 +742,17 @@ fn albums_tree(app: &mut LightcraftApp, ui: &mut egui::Ui, all: &AlbumKids, paredrop_target(app, ui, &resp, a);}if let Some(rules) = &a.smart {- resp = resp.on_hover_text(crate::i18n::tr_format!("Smart album: {}", crate::i18n::filter_label(rules, &app.session.catalog)));+ // one tooltip: the rules, then what needs fixing in them+ let mut tip = crate::i18n::tr_format!("Smart album: {}", crate::i18n::filter_label(rules, &app.session.catalog));+ if !problems.is_empty() {+ tip.push_str("\n\n");+ tip.push_str(crate::i18n::tr("Some rules need fixing (Edit Smart Album…):"));+ for p in &problems {+ tip.push('\n');+ tip.push_str(&crate::i18n::problem_text(p));+ }+ }+ resp = resp.on_hover_text(tip);}if resp.clicked() {let _ = app.run("library.source", json!({"kind": "album", "id": a.id.0}));@@ -1038,9 +1054,9 @@ fn folder_menu(app: &mut LightcraftApp, resp: &egui::Response, a: &Album) {let _ = app.run("album.clearQuick", json!({}));}if a.is_smart() && ui.button(crate::i18n::tr("Edit Smart Album…")).clicked() {- // older smart albums keep their filter fields; the editor works on the rule set- let rules = a.smart.as_ref().and_then(|f| f.rule_set.clone()).unwrap_or_default();- app.ui.dialog = Some(crate::state::Dialog::SmartRules { id: Some(a.id.0), name: a.name.clone(), rules, parent: None });+ // the same editor as `dialog.smartAlbum` (older smart albums keep their filter fields;+ // it works on the rule set, upgraded)+ let _ = app.run("dialog.smartAlbum", json!({"id": a.id.0}));}if a.is_smart() && ui.button(crate::i18n::tr("Update Rules from Current Filter")).clicked() {let _ = app.run("album.setRules", json!({"id": a.id.0, "fromView": true}));diff --git a/crates/ui-egui/src/tests_masking.rs b/crates/ui-egui/src/tests_masking.rsindex 0a1d37b4d..b68670177 100644--- a/crates/ui-egui/src/tests_masking.rs+++ b/crates/ui-egui/src/tests_masking.rs@@ -462,6 +462,24 @@ fn smart_album_edit_with_bad_rules_keeps_the_name() {assert!(album.smart.as_ref().is_some_and(|f| f.rule_set.is_none()));}+/// The sidebar marks a smart album whose rules no longer check, so it can be fixed.+#[test]+fn sidebar_marks_smart_albums_with_problems() {+ let mut h = detail("panel.edit");+ let trip = exec(&mut h, "album.create", json!({"name": "Trip", "addSelected": false}))["id"].as_u64().unwrap();+ let rules = json!({"ruleSet": {"rules": [{"field": "album", "op": "is", "value": trip}]}});+ let id = exec(&mut h, "album.createSmart", json!({"name": "In Trip", "rules": rules}))["id"].as_u64().unwrap();+ let r = h.request("ui.set", json!({"view": "photoGrid", "leftPanel": true}), T);+ assert_eq!(r["ok"], true, "{r}");+ h.settle(SETTLE);+ assert!(h.app.widgets.iter().any(|(w, _)| *w == format!("source:album:{id}")), "the album's row is on screen");+ let marked = |h: &Headless| h.app.widgets.iter().any(|(w, _)| *w == format!("albumProblem:{id}"));+ assert!(!marked(&h));+ exec(&mut h, "album.delete", json!({"id": trip}));+ h.settle(SETTLE);+ assert!(marked(&h), "its album is gone");+}+#[test]fn g_toggles_grids_and_shift_g_starts_guided_upright() {let mut h = detail("panel.edit");diff --git a/docs/parity.md b/docs/parity.mdindex d5584330e..4a86dee53 100644--- a/docs/parity.md+++ b/docs/parity.md@@ -744,7 +744,7 @@ From `08-lightroom-classic-extras.md` (Classic-only features) and part 2 of `06-| LRC-LIB-FOLDERS | Disk folder tree | P1 | ✅ | `cmd:library.browse`, `cmd:folder.rename`, `cmd:folder.move`, `crates/ui-egui/src/panels/left.rs` (`local_section`, `folder_tree`) | standard places + the browsed folder + Browse Folder…, each an expandable tree of subfolders, breadcrumb navigation; context menu: Rename Folder…, Move Folder To…, Show in Finder (on disk, photos relinked; one undo step each: undo / redo move the folder back and forth, refused when the destination is taken) || LRC-LIB-LIBFOLDERS | Library folders | P1 | ✅ | `cmd:library.folders`, `cmd:library.source` (`libraryFolder`), `cmd:library.filter` (`libraryFolder`), `cmd:library.removeFolder`, `cmd:folder.rename`, `cmd:folder.move`, `crates/catalog/src/folders.rs`, `crates/ui-egui/src/panels/left.rs` (`folders_section`, `folder_menu_for_library`, `row_menu`), `crates/ui-egui/src/tests_panels.rs` | sidebar Folders: the folders the library's photos were imported from, with photo counts (subfolders included), as another way to explore the library next to By Date and Keywords; Local stays the way to browse any folder on disk. Each disk is a row of its own and starts open: a drive letter, a Windows share (`\\server\share`, `\\?\UNC\…`, `\\wsl$\…`), a macOS share or disk (`/Volumes/tokyo`), a Linux mount (`/media`, `/run/media`, `/mnt`, gvfs `smb-share:…`, `/net/<host>`), NFS (`/Network/Servers/<host>`), else “This Computer” — told apart from the stored paths alone, so an offline share lists like a mounted one and the sidebar never waits on a network. Only folders that hold imported photos are listed (browsed, deleted and demo photos don't count); every folder is a row of its own (`Users` → `me` → `Pictures`), and a folder that holds nothing itself and leads to one folder starts open; every level indents one step more than its parent however deep it goes: the whole sidebar (Albums, Local, By Date, Folders, Keywords) scrolls sideways when its widest row is wider than the panel (rows are measured one frame behind; Create Album and the counts stay at the visible edge); a name that does not fit ends in an ellipsis at the count (the full name on hover; a row asks for room for at most 140 pt of its name, so depth, not one long name, makes the sidebar scroll), as does the grid title; selection and hover bars end at the panel's edge; click makes the folder the source, like an album or a Local folder (its photos and those of the folders inside it fill the grid, titled “photos/travel”; the filter bar narrows it further; `library.source` `libraryFolder` + `path`; kept with the library's view), and its row is always opened into view; the shown folder follows a rename or move and their undo (engine-tested; the sidebar test covers rename), is dropped back to All Photos when it is removed or no longer holds a photo, and a smart album made from the view keeps it, also when its rules are edited (the editor has no folder field). Only a folder that shows exactly its own photos can be shown (not the startup disk, not `/Volumes`-like folders above disks, not an empty one). A row that would cover other disks' photos too (the startup disk, `/Volumes`, `/mnt`…) only opens. Right-click (row or triangle): Rename Folder…, Move Folder To…, Show in Finder (on disk, photos relinked, as in Local) and Remove from Library… (asks; moves the folder's photos to Recently Deleted, one undo step, no file touched); a disk row offers Remove Disk from Library… (the command needs `disk: true` for a whole disk or a folder spanning several). Limits: names are compared as written (macOS `/Volumes/tokyo` vs `/Volumes/TOKYO` are two disks; `/Volumes/Macintosh HD/…` and `/…` two rows); no disk capacity / online status; no “include subfolders” switch (a folder always includes the ones inside it); creating a folder and moving photos between folders are not here || LRC-LIB-COLLECTIONS | Collections & sets | P1 | ✅ | `cmd:album.create`, `cmd:album.createSmart`, `cmd:album.toggleTarget`, `cmd:album.setTarget`, `cmd:album.clearQuick` | albums + folders (sets), smart albums (rule editor; rules incl. File Path — the whole string, either separator, case-insensitive), Quick Collection and target album (B in the grids adds / removes the selection; album menu ▸ Set as Target Album; the target is marked +) |-| LRC-LIB-SMARTCOLL | Smart-collection rules | P1 | ✅ | `cmd:album.createSmart`, `cmd:album.setRules`, `cmd:album.ruleFields`, `cmd:dialog.smartAlbum`, `crates/catalog/src/rules.rs`, `crates/ui-egui/src/panels/rules_editor.rs` | rule editor: match all / any / none, nested groups (⌥+ or + Group), 47 fields. The field menu shows Rating, Pick Flag, Color Label and Any Searchable Text, then one submenu per group (`FIELD_GROUPS`; `album.ruleFields` reports each field's `group`): Source (album, virtual copy, copy name, in a stack), File (filename, extension, file path, type, format, video duration), Date (capture / import / edit), Keywords & People (keywords, keyword count, people on named faces, people count), Description (title, caption, alt text, creator, copyright, copyright status), Camera Info (camera, lens, focal length, aperture, shutter speed as 1/250, ISO), Location (any, city, state / province, country, GPS), Size (long / short edge, aspect ratio and megapixels, all of the photo as shown: oriented and cropped), Develop (has edits, cropped, treatment), Assisted Culling (focus, best of similar shots); text / number / date / in-the-last operators; live match count; also usable as a library filter (`ruleSet`). Missing vs Classic: develop preset, flash, exposure bias, camera serial, colour profile / bit depth, IPTC Job, smart-preview status, membership of smart collections. Choice values read as words in every language (Public Domain, Black & White; `album.ruleFields` gives `choiceLabels`), while rules store the ids; yes/no fields read Yes / No and take `true`/`false`, `"yes"`/`"no"`, `"true"`/`"false"` or 1/0. Every value is checked against its field (`RuleSet::check`): numbers (rating 0–5), shutter speeds, dates (`2026`, `2026-08`, `2026-08-14`, a full time; no 30 February), between = two bounds in order, in the last = more than 0 of a known unit, choices (ids, the flag's picked / rejected, a colour label's custom name), text with something to look for, an existing plain album, no empty groups; each problem names its rule (`rule 2.1: rating is 0–5, not 9`), and album.createSmart / setRules / library.filter refuse them. The editor marks each bad rule under its row (inside groups too), keeps OK disabled until they are fixed (and its confirm refuses them before renaming anything), picks an Album rule's album from a list of the plain albums, named with their folder and sorted by name (is / isn't; a folder can't be tested), and drawing it never changes a rule: a rating of 9, "in the last 0 days" or 20,000 days, a "between" that isn't a pair all stay as stored (and are marked where they can't match) until edited. Album rules saved with an old operator (≥, between) are read as the "isn't" they always meant (`RuleSet::upgrade`). Not yet: problem messages are English and name fields by id |+| LRC-LIB-SMARTCOLL | Smart-collection rules | P1 | ✅ | `cmd:album.createSmart`, `cmd:album.setRules`, `cmd:album.ruleFields`, `cmd:dialog.smartAlbum`, `crates/catalog/src/rules.rs`, `crates/ui-egui/src/panels/rules_editor.rs` | rule editor: match all / any / none, nested groups (⌥+ or + Group), 47 fields. The field menu shows Rating, Pick Flag, Color Label and Any Searchable Text, then one submenu per group (`FIELD_GROUPS`; `album.ruleFields` reports each field's `group`): Source (album, virtual copy, copy name, in a stack), File (filename, extension, file path, type, format, video duration), Date (capture / import / edit), Keywords & People (keywords, keyword count, people on named faces, people count), Description (title, caption, alt text, creator, copyright, copyright status), Camera Info (camera, lens, focal length, aperture, shutter speed as 1/250, ISO), Location (any, city, state / province, country, GPS), Size (long / short edge, aspect ratio and megapixels, all of the photo as shown: oriented and cropped), Develop (has edits, cropped, treatment), Assisted Culling (focus, best of similar shots); text / number / date / in-the-last operators; live match count; also usable as a library filter (`ruleSet`). Missing vs Classic: develop preset, flash, exposure bias, camera serial, colour profile / bit depth, IPTC Job, smart-preview status, membership of smart collections. Choice values read as words in every language (Public Domain, Black & White; `album.ruleFields` gives `choiceLabels`), while rules store the ids; yes/no fields read Yes / No and take `true`/`false`, `"yes"`/`"no"`, `"true"`/`"false"` or 1/0. Every value is checked against its field (`RuleSet::check`): numbers (rating 0–5), shutter speeds, dates (`2026`, `2026-08`, `2026-08-14`, a full time; no 30 February), between = two bounds in order, in the last = more than 0 of a known unit, choices (ids, the flag's picked / rejected, a colour label's custom name), text with something to look for, an existing plain album, no empty groups; each problem names its rule (`rule 2.1: rating is 0–5, not 9`), and album.createSmart / setRules / library.filter refuse them. The editor marks each bad rule under its row (inside groups too), keeps OK disabled until they are fixed (and its confirm refuses them before renaming anything), picks an Album rule's album from a list of the plain albums, named with their folder and sorted by name (is / isn't; a folder can't be tested), and drawing it never changes a rule: a rating of 9, "in the last 0 days" or 20,000 days, a "between" that isn't a pair all stay as stored (and are marked where they can't match) until edited. Album rules saved with an old operator (≥, between) are read as the "isn't" they always meant (`RuleSet::upgrade`). Saved smart albums whose rules no longer check are marked ⚠ in the sidebar (tooltip: what to fix; `albums.list` `problems`, `Catalog::smart_album_problems`); the name and rules of an album are saved as one undo step (`album.setRules` `name`). Not yet: problem messages are English and name fields by id || LRC-LIB-PUBLISH | Publish services | P2 | ⬜ | | || LRC-LIB-FILTERBAR | Library filter bar | P1 | ✅ | `cmd:view.filterBar`, `cmd:filter.applyPreset`, `cmd:library.filter` (`labels`, `ruleSet`), `crates/ui-egui/src/panels/filterbar.rs` | rating/flag/label (several labels at once = any of them)/kind/edited/camera/lens/keyword, clear, save as smart album, filter presets; the filter stays as you change albums (always locked, as in the desktop app); arbitrary conditions via the smart-album rule editor || LRC-LIB-STACKS | Stacks (full) | P1 | ✅ | `crates/catalog/src/stacks.rs`, `cmd:stack.group`, `cmd:stack.split`, `cmd:stack.moveUp`, `cmd:stack.moveDown` | group / ungroup / toggle / set top / remove / auto by time / split / move up and down |diff --git a/docs/whats-new.md b/docs/whats-new.mdindex 5b97d1c85..8252f9c31 100644--- a/docs/whats-new.md+++ b/docs/whats-new.md@@ -17,6 +17,8 @@way round, "in the last 0 days", a colour label that doesn't exist, "contains" with nothing to look for, analbum that is gone or smart, or an empty group is reported with its rule ("rule 2.1: rating is 0–5, not 9")instead of quietly matching nothing or everything. New date rules start at the current year.+- A smart album whose rules no longer check (an album they test was deleted) is marked ⚠ in the sidebar; its tooltip+ says what to fix, and `albums.list` reports `problems`.- Editing a smart album's name and rules is one step: both or neither, and one undo takes both back(`album.setRules` takes `name`).- The rule editor marks each rule that needs fixing right under it and keeps OK disabled until they are fixed. An