-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLoadFilePage.qml
269 lines (202 loc) · 7.73 KB
/
LoadFilePage.qml
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.Window 2.0
import qmlbcvdecoder 1.0
Item {
width: 1000
height: 800
SystemPalette { id: palette }
clip: true
FileDialog {
id: fileDialog
visible: false
modality: Qt.WindowModal
title: "Choose a file"
selectExisting: true
selectMultiple: false
selectFolder: false
nameFilters: [ "(*.bcv)" ]
selectedNameFilter: "(*.bcv)"
onFileUrlChanged: {
photoGallery.state = "loading"
resetPreviewer()
decoder.decodeFile(fileUrl)
}
}
ColumnLayout {
id: fileChooser
anchors {
left: parent.left
right: parent.right
top: parent.top
leftMargin: 12
}
spacing: 8
Label {
text: "<b>chosen files:</b> " + fileDialog.fileUrls
}
RowLayout{
Button {
id: button
text: "Choose File"
onClicked: {
fileDialog.visible = true
fileDialog.open()
detailButton.visible = true
}
}
Button {
id: detailButton
visible: false
text: "File Detail"
onClicked: {
fileInfoDialog.visible = true
fileInfoDialog.open()
}
}
}
Dialog{
id: fileInfoDialog
visible: false
modality: Qt.WindowModal
title: "BCV file information"
width: 350
height: 250
contentItem: Rectangle{
id: fileInfo
border.color: "#c8cccf"
radius: 8
anchors.fill: parent
property int version: 0
property int videoWidth: 0
property int videoHeight: 0
property double fps: 0
property string pixFormat: ""
property int totalFrame: 0
property int year: 0
property int mon: 0
property int day: 0
property int hour: 0
property int min: 0
property int sec: 0
property string camName: ""
property string nirBaseline: ""
property string channel: ""
ColumnLayout{
anchors.top: parent.top
anchors.left: parent.left
anchors.topMargin: 12
anchors.leftMargin: 12
spacing: 2
Label{
font.bold: true
text: "File Information"
}
Label{
text: "Version " + fileInfo.version
}
Label{
text: "Width " + fileInfo.videoWidth
}
Label{
text: "Height " + fileInfo.videoHeight
}
Label{
text: "Fps " + fileInfo.fps
}
Label{
text: "Pixel Format " + fileInfo.pixFormat
}
Label{
text: "Total Frames " + fileInfo.totalFrame
}
Label{
text: "Time " + fileInfo.year + "/" + fileInfo.mon + "/" + fileInfo.day + " " + fileInfo.hour + ":" + fileInfo.min + ":" + fileInfo.sec
}
Label{
text: "Camera Name " + fileInfo.camName
}
Label{
text: "Nir Baseline " + fileInfo.nirBaseline
}
Label{
text: "Nir Channels " + fileInfo.channel
}
Button{
text:"Close"
onClicked: {
fileInfoDialog.visible = false
fileInfoDialog.close()
}
}
}
}
}
}
BCVDecoder{
id: decoder
onSendVideoHeaderInfo: {
console.log("receive video header" + videoHeaderStruct )
var infos = videoHeaderStruct.split(";")
fileInfo.version = infos[0]
fileInfo.videoWidth = infos[1]
fileInfo.videoHeight = infos[2]
fileInfo.fps = infos[3]
fileInfo.pixFormat = "RGBA8888"
fileInfo.totalFrame = infos[5]
fileInfo.year = infos[6]
fileInfo.mon = infos[7]
fileInfo.day = infos[8]
fileInfo.hour = infos[9]
fileInfo.min = infos[10]
fileInfo.sec = infos[11]
fileInfo.camName = infos[12]
fileInfo.nirBaseline = infos[13]
fileInfo.channel = infos[14]
}
onSendFrameHeaderInfo:{
console.log("receive frame header" + frameHeaderStruct )
var infos = frameHeaderStruct.split(";")
var index = infos[0]
var hr_bpm = infos[1]
var rr_bpm = infos[2]
var interval = infos[3]
var lambda = infos[4]
var eb_ts = infos[5]
// console.log("index = " + index )
// console.log("hr_bpm = " + hr_bpm )
// console.log("rr_bpm = " + rr_bpm )
// console.log("lambda = " + lambda )
// console.log("interval = " + interval )
// console.log("eb_ts = " + eb_ts )
photoGallery.frameInfoModel.append( { "index": index, "hr_bpm": hr_bpm, "rr_bpm": rr_bpm, "interval": interval, "lambda": lambda, "eb_ts": eb_ts } )
}
onSendImage: {
ProviderImg.carryImage( image );
}
onFinish:{
photoGallery.state = "active"
}
}
Rectangle{
id: fileScrollView
anchors.top: fileChooser.bottom
anchors.topMargin: 30
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.leftMargin: 12
anchors.right: parent.right
Gallery{
id: photoGallery
frameNumber: fileInfo.totalFrame
fps: fileInfo.fps
}
}
function resetPreviewer(){
ProviderImg.reset();
photoGallery.frameInfoModel.clear();
photoGallery.index = 0
}
}