| 1 |
import QtQuick 2.12 |
| 2 |
import Lomiri.Components 1.3 |
| 3 |
import Lomiri.Components.Popups 1.3 |
| 4 |
|
| 5 |
import CameraApp 0.1 |
| 6 |
|
| 7 |
Popover { |
| 8 |
id: infoPopover |
| 9 |
property var currentMedia: null |
| 10 |
property var model: null |
| 11 |
property var exifData: currentMedia != undefined ? fileOperations.getEXIFData(currentMedia.url) : undefined |
| 12 |
|
| 13 |
property var infoKeys : [ |
| 14 |
{ "key": 'Exif.Photo.PixelYDimension' , "title" : i18n.tr( "Width : %1")}, |
| 15 |
{ "key": 'Exif.Photo.PixelXDimension' , "title" :i18n.tr( "Height : %1")}, |
| 16 |
{ "key": 'Exif.Photo.DateTimeOriginal' , "title" :i18n.tr( "Date : %1")}, |
| 17 |
{ "key": 'Exif.Image.Model' , "title" :i18n.tr( "Camera Model : %1")}, |
| 18 |
{ "key": 'Exif.Image.Copyright' , "title" :i18n.tr( "Copyright : %1")}, |
| 19 |
{ "key": 'Exif.Image.ExposureTime' , "title" :i18n.tr( "Exposure Time : %1")}, |
| 20 |
{ "key": 'Exif.Image.FNumber' , "title" :i18n.tr( "F. Number : %1")}, |
| 21 |
{ "key": 'Exif.Image.NewSubfileType' , "title" :i18n.tr( "Sub-File type : %1")}, |
| 22 |
]; |
| 23 |
|
| 24 |
FileOperations { |
| 25 |
id: fileOperations |
| 26 |
} |
| 27 |
|
| 28 |
autoClose: true |
| 29 |
|
| 30 |
Item { |
| 31 |
height: childrenRect.height + units.gu(4) |
| 32 |
anchors { |
| 33 |
centerIn: parent |
| 34 |
margins: units.gu(1) |
| 35 |
} |
| 36 |
Column { |
| 37 |
anchors { |
| 38 |
centerIn: parent |
| 39 |
} |
| 40 |
|
| 41 |
spacing:units.gu(1) |
| 42 |
Label { |
| 43 |
text:i18n.tr("Media Information"); |
| 44 |
textSize: Label.Large |
| 45 |
color: theme.palette.normal.overlayText |
| 46 |
} |
| 47 |
Label { |
| 48 |
text:i18n.tr("Name : %1".arg(infoPopover.model.fileName)) |
| 49 |
} |
| 50 |
Label { |
| 51 |
text:i18n.tr("Type : %1").arg(infoPopover.model.fileType) |
| 52 |
} |
| 53 |
//Print stright forward EXIF data |
| 54 |
Repeater { |
| 55 |
model:infoKeys |
| 56 |
Label { |
| 57 |
visible: undefined !== exifData && undefined !== exifData[modelData['key']]; |
| 58 |
text:visible ? modelData["title"].arg(exifData[modelData['key']]) : ""; |
| 59 |
} |
| 60 |
} |
| 61 |
Label { |
| 62 |
visible: undefined !== exifData && undefined !== exifData['Exif.Photo.Flash']; |
| 63 |
text: { |
| 64 |
if (!visible) |
| 65 |
return ""; |
| 66 |
|
| 67 |
var flashTag = parseInt(exifData['Exif.Photo.Flash'], /* radix */ 10); |
| 68 |
|
| 69 |
/* |
| 70 |
* From https://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif/flash.html: |
| 71 |
* |
| 72 |
* Exif TIFF Tag Flash, code 37385 (0x9209) |
| 73 |
* |
| 74 |
* Indicates the status of flash when the image was shot. |
| 75 |
* |
| 76 |
* Bit 0 indicates the flash firing status, bits 1 and 2 |
| 77 |
* indicate the flash return status, bits 3 and 4 indicate |
| 78 |
* the flash mode, bit 5 indicates whether the flash |
| 79 |
* function is present, and bit 6 indicates "red eye" mode. |
| 80 |
*/ |
| 81 |
var flashDidFire = (flashTag & (1 << 0)); |
| 82 |
|
| 83 |
return i18n.tr("With Flash : %1").arg( flashDidFire ? i18n.tr("Yes") : i18n.tr("No")); |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
} |