Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Merge main into worktree-agent-ab72a7623afb95196

Brandon Thomas22e4f0fd8c66
diff --cc crates/engine/src/lib.rs
index bd9e38522,63a93e400..290fee45f
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@@ -103,8 -104,10 +105,12 @@@ pub struct Session
pub xmp: sidecar::XmpPrefs,
/// Parameters of the last export (`app.export` params, minus targets), persisted in prefs.json.
pub last_export: Option<serde_json::Value>,
+ /// File probes from the last import review (`library.importPreview`), reused by the import.
+ pub import_probes: std::collections::HashMap<String, media::ProbeInfo>,
+ /// Develop defaults applied on import (persisted in prefs.json).
+ pub import_defaults: import::ImportDefaults,
+ /// Disk budget of the library's thumbnail cache in MB (0 = default; persisted in prefs.json).
+ pub cache_mb: u32,
}
impl Default for Session {
@@@ -140,7 -144,8 +147,9 @@@ impl Session
library: None,
xmp: sidecar::XmpPrefs::default(),
last_export: None,
+ import_probes: Default::default(),
+ import_defaults: import::ImportDefaults::default(),
+ cache_mb: 0,
}
}
diff --cc crates/ui-egui/src/headless.rs
index 67269ef5d,dfd630eea..a72b9e4c9
--- a/crates/ui-egui/src/headless.rs
+++ b/crates/ui-egui/src/headless.rs
@@@ -467,196 -463,133 +467,323 @@@ mod tests
h.settle(SETTLE);
}
+ /// The photo grid shows date headers (registered as `group:<date>` widgets); clicking one
+ /// selects that day's photos; month headers when zoomed out; none when grouping is off.
+ #[test]
+ fn grid_groups_by_capture_date() {
+ let mut h = demo([1300.0, 800.0]);
+ let t = Duration::from_secs(10);
+ h.settle(SETTLE);
+ let groups = h.app.session.execute("library.groups", &json!({})).unwrap();
+ let first = groups[0].clone();
+ let key = first["key"].as_str().unwrap().to_string();
+ let r = h.request("ui.clickWidget", json!({"id": format!("group:{key}")}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ assert_eq!(h.app.session.selection.ids.len() as u64, first["count"].as_u64().unwrap());
+ // zoomed out: month headers
+ h.app.ui.thumb_size = 120.0;
+ h.settle(SETTLE);
+ let vis = h.app.session.visible_cloned();
+ let month = h.app.session.catalog.date_runs(&vis, h.app.session.sort.key, lightcraft_catalog::GroupBy::Month);
+ let r = h.request("ui.clickWidget", json!({"id": format!("group:{}", month[0].key)}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ h.request("engine.execute", json!({"command": "library.sort", "params": {"group": "none"}}), t);
+ let r = h.request("ui.clickWidget", json!({"id": format!("group:{}", month[0].key)}), t);
+ assert_eq!(r["ok"], false, "no headers: {r}");
+ h.settle(SETTLE);
+ }
+
+ /// Keywords: the left-panel tree filters (children included), opens levels, the rename dialog
+ /// renames library-wide, and the Keywords panel adds a suggestion.
+ #[test]
+ fn keyword_list_filters_renames_and_suggests() {
+ // tall: the demo library's own keywords come first in the list
+ let mut h = demo([1300.0, 1800.0]);
+ let t = Duration::from_secs(10);
+ let vis: Vec<u64> = h.app.session.visible_cloned().iter().map(|p| p.0).collect();
+ let ex = |h: &mut Headless, c: &str, p: Value| h.request("engine.execute", json!({"command": c, "params": p}), Duration::from_secs(10));
+ ex(&mut h, "photo.setMeta", json!({"ids": [vis[0], vis[1]], "addKeywords": ["travel|italy"]}));
+ ex(&mut h, "photo.setMeta", json!({"ids": [vis[2]], "addKeywords": ["travel|france"]}));
+ h.request("ui.set", json!({"leftPanel": true}), t);
+ let r = h.request("ui.clickWidget", json!({"id": "source:keyword:travel"}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ assert_eq!(h.app.session.filter.keyword.as_deref(), Some("travel"));
+ assert_eq!(h.app.session.visible_cloned().len(), 3);
+ // open the level, filter by the child
+ h.request("ui.clickWidget", json!({"id": "keywordToggle:travel"}), t);
+ let r = h.request("ui.clickWidget", json!({"id": "source:keyword:travel|italy"}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ assert_eq!(h.app.session.visible_cloned().len(), 2);
+ h.app.ui.dialog = Some(crate::state::Dialog::RenameKeyword { from: "travel".into(), to: "trips".into() });
+ h.settle(SETTLE);
+ let r = h.request("ui.dialog.confirm", json!({}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ assert_eq!(h.app.session.filter.keyword.as_deref(), Some("trips|italy"));
+ assert_eq!(h.app.session.visible_cloned().len(), 2);
+ // Keywords panel: suggestions co-occurring with the photo's keywords
+ h.request("engine.execute", json!({"command": "library.clearFilter"}), t);
+ h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [vis[1]]}}), t);
+ ex(&mut h, "photo.setMeta", json!({"ids": [vis[0]], "addKeywords": ["gelato"]}));
+ h.request("ui.set", json!({"right": "keywords"}), t);
+ let r = h.request("ui.clickWidget", json!({"id": "kwSuggest:gelato"}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ assert!(h.app.session.catalog.photo(lightcraft_catalog::PhotoId(vis[1])).unwrap().meta.keywords.contains(&"gelato".to_string()));
+ h.settle(SETTLE);
+ }
+
+ /// Photo > Rename Photos…: the dialog previews and renames the selection.
+ #[test]
+ fn rename_dialog_renames_the_selection() {
+ let mut h = demo([1200.0, 800.0]);
+ let t = Duration::from_secs(10);
+ let vis: Vec<u64> = h.app.session.visible_cloned().iter().take(2).map(|p| p.0).collect();
+ h.request("engine.execute", json!({"command": "library.select", "params": {"ids": vis}}), t);
+ let tree = h.request("ui.menu.tree", json!({}), t);
+ assert!(tree.to_string().contains("Rename 2 Photos…"), "live menu label");
+ h.request("engine.execute", json!({"command": "dialog.rename", "params": {"template": "Trip-{seq:2}", "start": 5}}), t);
+ h.settle(SETTLE);
+ let r = h.request("ui.dialog.confirm", json!({}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ let name = |id: u64| h.app.session.catalog.photo(lightcraft_catalog::PhotoId(id)).unwrap().file_name.clone();
+ assert!(name(vis[0]).starts_with("Trip-05."), "{}", name(vis[0]));
+ assert!(name(vis[1]).starts_with("Trip-06."), "{}", name(vis[1]));
+ h.settle(SETTLE);
+ }
+
+ /// Info panel → Edit Capture Time…: a time-zone shift moves the selected photos.
+ #[test]
+ fn capture_time_dialog_shifts_time_zone() {
+ let mut h = demo([1200.0, 900.0]);
+ let t = Duration::from_secs(10);
+ let id = h.app.session.visible_cloned()[0];
+ h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [id.0]}}), t);
+ h.request("ui.set", json!({"view": "detail", "right": "info"}), t);
+ let before = h.app.session.catalog.photo(id).unwrap().captured.clone().unwrap();
+ let r = h.request("ui.clickWidget", json!({"id": "button:editCaptureTime"}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ h.request("ui.clickWidget", json!({"id": "button:captureMode-2"}), t);
+ if let Some(crate::state::Dialog::CaptureTime { zone, .. }) = &mut h.app.ui.dialog {
+ *zone = -3.0;
+ } else {
+ panic!("dialog not open: {:?}", h.app.ui.dialog);
+ }
+ h.settle(SETTLE);
+ let r = h.request("ui.dialog.confirm", json!({}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ let after = h.app.session.catalog.photo(id).unwrap().captured.clone().unwrap();
+ let secs = lightcraft_catalog::dates::iso_seconds;
+ assert_eq!(secs(&after).unwrap() - secs(&before).unwrap(), -3 * 3600);
+ h.settle(SETTLE);
+ }
+
+ /// Colour labels: Info-panel swatches set/clear the label, the names dialog renames them and
+ /// the Photo menu shows the names.
+ #[test]
+ fn label_swatches_and_names() {
+ let mut h = demo([1200.0, 900.0]);
+ let t = Duration::from_secs(10);
+ let id = h.app.session.visible_cloned()[0];
+ h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [id.0]}}), t);
+ h.request("ui.set", json!({"view": "detail", "right": "info"}), t);
+ let r = h.request("ui.clickWidget", json!({"id": "label:green"}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ assert_eq!(h.app.session.catalog.photo(id).unwrap().label, Some(lightcraft_catalog::ColorLabel::Green));
+ h.request("engine.execute", json!({"command": "dialog.labelNames"}), t);
+ if let Some(crate::state::Dialog::LabelNames { names }) = &mut h.app.ui.dialog {
+ names[2] = "Approved".into();
+ } else {
+ panic!("no dialog");
+ }
+ h.settle(SETTLE);
+ let r = h.request("ui.dialog.confirm", json!({}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ let tree = h.request("ui.menu.tree", json!({}), t).to_string();
+ assert!(tree.contains("Approved (Green)"), "menu shows the name");
+ h.request("ui.clickWidget", json!({"id": "label:green"}), t);
+ assert_eq!(h.app.session.catalog.photo(id).unwrap().label, None, "clicking the current label clears it");
+ h.settle(SETTLE);
+ }
+
+ /// File → Add Photos… opens the import review: candidates with thumbnails, the duplicate is
+ /// unchecked; unchecking a cell and confirming imports the rest in batches, into a new album
+ /// with keywords, as one undo step.
+ #[test]
+ fn import_review_dialog() {
+ let dir = std::env::temp_dir().join(format!("lc-ui-import-{}", std::process::id()));
+ let _ = std::fs::remove_dir_all(&dir);
+ std::fs::create_dir_all(&dir).unwrap();
+ for i in 0..5u8 {
+ let (w, h) = (40usize, 30usize);
+ let data: Vec<[u8; 4]> = (0..w * h).map(|k| [(k % w * 6) as u8, i * 40, (k / w * 8) as u8, 255]).collect();
+ let img = lightcraft_raster::Rgba8 { width: w, height: h, data };
+ let png = lightcraft_codecs::encode_png(&lightcraft_codecs::EncodeImage::rgba8(&img), &lightcraft_codecs::EncodeMeta::default()).unwrap();
+ std::fs::write(dir.join(format!("img{i}.png")), png).unwrap();
+ }
+ std::fs::copy(dir.join("img0.png"), dir.join("img0-copy.png")).unwrap();
+ let services = crate::Services { png: None, ..Default::default() };
+ let mut app = LightcraftApp::new(lightcraft_engine::Session::with_demo().with_fs(), services);
+ app.ui.view = crate::state::ViewMode::PhotoGrid;
+ let mut h = Headless::new(app, [1300.0, 900.0], 1.0);
+ let t = Duration::from_secs(10);
+ let n0 = h.app.session.catalog.len();
+ let undo0 = h.app.session.undo.len();
+ let r = h.request("engine.execute", json!({"command": "file.addPhotos", "params": {"paths": [dir.to_string_lossy()]}}), t);
+ assert_eq!(r["result"]["candidates"], 6, "{r}");
+ assert_eq!(r["result"]["duplicates"], 1, "{r}");
+ h.settle(SETTLE);
+ assert!(h.app.renderer.textures.keys().filter(|s| matches!(s, crate::render::Slot::Import(_))).count() >= 5, "thumbnails");
+ // uncheck the first photo; name a new album and keywords
+ let r = h.request("ui.clickWidget", json!({"id": "import:0"}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ if let Some(crate::state::Dialog::Import { opts }) = &mut h.app.ui.dialog {
+ assert_eq!(opts.selected_paths().len(), 4, "duplicate and unchecked photo left out");
+ opts.new_album = "Card 1".into();
+ opts.keywords = "cardone, 2026".into();
+ } else {
+ panic!("no import dialog");
+ }
+ let r = h.request("ui.dialog.confirm", json!({}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ h.settle(SETTLE);
+ assert!(h.app.import.is_none(), "finished");
+ assert_eq!(h.app.session.catalog.len(), n0 + 4);
+ let album = h.app.session.catalog.albums().find(|a| a.name == "Card 1").expect("album").id;
+ assert_eq!(h.app.session.catalog.album_count(album), 4);
+ assert!(h.app.session.catalog.photos().filter(|p| p.meta.keywords.contains(&"cardone".to_string())).count() == 4);
+ assert_eq!(h.app.session.undo.len(), undo0 + 1, "one undo step");
+ h.request("engine.execute", json!({"command": "edit.undo"}), t);
+ assert_eq!(h.app.session.catalog.len(), n0);
+ h.settle(SETTLE);
+ let _ = std::fs::remove_dir_all(&dir);
+ }
+
+ /// Settings (⌘,): tabs switch, app settings change the UI state, library settings go through
+ /// the engine; the delete confirmation guards ⌫.
+ #[test]
+ fn settings_dialog_by_keyboard_and_clicks() {
+ let mut h = demo([1300.0, 820.0]);
+ let t = Duration::from_secs(10);
+ let r = h.request("ui.key", json!({"key": ",", "cmd": true}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ assert_eq!(h.app.ui.dialog, Some(crate::state::Dialog::Settings { tab: "general".into() }));
+ for tab in ["import", "performance", "interface", "general"] {
+ let r = h.request("ui.clickWidget", json!({"id": format!("button:settingsTab-{tab}")}), t);
+ assert_eq!(r["ok"], true, "{tab}: {r}");
+ assert_eq!(h.app.ui.dialog, Some(crate::state::Dialog::Settings { tab: tab.into() }));
+ }
+ // General: confirm before delete, startup view
+ h.request("ui.clickWidget", json!({"id": "check:settings.confirmDelete"}), t);
+ assert!(h.app.ui.settings.confirm_delete);
+ h.request("ui.clickWidget", json!({"id": "button:settingsStartup-2"}), t);
+ assert_eq!(h.app.ui.settings.startup_view, crate::state::StartupView::Detail);
+ // Interface: filmstrip names off, grid badges always
+ h.request("ui.clickWidget", json!({"id": "button:settingsTab-interface"}), t);
+ h.request("ui.clickWidget", json!({"id": "check:settings.filmNames"}), t);
+ assert!(!h.app.ui.settings.film_names);
+ h.request("ui.clickWidget", json!({"id": "button:settingsGridBadges-1"}), t);
+ assert_eq!(h.app.ui.settings.grid_badges, crate::state::GridBadges::Always);
+ // Performance: the thumbnail cache size goes to the library preferences
+ h.request("ui.clickWidget", json!({"id": "button:settingsTab-performance"}), t);
+ h.request("ui.clickWidget", json!({"id": "button:settingsCache-0"}), t);
+ assert_eq!(h.app.session.cache_mb, 512);
+ h.request("ui.clickWidget", json!({"id": "button:settingsPreview-2"}), t);
+ assert_eq!(h.app.ui.settings.preview_edge, 3840);
+ h.request("ui.clickWidget", json!({"id": "button:settingsMemory-2"}), t);
+ assert_eq!(h.app.ui.settings.memory_mb, 1024);
+ h.step();
+ assert_eq!(lightcraft_engine::memory::budget(), 1024 << 20, "applied through app.memoryBudget");
+ h.request("ui.clickWidget", json!({"id": "button:settingsMemory-0"}), t);
+ h.step();
+ assert_eq!(lightcraft_engine::memory::budget(), lightcraft_engine::memory::default_budget(), "back to automatic");
+ // Import: per-camera defaults
+ h.request("ui.clickWidget", json!({"id": "button:settingsTab-import"}), t);
+ h.request("ui.clickWidget", json!({"id": "check:settings.perCamera"}), t);
+ assert!(h.app.session.import_defaults.per_camera);
+ let img = h.snapshot(SETTLE);
+ assert_eq!(img.size, [1300, 820]);
+ // Escape closes; ⌫ now asks first
+ h.request("ui.key", json!({"key": "escape"}), t);
+ assert_eq!(h.app.ui.dialog, None);
+ let active = h.app.session.active().unwrap();
+ h.request("ui.key", json!({"key": "delete"}), t);
+ assert_eq!(h.app.ui.dialog, Some(crate::state::Dialog::ConfirmDelete { count: 1 }));
+ assert!(!h.app.session.catalog.photo(active).unwrap().deleted);
+ let r = h.request("ui.dialog.confirm", json!({}), t);
+ assert_eq!(r["ok"], true, "{r}");
+ assert!(h.app.session.catalog.photo(active).unwrap().deleted);
+ // app settings survive a save/load round trip of the UI state (ui.json)
+ let saved = serde_json::to_string(&h.app.ui).unwrap();
+ let back = serde_json::from_str::<crate::UiState>(&saved).unwrap().sanitized();
+ assert_eq!(back.settings, h.app.ui.settings);
+ assert_eq!(back.view, crate::state::ViewMode::Detail, "startup view applied on load");
+ h.settle(SETTLE);
+ }
+
+ /// F: full-screen preview (arrows step, I cycles the info overlay, Esc exits); ⌘I cycles the
+ /// overlay in Detail; ⇧⌘F asks the host for window full screen.
+ #[test]
+ fn full_screen_preview_and_info_overlay_by_keyboard() {
+ use crate::state::InfoOverlay;
+ let mut h = demo([1000.0, 700.0]);
+ let t = Duration::from_secs(10);
+ let vis: Vec<u64> = h.app.session.visible_cloned().iter().map(|p| p.0).collect();
+ h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [vis[0]]}}), t);
+ h.request("ui.key", json!({"key": "f"}), t);
+ assert!(h.app.ui.fullscreen);
+ h.request("ui.key", json!({"key": "right"}), t);
+ assert_eq!(h.app.session.active().map(|p| p.0), Some(vis[1]));
+ let right = h.app.ui.right;
+ h.request("ui.key", json!({"key": "i"}), t);
+ assert_eq!(h.app.ui.info_overlay, InfoOverlay::Basic);
+ assert_eq!(h.app.ui.right, right, "I doesn't open the Info panel in full screen");
+ let img = h.snapshot(SETTLE);
+ // no chrome: the frame's corners are black
+ for (x, y) in [(2usize, 2usize), (997, 2), (2, 697), (997, 697)] {
+ let c = img.pixels[y * 1000 + x];
+ assert!(c.r() < 8 && c.g() < 8 && c.b() < 8, "({x},{y}) = {c:?}");
+ }
+ assert!(h.app.widgets.iter().any(|(w, _)| w == "canvas:infoOverlay"));
+ h.request("ui.key", json!({"key": "escape"}), t);
+ assert!(!h.app.ui.fullscreen);
+ assert_eq!(h.app.ui.view, crate::state::ViewMode::PhotoGrid, "Esc leaves full screen only, back to where it was entered");
+ h.request("ui.set", json!({"view": "detail"}), t);
+ h.request("ui.key", json!({"key": "i", "cmd": true}), t);
+ assert_eq!(h.app.ui.info_overlay, InfoOverlay::Exposure);
+ h.request("ui.key", json!({"key": "i", "cmd": true}), t);
+ assert_eq!(h.app.ui.info_overlay, InfoOverlay::Off);
+ h.request("ui.key", json!({"key": "f", "cmd": true, "shift": true}), t);
+ assert!(h.app.window_is_fullscreen);
+ h.request("ui.key", json!({"key": "f", "cmd": true, "shift": true}), t);
+ assert!(!h.app.window_is_fullscreen);
+ h.settle(SETTLE);
+ }
+
+ /// The Navigator appears when zoomed in; clicking it pans to that point.
+ #[test]
+ fn navigator_pans_the_zoomed_loupe() {
+ let mut h = demo([1000.0, 700.0]);
+ let t = Duration::from_secs(10);
+ h.request("ui.set", json!({"view": "detail", "right": "none"}), t);
+ h.settle(SETTLE);
+ assert!(!h.app.widgets.iter().any(|(w, _)| w == "canvas:navigator"), "hidden at Fit");
+ h.request("engine.execute", json!({"command": "view.zoom100"}), t);
+ h.settle(SETTLE);
+ assert!(h.app.widgets.iter().any(|(w, _)| w == "canvas:navigator"), "navigator shown when zoomed");
+ h.request("ui.clickWidget", json!({"id": "canvas:navigator", "fx": 0.1, "fy": 0.2}), t);
+ let (u, v) = h.app.ui.pan;
+ assert!((u - 0.1).abs() < 0.03 && (v - 0.2).abs() < 0.03, "pan {:?}", h.app.ui.pan);
+ assert_eq!(h.app.ui.zoom, crate::state::Zoom::Percent(100), "the click didn't reach the loupe (which would zoom out)");
+ h.settle(SETTLE);
+ let nav = h.app.widgets.iter().rev().find(|(w, _)| w == "canvas:navigator").map(|(_, r)| *r).unwrap();
+ let to = nav.min + egui::vec2(nav.width() * 0.8, nav.height() * 0.7);
+ h.request("ui.dragWidget", json!({"id": "canvas:navigator", "fx": 0.5, "fy": 0.5, "toX": to.x, "toY": to.y}), t);
+ let (u, v) = h.app.ui.pan;
+ assert!((u - 0.8).abs() < 0.03 && (v - 0.7).abs() < 0.03, "drag pan {:?}", h.app.ui.pan);
+ h.request("engine.execute", json!({"command": "view.navigator"}), t);
+ h.settle(SETTLE);
+ assert!(!h.app.widgets.iter().any(|(w, _)| w == "canvas:navigator"), "toggled off");
+ }
+
#[test]
fn screenshot_request_is_answered_without_a_window() {
let mut h = demo([800.0, 500.0]);
diff --cc crates/ui-egui/src/lib.rs
index 25ea8e5ac,c857545ac..5ae238296
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@@ -130,8 -140,10 +143,11 @@@ impl LightcraftApp
gesture: None,
loupe_shown: None,
merge: merge::MergeState::default(),
+ import: None,
hover_preview: None,
+ window_is_fullscreen: false,
+ gpu_applied: None,
+ memory_applied: None,
}
}
diff --cc crates/ui-egui/src/panels/dialogs.rs
index d36f85274,8f5bb92d3..718726b06
--- a/crates/ui-egui/src/panels/dialogs.rs
+++ b/crates/ui-egui/src/panels/dialogs.rs
@@@ -323,7 -207,12 +354,13 @@@ pub fn show(app: &mut LightcraftApp, ct
field(ui, "Folder", |ui| ui.add(egui::TextEdit::singleline(dir).desired_width(f32::INFINITY)));
}
Dialog::Merge { opts } => crate::merge::body(app, ui, opts),
+ Dialog::Import { opts } => crate::import::body(app, ui, opts),
+ Dialog::Settings { tab } => crate::panels::settings::body(app, ui, tab),
+ Dialog::ConfirmDelete { count } => {
+ let what = if *count == 1 { "this photo".to_string() } else { format!("these {count} photos") };
+ ui.label(format!("Move {what} to Recently Deleted?"));
+ ui.label(egui::RichText::new("They can be restored from Recently Deleted until it is emptied.").color(t.text_dim));
+ }
Dialog::About => {
ui.label(egui::RichText::new("LightCraft").font(t.semibold(20.0)).color(t.text));
ui.label(format!("Version {} — a clean-room, pure-Rust photo library and raw developer.", env!("CARGO_PKG_VERSION")));
@@@ -370,14 -259,9 +407,15 @@@
if !informational && ui.button("Cancel").clicked() {
close = true;
}
- let ok = match dlg {
+ let add_label;
+ let ok = match &dlg {
+ Dialog::Import { opts } => {
+ let n = opts.selected_paths().len();
+ add_label = format!("Add {n} Photo{}", if n == 1 { "" } else { "s" });
+ add_label.as_str()
+ }
Dialog::Merge { .. } => "Merge",
+ Dialog::ConfirmDelete { .. } => "Delete",
_ if informational => "Close",
_ => "OK",
};
@@@ -459,8 -326,8 +498,9 @@@ pub fn confirm_dialog(app: &mut Lightcr
}),
),
Dialog::Merge { opts } => crate::merge::start_final(app, opts),
+ Dialog::Import { opts } => crate::import::start(app, opts),
- Dialog::About | Dialog::Shortcuts => Ok(serde_json::Value::Null),
+ Dialog::ConfirmDelete { .. } => app.run("photo.delete", json!({})),
+ Dialog::About | Dialog::Shortcuts | Dialog::Settings { .. } => Ok(serde_json::Value::Null),
}
}
diff --cc crates/ui-egui/src/panels/grid.rs
index c500bbf8c,c949eda6a..37175302c
--- a/crates/ui-egui/src/panels/grid.rs
+++ b/crates/ui-egui/src/panels/grid.rs
@@@ -312,7 -203,11 +312,11 @@@ fn cell(app: &mut LightcraftApp, ui: &m
p.rect_filled(br, 2.0, Color32::from_gray(26));
p.galley(br.min + vec2(4.0, 1.5), g, t.text_label);
}
- let show_badges = resp.hovered() || selected || photo.rating > 0 || photo.flag != Flag::None || photo.label.is_some();
+ let show_badges = match app.ui.settings.grid_badges {
- crate::state::GridBadges::Auto => resp.hovered() || selected || photo.rating > 0 || photo.flag != Flag::None,
++ crate::state::GridBadges::Auto => resp.hovered() || selected || photo.rating > 0 || photo.flag != Flag::None || photo.label.is_some(),
+ crate::state::GridBadges::Always => true,
+ crate::state::GridBadges::Never => false,
+ };
if show_badges {
let bar = Rect::from_min_max(pos2(img_rect.left(), img_rect.bottom() - 24.0), img_rect.right_bottom());
if resp.hovered() || selected {
diff --cc docs/parity.md
index 5556570d8,c4e840f3e..ad7c03812
--- a/docs/parity.md
+++ b/docs/parity.md
@@@ -21,9 -21,9 +21,9 @@@ and prints the summary; `cargo xtask pa
<!-- parity:summary -->
| Section | ✅ | 🟡 | ⬜ | 🚫 | P0 done | P1 done |
|---|---:|---:|---:|---:|---:|---:|
- | A. Import (IMP) | 2 | 4 | 7 | 1 | 1/4 (25%) | 1/4 (25%) |
-| A. Import (IMP) | 3 | 4 | 6 | 1 | 1/4 (25%) | 2/4 (50%) |
--| B. Library management (LIB) | 12 | 4 | 9 | 2 | 7/9 (78%) | 4/9 (44%) |
- | C. Views & navigation (VIEW) | 9 | 2 | 6 | 0 | 7/9 (78%) | 1/4 (25%) |
-| C. Views & navigation (VIEW) | 12 | 2 | 3 | 0 | 7/9 (78%) | 4/4 (100%) |
++| A. Import (IMP) | 5 | 3 | 5 | 1 | 2/4 (50%) | 2/4 (50%) |
++| B. Library management (LIB) | 16 | 2 | 7 | 2 | 8/9 (89%) | 7/9 (78%) |
++| C. Views & navigation (VIEW) | 13 | 1 | 3 | 0 | 8/9 (89%) | 4/4 (100%) |
| D. Search & filter (FILT) | 7 | 2 | 4 | 0 | 4/4 (100%) | 3/4 (75%) |
| E. Metadata (META) | 2 | 2 | 2 | 0 | 2/2 (100%) | 0/2 (0%) |
| F. Edit panel — global adjustments (EDIT) | 36 | 2 | 10 | 1 | 28/28 (100%) | 8/14 (57%) |
@@@ -39,39 -39,32 +39,27 @@@
| P. Enhance (ENH) | 0 | 0 | 2 | 0 | — | — |
| Q. HDR (HDR) | 0 | 0 | 5 | 0 | — | — |
| R. Video (VID) | 0 | 0 | 5 | 1 | — | 0/2 (0%) |
- | S. Export (EXP) | 4 | 6 | 8 | 0 | 2/7 (29%) | 2/7 (29%) |
+ | S. Export (EXP) | 6 | 6 | 6 | 0 | 3/7 (43%) | 3/7 (43%) |
| T. Share (SHARE) | 0 | 0 | 0 | 4 | — | — |
| U. Map & location (MAP) | 0 | 1 | 1 | 0 | — | 0/1 (0%) |
- | V. Preferences (PREF) | 0 | 3 | 5 | 3 | 0/1 (0%) | 0/4 (0%) |
+ | V. Preferences (PREF) | 4 | 1 | 3 | 3 | 1/1 (100%) | 3/4 (75%) |
| W. Cloud & AI infrastructure (CLOUD / AI) | 0 | 1 | 1 | 2 | — | — |
| X. Cross-cutting behaviours (BEHAV) | 10 | 3 | 4 | 1 | 7/8 (88%) | 3/5 (60%) |
- | Y. Menus | 46 | 18 | 21 | 8 | 37/47 (79%) | 7/23 (30%) |
- | Z. Keyboard shortcuts (desktop) | 46 | 16 | 18 | 1 | 39/52 (75%) | 7/23 (30%) |
- | Lightroom Classic extras | 4 | 19 | 56 | 9 | — | 3/21 (14%) |
- | **Total** | 213 | 101 | 186 | 37 | 155/198 (78%) | 49/144 (34%) |
-| Y. Menus | 50 | 18 | 17 | 8 | 38/47 (81%) | 10/23 (43%) |
++| Y. Menus | 53 | 17 | 15 | 8 | 38/47 (81%) | 13/23 (57%) |
+ | Z. Keyboard shortcuts (desktop) | 53 | 14 | 13 | 1 | 44/52 (85%) | 9/23 (39%) |
-| Lightroom Classic extras | 4 | 19 | 56 | 9 | — | 3/21 (14%) |
-| **Total** | 240 | 91 | 169 | 37 | 168/198 (85%) | 63/144 (44%) |
++| Lightroom Classic extras | 4 | 20 | 55 | 9 | — | 3/21 (14%) |
++| **Total** | 250 | 87 | 163 | 37 | 171/198 (86%) | 69/144 (48%) |
<!-- /parity:summary -->
## Top gaps
Ordered by tier, then user value, then (low) effort. Take the first one nobody is working on.
- 1. **LR-EXP-COLORSPACE** (P0) — export is sRGB only. Add Display P3 / Adobe RGB-compatible / ProPhoto-compatible /
- Rec.2020 output (our own primaries + ICC from `crates/codecs/src/icc.rs`). High value, low–medium effort.
- 2. **LR-MASK-OVERLAY + LR-MASK-PINS** (P0/P1) — show the evaluated mask alpha as a coloured overlay (all mask
- kinds, colour/opacity choice), not just brush dabs and outlines. High value, medium effort.
- 3. **LR-MASK-BRUSH + LR-MASK-SLIDERS** (P0) — apply the stored Auto Mask flag (edge-aware brush) and the local
- Noise / Moiré / Defringe sliders, which are stored but not rendered. High value, medium effort.
- 4. **LR-REM-SPOT-EDIT + LR-REM-BRUSH-PARAMS** (P0) — select a spot pin, move target/source, delete with ⌫,
- feather/opacity sliders, `[`/`]` size keys. Medium effort.
- 7. **LR-PREF-GENERAL + LR-IMP-RAWDEFAULT** (P0/P1) — a Settings dialog: raw defaults (preset or camera-specific),
- XMP prefs, cache, GPU. Medium effort.
- 9. **LR-EXP-TYPE + LR-EXP-DIM** (P0) — Original (+XMP) and DNG export (writer exists in
-1. **LR-VIEW-PHOTOGRID** (P0) — group the justified grid by capture date with headers. Low–medium effort.
-2. **LR-LIB-KEYWORD** (P0) — rename/delete a keyword library-wide; keyword list in the left panel for browsing.
-3. **LR-IMP-ADD-DIALOG + LR-IMP-LOCAL** (P0) — an import review grid with per-photo checkboxes and destination
- album; browse folders before adding. Medium effort.
-4. **LR-EXP-TYPE + LR-EXP-DIM** (P0) — Original (+XMP) and DNG export (writer exists in
++1. **LR-EXP-TYPE + LR-EXP-DIM** (P0) — Original (+XMP) and DNG export (writer exists in
`crates/raw/src/dngwrite.rs`), short edge / width / height / megapixels, "don't enlarge", ppi.
- 10. **LR-IMP-FORMATS** (P0) — CR3, compressed NEF/RAF/ORF, RW2 v4 (preview only today); HEIC/AVIF decode (no
-5. **LR-IMP-FORMATS** (P0) — CR3, compressed NEF/RAF/ORF, RW2 v4 (preview only today); HEIC/AVIF decode (no
++2. **LR-IMP-FORMATS** (P0) — CR3, compressed NEF/RAF/ORF, RW2 v4 (preview only today); HEIC/AVIF decode (no
permissive pure-Rust decoder yet). High value, high effort (clean sources needed).
- 11. **LR-VIEW-FULLSCREEN + LR-VIEW-NAVIGATOR + LR-VIEW-INFOOVERLAY** (P1) — view modes. Medium effort.
- 13. **LR-EXP-BITDEPTH + LR-EXP-COMPRESSION** (P1) — 16-bit TIFF/PNG and TIFF compression choice.
- 14. **LR-EDIT-OPTICS-PROFILE** (P1) — a lens-profile database of our own (embedded DNG/maker corrections work today).
-6. **LR-LIB-RENAME + LR-LIB-CAPTURETIME + LR-LIB-LABEL UI** (P1) — batch rename, capture-time edit, label menu/names.
-7. **LR-EDIT-OPTICS-PROFILE** (P1) — a lens-profile database of our own (embedded DNG/maker corrections work today).
++3. **LR-EDIT-OPTICS-PROFILE** (P1) — a lens-profile database of our own (embedded DNG/maker corrections work today).
## Shortcuts: conflicts and missing bindings
@@@ -117,11 -109,11 +104,11 @@@ under the UI command that wraps it (a n
| LR-IMP-DUPES | Skip duplicates by content | P1 | ✅ | `crates/engine/src/import.rs`, `crates/engine/src/tests_import.rs` | |
| LR-IMP-DEVICE | Import from camera/card | P1 | ⬜ | | no device detection |
| LR-IMP-AUTO | Watched-folder auto import | P2 | ⬜ | | |
-| LR-IMP-PRESET | Preset on import | P2 | ⬜ | | |
+| LR-IMP-PRESET | Preset on import | P2 | ✅ | `cmd:library.import` (`preset`) | chosen in the import review; one History entry |
- | LR-IMP-RAWDEFAULT | Raw defaults | P1 | ⬜ | `crates/engine/src/import.rs` | raws get embedded lens corrections on import; no user raw-default setting |
+ | LR-IMP-RAWDEFAULT | Raw defaults | P1 | ✅ | `cmd:library.preferences`, `crates/engine/src/import.rs`, `crates/ui-egui/src/panels/settings.rs` | LightCraft default / a preset / per camera (make + model); non-raw default too; the preset look counts as unedited and Reset returns to it |
| LR-IMP-MIGRATE | Migrate other catalogs | OOS | 🚫 | | |
| LR-IMP-PROFILES | Import profiles & presets | P1 | 🟡 | `cmd:file.importPresets`, `cmd:preset.import` | presets (.lcpreset, XMP `crs:`) only; no profile import; Adobe profile formats are deliberately unsupported |
-| LR-IMP-LOCAL | Work on files in place | P0 | 🟡 | `cmd:library.import` (mode add), `crates/engine/src/sidecar.rs`, `cmd:library.toggleAutoWriteXmp` | files referenced in place with XMP sidecars; no browse-a-folder-without-adding view |
+| LR-IMP-LOCAL | Work on files in place | P0 | 🟡 | `cmd:library.import` (mode add), `cmd:library.importPreview`, `crates/engine/src/sidecar.rs`, `cmd:library.toggleAutoWriteXmp` | files referenced in place with XMP sidecars; the import review shows a folder's photos before adding (“Add in place” or “Copy into library”); no browse-a-folder-without-adding view in the main grid |
| LR-IMP-SIDECAR-SPLIT | Separate XMP sidecar variants | P2 | ⬜ | `cmd:library.xmpPreferences` | sidecar naming option exists (stem/full), no split sidecars |
| LR-IMP-FORMATS | Supported formats | P0 | 🟡 | `crates/codecs/src/lib.rs`, `crates/raw/src/lib.rs` | JPEG, PNG, TIFF, WebP, JXL, PSD, GIF, BMP; DNG, CR2, ARW, NEF, RAF, RW2, PEF, ORF. Missing: CR3, compressed NEF/RAF/ORF, RW2 v4 (preview only), HEIC/AVIF decode |
| LR-IMP-CULL-AT-IMPORT | Culling analysis at import | P2 | ⬜ | | |
@@@ -163,14 -155,14 +150,14 @@@
| Id | Feature | Tier | Status | Evidence | Missing / notes |
|---|---|---|---|---|---|
-| LR-VIEW-PHOTOGRID | Justified photo grid | P0 | 🟡 | `cmd:view.photoGrid`, `crates/ui-egui/src/panels/grid.rs` | no grouping by date |
-| LR-VIEW-SQUAREGRID | Square grid | P0 | ✅ | `cmd:view.squareGrid` | |
+| LR-VIEW-PHOTOGRID | Justified photo grid | P0 | ✅ | `cmd:view.photoGrid`, `cmd:library.groups`, `cmd:library.sort` (`group`), `crates/ui-egui/src/panels/grid.rs`, `crates/catalog/src/dates.rs` | grouped by capture / import / edit date (day headers “Wednesday, 30 September 2026 · 12 photos”, months or years when zoomed out, or a fixed day/month/year/none choice in the sort menu); sticky header; clicking a header selects its photos; stacks never split |
+| LR-VIEW-SQUAREGRID | Square grid | P0 | ✅ | `cmd:view.squareGrid` | same date headers as the photo grid |
| LR-VIEW-DETAIL | Single-photo view | P0 | ✅ | `cmd:view.detail`, `crates/ui-egui/src/panels/detail.rs` | |
| LR-VIEW-EDIT | Edit view | P0 | ✅ | `cmd:panel.edit` | |
- | LR-VIEW-FULLSCREEN | Full-screen preview | P1 | ⬜ | | |
+ | LR-VIEW-FULLSCREEN | Full-screen preview | P1 | ✅ | `cmd:view.fullScreenPreview`, `cmd:view.enterFullScreen` | photo on black, arrows step, Esc exits; ⇧⌘F window full screen |
| LR-VIEW-FILMSTRIP | Filmstrip | P0 | ✅ | `cmd:view.filmstrip` | |
| LR-VIEW-ZOOM | Zoom & pan | P0 | ✅ | `cmd:view.zoomFit`, `cmd:view.zoom100`, `cmd:view.zoomIn`, `cmd:view.zoomOut`, `cmd:view.zoomToggle` | steps 25–800 % (not 6–1600 %); Fill only in the bottom bar |
- | LR-VIEW-NAVIGATOR | Navigator mini map | P1 | ⬜ | | |
+ | LR-VIEW-NAVIGATOR | Navigator mini map | P1 | ✅ | `cmd:view.navigator`, `crates/ui-egui/src/panels/detail.rs` | shown while zoomed (bottom right); click/drag pans |
| LR-VIEW-BEFOREAFTER | Before / after | P0 | 🟡 | `cmd:view.showOriginal`, `cmd:view.beforeAfter`, `cmd:view.beforeAfterSplit`, `cmd:view.beforeAfterTopBottom`, `cmd:view.beforeAfterSplitTopBottom` | all four layouts; "before" is always the original (no before-state from history) |
| LR-VIEW-COMPARE | Compare two photos | P1 | ✅ | `cmd:view.compare`, `cmd:compare.swap`, `cmd:compare.makeSelect`, `crates/ui-egui/src/panels/compare.rs` | select / candidate, synced zoom + pan, arrows move the candidate; no zoom-link toggle |
| LR-VIEW-SURVEY | Survey view [Classic] | P2 | ✅ | `cmd:view.survey`, `crates/ui-egui/src/panels/compare.rs` | selection tiled (≤ 48), keys act on the active photo, hover × removes |