Debian Codegraph @

src/context/applets/photos/package/contents/ui/main.qml

raw
1 /****************************************************************************************
2 * Copyright (c) 2017 Malte Veerman <[email protected]> *
3 * *
4 * This program is free software; you can redistribute it and/or modify it under *
5 * the terms of the GNU General Public License as published by the Free Software *
6 * Foundation; either version 2 of the License, or (at your option) any later *
7 * version. *
8 * *
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
11 * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU General Public License along with *
14 * this program. If not, see <http://www.gnu.org/licenses/>. *
15 ****************************************************************************************/
16
17 import QtQuick 2.15
18 import QtQuick.Controls 2.15
19 import org.kde.kirigami 2.14 as Kirigami
20 import org.kde.amarok.qml 1.0 as AmarokQml
21 import org.kde.amarok.photos 1.0
22
23 AmarokQml.Applet {
24 id: applet
25
26 title: name + ": " + PhotosEngine.artist
27
28 Flickable {
29 anchors.fill: parent
30 contentHeight: height
31 contentWidth: contentRow.width
32
33 Row {
34 id: contentRow
35
36 height: parent.height
37 spacing: Kirigami.Units.smallSpacing
38
39 Repeater {
40 model: PhotosEngine.photoTitles.length
41
42 Item {
43 height: parent.height
44 width: image.width
45
46 Image {
47 id: image
48
49 anchors.top: parent.top
50 height: parent.height
51 width: height * sourceSize.width / sourceSize.height
52 source: PhotosEngine.photoUrls[index]
53 asynchronous: true
54 fillMode: Image.PreserveAspectFit
55 }
56 MouseArea {
57 anchors.fill: parent
58 cursorShape: Qt.PointingHandCursor
59
60 onClicked: Context.runLink(PhotosEngine.pageUrls[index]);
61 }
62 }
63 }
64 }
65 }
66
67 Label {
68 anchors.centerIn: parent
69 text: PhotosEngine.error
70 visible: PhotosEngine.Status === PhotosEngine.Error
71 }
72
73 BusyIndicator {
74 anchors.centerIn: parent
75 running: PhotosEngine.Status === PhotosEngine.Fetching
76 }
77 }