Implement comprehensive metadata extraction for raster images with
EXIF support and display in the right panel.
New features:
- Extract basic metadata (filename, format, resolution, file size, color type)
- Parse EXIF data (camera, date, exposure, aperture, ISO, focal length, GPS)
- Display metadata in collapsible right panel (toggle with 'i' key)
- Auto-refresh metadata on document navigation
Changes by file:
Cargo.toml, Cargo.lock:
- Add kamadak-exif dependency for EXIF parsing
i18n/en/noctua.ftl:
- Add translation strings for all metadata labels
src/app/document/meta.rs:
- New module for metadata types (BasicMeta, ExifMeta, DocumentMeta)
- Extraction logic with EXIF parsing via kamadak-exif
- Helper methods for formatted display (resolution, file size, camera, GPS)
src/app/document/mod.rs:
- Re-export meta module
src/app/document/{raster,vector,portable}.rs:
- Add extract_metadata() method stubs (full impl for raster)
src/app/document/file.rs:
- Reset metadata on document change
src/app/message.rs:
- Add ToggleRightPanel and RefreshMetadata messages
src/app/model.rs:
- Add metadata: Option<DocumentMeta> field
- Add show_right_panel: bool field
src/app/update.rs:
- Handle panel toggle and metadata refresh
- Auto-refresh metadata on navigation when panel visible
src/app/view/panels.rs:
- Implement right_panel() with metadata display
- Conditional sections for basic info and EXIF data
src/app/view/canvas.rs:
- Integrate right panel into layout"
This commit is contained in:
parent
6623a12632
commit
823dfe9fa2
14 changed files with 616 additions and 153 deletions
|
|
@ -17,14 +17,26 @@ pub fn update(model: &mut AppModel, msg: AppMessage) {
|
|||
// ===== File / navigation ==========================================================
|
||||
AppMessage::OpenPath(path) => {
|
||||
document::file::open_single_file(model, &path);
|
||||
// Refresh metadata if panel is visible.
|
||||
if model.show_right_panel {
|
||||
refresh_metadata(model);
|
||||
}
|
||||
}
|
||||
|
||||
AppMessage::NextDocument => {
|
||||
document::file::navigate_next(model);
|
||||
// Refresh metadata if panel is visible.
|
||||
if model.show_right_panel {
|
||||
refresh_metadata(model);
|
||||
}
|
||||
}
|
||||
|
||||
AppMessage::PrevDocument => {
|
||||
document::file::navigate_prev(model);
|
||||
// Refresh metadata if panel is visible.
|
||||
if model.show_right_panel {
|
||||
refresh_metadata(model);
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Panels =====================================================================
|
||||
|
|
@ -33,6 +45,10 @@ pub fn update(model: &mut AppModel, msg: AppMessage) {
|
|||
}
|
||||
AppMessage::ToggleRightPanel => {
|
||||
model.show_right_panel = !model.show_right_panel;
|
||||
// Load metadata lazily when panel becomes visible.
|
||||
if model.show_right_panel && model.metadata.is_none() {
|
||||
refresh_metadata(model);
|
||||
}
|
||||
}
|
||||
|
||||
// ===== View / zoom ===============================================================
|
||||
|
|
@ -102,6 +118,11 @@ pub fn update(model: &mut AppModel, msg: AppMessage) {
|
|||
}
|
||||
}
|
||||
|
||||
// ===== Metadata ==================================================================
|
||||
AppMessage::RefreshMetadata => {
|
||||
refresh_metadata(model);
|
||||
}
|
||||
|
||||
// ===== Error handling ============================================================
|
||||
AppMessage::ShowError(msg) => {
|
||||
model.set_error(msg);
|
||||
|
|
@ -139,3 +160,8 @@ fn current_zoom(model: &AppModel) -> f32 {
|
|||
ViewMode::Custom(z) => z,
|
||||
}
|
||||
}
|
||||
|
||||
/// Refresh metadata from the current document.
|
||||
fn refresh_metadata(model: &mut AppModel) {
|
||||
model.metadata = model.document.as_ref().map(|doc| doc.extract_meta());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue