File: MediaInfoPopover.qml

package info (click to toggle)
lomiri-camera-app 4.0.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,092 kB
  • sloc: cpp: 1,671; javascript: 27; makefile: 16; sh: 12
file content (89 lines) | stat: -rw-r--r-- 3,263 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import QtQuick 2.12
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3

import CameraApp 0.1

Popover {
    id: infoPopover
    property var currentMedia: null
    property var model: null
    property var exifData: fileOperations.getEXIFData(currentMedia.url)

    property var infoKeys : [
              { "key": 'Exif.Photo.PixelYDimension' , "title" : i18n.tr( "Width : %1")},
              { "key": 'Exif.Photo.PixelXDimension' , "title" :i18n.tr( "Height : %1")},
              { "key": 'Exif.Photo.DateTimeOriginal' , "title" :i18n.tr( "Date : %1")},
              { "key": 'Exif.Image.Model' , "title" :i18n.tr( "Camera Model : %1")},
              { "key": 'Exif.Image.Copyright' , "title" :i18n.tr( "Copyright : %1")},
              { "key": 'Exif.Image.ExposureTime' , "title" :i18n.tr( "Exposure Time : %1")},
              { "key": 'Exif.Image.FNumber' , "title" :i18n.tr( "F. Number : %1")},
              { "key": 'Exif.Image.NewSubfileType' , "title" :i18n.tr( "Sub-File type : %1")},
            ];

    FileOperations {
        id: fileOperations
    }

    autoClose: true

    Item {
        height: childrenRect.height + units.gu(4)
        anchors {
            centerIn: parent
            margins: units.gu(1)
        }
        Column {
            anchors {
                centerIn: parent
            }

            spacing:units.gu(1)
            Label {
                text:i18n.tr("Media Information");
                textSize: Label.Large
                color: theme.palette.normal.overlayText
            }
            Label {
                text:i18n.tr("Name : %1".arg(infoPopover.model.fileName))
            }
            Label {
                text:i18n.tr("Type : %1").arg(infoPopover.model.fileType)
            }
            //Print stright forward EXIF data
            Repeater {
                model:infoKeys
                Label {
                    visible:undefined !== exifData[modelData['key']];
                    text:visible ? modelData["title"].arg(exifData[modelData['key']]) : "";
                }
            }
            Label {
                visible: undefined !== exifData['Exif.Photo.Flash'];
                text: {
                    if (!visible)
                        return "";

                    var flashTag = parseInt(exifData['Exif.Photo.Flash'], /* radix */ 10);

                    /*
                     * From https://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif/flash.html:
                     *
                     * Exif TIFF Tag Flash, code 37385 (0x9209)
                     *
                     * Indicates the status of flash when the image was shot.
                     *
                     * Bit 0 indicates the flash firing status, bits 1 and 2
                     * indicate the flash return status, bits 3 and 4 indicate
                     * the flash mode, bit 5 indicates whether the flash
                     * function is present, and bit 6 indicates "red eye" mode.
                     */
                    var flashDidFire = (flashTag & (1 << 0));

                    return i18n.tr("With Flash : %1").arg( flashDidFire ? i18n.tr("Yes") : i18n.tr("No"));
                }
            }
        }
    }

    }