RecordingNotice.qml
2.8 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* Webcamoid, webcam capture application.
* Copyright (C) 2019 Gonzalo Exequiel Pedone
*
* Webcamoid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Webcamoid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Webcamoid. If not, see <http://www.gnu.org/licenses/>.
*
* Web-Site: http://webcamoid.github.io/
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Rectangle {
id: recordingNotice
color: "black"
width: 128
height: 60
radius: 4
onVisibleChanged: {
if (visible) {
recordingTimer.startTime = new Date().getTime()
recordingTimer.start()
} else {
recordingTimer.stop()
}
}
ColumnLayout {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
RowLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Image {
id: recordingIcon
source: "image://icons/recording"
sourceSize: Qt.size(width, height)
width: 32
height: 32
}
Label {
text: qsTr("Recording")
color: "white"
font.bold: true
}
}
Label {
id: recordingTime
color: "white"
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
font.bold: true
}
}
Timer {
id: recordingTimer
interval: 500
repeat: true
property double startTime: new Date().getTime()
function pad(x)
{
return x < 10? "0" + x: x
}
onTriggered: {
var diffTime = (new Date().getTime() - startTime) / 1000
diffTime = parseInt(diffTime, 10)
var ss = diffTime % 60;
diffTime = (diffTime - ss) / 60;
var mm = diffTime % 60;
var hh = (diffTime - mm) / 60;
recordingTime.text = pad(hh) + ":" + pad(mm) + ":" + pad(ss)
}
}
SequentialAnimation on opacity {
loops: Animation.Infinite
running: recordingNotice.visible
PropertyAnimation {
easing.type: Easing.OutSine
to: 0
duration: 1000
}
PropertyAnimation {
easing.type: Easing.InSine
to: 1
duration: 1000
}
}
}