info: improved some xmp display
This commit is contained in:
parent
8df538e7f7
commit
4abc9c9844
12 changed files with 62 additions and 43 deletions
|
@ -13,25 +13,35 @@ class XMP {
|
|||
'crs': 'Camera Raw Settings',
|
||||
'dc': 'Dublin Core',
|
||||
'drone-dji': 'DJI Drone',
|
||||
'exif': 'Exif',
|
||||
'exifEX': 'Exif Ex',
|
||||
'GettyImagesGIFT': 'Getty Images',
|
||||
'GAudio': 'Google Audio',
|
||||
'GDepth': 'Google Depth',
|
||||
'GImage': 'Google Image',
|
||||
'GIMP': 'GIMP',
|
||||
'GCamera': 'Google Camera',
|
||||
'GCreations': 'Google Creations',
|
||||
'GFocus': 'Google Focus',
|
||||
'GPano': 'Google Panorama',
|
||||
'illustrator': 'Illustrator',
|
||||
'Iptc4xmpCore': 'IPTC Core',
|
||||
'lr': 'Lightroom',
|
||||
'MicrosoftPhoto': 'Microsoft Photo',
|
||||
'mwg-rs': 'Regions',
|
||||
'panorama': 'Panorama',
|
||||
'PanoStudioXMP': 'PanoramaStudio',
|
||||
'pdf': 'PDF',
|
||||
'pdfx': 'PDF/X',
|
||||
'PanoStudioXMP': 'PanoramaStudio',
|
||||
'photomechanic': 'Photo Mechanic',
|
||||
'photoshop': 'Photoshop',
|
||||
'plus': 'PLUS',
|
||||
'pmtm': 'Photomatix',
|
||||
'tiff': 'TIFF',
|
||||
'xmp': 'Basic',
|
||||
'xmpBJ': 'Basic Job Ticket',
|
||||
'xmpDM': 'Dynamic Media',
|
||||
'xmpMM': 'Media Management',
|
||||
'xmpRights': 'Rights Management',
|
||||
'xmpTPg': 'Paged-Text',
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:aves/utils/constants.dart';
|
|||
import 'package:aves/utils/string_utils.dart';
|
||||
import 'package:aves/widgets/common/identity/highlight_title.dart';
|
||||
import 'package:aves/widgets/viewer/info/common.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/crs.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/darktable.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/exif.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/xmp_ns/google.dart';
|
||||
|
@ -31,6 +32,8 @@ class XmpNamespace extends Equatable {
|
|||
switch (namespace) {
|
||||
case XmpBasicNamespace.ns:
|
||||
return XmpBasicNamespace(rawProps);
|
||||
case XmpCrsNamespace.ns:
|
||||
return XmpCrsNamespace(rawProps);
|
||||
case XmpDarktableNamespace.ns:
|
||||
return XmpDarktableNamespace(rawProps);
|
||||
case XmpExifNamespace.ns:
|
||||
|
|
36
lib/widgets/viewer/info/metadata/xmp_ns/crs.dart
Normal file
36
lib/widgets/viewer/info/metadata/xmp_ns/crs.dart
Normal file
|
@ -0,0 +1,36 @@
|
|||
import 'package:aves/widgets/viewer/info/metadata/xmp_namespaces.dart';
|
||||
import 'package:aves/widgets/viewer/info/metadata/xmp_structs.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class XmpCrsNamespace extends XmpNamespace {
|
||||
static const ns = 'crs';
|
||||
|
||||
static final cgbcPattern = RegExp(ns + r':CircularGradientBasedCorrections\[(\d+)\]/(.*)');
|
||||
static final lookPattern = RegExp(ns + r':Look/(.*)');
|
||||
|
||||
final cgbc = <int, Map<String, String>>{};
|
||||
final look = <String, String>{};
|
||||
|
||||
XmpCrsNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||
|
||||
@override
|
||||
bool extractData(XmpProp prop) {
|
||||
final hasStructs = extractStruct(prop, lookPattern, look);
|
||||
final hasIndexedStructs = extractIndexedStruct(prop, cgbcPattern, cgbc);
|
||||
return hasStructs || hasIndexedStructs;
|
||||
}
|
||||
|
||||
@override
|
||||
List<Widget> buildFromExtractedData() => [
|
||||
if (look.isNotEmpty)
|
||||
XmpStructCard(
|
||||
title: 'Look',
|
||||
struct: look,
|
||||
),
|
||||
if (cgbc.isNotEmpty)
|
||||
XmpStructArrayCard(
|
||||
title: 'Circular Gradient Based Corrections',
|
||||
structByIndex: cgbc,
|
||||
),
|
||||
];
|
||||
}
|
|
@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
|
|||
class XmpDarktableNamespace extends XmpNamespace {
|
||||
static const ns = 'darktable';
|
||||
|
||||
static final historyPattern = RegExp(r'darktable:history\[(\d+)\]/(.*)');
|
||||
static final historyPattern = RegExp(ns + r':history\[(\d+)\]/(.*)');
|
||||
|
||||
final history = <int, Map<String, String>>{};
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@ class XmpExifNamespace extends XmpNamespace {
|
|||
|
||||
const XmpExifNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||
|
||||
@override
|
||||
String get displayTitle => 'Exif';
|
||||
|
||||
@override
|
||||
String formatValue(XmpProp prop) {
|
||||
final v = prop.value;
|
||||
|
|
|
@ -39,9 +39,6 @@ class XmpGAudioNamespace extends XmpGoogleNamespace {
|
|||
|
||||
@override
|
||||
List<Tuple2<String, String>> get dataProps => const [Tuple2('$ns:Data', '$ns:Mime')];
|
||||
|
||||
@override
|
||||
String get displayTitle => 'Google Audio';
|
||||
}
|
||||
|
||||
class XmpGDepthNamespace extends XmpGoogleNamespace {
|
||||
|
@ -54,9 +51,6 @@ class XmpGDepthNamespace extends XmpGoogleNamespace {
|
|||
Tuple2('$ns:Data', '$ns:Mime'),
|
||||
Tuple2('$ns:Confidence', '$ns:ConfidenceMime'),
|
||||
];
|
||||
|
||||
@override
|
||||
String get displayTitle => 'Google Depth';
|
||||
}
|
||||
|
||||
class XmpGImageNamespace extends XmpGoogleNamespace {
|
||||
|
@ -66,7 +60,4 @@ class XmpGImageNamespace extends XmpGoogleNamespace {
|
|||
|
||||
@override
|
||||
List<Tuple2<String, String>> get dataProps => const [Tuple2('$ns:Data', '$ns:Mime')];
|
||||
|
||||
@override
|
||||
String get displayTitle => 'Google Image';
|
||||
}
|
||||
|
|
|
@ -5,15 +5,12 @@ import 'package:flutter/material.dart';
|
|||
class XmpIptcCoreNamespace extends XmpNamespace {
|
||||
static const ns = 'Iptc4xmpCore';
|
||||
|
||||
static final creatorContactInfoPattern = RegExp(r'Iptc4xmpCore:CreatorContactInfo/(.*)');
|
||||
static final creatorContactInfoPattern = RegExp(ns + r':CreatorContactInfo/(.*)');
|
||||
|
||||
final creatorContactInfo = <String, String>{};
|
||||
|
||||
XmpIptcCoreNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||
|
||||
@override
|
||||
String get displayTitle => 'IPTC Core';
|
||||
|
||||
@override
|
||||
bool extractData(XmpProp prop) => extractStruct(prop, creatorContactInfoPattern, creatorContactInfo);
|
||||
|
||||
|
|
|
@ -6,17 +6,14 @@ import 'package:flutter/widgets.dart';
|
|||
class XmpMgwRegionsNamespace extends XmpNamespace {
|
||||
static const ns = 'mwg-rs';
|
||||
|
||||
static final dimensionsPattern = RegExp(r'mwg-rs:Regions/mwg-rs:AppliedToDimensions/(.*)');
|
||||
static final regionListPattern = RegExp(r'mwg-rs:Regions/mwg-rs:RegionList\[(\d+)\]/(.*)');
|
||||
static final dimensionsPattern = RegExp(ns + r':Regions/mwg-rs:AppliedToDimensions/(.*)');
|
||||
static final regionListPattern = RegExp(ns + r':Regions/mwg-rs:RegionList\[(\d+)\]/(.*)');
|
||||
|
||||
final dimensions = <String, String>{};
|
||||
final regionList = <int, Map<String, String>>{};
|
||||
|
||||
XmpMgwRegionsNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||
|
||||
@override
|
||||
String get displayTitle => 'Regions';
|
||||
|
||||
@override
|
||||
bool extractData(XmpProp prop) {
|
||||
final hasStructs = extractStruct(prop, dimensionsPattern, dimensions);
|
||||
|
|
|
@ -7,9 +7,6 @@ class XmpPhotoshopNamespace extends XmpNamespace {
|
|||
|
||||
const XmpPhotoshopNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||
|
||||
@override
|
||||
String get displayTitle => 'Photoshop';
|
||||
|
||||
@override
|
||||
String formatValue(XmpProp prop) {
|
||||
final value = prop.value;
|
||||
|
|
|
@ -5,9 +5,6 @@ import 'package:aves/widgets/viewer/info/metadata/xmp_namespaces.dart';
|
|||
class XmpTiffNamespace extends XmpNamespace {
|
||||
static const ns = 'tiff';
|
||||
|
||||
@override
|
||||
String get displayTitle => 'TIFF';
|
||||
|
||||
const XmpTiffNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||
|
||||
@override
|
||||
|
|
|
@ -9,16 +9,13 @@ import 'package:flutter/material.dart';
|
|||
class XmpBasicNamespace extends XmpNamespace {
|
||||
static const ns = 'xmp';
|
||||
|
||||
static final thumbnailsPattern = RegExp(r'xmp:Thumbnails\[(\d+)\]/(.*)');
|
||||
static final thumbnailsPattern = RegExp(ns + r':Thumbnails\[(\d+)\]/(.*)');
|
||||
static const thumbnailDataDisplayKey = 'Image';
|
||||
|
||||
final thumbnails = <int, Map<String, String>>{};
|
||||
|
||||
XmpBasicNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||
|
||||
@override
|
||||
String get displayTitle => 'Basic';
|
||||
|
||||
@override
|
||||
bool extractData(XmpProp prop) => extractIndexedStruct(prop, thumbnailsPattern, thumbnails);
|
||||
|
||||
|
@ -51,10 +48,10 @@ class XmpMMNamespace extends XmpNamespace {
|
|||
static const didPrefix = 'xmp.did:';
|
||||
static const iidPrefix = 'xmp.iid:';
|
||||
|
||||
static final derivedFromPattern = RegExp(r'xmpMM:DerivedFrom/(.*)');
|
||||
static final historyPattern = RegExp(r'xmpMM:History\[(\d+)\]/(.*)');
|
||||
static final ingredientsPattern = RegExp(r'xmpMM:Ingredients\[(\d+)\]/(.*)');
|
||||
static final pantryPattern = RegExp(r'xmpMM:Pantry\[(\d+)\]/(.*)');
|
||||
static final derivedFromPattern = RegExp(ns + r':DerivedFrom/(.*)');
|
||||
static final historyPattern = RegExp(ns + r':History\[(\d+)\]/(.*)');
|
||||
static final ingredientsPattern = RegExp(ns + r':Ingredients\[(\d+)\]/(.*)');
|
||||
static final pantryPattern = RegExp(ns + r':Pantry\[(\d+)\]/(.*)');
|
||||
|
||||
final derivedFrom = <String, String>{};
|
||||
final history = <int, Map<String, String>>{};
|
||||
|
@ -63,9 +60,6 @@ class XmpMMNamespace extends XmpNamespace {
|
|||
|
||||
XmpMMNamespace(Map<String, String> rawProps) : super(ns, rawProps);
|
||||
|
||||
@override
|
||||
String get displayTitle => 'Media Management';
|
||||
|
||||
@override
|
||||
bool extractData(XmpProp prop) {
|
||||
final hasStructs = extractStruct(prop, derivedFromPattern, derivedFrom);
|
||||
|
|
|
@ -59,11 +59,11 @@ class _XmpStructArrayCardState extends State<XmpStructArrayCard> {
|
|||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
Expanded(
|
||||
child: HighlightTitle(
|
||||
title: '${widget.title} ${_index + 1}',
|
||||
color: Colors.transparent,
|
||||
selectable: true,
|
||||
showHighlight: false,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
|
@ -128,8 +128,8 @@ class XmpStructCard extends StatelessWidget {
|
|||
children: [
|
||||
HighlightTitle(
|
||||
title: title,
|
||||
color: Colors.transparent,
|
||||
selectable: true,
|
||||
showHighlight: false,
|
||||
),
|
||||
InfoRowGroup(
|
||||
info: struct,
|
||||
|
|
Loading…
Reference in a new issue