LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #218
Claudea86defd1b9ac
diff --cc apps/lightcraft/src/main.rsindex 363141766,c04ba9303..37b17f37c--- a/apps/lightcraft/src/main.rs+++ b/apps/lightcraft/src/main.rs@@@ -271,18 -228,15 +271,25 @@@ impl PrefsWriter}}+/// The Windows command that opens `url` in the default browser. `explorer <url>` opened File+/// Explorer instead for links with a query or fragment, like the Map button's OpenStreetMap link+/// (issue #234). The URL protocol handler hands the URL to the browser as is; no shell runs, so+/// `?`, `&` and `#` need no escaping.+fn windows_open_url_command(url: &str) -> std::process::Command {+ let mut c = std::process::Command::new("rundll32");+ c.args(["url.dll,FileProtocolHandler", url]);+ c+}+fn services() -> Services {Services {+ pick_lightroom_catalog: Some(Box::new(|| {+ rfd::FileDialog::new()+ .set_title(lightcraft_ui_egui::i18n::tr("Import Lightroom Catalog"))+ .add_filter(lightcraft_ui_egui::i18n::tr("Lightroom Classic Catalog"), &["lrcat"])+ .pick_file()+ .map(|p| p.to_string_lossy().to_string())+ })),pick_folder: Some(Box::new(|| {rfd::FileDialog::new().set_title(lightcraft_ui_egui::i18n::tr("Open Library")).pick_folder().map(|p| p.to_string_lossy().to_string())})),diff --cc crates/engine/src/lib.rsindex fab178964,122bde8fa..0db9ea62f--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@@ -25,7 -25,10 +25,11 @@@ pub mod guardpub mod import;mod import_move;pub mod library;+ mod lightroom_archive;+ pub mod lightroom_catalog;+ pub mod lightroom_job;+ mod lightroom_sqlite;+pub mod logging;pub mod media;pub mod memory;pub mod merge;diff --cc crates/ui-egui/locales/pt-br-formats.jsonindex 73b609c13,c79f96de8..2a59467f8--- a/crates/ui-egui/locales/pt-br-formats.json+++ b/crates/ui-egui/locales/pt-br-formats.json@@@ -45,9 -43,13 +45,15 @@@"Imported {n} preset{}": "Importadas {n} predefinição{:.0}","Imported {n} preset{}, {f} file{} not readable": "Importadas {n} predefinição{:.0}, {f} arquivo{:.0} não legível","Imported {} photo{}": "Importadas {} foto{:.0}",+ "Lightroom catalog inspected: {photos} photos, {collections} collections, {missing} missing": "Lightroom catalog inspected: {photos} photos, {collections} collections, {missing} missing",+ "Lightroom import complete: {imported} photos added": "Lightroom import complete: {imported} photos added",+ "Lightroom import complete: {imported} photos added, {failed} failed": "Lightroom import complete: {imported} photos added, {failed} failed",+ "Lightroom import complete: {imported} photos added; index warning: {warning}": "Lightroom import complete: {imported} photos added; index warning: {warning}",+ "Lightroom import failed: {e}{warning}": "Lightroom import failed: {e}{warning}",+ "Lightroom inspection failed: {e}{warning}": "Lightroom inspection failed: {e}{warning}","Label Set: {name}": "Conjunto de rótulos: {name}",+ "LightCraft could not open its window: {e}": "O LightCraft não conseguiu abrir sua janela: {e}",+ "LightCraft could not open its window: {e}\n\nThe log file has the details: {path}": "O LightCraft não conseguiu abrir sua janela: {e}\n\nO arquivo de log tem os detalhes: {path}","Matches: {}": "Correspondências: {}","Merging… {stage} {:.0}%": "Mesclando… {stage} {:.0}%","Move {what} to Recently Deleted?": "Mover {what} para Excluídos recentemente?",diff --cc crates/ui-egui/locales/zh-hant-formats.jsonindex a2f95cb1c,0147db0c1..a51e1749d--- a/crates/ui-egui/locales/zh-hant-formats.json+++ b/crates/ui-egui/locales/zh-hant-formats.json@@@ -42,9 -40,13 +42,15 @@@"Imported {n} preset{}": "已匯入 {n} 個預設集{:.0}","Imported {n} preset{}, {f} file{} not readable": "已匯入 {n} 個預設集{:.0},{f} 個檔案無法讀取{:.0}","Imported {} photo{}": "已匯入 {} 張照片{:.0}",+ "Lightroom catalog inspected: {photos} photos, {collections} collections, {missing} missing": "Lightroom catalog inspected: {photos} photos, {collections} collections, {missing} missing",+ "Lightroom import complete: {imported} photos added": "Lightroom import complete: {imported} photos added",+ "Lightroom import complete: {imported} photos added, {failed} failed": "Lightroom import complete: {imported} photos added, {failed} failed",+ "Lightroom import complete: {imported} photos added; index warning: {warning}": "Lightroom import complete: {imported} photos added; index warning: {warning}",+ "Lightroom import failed: {e}{warning}": "Lightroom import failed: {e}{warning}",+ "Lightroom inspection failed: {e}{warning}": "Lightroom inspection failed: {e}{warning}","Label Set: {name}": "標籤集:{name}",+ "LightCraft could not open its window: {e}": "LightCraft 無法開啟視窗:{e}",+ "LightCraft could not open its window: {e}\n\nThe log file has the details: {path}": "LightCraft 無法開啟視窗:{e}\n\n詳細資訊請見記錄檔:{path}","Matches: {}": "符合條件:{}","Merging… {stage} {:.0}%": "正在合併… {stage} {:.0}%","Move {what} to Recently Deleted?": "要將{what}移至「最近刪除」嗎?",diff --cc crates/ui-egui/src/menus.rsindex 6b95fd576,b04ba2bd3..609107276--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@@ -978,12 -951,10 +983,15 @@@ pub fn run_ui_command(app: &mut Lightcrapp.ui.dialog = Some(Dialog::Shortcuts);Ok(Value::Null)}+ "app.setShortcut" => crate::shortcuts::set_shortcut(app, p),+ "app.resetShortcuts" => {+ app.ui.settings.keymap.clear();+ Ok(Value::Null)+ }"library.browse" if !cfg!(target_arch = "wasm32") => {+ if crate::lightroom_import::is_running(app) {+ return Some(Err("finish Lightroom catalog import before browsing folders".into()));+ }// listed and read in the background (see `import::browse`)let path = p.get("path").and_then(Value::as_str)?;crate::import::browse(app, path, p.get("subfolders").and_then(Value::as_bool))diff --cc docs/parity.mdindex b6126ea5d,0212a6816..8b7f2cbae--- a/docs/parity.md+++ b/docs/parity.md@@@ -731,9 -716,9 +731,10 @@@ From `08-lightroom-classic-extras.md` (| LRC-LIB-SURVEY | Survey view | P2 | ✅ | `cmd:view.survey` | N || LRC-LIB-REFVIEW | Reference view | P2 | ✅ | `cmd:view.reference`, `cmd:photo.setReference`, `crates/ui-egui/src/panels/compare.rs` (`show_reference`) | View ▸ Reference View (⇧R): the reference photo beside the active one (edited with the Edit panel); photo menu ▸ Set as Reference Photo || LRC-LIB-CATALOG-PANEL | Catalog sets | P1 | ✅ | `cmd:library.source` (`missing`) | all, recently added, picks, recently deleted, missing photos (when any) |+ | LRC-LIB-CATALOG-IMPORT | Native Lightroom Classic catalog import | P1 | 🟡 | `cmd:library.inspectLightroom`, `cmd:library.importLightroom`, `crates/engine/src/lightroom_catalog.rs`, `docs/lightroom-catalog-import.md` | read-only `.lrcat` plus committed WAL pages, in-tree read-only Rust SQLite B-tree reader; background inspection/import with progress/cancellation, per-open library identity checks; originals in place, ratings/flags/labels, XMP, hierarchical keywords, collection sets/regular collections, virtual copies, mapped develop settings; stable reimport identities, undo, missing-file placeholders, existing edits preserved. Best-effort deduplicated recovery archives retain settings/history/snapshots/collection rules (32 MiB each, eight archives/128 MiB aggregate); archive limits/write failures and optional-table limits warn without blocking photo import; unrelated unsupported tables and opaque SQL BLOBs skipped. Adobe rendering, AI data and native history replay remain incomplete; no writes to Lightroom catalogs |-| LRC-LIB-CATALOG-LOCK | Catalog open in one program at a time | P1 | ✅ | `cmd:app.openLibrary`, `crates/catalog/src/lock.rs`, `crates/engine/src/library.rs` (`open_library`) | exclusive OS lock on `catalog.lock` for the session (app and `lightcraft-cli --library`); a second opener is refused with who has it (`catalog.lock.owner`: program, process, computer); released by the OS on a crash, so never stale; file systems without locks open unprotected with a warning; no read-only mode; the browser build (OPFS) has no guard across tabs yet. A library that can't be opened at launch (locked, unreadable, newer format, drive missing) shows a window — Try Again, Choose Another Library…, Continue Without Saving (then a banner; nothing written), Quit — instead of a silent demo session (`crates/ui-egui/src/panels/library_problem.rs`) |+| LRC-LIB-CATALOG-LOCK | Catalog open in one program at a time | P1 | ✅ | `cmd:app.openLibrary`, `crates/catalog/src/lock.rs`, `crates/engine/src/library.rs` (`open_library`) | exclusive OS lock on `catalog.lock` for the session (app and `lightcraft-cli --library`); a second opener is refused with who has it (`catalog.lock.owner`: program, process, computer); released by the OS on a crash, so never stale; file systems without locks open unprotected with a warning (the app's notices, `library.info` → `settingsWarnings`, and the CLI's stderr; issue #171); no read-only mode; the browser build (OPFS) has no guard across tabs yet. A library that can't be opened at launch (locked, unreadable, newer format, drive missing) shows a window — Try Again, Choose Another Library…, Continue Without Saving (then a banner; nothing written), Quit — instead of a silent demo session (`crates/ui-egui/src/panels/library_problem.rs`) || 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), 30 fields (rating, flag, label, type, edits, keywords, any text, filename, file path, format, title, caption, camera, lens, location, creator, copyright, copyright status, capture / import / edit date, ISO, aperture, focal length, megapixels, GPS, virtual copy, album) with text / number / date / in-the-last operators; live match count; also usable as a library filter (`ruleSet`) || LRC-LIB-PUBLISH | Publish services | P2 | ⬜ | | |diff --cc docs/whats-new.mdindex 2381cb4c1,cad1980c1..81366dc9e--- a/docs/whats-new.md+++ b/docs/whats-new.md@@@ -2,31 -2,16 +2,37 @@@## October 2026+### Library keyboard culling+- Colour labels tint thumbnail surrounds in Square Grid and the Detail filmstrip, and a translucent footer along the bottom of the photo in Photo Grid. Label confirmations use a matching pale colour.+- Setting or clearing a colour label shows a brief bottom confirmation, like rating a photo; custom label names appear in the message too.+- On macOS, ratings `0–5`, labels `6–9` and pick/unflag `P/U` now reach the app even when shown in the native menu (issue #283; adapted from PR #261).+- `Shift+6–9` labels and advances. `Shift+P` picks and advances in Photo Grid and Square Grid; it opens Presets in other views. With Auto Advance on, Shift still moves only once.+- Help → Keyboard Shortcuts includes the number-key bindings. See [library shortcuts](library-shortcuts.md).++### Keyboard shortcuts+- Shortcuts are editable: Help ▸ Keyboard Shortcuts (⌘/) lists every command with a search box; click a shortcut and+ press the new keys (Esc cancels), × removes it, ↺ restores the original, Reset All undoes every change. A key that+ belonged to another command moves to the new one. Menus show the new keys; agents use `app.setShortcut`.+### RAW decoding+- Panasonic and Leica raws (RW2, RWL) are now corrected for lens distortion the way the camera corrects its own JPEG+ (issue #256): the correction the camera records in the file is applied under Lens Corrections ▸ Enable Profile+ Corrections, on by default for newly imported photos, with the same framing as the camera's JPEG. At 12 mm the+ 12–32 mm kit zoom was off by about 5 % of the image width at the corners before. Files shot with the correction off+ are unchanged; photos imported before this change get it when imported again.+- Canon CR3 raws now develop from their sensor data: lossless RAW and C-RAW, checked sample for sample on the EOS+ M50, R100 and R8. CR3 files the decoder can't read yet still open from their embedded JPEG, as before.- Sony ILCE-7M4 downsized lossless ARWs now decode subsampled YCbCr tiles into linear RGB,preserving RAW editing & full-resolution export instead of using embedded JPEG previews.+- Sony A7R II (and other) raws whose camera JPEG is lens-corrected no longer open grey and too dark (issue #232): the+ starting look is fitted to the camera JPEG away from edges when the misaligned edges spoil the fit on all pixels.+ ### Lightroom Classic catalogs+ - File → Import Lightroom Catalog… opens `.lrcat` directly, with originals referenced in place.+ Ratings, flags, labels, keywords, collections/sets, virtual copies and supported edits migrate;+ existing LightCraft edits are preserved by default. Source settings/history are archived, unsupported+ fields are reported, and the original Lightroom database stays read-only. Rendering is approximate.+### Presets and profiles- Import presets from other editors: XMP presets, classic `.lrtemplate` files, "DNG presets" from mobile apps and `.zip`bundles of any of these — whole folders at once, grouped by pack. Masks inside presets come along.