minor fixes

This commit is contained in:
Thibault Deckers 2020-11-20 15:29:29 +09:00
parent edc90f085c
commit 3fb3cf1f88
3 changed files with 22 additions and 10 deletions

View file

@ -44,14 +44,21 @@ class MimeTypes {
static const List<String> undecodable = [crw, psd]; // TODO TLAD make it dynamic if it depends on OS/lib versions static const List<String> undecodable = [crw, psd]; // TODO TLAD make it dynamic if it depends on OS/lib versions
static String displayType(String mime) { static String displayType(String mime) {
final patterns = [ switch (mime) {
RegExp('.*/'), // remove type, keep subtype case 'image/x-icon':
RegExp('(X-|VND.(WAP.)?)'), // noisy prefixes return 'ICO';
'+XML', // noisy suffix case 'image/vnd.adobe.photoshop':
RegExp('ADOBE\\\.'), // for PSD case 'image/x-photoshop':
]; return 'PSD';
mime = mime.toUpperCase(); default:
patterns.forEach((pattern) => mime = mime.replaceFirst(pattern, '')); final patterns = [
return mime; RegExp('.*/'), // remove type, keep subtype
RegExp('(X-|VND.(WAP.)?)'), // noisy prefixes
'+XML', // noisy suffix
];
mime = mime.toUpperCase();
patterns.forEach((pattern) => mime = mime.replaceFirst(pattern, ''));
return mime;
}
} }
} }

View file

@ -2,7 +2,9 @@ class XMP {
static const namespaceSeparator = ':'; static const namespaceSeparator = ':';
static const structFieldSeparator = '/'; static const structFieldSeparator = '/';
// cf https://exiftool.org/TagNames/XMP.html
static const Map<String, String> namespaces = { static const Map<String, String> namespaces = {
'aux': 'Auxiliary Exif',
'Camera': 'Camera', 'Camera': 'Camera',
'crs': 'Camera Raw Settings', 'crs': 'Camera Raw Settings',
'dc': 'Dublin Core', 'dc': 'Dublin Core',
@ -12,6 +14,7 @@ class XMP {
'Iptc4xmpCore': 'IPTC Core', 'Iptc4xmpCore': 'IPTC Core',
'lr': 'Lightroom', 'lr': 'Lightroom',
'MicrosoftPhoto': 'Microsoft Photo', 'MicrosoftPhoto': 'Microsoft Photo',
'panorama': 'Panorama',
'pdf': 'PDF', 'pdf': 'PDF',
'pdfx': 'PDF/X', 'pdfx': 'PDF/X',
'photomechanic': 'Photo Mechanic', 'photomechanic': 'Photo Mechanic',

View file

@ -15,7 +15,9 @@ class ErrorThumbnail extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Container(
alignment: Alignment.center,
color: Colors.black,
child: Tooltip( child: Tooltip(
message: tooltip, message: tooltip,
preferBelow: false, preferBelow: false,