metadata: Use gufo instead of kamadak exif
A bunch of metadata code is now provided by gufo.
This commit is contained in:
parent
51b4ddbc5c
commit
5409203ec9
12 changed files with 212 additions and 438 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) 2021 Christopher Davis
|
||||
// Copyright (c) 2022-2024 Sophie Herold
|
||||
// Copyright (c) 2023 Lubosz Sarnecki
|
||||
// Copyright (c) 2024 kramo
|
||||
// Copyright (c) 2024 Maximiliano Sandoval
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Sophie Herold
|
||||
// Copyright (c) 2023-2024 Sophie Herold
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -44,8 +44,8 @@ impl LpImage {
|
|||
|
||||
imp.snapshot_rotate_mirror(
|
||||
&snapshot,
|
||||
-orientation.rotation as f32,
|
||||
orientation.mirrored,
|
||||
-(orientation.rotate().degrees() as f32),
|
||||
orientation.mirror(),
|
||||
scale as f64,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use gufo::common::orientation::Rotation;
|
||||
|
||||
use super::*;
|
||||
use crate::metadata;
|
||||
|
||||
|
|
@ -98,7 +100,7 @@ impl LpImage {
|
|||
/// Image size of original image with EXIF rotation applied
|
||||
pub fn image_size(&self) -> (i32, i32) {
|
||||
let orientation = self.imp().metadata.borrow().orientation();
|
||||
if orientation.rotation.abs() == 90. || orientation.rotation.abs() == 270. {
|
||||
if orientation.rotate() == Rotation::_90 || orientation.rotate() == Rotation::_270 {
|
||||
let (x, y) = self.imp().original_dimensions();
|
||||
(y, x)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ impl LpImage {
|
|||
|
||||
self.imp().snapshot_rotate_mirror(
|
||||
&snapshot,
|
||||
-orientation.rotation as f32,
|
||||
orientation.mirrored,
|
||||
-(orientation.rotate().degrees() as f32),
|
||||
orientation.mirror(),
|
||||
scale,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,9 +76,11 @@ impl LpImage {
|
|||
pub fn reset_rotation(&self) {
|
||||
log::debug!("Resetting rotation");
|
||||
let orientation = self.metadata().orientation();
|
||||
self.imp().rotation_target.set(-orientation.rotation);
|
||||
self.set_mirrored(orientation.mirrored);
|
||||
self.set_rotation(-orientation.rotation);
|
||||
self.imp()
|
||||
.rotation_target
|
||||
.set(-(orientation.rotate().degrees() as f64));
|
||||
self.set_mirrored(orientation.mirror());
|
||||
self.set_rotation(-(orientation.rotate().degrees() as f64));
|
||||
}
|
||||
|
||||
pub fn rotate_by(&self, angle: f64) {
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ mod imp {
|
|||
|
||||
// Details (EXIF)
|
||||
let has_details = [
|
||||
Self::update_row(&self.location, metadata.gps_location().map(|x| x.display())),
|
||||
Self::update_row(&self.location, metadata.gps_location_place()),
|
||||
Self::update_row(&self.originally_created, metadata.originally_created()),
|
||||
Self::update_row(&self.aperture, metadata.f_number()),
|
||||
Self::update_row(&self.exposure, metadata.exposure_time()),
|
||||
|
|
@ -318,7 +318,7 @@ mod imp {
|
|||
|
||||
if let Some(location) = obj.image().and_then(|x| x.metadata().gps_location()) {
|
||||
let clipboard = obj.display().clipboard();
|
||||
clipboard.set_text(&location.machine_readable());
|
||||
clipboard.set_text(&location.iso_6709());
|
||||
let _ = obj.activate_action(
|
||||
"win.show-toast",
|
||||
Some(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue