Debian Codegraph @

qml/Viewfinder/TimedShootFeedback.qml

raw
1 /*
2 * <one line to give the program's name and a brief idea of what it does.>
3 * Copyright (C) 2019 eran <email>
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, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 import QtQuick 2.12
20 import Lomiri.Components 1.3
21
22 OrientationHelper {
23 id: timedShootFeedback
24 property real customRotation: 0
25
26 anchors.fill: parent
27
28 function start() {
29 }
30
31 function stop() {
32 remainingSecsLabel.text = "";
33 }
34
35 function showRemainingSecs(secs) {
36 remainingSecsLabel.text = secs;
37 remainingSecsLabel.opacity = 1.0;
38 remainingSecsLabelAnimation.restart();
39 }
40
41 Label {
42 id: remainingSecsLabel
43 anchors.fill: parent
44 font.pixelSize: units.gu(6)
45 font.bold: true
46 color: "white"
47 style: Text.Outline;
48 styleColor: "black"
49 verticalAlignment: Text.AlignVCenter
50 horizontalAlignment: Text.AlignHCenter
51 visible: opacity != 0.0
52 opacity: 0.0
53
54 OpacityAnimator {
55 id: remainingSecsLabelAnimation
56 target: remainingSecsLabel
57 from: 1.0
58 to: 0.0
59 duration: 750
60 easing: LomiriAnimation.StandardEasing
61 }
62
63 rotation: timedShootFeedback.automaticOrientation ? 0 : timedShootFeedback.customRotation
64 Behavior on rotation {
65 RotationAnimator {
66 duration: LomiriAnimation.BriskDuration
67 easing: LomiriAnimation.StandardEasing
68 direction: RotationAnimator.Shortest
69 }
70 }
71 }
72
73 // tapping anywhere on the screen while a timed shoot is ongoing cancels it
74 MouseArea {
75 anchors.fill: parent
76 onClicked: viewFinderOverlay.controls.cancelTimedShoot()
77 enabled: remainingSecsLabel.visible
78 }
79 }