From 386c1cf57dbb3f463fb6b33446a90c83373a54ba Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Thu, 15 Dec 2022 19:27:04 +0100 Subject: [PATCH] #443 info: improved display for `google device` in XMP --- lib/utils/xmp_utils.dart | 14 ++++++++------ lib/widgets/navigation/tv_rail.dart | 1 - .../action/entry_info_action_delegate.dart | 15 +++++++++++++++ .../viewer/info/metadata/xmp_namespaces.dart | 2 ++ .../viewer/info/metadata/xmp_ns/google.dart | 18 ++++++++++++++++++ 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/lib/utils/xmp_utils.dart b/lib/utils/xmp_utils.dart index 481e85c54..f81fa46d8 100644 --- a/lib/utils/xmp_utils.dart +++ b/lib/utils/xmp_utils.dart @@ -28,13 +28,14 @@ class Namespaces { static const gCamera = 'http://ns.google.com/photos/1.0/camera/'; static const gCreations = 'http://ns.google.com/photos/1.0/creations/'; static const gDepth = 'http://ns.google.com/photos/1.0/depthmap/'; - static const gettyImagesGift = 'http://xmp.gettyimages.com/gift/1.0/'; + static const gDevice = 'http://ns.google.com/photos/dd/1.0/device/'; static const gFocus = 'http://ns.google.com/photos/1.0/focus/'; static const gImage = 'http://ns.google.com/photos/1.0/image/'; - static const gimp210 = 'http://www.gimp.org/ns/2.10/'; - static const gimpXmp = 'http://www.gimp.org/xmp/'; static const gPano = 'http://ns.google.com/photos/1.0/panorama/'; static const gSpherical = 'http://ns.google.com/videos/1.0/spherical/'; + static const gettyImagesGift = 'http://xmp.gettyimages.com/gift/1.0/'; + static const gimp210 = 'http://www.gimp.org/ns/2.10/'; + static const gimpXmp = 'http://www.gimp.org/xmp/'; static const illustrator = 'http://ns.adobe.com/illustrator/1.0/'; static const iptc4xmpCore = 'http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'; static const iptc4xmpExt = 'http://iptc.org/std/Iptc4xmpExt/2008-02-29/'; @@ -93,17 +94,18 @@ class Namespaces { dwc: 'Darwin Core', exif: 'Exif', exifEx: 'Exif Ex', - gettyImagesGift: 'Getty Images', gAudio: 'Google Audio', gCamera: 'Google Camera', gCreations: 'Google Creations', gDepth: 'Google Depth', + gDevice: 'Google Device', gFocus: 'Google Focus', gImage: 'Google Image', - gimp210: 'GIMP 2.10', - gimpXmp: 'GIMP', gPano: 'Google Panorama', gSpherical: 'Google Spherical', + gettyImagesGift: 'Getty Images', + gimp210: 'GIMP 2.10', + gimpXmp: 'GIMP', illustrator: 'Illustrator', iptc4xmpCore: 'IPTC Core', iptc4xmpExt: 'IPTC Extension', diff --git a/lib/widgets/navigation/tv_rail.dart b/lib/widgets/navigation/tv_rail.dart index 300032f8b..560ee9db6 100644 --- a/lib/widgets/navigation/tv_rail.dart +++ b/lib/widgets/navigation/tv_rail.dart @@ -60,7 +60,6 @@ class _TvRailState extends State { controller.focusedIndex = null; WidgetsBinding.instance.addPostFrameCallback((_) { final nodes = _focusNode.children.toList(); - debugPrint('TLAD focusedIndex=$focusedIndex < nodes.length=${nodes.length}'); if (focusedIndex < nodes.length) { nodes[focusedIndex].requestFocus(); } diff --git a/lib/widgets/viewer/action/entry_info_action_delegate.dart b/lib/widgets/viewer/action/entry_info_action_delegate.dart index 5e3a3382c..162cb0db0 100644 --- a/lib/widgets/viewer/action/entry_info_action_delegate.dart +++ b/lib/widgets/viewer/action/entry_info_action_delegate.dart @@ -19,6 +19,7 @@ import 'package:aves/widgets/common/extensions/build_context.dart'; import 'package:aves/widgets/dialogs/aves_dialog.dart'; import 'package:aves/widgets/map/map_page.dart'; import 'package:aves/widgets/viewer/action/single_entry_editor.dart'; +import 'package:aves/widgets/viewer/debug/debug_page.dart'; import 'package:aves/widgets/viewer/embedded/notifications.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -118,6 +119,10 @@ class EntryInfoActionDelegate with FeedbackMixin, PermissionAwareMixin, EntryEdi case EntryAction.viewMotionPhotoVideo: OpenEmbeddedDataNotification.motionPhotoVideo().dispatch(context); break; + // debug + case EntryAction.debug: + _goToDebug(context, targetEntry); + break; default: break; } @@ -273,4 +278,14 @@ class EntryInfoActionDelegate with FeedbackMixin, PermissionAwareMixin, EntryEdi ); mapCollection.dispose(); } + + void _goToDebug(BuildContext context, AvesEntry targetEntry) { + Navigator.push( + context, + MaterialPageRoute( + settings: const RouteSettings(name: ViewerDebugPage.routeName), + builder: (context) => ViewerDebugPage(entry: targetEntry), + ), + ); + } } diff --git a/lib/widgets/viewer/info/metadata/xmp_namespaces.dart b/lib/widgets/viewer/info/metadata/xmp_namespaces.dart index 14075d416..1a92214f0 100644 --- a/lib/widgets/viewer/info/metadata/xmp_namespaces.dart +++ b/lib/widgets/viewer/info/metadata/xmp_namespaces.dart @@ -48,6 +48,8 @@ class XmpNamespace extends Equatable { return XmpGAudioNamespace(nsPrefix, rawProps); case Namespaces.gDepth: return XmpGDepthNamespace(nsPrefix, rawProps); + case Namespaces.gDevice: + return XmpGDeviceNamespace(nsPrefix, rawProps); case Namespaces.gImage: return XmpGImageNamespace(nsPrefix, rawProps); case Namespaces.iptc4xmpCore: diff --git a/lib/widgets/viewer/info/metadata/xmp_ns/google.dart b/lib/widgets/viewer/info/metadata/xmp_ns/google.dart index 419d43fd4..06639ab7d 100644 --- a/lib/widgets/viewer/info/metadata/xmp_ns/google.dart +++ b/lib/widgets/viewer/info/metadata/xmp_ns/google.dart @@ -69,6 +69,24 @@ class XmpGDepthNamespace extends XmpGoogleNamespace { ]; } +class XmpGDeviceNamespace extends XmpNamespace { + XmpGDeviceNamespace(String nsPrefix, Map rawProps) : super(Namespaces.gDevice, nsPrefix, rawProps); + + @override + late final List cards = [ + XmpCardData( + RegExp(nsPrefix + r'Cameras\[(\d+)\]/(.*)'), + cards: [ + XmpCardData(RegExp(r'Camera:DepthMap/(.*)')), + XmpCardData(RegExp(r'Camera:Image/(.*)')), + XmpCardData(RegExp(r'Camera:ImagingModel/(.*)')), + ], + ), + XmpCardData(RegExp(nsPrefix + r'Container/Container:Directory\[(\d+)\]/(.*)')), + XmpCardData(RegExp(nsPrefix + r'Profiles\[(\d+)\]/(.*)')), + ]; +} + class XmpGImageNamespace extends XmpGoogleNamespace { const XmpGImageNamespace(String nsPrefix, Map rawProps) : super(Namespaces.gImage, nsPrefix, rawProps);