Debian Codegraph @

qml/components/VideoReview.qml

raw
1 /*
2 * Copyright 2015 Canonical Ltd.
3 * Copyright (C) 2025 UBports Foundation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 import QtQuick 2.12
19 import Lomiri.Components 1.3
20
21 Item {
22 property string videoPath
23 property int bottomMargin
24
25 Image {
26 id: thumbnail
27 anchors.fill: parent
28
29 fillMode: Image.PreserveAspectFit
30 sourceSize.width: width
31 sourceSize.height: height
32
33 source: videoPath ? "image://thumbnailer/%1".arg(videoPath) : ""
34 opacity: status == Image.Ready ? 1.0 : 0.0
35 Behavior on opacity { LomiriNumberAnimation { duration: LomiriAnimation.FastDuration } }
36 }
37
38 Item {
39 anchors.fill: parent
40 anchors.bottomMargin: parent.bottomMargin
41
42 ActivityIndicator {
43 anchors.centerIn: parent
44 visible: running
45 running: thumbnail.status == Image.Loading
46 }
47
48 PlayIcon {
49 anchors.centerIn: parent
50 width: units.gu(7)
51 height: width
52 }
53
54 MouseArea {
55 anchors.centerIn: parent
56 width: units.gu(10)
57 height: units.gu(10)
58 onClicked: Qt.openUrlExternally("video://%1".arg(videoPath));
59 }
60 }
61 }