blob: 627c2fe04fc1329af39a7d94e79cee3826f829cf (
plain)
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
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtMultimedia
Row {
id: root
required property MediaRecorder recorder
property bool settingsVisible: false
property bool capturesVisible: false
property alias audioInput: audioInputSelect.selected
property alias camera: videoSourceSelect.selectedCamera
property alias screenCapture: videoSourceSelect.selectedScreenCapture
property alias windowCapture: videoSourceSelect.selectedWindowCapture
spacing: Style.interSpacing * Style.ratio
Column {
id: inputControls
spacing: Style.intraSpacing
VideoSourceSelect { id: videoSourceSelect }
AudioInputSelect { id: audioInputSelect }
}
Column {
width: recordButton.width
RecordButton {
id: recordButton
recording: recorder.recorderState === MediaRecorder.RecordingState
onClicked: recording ? recorder.stop() : recorder.record()
}
Text {
id: recordingTime
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: Style.fontSize
color: palette.text
}
}
Column {
id: optionButtons
spacing: Style.intraSpacing
Button {
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
height: Style.height
width: Style.widthMedium
background: StyleRectangle { anchors.fill: parent }
onClicked: root.capturesVisible = !root.capturesVisible
text: "Captures"
font.pointSize: Style.fontSize
}
Button {
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
height: Style.height
width: Style.widthMedium
background: StyleRectangle { anchors.fill: parent }
onClicked: settingsVisible = !settingsVisible
text: "Settings"
font.pointSize: Style.fontSize
}
}
Timer {
running: true; interval: 100; repeat: true
onTriggered: {
var m = Math.floor(recorder.duration / 60000)
var ms = (recorder.duration / 1000 - m * 60).toFixed(1)
recordingTime.text = `${m}:${ms.padStart(4, 0)}`
}
}
}
|