info: improved some xmp display

This commit is contained in:
Thibault Deckers 2021-10-09 12:28:10 +09:00
parent 4abc9c9844
commit 4e441e8491
2 changed files with 23 additions and 6 deletions

View file

@ -26,6 +26,7 @@ class XMP {
'GPano': 'Google Panorama',
'illustrator': 'Illustrator',
'Iptc4xmpCore': 'IPTC Core',
'Iptc4xmpExt': 'IPTC Extension',
'lr': 'Lightroom',
'MicrosoftPhoto': 'Microsoft Photo',
'mwg-rs': 'Regions',

View file

@ -6,9 +6,13 @@ class XmpCrsNamespace extends XmpNamespace {
static const ns = 'crs';
static final cgbcPattern = RegExp(ns + r':CircularGradientBasedCorrections\[(\d+)\]/(.*)');
static final gbcPattern = RegExp(ns + r':GradientBasedCorrections\[(\d+)\]/(.*)');
static final pbcPattern = RegExp(ns + r':PaintBasedCorrections\[(\d+)\]/(.*)');
static final lookPattern = RegExp(ns + r':Look/(.*)');
final cgbc = <int, Map<String, String>>{};
final gbc = <int, Map<String, String>>{};
final pbc = <int, Map<String, String>>{};
final look = <String, String>{};
XmpCrsNamespace(Map<String, String> rawProps) : super(ns, rawProps);
@ -16,21 +20,33 @@ class XmpCrsNamespace extends XmpNamespace {
@override
bool extractData(XmpProp prop) {
final hasStructs = extractStruct(prop, lookPattern, look);
final hasIndexedStructs = extractIndexedStruct(prop, cgbcPattern, cgbc);
var hasIndexedStructs = extractIndexedStruct(prop, cgbcPattern, cgbc);
hasIndexedStructs |= extractIndexedStruct(prop, gbcPattern, gbc);
hasIndexedStructs |= extractIndexedStruct(prop, pbcPattern, pbc);
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,
),
if (gbc.isNotEmpty)
XmpStructArrayCard(
title: 'Gradient Based Corrections',
structByIndex: gbc,
),
if (look.isNotEmpty)
XmpStructCard(
title: 'Look',
struct: look,
),
if (pbc.isNotEmpty)
XmpStructArrayCard(
title: 'Paint Based Corrections',
structByIndex: pbc,
),
];
}