diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index d3155d1f45..25736c0aac 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1122,7 +1122,7 @@ fn new_smart_album_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, /// The body of the CaptureTime dialog. fn capture_time_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { - let Dialog::CaptureTime { mode, time, days, hours, minutes, zone } = dlg else { return }; + let Dialog::CaptureTime { mode, time, days, hours, minutes, zone, each } = dlg else { return }; let n = app.session.selected().len(); field(ui, "Change", |ui| { ui.spacing_mut().item_spacing.x = 4.0; @@ -1138,7 +1138,12 @@ fn capture_time_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg let r = ui.add(egui::TextEdit::singleline(time).hint_text("2026-09-30 14:05:00").desired_width(f32::INFINITY)); crate::widgets::register(ui, "field:captureTime", r.rect); }); - json!({"time": time}) + // several photos: give them all this time, rather than move them by the active photo's change + if n > 1 { + let r = ui.checkbox(each, crate::i18n::tr("Give every selected photo this time")); + crate::widgets::register(ui, "captureTimeEach", r.rect); + } + json!({"time": time, "each": *each}) } "shift" => { field(ui, "Shift", |ui| { @@ -1180,7 +1185,12 @@ fn capture_time_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg ); } if n > 1 { - ui.label(egui::RichText::new(crate::i18n::tr_format!("All {n} selected photos move by the same amount.", n = n)).color(t.text_dim)); + let note = if mode == "set" && *each { + crate::i18n::tr_format!("All {n} selected photos get this time.", n = n) + } else { + crate::i18n::tr_format!("All {n} selected photos move by the same amount.", n = n) + }; + ui.label(egui::RichText::new(note).color(t.text_dim)); } } diff --git a/crates/ui-egui/src/dialogs/confirm.rs b/crates/ui-egui/src/dialogs/confirm.rs index dedb50cd9b..df689f5c7b 100644 --- a/crates/ui-egui/src/dialogs/confirm.rs +++ b/crates/ui-egui/src/dialogs/confirm.rs @@ -72,10 +72,10 @@ pub fn confirm_dialog(app: &mut LightcraftApp, dlg: &Dialog) -> Result app.run( + Dialog::CaptureTime { mode, time, days, hours, minutes, zone, each } => app.run( "photo.setCaptureTime", match mode.as_str() { - "set" => json!({"time": time}), + "set" => json!({"time": time, "each": each}), "shift" => json!({"shift": *days as i64 * 86_400 + *hours as i64 * 3600 + *minutes as i64 * 60}), _ => json!({"hours": zone}), }, diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index f0a19797ec..e2d0127d7c 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -1337,8 +1337,15 @@ fn ui_commands_9(app: &mut LightcraftApp, _ctx: &egui::Context, id: &str, p: &Va .map(|d| d.replace('T', " ")) .unwrap_or_default(); let mode = p.get("mode").and_then(Value::as_str).unwrap_or("set").to_string(); - app.ui.dialog = - Some(Dialog::CaptureTime { mode, time: time.get(..19).unwrap_or(&time).to_string(), days: 0, hours: 0, minutes: 0, zone: 0.0 }); + app.ui.dialog = Some(Dialog::CaptureTime { + mode, + time: time.get(..19).unwrap_or(&time).to_string(), + days: 0, + hours: 0, + minutes: 0, + zone: 0.0, + each: false, + }); Ok(Value::Null) } "dialog.labelNames" => { diff --git a/crates/ui-egui/src/state/dialog.rs b/crates/ui-egui/src/state/dialog.rs index b4c1469017..2a2837ea7e 100644 --- a/crates/ui-egui/src/state/dialog.rs +++ b/crates/ui-egui/src/state/dialog.rs @@ -78,8 +78,8 @@ pub enum Dialog { params: serde_json::Value, key: String, }, - /// Edit Capture Time: `mode` "set" (`time`; the others shift along), "shift" (by `days`, - /// `hours`, `minutes`) or "zone" (time-zone shift by `zone` hours). + /// Edit Capture Time: `mode` "set" (`time`; the others shift along, or with `each` every photo gets + /// `time`), "shift" (by `days`, `hours`, `minutes`) or "zone" (time-zone shift by `zone` hours). CaptureTime { mode: String, time: String, @@ -87,6 +87,10 @@ pub enum Dialog { hours: i32, minutes: i32, zone: f32, + /// "set" with several photos: every one gets `time` instead of moving by the active photo's change + /// (issue #4205). + #[serde(default)] + each: bool, }, /// The import review (File → Import Photos…). Import { diff --git a/crates/ui-egui/src/tests/capture_time.rs b/crates/ui-egui/src/tests/capture_time.rs index c604ecad1a..8905c12a22 100644 --- a/crates/ui-egui/src/tests/capture_time.rs +++ b/crates/ui-egui/src/tests/capture_time.rs @@ -174,3 +174,50 @@ fn set_mode_does_not_start_from_an_unreadable_time() { ); assert!(painted(&h, "Enter a date"), "alone, the photo will get the time typed, so the preview asks for one: {:?}", h.painted_text()); } + +/// Issue #4205: with several photos selected, Set date & time moves them all by the active photo's change +/// (as Lightroom does), and "Give every selected photo this time" gives each of them the time typed instead. +#[test] +fn every_selected_photo_can_get_the_same_time() { + let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }); + let mut h = Headless::new(app, [1300.0, 900.0], 1.0); + let ids: Vec<_> = h.app.session.visible_cloned().into_iter().take(3).collect(); + let times = ["2026-01-01T10:00:00", "2026-01-02T08:30:00", "2026-02-10T18:45:00"]; + let reset = |h: &mut Headless| { + for (id, t) in ids.iter().zip(times) { + set_captured(h, *id, t); + } + }; + let captured = |h: &Headless| -> Vec { + ids.iter().map(|id| h.app.session.catalog.photo(*id).and_then(|p| p.captured.clone()).unwrap_or_default()).collect() + }; + let set = |h: &mut Headless, each: bool| { + open(h, &ids, ids[0]); + match &mut h.app.ui.dialog { + Some(Dialog::CaptureTime { mode, time, .. }) => { + *mode = "set".into(); + *time = "2026-05-05 12:00:00".into(); + } + other => panic!("Edit Capture Time is not open: {other:?}"), + } + h.settle(SETTLE); + assert!(painted(h, "All 3 selected photos move by the same amount."), "{:?}", h.painted_text()); + if each { + let r = h.request("ui.clickWidget", json!({"id": "captureTimeEach"}), T); + assert_eq!(r["ok"], true, "the option is offered with several photos: {r}"); + h.settle(SETTLE); + assert!(painted(h, "All 3 selected photos get this time."), "{:?}", h.painted_text()); + } + let r = h.request("ui.clickWidget", json!({"id": "button:dialogOk"}), T); + assert_eq!(r["ok"], true, "{r}"); + h.settle(SETTLE); + }; + // as before: the active photo gets the time, the others move by the same amount (+124 days 2 h) + reset(&mut h); + set(&mut h, false); + assert_eq!(captured(&h), ["2026-05-05T12:00:00", "2026-05-06T10:30:00", "2026-06-14T20:45:00"]); + // with the option: every photo gets the time typed + reset(&mut h); + set(&mut h, true); + assert_eq!(captured(&h), ["2026-05-05T12:00:00"; 3]); +} diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index f5304d8af9..2057855476 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -117,7 +117,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-LIB-REMOVE-ALBUM | Remove from album | P0 | ✅ | `cmd:album.removePhotos`, `crates/engine/src/tests/album_remove.rs`, `crates/ui-egui/src/tests/album_remove.rs` | changes the album only: the photos stay in the library, their library folder and their folder on disk (issue #1805); `id` defaults to the album on screen; returns `{removed, album}`. In a normal album ⌫ removes from the album (as in Lightroom; no confirmation, one undo step), in a smart album it changes nothing and says to edit its rules | | LR-LIB-DUPLICATE | Duplicate a photo | P2 | ✅ | `cmd:photo.duplicate` | Photo ▸ Duplicate: a real `-copy` file with the same settings, metadata and albums (virtual copies share the file) | | LR-LIB-RENAME | Batch rename | P1 | ✅ | `cmd:photo.rename`, `cmd:photo.renamePreview`, `cmd:photo.renameTokens`, `cmd:dialog.rename`, `crates/engine/src/rename.rs` (`TOKENS`) | template tokens {name} {num} {seq:N} {date:%Y%m%d} {folder} {camera} {lens} {iso} {rating} {title} {creator} {ext} (shared with export naming and import rename); a Tags picker beside every template field (Rename Photos, import Rename, export File name) lists each tag with meaning + live example, the date directives and the rules, and inserts the clicked tag at the text cursor; unknown tags are flagged; preview; renames files on disk with their XMP sidecars (a stem sidecar another file still shares, e.g. raw + JPEG, is copied rather than taken), never overwriting (-1, -2… suffixes; a change of letter case only is checked by file identity, so on case-sensitive volumes `img_1.jpg` next to `IMG_1.JPG` is a collision), rolls back on failure (a file that can't be moved back is reported old → new and the library follows it as an undoable partial rename; the same for undo/redo); undo/redo move the files; virtual copies follow | -| LR-LIB-CAPTURETIME | Edit capture time | P1 | ✅ | `cmd:photo.setCaptureTime`, `cmd:dialog.captureTime`, `crates/catalog/src/dates.rs` | set (the other selected photos shift by the same amount, or `each`), shift by days/hours/minutes, time-zone shift; one undo step, journaled; Info panel button; no “revert to original capture time”. Impossible calendar dates cannot anchor relative shifts; rejection preserves metadata, selection, Undo and Redo. A capture time that doesn't fully read (cut short, or text after it) is left as it is and counted (`unreadable`); it can't anchor a set that moves other photos, and set alone repairs it. | +| LR-LIB-CAPTURETIME | Edit capture time | P1 | ✅ | `cmd:photo.setCaptureTime`, `cmd:dialog.captureTime`, `crates/catalog/src/dates.rs` | set (the other selected photos shift by the same amount, or `each`), shift by days/hours/minutes, time-zone shift; one undo step, journaled; Info panel button; no “revert to original capture time”. Impossible calendar dates cannot anchor relative shifts; rejection preserves metadata, selection, Undo and Redo. A capture time that doesn't fully read (cut short, or text after it) is left as it is and counted (`unreadable`); it can't anchor a set that moves other photos, and set alone repairs it.; with several photos selected, Set date & time can also give every one the time typed ("Give every selected photo this time", `each`), instead of moving them all by the active photo's change (issue #4205) | | LR-LIB-SHOWFINDER | Reveal original in file manager | P0 | ✅ | `cmd:app.showInFinder` | ⌘R (see MENU-FILE-SHOWFINDER) | | LR-LIB-COVER | Album cover | P2 | ✅ | `cmd:album.setCover` | | | LR-LIB-CULL | Assisted culling | P2 | 🟡 | `cmd:photo.analyze`, `cmd:dialog.cull`, `cmd:photo.moveToBurst`, `cmd:panel.bursts`, `crates/pipeline/src/cull.rs`, `crates/ui-egui/src/panels/bursts.rs` | Photo ▸ Assisted Culling…: focus score (0–100), clipping, burst grouping (look-alike shots within 10 s, both limits adjustable in the dialog and as `burstGap` / `similarity`, #2275) with the sharpest marked, optionally stacked collapsed with the best photo on top (`stackGroups`, #2277; photos already stacked are left alone); reject below a focus score, pick each burst's best; bursts put right by hand in Window ▸ Bursts (drag a photo within its burst — first place is the pick, and the Pick flag culling set, Best of Similar Shots and a stacked burst's top follow — into another burst, a new one or none; drag a burst onto another to merge; kept when culling runs again unless *Regroup bursts I arranged by hand*); classical measures — no eyes-closed / expression detection | diff --git a/docs/whats-new.md b/docs/whats-new.md index 129c3e577c..308043cadc 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -55,6 +55,11 @@ the search field's. A click anywhere in it puts the cursor in the field, and only the bar's empty space moves the window (#2807). +### One capture time for several photos +- Edit Capture Time with several photos selected moves them all by the same amount, as before; tick "Give every + selected photo this time" under Set date & time to give each of them exactly the time you type instead + (issue #4205). + ### Export subfolder variables - The Export dialog's Subfolder field now supports `{album}` (active album name sanitized for filesystem safety, empty outside an album view), `{date}` (batch export date in `YYYYMMDD`, local time), and `{hour}` (batch export time in `HHMM`, local time). An **Insert…** dropdown next to the field inserts tokens at the cursor. Tokens are stored in presets and expanded at export time, so the same preset produces dated subfolders on every use. ### Heal meets its surroundings (process 14)