Debian Codegraph @

rc/qml/MediaViewer/GalleryPhotoComponent.qml

raw
1 /*
2 * Copyright (C) 2011-2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Jim Nelson <[email protected]>
18 * Lucas Beeler <[email protected]>
19 * Eric Gregory <[email protected]>
20 */
21
22 import QtQuick 2.9
23
24 // Basic photo component. Can be used on its own, or as a delegate
25 // for PhotoViewer.
26 Rectangle {
27 id: photoComponent
28
29 /*!
30 */
31 property variant mediaSource
32 /*!
33 */
34 property bool load: false
35
36 /*!
37 */
38 property url source: {
39 if (!load)
40 return source;
41
42 if (!mediaSource)
43 return "";
44
45 // TODO: If MediaSource could return dimensions of both original image
46 // and its preview, could dynamically determine if the display dimensions
47 // are smaller than preview's and automatically use that instead of a
48 // full image load
49
50 // Load image using the photo image provider to ensure EXIF orientation
51 return "image://" + (isPreview ? "thumbnailer/" : "photo:/") + mediaSource.path;
52 }
53
54 /*!
55 */
56 property bool isCropped: false
57 /*!
58 */
59 property bool isPreview: false
60 /*!
61 */
62 property bool isZoomable: false
63 /*!
64 */
65 property bool isAnimate: false
66 /*!
67 */
68 property string ownerName: "(not set)"
69
70 // read-only
71 /*!
72 */
73 property real paintedWidth: parent.width
74 /*!
75 */
76 property real paintedHeight: parent.height
77 /*!
78 */
79 property bool isLoaded: false
80
81 // internal
82 /*!
83 */
84 property Image image: null
85
86 /*!
87 */
88 signal loaded()
89 }