Skip to content

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

XMP: surface structured import warnings in UI

Adrian D'souzaec77f60b1bd4
diff --git a/crates/engine/src/cmd/library.rs b/crates/engine/src/cmd/library.rs
index a634f37fa..0eafa49a5 100644
--- a/crates/engine/src/cmd/library.rs
+++ b/crates/engine/src/cmd/library.rs
@@ -1103,7 +1103,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Import Photos",
["File"],
Some("Cmd+Shift+I"),
- "{paths: [file or folder (recursive)], mode?: add|copy|move (add = reference the files in place; copy = into the library's Originals/YYYY/YYYY-MM-DD/; move = as copy, then each original and its XMP sidecars are removed from the source — only after the copy is verified (a hard link on the same volume, else copied, synced and compared byte for byte) and its catalog record is saved; failed, duplicate and unchecked files keep their sources; a taken name gets -1, -2…; undo removes the photos from the library but leaves the files at the destination), destination?: folder for copies / moves, organize?: date (YYYY/YYYY-MM-DD) | month (YYYY/YYYY-MM) | flat | a folder template, e.g. `{date:%Y}/{date:%Y%m%d}` → 2026/20260114 (the template's `/` make the folders, each level expanded with the rename tokens and made a safe folder name: never outside the destination; must be relative, no `..`; a level with missing metadata is `unknown`) — dated by capture time, else the import time, rename?: file-name template for copies, original extension added (tokens: {name} {num} {seq} {seq:N} {date} {date:%Y%m%d} {folder} {camera} {lens} {iso} {rating} {title} {creator} {ext}; photo.renameTokens explains each; blank = keep names), renameStart?: 1, metadataPreset?: name, dng?: bool (copy raws as DNG; copy only), local?: bool (browsing: the photos stay out of the library, like library.browse; not with move), album?: albumId, albumName?: new album, preset?: presetId, keywords?: [..], onDeleted?: skip|restore|fresh (a file that is in Recently Deleted: skip = leave it there and say so, restore = bring the photo back with its edits, fresh = delete the trashed record and import the file as new)} → {imported, duplicates: [{path, existing, reason, existingDeleted?}], restored?: [photoId], failed, warnings?: [per-photo XMP diagnostic], moved?: [{from, to, sidecars?}], kept?: [{path, reason}] (move: sources left in place and why), album?}",
+ "{paths: [file or folder (recursive)], mode?: add|copy|move (add = reference the files in place; copy = into the library's Originals/YYYY/YYYY-MM-DD/; move = as copy, then each original and its XMP sidecars are removed from the source — only after the copy is verified (a hard link on the same volume, else copied, synced and compared byte for byte) and its catalog record is saved; failed, duplicate and unchecked files keep their sources; a taken name gets -1, -2…; undo removes the photos from the library but leaves the files at the destination), destination?: folder for copies / moves, organize?: date (YYYY/YYYY-MM-DD) | month (YYYY/YYYY-MM) | flat | a folder template, e.g. `{date:%Y}/{date:%Y%m%d}` → 2026/20260114 (the template's `/` make the folders, each level expanded with the rename tokens and made a safe folder name: never outside the destination; must be relative, no `..`; a level with missing metadata is `unknown`) — dated by capture time, else the import time, rename?: file-name template for copies, original extension added (tokens: {name} {num} {seq} {seq:N} {date} {date:%Y%m%d} {folder} {camera} {lens} {iso} {rating} {title} {creator} {ext}; photo.renameTokens explains each; blank = keep names), renameStart?: 1, metadataPreset?: name, dng?: bool (copy raws as DNG; copy only), local?: bool (browsing: the photos stay out of the library, like library.browse; not with move), album?: albumId, albumName?: new album, preset?: presetId, keywords?: [..], onDeleted?: skip|restore|fresh (a file that is in Recently Deleted: skip = leave it there and say so, restore = bring the photo back with its edits, fresh = delete the trashed record and import the file as new)} → {imported, duplicates: [{path, existing, reason, existingDeleted?}], restored?: [photoId], failed, warnings?: [{path, code: cameraProfile|uprightGeometry|unmappedXmp, profile?, fields?}], moved?: [{from, to, sidecars?}], kept?: [{path, reason}] (move: sources left in place and why), album?}",
always,
|s, p| {
let req = import_params(s, p)?;
diff --git a/crates/engine/src/import.rs b/crates/engine/src/import.rs
index b12b19e84..ad0ca9344 100644
--- a/crates/engine/src/import.rs
+++ b/crates/engine/src/import.rs
@@ -200,7 +200,31 @@ pub struct ImportReport {
pub sidecars: usize,
/// Per-photo diagnostics from foreign XMP develop settings that could not be fully carried over.
#[serde(skip_serializing_if = "Vec::is_empty")]
- pub warnings: Vec<String>,
+ pub warnings: Vec<ImportWarning>,
+}
+
+/// A structured diagnostic from foreign XMP develop settings.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum ImportWarningCode {
+ /// A named camera profile was found but cannot be applied as Lightroom does.
+ CameraProfile,
+ /// Lightroom geometry data was found but its saved transform is not retained.
+ UprightGeometry,
+ /// One or more other XMP develop fields have no LightCraft mapping.
+ UnmappedXmp,
+}
+
+/// One actionable XMP import diagnostic. `path` is filled when its photo is committed.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ImportWarning {
+ pub path: String,
+ pub code: ImportWarningCode,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub profile: Option<String>,
+ #[serde(skip_serializing_if = "Vec::is_empty")]
+ pub fields: Vec<String>,
}
/// A file moved by an import.
@@ -1238,7 +1262,10 @@ pub fn commit_prepared(s: &mut Session, opts: &ImportOptions, now: &str, prepare
if let Some(sc) = &sidecar {
crate::sidecar::merge_into(&mut p, sc, &now);
report.sidecars += 1;
- report.warnings.extend(sc.warnings.iter().map(|warning| format!("{path}: {warning}")));
+ report.warnings.extend(sc.warnings.iter().cloned().map(|mut warning| {
+ warning.path = path.clone();
+ warning
+ }));
}
if let Some(mp) = opts.metadata_preset.as_ref().and_then(|n| s.metadata_presets.iter().find(|m| m.name.eq_ignore_ascii_case(n))) {
crate::cmd::metadata::apply_to(&mut p.meta, &mp.fields);
diff --git a/crates/engine/src/sidecar.rs b/crates/engine/src/sidecar.rs
index 3cd0d132b..0ad3ec16b 100644
--- a/crates/engine/src/sidecar.rs
+++ b/crates/engine/src/sidecar.rs
@@ -106,7 +106,7 @@ pub struct SidecarData {
pub develop: Option<DevelopPatch>,
/// Actionable diagnostics for foreign develop settings that were not fully carried over.
/// These are surfaced in the photo import report and never persisted in the catalog.
- pub warnings: Vec<String>,
+ pub warnings: Vec<crate::import::ImportWarning>,
}
#[derive(Clone, Debug, PartialEq)]
@@ -165,30 +165,24 @@ pub fn parse_sidecar(xmp: &str, raw: bool) -> std::result::Result<SidecarData, S
out.develop = match full {
Some(s) => Some(DevelopPatch::Full(Box::new(s))),
None if crate::crs::has_adjustments(&d.properties) => {
- let (mut partial, unmapped) = crate::crs::to_partial_report(&d.properties, Some(&d.values), Some(raw), crate::crs_masks::DEFAULT_ASPECT);
+ let (partial, unmapped) = crate::crs::to_partial_report(&d.properties, Some(&d.values), Some(raw), crate::crs_masks::DEFAULT_ASPECT);
let profile = crate::crs::camera_profile_name(&d.properties).map(str::to_string);
- if let Some(name) = &profile
- && let Some(profile) = partial.get_mut("profile").and_then(Value::as_object_mut)
- {
- // Keep the selected name for inspection and round trips. An unknown id renders
- // as LightCraft's neutral profile; the warning below makes that limitation clear.
- profile.insert("id".into(), Value::String(name.clone()));
- }
if let Some(name) = profile {
- out.warnings.push(format!("{name} could not be applied; colors may differ from Lightroom."));
+ out.warnings.push(crate::import::ImportWarning {
+ path: String::new(),
+ code: crate::import::ImportWarningCode::CameraProfile,
+ profile: Some(name),
+ fields: Vec::new(),
+ });
}
let upright = crate::crs::has_saved_upright_transform(&d.properties);
if upright {
- let mode = d.properties.get("crs:PerspectiveUpright").and_then(|values| values.first()).map(String::as_str).unwrap_or_default();
- let mode = match mode {
- "1" => "Auto",
- "2" => "Level",
- "3" => "Vertical",
- "4" => "Full",
- "5" => "Guided",
- _ => "Upright",
- };
- out.warnings.push(format!("Lightroom geometry was not preserved; {mode} will be recalculated."));
+ out.warnings.push(crate::import::ImportWarning {
+ path: String::new(),
+ code: crate::import::ImportWarningCode::UprightGeometry,
+ profile: None,
+ fields: Vec::new(),
+ });
}
let other: Vec<&str> = unmapped
.iter()
@@ -200,7 +194,12 @@ pub fn parse_sidecar(xmp: &str, raw: bool) -> std::result::Result<SidecarData, S
})
.collect();
if !other.is_empty() {
- out.warnings.push(format!("XMP adjustments not imported: {}.", other.join(", ")));
+ out.warnings.push(crate::import::ImportWarning {
+ path: String::new(),
+ code: crate::import::ImportWarningCode::UnmappedXmp,
+ profile: None,
+ fields: other.into_iter().map(str::to_string).collect(),
+ });
}
Some(DevelopPatch::Partial(partial))
}
diff --git a/crates/engine/src/tests_xmp.rs b/crates/engine/src/tests_xmp.rs
index 962042d97..8ed9a4e26 100644
--- a/crates/engine/src/tests_xmp.rs
+++ b/crates/engine/src/tests_xmp.rs
@@ -194,15 +194,10 @@ fn foreign_profile_and_upright_import_diagnostics_are_actionable() {
let mut s = Session::new().with_fs();
let r = s.execute("library.import", &json!({"paths": [photo.to_string_lossy()]})).unwrap();
let warnings = r["warnings"].as_array().unwrap();
- assert!(warnings.iter().any(|w| w.as_str().is_some_and(|w| w.contains("Camera Faithful could not be applied"))), "{r}");
- assert!(
- warnings
- .iter()
- .any(|w| w.as_str().is_some_and(|w| w.contains("Lightroom geometry was not preserved") && w.contains("Auto will be recalculated"))),
- "{r}"
- );
+ assert!(warnings.iter().any(|w| w["code"] == "cameraProfile" && w["profile"] == "Camera Faithful"), "{r}");
+ assert!(warnings.iter().any(|w| w["code"] == "uprightGeometry"), "{r}");
let p = s.catalog.photos().next().unwrap();
- assert_eq!(p.develop.profile.id, "Camera Faithful");
+ assert_eq!(p.develop.profile.id, "lc.color");
assert_eq!(p.develop.light.exposure, 1.68);
assert_eq!(std::fs::read(&sidecar).unwrap(), before, "import never rewrites foreign XMP");
diff --git a/crates/ui-egui/locales/de-formats.json b/crates/ui-egui/locales/de-formats.json
index af10202f8..58bf68ebb 100644
--- a/crates/ui-egui/locales/de-formats.json
+++ b/crates/ui-egui/locales/de-formats.json
@@ -60,6 +60,10 @@
"Healed {n} dust spot{}": "Reparierte Staubflecken: {n}{:.0}",
"Import cancelled · {} photo{} added": "Import abgebrochen · {} Foto{} hinzugefügt",
"Import failed: {e}": "Import fehlgeschlagen: {e}",
+ "Import warnings ({n}):\n{warnings}": "Importwarnungen ({n}):\n{warnings}",
+ "XMP profile \"{profile}\" was not applied for {path}; colors may differ from Lightroom.": "XMP-Profil \"{profile}\" wurde für {path} nicht angewendet; Farben können von Lightroom abweichen.",
+ "Lightroom geometry was not preserved for {path}; Upright will be recalculated.": "Lightroom-Geometrie wurde für {path} nicht beibehalten; Upright wird neu berechnet.",
+ "XMP adjustments were not imported for {path}: {fields}.": "XMP-Anpassungen wurden für {path} nicht importiert: {fields}.",
"Imported {n} point curve preset{}": "Importierte Punktkurvenvorgaben: {n}{:.0}",
"Imported {n} preset{}": "Importierte Vorgaben: {n}{:.0}",
"Imported {n} preset{}, {f} file{} not readable": "Importierte Vorgaben: {n}{0:.0}, nicht lesbare Dateien: {f}{1:.0}",
diff --git a/crates/ui-egui/locales/es-formats.json b/crates/ui-egui/locales/es-formats.json
index b67d67204..a28d85db1 100644
--- a/crates/ui-egui/locales/es-formats.json
+++ b/crates/ui-egui/locales/es-formats.json
@@ -60,6 +60,10 @@
"Healed {n} dust spot{}": "{n} mancha{0} de polvo corregida{0}",
"Import cancelled · {} photo{} added": "Importación cancelada · {0} foto{1} añadida{1}",
"Import failed: {e}": "Error de importación: {e}",
+ "Import warnings ({n}):\n{warnings}": "Avisos de importación ({n}):\n{warnings}",
+ "XMP profile \"{profile}\" was not applied for {path}; colors may differ from Lightroom.": "El perfil XMP \"{profile}\" no se aplicó a {path}; los colores pueden diferir de Lightroom.",
+ "Lightroom geometry was not preserved for {path}; Upright will be recalculated.": "La geometría de Lightroom no se conservó para {path}; Upright se recalculará.",
+ "XMP adjustments were not imported for {path}: {fields}.": "Los ajustes XMP no se importaron para {path}: {fields}.",
"Imported {n} point curve preset{}": "{n} ajuste{0} preestablecido{0} de curva de puntos importado{0}",
"Imported {n} preset{}": "{n} ajuste{0} preestablecido{0} importado{0}",
"Imported {n} preset{}, {f} file{} not readable": "{n} ajuste{0} preestablecido{0} importado{0}, {f} archivo{1} ilegible{1}",
diff --git a/crates/ui-egui/locales/ja-formats.json b/crates/ui-egui/locales/ja-formats.json
index e462871c0..84f609733 100644
--- a/crates/ui-egui/locales/ja-formats.json
+++ b/crates/ui-egui/locales/ja-formats.json
@@ -153,6 +153,10 @@
"Folder “{}” (and its subfolders)": "フォルダ「{}」(サブフォルダを含む)",
"Found {n} missing photo{}; {left} still missing{unsure}": "見つからない写真を{n}枚見つけました{:.0}。{left}枚はまだ見つかりません{unsure}",
"Import failed: {e}": "読み込みに失敗しました:{e}",
+ "Import warnings ({n}):\n{warnings}": "読み込みの警告({n}):\n{warnings}",
+ "XMP profile \"{profile}\" was not applied for {path}; colors may differ from Lightroom.": "{path} に XMP プロファイル \"{profile}\" を適用できませんでした。色は Lightroom と異なる場合があります。",
+ "Lightroom geometry was not preserved for {path}; Upright will be recalculated.": "{path} の Lightroom ジオメトリは保持されませんでした。Upright を再計算します。",
+ "XMP adjustments were not imported for {path}: {fields}.": "{path} の XMP 調整は読み込まれませんでした:{fields}。",
"Imported {profiles} profile{} (Profile browser ▸ their groups)": "{profiles}個のプロファイルを読み込みました{:.0}(プロファイルブラウザー → 各グループ)",
"Insert at the cursor (also written {})": "カーソル位置に挿入({}とも表記可)",
"MIT OR Apache-2.0. Fonts: {} (OFL). Icons: original.": "MIT OR Apache-2.0。フォント:{}(OFL)。アイコン:オリジナル",
diff --git a/crates/ui-egui/locales/pt-br-formats.json b/crates/ui-egui/locales/pt-br-formats.json
index 59bec59d4..15e1f796e 100644
--- a/crates/ui-egui/locales/pt-br-formats.json
+++ b/crates/ui-egui/locales/pt-br-formats.json
@@ -153,6 +153,10 @@
"Folder “{}” (and its subfolders)": "Pasta “{}” (e suas subpastas)",
"Found {n} missing photo{}; {left} still missing{unsure}": "{n} foto{0} ausente{0} encontrada{0}; {left} ainda ausente(s){unsure}",
"Import failed: {e}": "Falha na importação: {e}",
+ "Import warnings ({n}):\n{warnings}": "Avisos de importação ({n}):\n{warnings}",
+ "XMP profile \"{profile}\" was not applied for {path}; colors may differ from Lightroom.": "O perfil XMP \"{profile}\" não foi aplicado a {path}; as cores podem diferir do Lightroom.",
+ "Lightroom geometry was not preserved for {path}; Upright will be recalculated.": "A geometria do Lightroom não foi preservada para {path}; o Upright será recalculado.",
+ "XMP adjustments were not imported for {path}: {fields}.": "Os ajustes XMP não foram importados para {path}: {fields}.",
"Imported {profiles} profile{} (Profile browser ▸ their groups)": "{profiles} perfil(is) importado(s){:.0} (Navegador de perfis → seus grupos)",
"Insert at the cursor (also written {})": "Inserir no cursor (também escrito {})",
"MIT OR Apache-2.0. Fonts: {} (OFL). Icons: original.": "MIT OR Apache-2.0. Fontes: {} (OFL). Ícones: originais.",
diff --git a/crates/ui-egui/locales/ru-formats.json b/crates/ui-egui/locales/ru-formats.json
index 2beb4a5ba..b8be34f4b 100644
--- a/crates/ui-egui/locales/ru-formats.json
+++ b/crates/ui-egui/locales/ru-formats.json
@@ -63,6 +63,10 @@
"Healed {n} dust spot{}": "Убрано пылинок: {n}{:.0}",
"Import cancelled · {} photo{} added": "Импорт отменён · добавлено фото: {}{:.0}",
"Import failed: {e}": "Ошибка импорта: {e}",
+ "Import warnings ({n}):\n{warnings}": "Предупреждения импорта ({n}):\n{warnings}",
+ "XMP profile \"{profile}\" was not applied for {path}; colors may differ from Lightroom.": "Профиль XMP \"{profile}\" не применён к {path}; цвета могут отличаться от Lightroom.",
+ "Lightroom geometry was not preserved for {path}; Upright will be recalculated.": "Геометрия Lightroom для {path} не сохранена; Upright будет пересчитан.",
+ "XMP adjustments were not imported for {path}: {fields}.": "Коррекции XMP для {path} не импортированы: {fields}.",
"Imported {n} point curve preset{}": "Импортировано пресетов точечной кривой: {n}{:.0}",
"Imported {n} preset{}": "Импортировано пресетов: {n}{:.0}",
"Imported {n} preset{}, {f} file{} not readable": "Импортировано пресетов: {n}{:.0}, не читается файлов: {f}{:.0}",
diff --git a/crates/ui-egui/locales/zh-hans-formats.json b/crates/ui-egui/locales/zh-hans-formats.json
index eca40f8e6..01dba1ab4 100644
--- a/crates/ui-egui/locales/zh-hans-formats.json
+++ b/crates/ui-egui/locales/zh-hans-formats.json
@@ -153,6 +153,10 @@
"Folder “{}” (and its subfolders)": "文件夹“{0}”(含子文件夹)",
"Found {n} missing photo{}; {left} still missing{unsure}": "已找到 {n} 张缺失的照片{0:.0};仍有 {left} 张缺失{unsure}",
"Import failed: {e}": "导入失败:{e}",
+ "Import warnings ({n}):\n{warnings}": "导入警告({n}):\n{warnings}",
+ "XMP profile \"{profile}\" was not applied for {path}; colors may differ from Lightroom.": "未对 {path} 应用 XMP 配置文件“{profile}”;颜色可能与 Lightroom 不同。",
+ "Lightroom geometry was not preserved for {path}; Upright will be recalculated.": "未保留 {path} 的 Lightroom 几何信息;将重新计算 Upright。",
+ "XMP adjustments were not imported for {path}: {fields}.": "未导入 {path} 的 XMP 调整:{fields}。",
"Imported {profiles} profile{} (Profile browser ▸ their groups)": "已导入 {profiles} 个配置文件{0:.0}(配置文件浏览器 → 各自的分组)",
"Insert at the cursor (also written {})": "在光标处插入(也可写作 {0})",
"MIT OR Apache-2.0. Fonts: {} (OFL). Icons: original.": "MIT OR Apache-2.0。字体:{0}(OFL)。图标:原创。",
diff --git a/crates/ui-egui/locales/zh-hant-formats.json b/crates/ui-egui/locales/zh-hant-formats.json
index 640e3eb7e..ab34b129f 100644
--- a/crates/ui-egui/locales/zh-hant-formats.json
+++ b/crates/ui-egui/locales/zh-hant-formats.json
@@ -153,6 +153,10 @@
"Folder “{}” (and its subfolders)": "資料夾「{}」(含子資料夾)",
"Found {n} missing photo{}; {left} still missing{unsure}": "已找到 {n} 張遺失的照片{:.0};仍有 {left} 張遺失{unsure}",
"Import failed: {e}": "匯入失敗:{e}",
+ "Import warnings ({n}):\n{warnings}": "匯入警告({n}):\n{warnings}",
+ "XMP profile \"{profile}\" was not applied for {path}; colors may differ from Lightroom.": "未將 XMP 描述檔「{profile}」套用至 {path};色彩可能與 Lightroom 不同。",
+ "Lightroom geometry was not preserved for {path}; Upright will be recalculated.": "未保留 {path} 的 Lightroom 幾何資料;將重新計算 Upright。",
+ "XMP adjustments were not imported for {path}: {fields}.": "未匯入 {path} 的 XMP 調整:{fields}。",
"Imported {profiles} profile{} (Profile browser ▸ their groups)": "已匯入 {profiles} 個描述檔{:.0}(描述檔瀏覽器 → 各自的群組)",
"Insert at the cursor (also written {})": "在游標處插入(也可寫成 {})",
"MIT OR Apache-2.0. Fonts: {} (OFL). Icons: original.": "MIT OR Apache-2.0。字型:{}(OFL)。圖示:原創。",
diff --git a/crates/ui-egui/src/import.rs b/crates/ui-egui/src/import.rs
index 49e3a2664..d8aceb01a 100644
--- a/crates/ui-egui/src/import.rs
+++ b/crates/ui-egui/src/import.rs
@@ -8,7 +8,7 @@
//! catalog between frames, with a progress window and Cancel; the whole import is one undo step.
use egui::{Align2, Color32, Rect, Sense, Stroke, StrokeKind, pos2, vec2};
-use lightcraft_engine::import::{ImportCandidate, ScanInput, ScanOutput, ScanProgress, scan_with};
+use lightcraft_engine::import::{ImportCandidate, ImportWarning, ImportWarningCode, ScanInput, ScanOutput, ScanProgress, scan_with};
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use std::sync::atomic::Ordering;
@@ -223,6 +223,8 @@ pub struct ImportTask {
/// Move: originals moved, and sources left in place (reported by the engine with a reason).
pub moved: usize,
pub kept: usize,
+ /// Structured diagnostics from foreign XMP develop settings.
+ pub warnings: Vec<ImportWarning>,
undo0: usize,
first: Option<u64>,
/// Reading a folder for the Local view: the photos stay out of the library, and nothing is
@@ -693,6 +695,7 @@ fn commit_batch(app: &mut LightcraftApp, task: &mut ImportTask, prepared: lightc
task.failed += len("failed");
task.moved += len("moved");
task.kept += len("kept");
+ task.warnings.extend(v["warnings"].as_array().into_iter().flatten().filter_map(|warning| serde_json::from_value(warning.clone()).ok()));
for k in v["kept"].as_array().into_iter().flatten() {
log::warn!("import: kept {}: {}", k["path"].as_str().unwrap_or(""), k["reason"].as_str().unwrap_or(""));
}
@@ -707,6 +710,31 @@ fn commit_batch(app: &mut LightcraftApp, task: &mut ImportTask, prepared: lightc
}
}
+fn xmp_warning_text(warning: &ImportWarning) -> String {
+ let path = &warning.path;
+ match warning.code {
+ ImportWarningCode::CameraProfile => crate::i18n::tr_format!(
+ "XMP profile \"{profile}\" was not applied for {path}; colors may differ from Lightroom.",
+ profile = warning.profile.as_deref().unwrap_or_default(),
+ path = path,
+ ),
+ ImportWarningCode::UprightGeometry => {
+ crate::i18n::tr_format!("Lightroom geometry was not preserved for {path}; Upright will be recalculated.", path = path,)
+ }
+ ImportWarningCode::UnmappedXmp => {
+ crate::i18n::tr_format!("XMP adjustments were not imported for {path}: {fields}.", path = path, fields = warning.fields.join(", "),)
+ }
+ }
+}
+
+fn xmp_warnings_text(warnings: &[ImportWarning]) -> String {
+ crate::i18n::tr_format!(
+ "Import warnings ({n}):\n{warnings}",
+ n = warnings.len(),
+ warnings = warnings.iter().map(xmp_warning_text).collect::<Vec<_>>().join("\n"),
+ )
+}
+
/// The import is done (or cancelled): one undo step, select the first photo, say what happened.
fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) {
let steps = app.session.undo.len().saturating_sub(task.undo0);
@@ -720,13 +748,17 @@ fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) {
};
app.session.merge_undo(steps, &label);
if task.auto {
- if task.imported > 0 {
+ if !task.warnings.is_empty() {
+ app.toast_for(ctx, xmp_warnings_text(&task.warnings), 8.0);
+ } else if task.imported > 0 {
app.toast(ctx, crate::i18n::tr_format!("Auto Import: added {} photo{}", task.imported, if task.imported == 1 { "" } else { "s" }));
}
return;
}
if task.browse {
- if task.failed > 0 {
+ if !task.warnings.is_empty() {
+ app.toast_for(ctx, xmp_warnings_text(&task.warnings), 8.0);
+ } else if task.failed > 0 {
app.toast(ctx, crate::i18n::tr_format!("{} photo{} not readable", task.failed, if task.failed == 1 { "" } else { "s" }));
}
return;
@@ -737,7 +769,13 @@ fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) {
let plural = |n: usize| if n == 1 { "" } else { "s" };
// nothing new, only files the library already has: show where they are (Recently Deleted is
// easy to miss, and the side panel that lists it starts collapsed)
- if task.imported == 0 && task.restored == 0 && task.failed == 0 && !task.cancelled && show_existing(app, ctx, &task.existing) {
+ if task.imported == 0
+ && task.restored == 0
+ && task.failed == 0
+ && task.warnings.is_empty()
+ && !task.cancelled
+ && show_existing(app, ctx, &task.existing)
+ {
return;
}
let mut msg = if task.cancelled {
@@ -764,7 +802,13 @@ fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) {
if task.failed > 0 {
msg.push_str(&crate::i18n::tr_format!(" · {} not readable", task.failed));
}
- app.toast(ctx, msg);
+ if task.warnings.is_empty() {
+ app.toast(ctx, msg);
+ } else {
+ msg.push_str("\n\n");
+ msg.push_str(&xmp_warnings_text(&task.warnings));
+ app.toast_for(ctx, msg, 8.0);
+ }
}
/// The photos among `ids` that are in Recently Deleted (each once).
diff --git a/docs/xmp-interop.md b/docs/xmp-interop.md
index ebdbb5d2e..a95893e4b 100644
--- a/docs/xmp-interop.md
+++ b/docs/xmp-interop.md
@@ -142,9 +142,9 @@ names are read (e.g. `Exposure2012`, not the older `Exposure`).
Values pass through our control specs, so anything outside our slider ranges gets clamped.
-`crs:CameraProfile` is retained as its selected name in the photo's profile settings, but the name carries no
-rendering data and does not select an Adobe profile. Photo import reports that the profile could not be applied and
-colours may differ from Lightroom. Camera profiles and looks (`Look`; we have our own profile set), local adjustments
+`crs:CameraProfile` is retained as its selected name in the photo import warning metadata, while active profile
+settings stay unchanged: the name carries no rendering data and does not select an Adobe profile. Photo import
+reports that the profile could not be applied and colours may differ from Lightroom. Camera profiles and looks (`Look`; we have our own profile set), local adjustments
(masks, gradients, brushes), spot removal, red eye, lens blur, process-version 2010 field names, and AI features.
## Local corrections (masks)