blob: 64a9f1cdc16a4cc3e16417b3842710bd9d748c00 [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001/*
2 * Copyright (C) 2019-2020 by Savoir-faire Linux
3 * Author: Yang Wang <yang.wang@savoirfairelinux.com>
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
19import QtQuick 2.15
20import QtQuick.Window 2.14
21import QtQuick.Controls 2.15
22import QtQuick.Controls.Universal 2.12
23import QtQuick.Layouts 1.3
24import QtGraphicalEffects 1.14
25import QtQuick.Controls.Styles 1.4
26import net.jami.Models 1.0
ababia284cae2020-08-10 12:33:34 +020027import "../../commoncomponents"
Sébastien Blin1f915762020-08-03 13:27:42 -040028
29Rectangle {
Sébastien Blin2eb16d72020-08-13 23:38:43 -040030 id: root
Sébastien Blin1f915762020-08-03 13:27:42 -040031
32 AudioInputDeviceModel{
33 id: audioInputDeviceModel
34 }
35
36 AudioOutputDeviceModel{
37 id: audioOutputDeviceModel
38 }
39
40 AudioManagerListModel{
41 id: audioManagerListModel
42 }
43
44 VideoInputDeviceModel{
45 id: videoInputDeviceModel
46 }
47
48 VideoFormatResolutionModel{
49 id: videoFormatResolutionModel
50 }
51
52 VideoFormatFpsModel{
53 id: videoFormatFpsModel
54 }
55
56 function populateAVSettings(){
57 audioInputDeviceModel.reset()
58 audioOutputDeviceModel.reset()
59
60 inputComboBox.currentIndex = audioInputDeviceModel.getCurrentSettingIndex()
61 outputComboBox.currentIndex = audioOutputDeviceModel.getCurrentSettingIndex()
62 ringtoneDeviceComboBox.currentIndex = audioOutputDeviceModel.getCurrentRingtoneDeviceIndex()
63
64 audioManagerRowLayout.visible = (audioManagerListModel.rowCount() > 0)
65 if(audioManagerListModel.rowCount() > 0){
66 audioManagerComboBox.currentIndex = audioManagerListModel.getCurrentSettingIndex()
67 }
68
69 populateVideoSettings()
70 var encodeAccel = ClientWrapper.avmodel.getHardwareAcceleration()
71 hardwareAccelControl.checked = encodeAccel
72 }
73
74 function populateVideoSettings() {
75 videoInputDeviceModel.reset()
76
77 deviceBox.enabled = (videoInputDeviceModel.deviceCount() > 0)
78 resolutionBox.enabled = (videoInputDeviceModel.deviceCount() > 0)
79 fpsBox.enabled = (videoInputDeviceModel.deviceCount() > 0)
80 labelVideoDevice.enabled = (videoInputDeviceModel.deviceCount() > 0)
81 labelVideoResolution.enabled = (videoInputDeviceModel.deviceCount() > 0)
82 labelVideoFps.enabled = (videoInputDeviceModel.deviceCount() > 0)
83
84 deviceBox.currentIndex = videoInputDeviceModel.getCurrentSettingIndex()
85 slotDeviceBoxCurrentIndexChanged(deviceBox.currentIndex)
86
87 try{
88 startPreviewing(false)
89 } catch (err2){ console.log("Start preview fail when populate video settings, exception: "+ err2.message)}
90
91 }
92
93 function setFormatListForCurrentDevice(){
94 var device = ClientWrapper.avmodel.getCurrentVideoCaptureDevice()
95 if(ClientWrapper.settingsAdaptor.get_DeviceCapabilitiesSize(device) === 0){
96 return
97 }
98
99 try{
100 videoFormatResolutionModel.reset()
101 resolutionBox.currentIndex = videoFormatResolutionModel.getCurrentSettingIndex()
102 slotFormatCurrentIndexChanged(resolutionBox.currentIndex,true)
103 } catch(err){console.warn("Exception: " + err.message)}
104 }
105
106 function startPreviewing(force = false){
107 ClientWrapper.accountAdaptor.startPreviewing(force)
108 previewAvailable = true
109 }
110
111 function stopPreviewing(){
112 ClientWrapper.accountAdaptor.stopPreviewing()
113 }
114
115 function startAudioMeter(async = true){
116 audioInputMeter.start()
117 ClientWrapper.accountAdaptor.startAudioMeter(async)
118 }
119
120 function stopAudioMeter(async = true){
121 audioInputMeter.stop()
122 ClientWrapper.accountAdaptor.stopAudioMeter(async)
123 }
124
125 // slots for av page
126 function slotAudioMeter(id, level){
127 if (id === "audiolayer_id") {
128 audioInputMeter.setLevel(level)
129 }
130 }
131
132 function slotSetHardwareAccel(state){
133 ClientWrapper.accountAdaptor.avModel().setHardwareAcceleration(state)
134 startPreviewing(true)
135 }
136
137 function slotAudioManagerIndexChanged(index){
138 stopAudioMeter(false)
139 var selectedAudioManager = audioManagerListModel.data(audioManagerListModel.index(
140 index, 0), AudioManagerListModel.AudioManagerID)
141 ClientWrapper.avmodel.setAudioManager(selectedAudioManager)
142 startAudioMeter(false)
143 }
144
145 function slotRingtoneDeviceIndexChanged(index){
146 stopAudioMeter(false)
147 var selectedRingtoneDeviceName = audioOutputDeviceModel.data(audioOutputDeviceModel.index(
148 index, 0), AudioOutputDeviceModel.Device_ID)
149 ClientWrapper.avmodel.setRingtoneDevice(selectedRingtoneDeviceName)
150 startAudioMeter(false)
151 }
152
153 function slotAudioOutputIndexChanged(index){
154 stopAudioMeter(false)
155 var selectedOutputDeviceName = audioOutputDeviceModel.data(audioOutputDeviceModel.index(
156 index, 0), AudioOutputDeviceModel.Device_ID)
157 ClientWrapper.avmodel.setOutputDevice(selectedOutputDeviceName)
158 startAudioMeter(false)
159 }
160
161 function slotAudioInputIndexChanged(index){
162 stopAudioMeter(false)
163 var selectedInputDeviceName = audioInputDeviceModel.data(audioInputDeviceModel.index(
164 index, 0), AudioInputDeviceModel.Device_ID)
165
166 ClientWrapper.avmodel.setInputDevice(selectedInputDeviceName)
167 startAudioMeter(false)
168 }
169
170 function slotDeviceBoxCurrentIndexChanged(index){
171 if(videoInputDeviceModel.deviceCount() <= 0){
172 return
173 }
174
175 try{
176 var deviceId = videoInputDeviceModel.data(videoInputDeviceModel.index(
177 index, 0), VideoInputDeviceModel.DeviceId)
178 var deviceName = videoInputDeviceModel.data(videoInputDeviceModel.index(
179 index, 0), VideoInputDeviceModel.DeviceName)
180 if(deviceId.length === 0){
181 console.warn("Couldn't find device: " + deviceName)
182 return
183 }
184
185 ClientWrapper.avmodel.setCurrentVideoCaptureDevice(deviceId)
186 ClientWrapper.avmodel.setDefaultDevice(deviceId)
187 setFormatListForCurrentDevice()
188 startPreviewing(true)
189 } catch(err){console.warn(err.message)}
190 }
191
192 function slotFormatCurrentIndexChanged(index, isResolutionIndex){
193 var resolution
194 var rate
195 if(isResolutionIndex){
196 resolution = videoFormatResolutionModel.data(videoFormatResolutionModel.index(
197 index, 0), VideoFormatResolutionModel.Resolution)
198 videoFormatFpsModel.currentResolution = resolution
199 fpsBox.currentIndex = videoFormatFpsModel.getCurrentSettingIndex()
200 rate = videoFormatFpsModel.data(videoFormatFpsModel.index(
201 fpsBox.currentIndex, 0), VideoFormatFpsModel.FPS)
202 } else {
203 resolution = videoFormatResolutionModel.data(videoFormatResolutionModel.index(
204 resolutionBox.currentIndex, 0), VideoFormatResolutionModel.Resolution)
205 videoFormatFpsModel.currentResolution = resolution
206 rate = videoFormatFpsModel.data(videoFormatFpsModel.index(
207 index, 0), VideoFormatFpsModel.FPS)
208 }
209
210 try{
211 ClientWrapper.settingsAdaptor.set_Video_Settings_Rate_And_Resolution(ClientWrapper.avmodel.getCurrentVideoCaptureDevice(),rate,resolution)
ababi6fa08612020-08-10 19:13:28 +0200212 updatePreviewRatio(resolution)
Sébastien Blin1f915762020-08-03 13:27:42 -0400213 } catch(error){console.warn(error.message)}
214 }
215
216 function slotVideoDeviceListChanged(){
217 populateVideoSettings()
218 }
219
ababi6fa08612020-08-10 19:13:28 +0200220 function updatePreviewRatio(resolution){
221 var res = resolution.split("x")
222 var ratio = res[1] / res[0]
223 if (ratio) {
224 aspectRatio = ratio
225 } else {
226 console.error("Could not scale recording video preview")
227 }
228 }
229
230 property int preferredColumnWidth: avSettingsScrollView.width / 2 - 50
231 property int preferredSettingsWidth: avSettingsScrollView.width - 100
232
233 property real aspectRatio: 0.75
234
Sébastien Blin1f915762020-08-03 13:27:42 -0400235 property bool previewAvailable: false
ababia284cae2020-08-10 12:33:34 +0200236 signal backArrowClicked
Sébastien Blin1f915762020-08-03 13:27:42 -0400237
238 Connections{
239 target: ClientWrapper.avmodel
Sébastien Blin2eb16d72020-08-13 23:38:43 -0400240 enabled: root.visible
Sébastien Blin1f915762020-08-03 13:27:42 -0400241
242 function onAudioMeter(id, level){
243 slotAudioMeter(id,level)
244 }
245 }
246
247 Connections{
248 target: ClientWrapper.renderManager
Sébastien Blin2eb16d72020-08-13 23:38:43 -0400249 enabled: root.visible
Sébastien Blin1f915762020-08-03 13:27:42 -0400250
251 function onVideoDeviceListChanged(){
252 slotVideoDeviceListChanged()
253 }
254 }
255
256 Layout.fillHeight: true
ababi6fa08612020-08-10 19:13:28 +0200257 Layout.maximumWidth: JamiTheme.maximumWidthSettingsView
258 anchors.centerIn: parent
Sébastien Blin1f915762020-08-03 13:27:42 -0400259
ababi6fa08612020-08-10 19:13:28 +0200260 ColumnLayout {
Sébastien Blin2eb16d72020-08-13 23:38:43 -0400261 anchors.fill: root
Sébastien Blin1f915762020-08-03 13:27:42 -0400262
263 RowLayout {
ababi6fa08612020-08-10 19:13:28 +0200264 id: avSettingsTitle
265 Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
266 Layout.leftMargin: JamiTheme.preferredMarginSize
267 Layout.fillWidth: true
268 Layout.maximumHeight: 64
269 Layout.minimumHeight: 64
270 Layout.preferredHeight: 64
Sébastien Blin1f915762020-08-03 13:27:42 -0400271
ababi6fa08612020-08-10 19:13:28 +0200272 HoverableButton {
273 id: backToSettingsMenuButton
274
275 Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
276 Layout.preferredWidth: JamiTheme.preferredFieldHeight
277 Layout.preferredHeight: JamiTheme.preferredFieldHeight
278 Layout.rightMargin: JamiTheme.preferredMarginSize
279
280 radius: 30
281 source: "qrc:/images/icons/ic_arrow_back_24px.svg"
282 backgroundColor: "white"
283 onExitColor: "white"
Yang Wangb97bde42020-08-07 11:24:18 -0400284 toolTipText: qsTr("Toggle to display side panel")
285 hoverEnabled: true
ababi6fa08612020-08-10 19:13:28 +0200286
287 visible: mainViewWindow.sidePanelHidden
288
289 onClicked: {
290 backArrowClicked()
291 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400292 }
293
ababi6fa08612020-08-10 19:13:28 +0200294 Label {
295 Layout.fillWidth: true
296 Layout.minimumHeight: JamiTheme.preferredFieldHeight
297 Layout.preferredHeight: JamiTheme.preferredFieldHeight
298 Layout.maximumHeight: JamiTheme.preferredFieldHeight
299
300 text: qsTr("Audio / Video")
301 font.pointSize: JamiTheme.titleFontSize
302 font.kerning: true
303
304 horizontalAlignment: Text.AlignLeft
305 verticalAlignment: Text.AlignVCenter
306 }
307
308 }
309
310
311 ScrollView {
312 id: avSettingsScrollView
313 property ScrollBar vScrollBar: ScrollBar.vertical
314
315 Layout.fillHeight: true
316 Layout.fillWidth: true
317
318 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
319
Sébastien Blin2eb16d72020-08-13 23:38:43 -0400320 width: root.width
321 height: root.height - avSettingsTitle.height
ababi6fa08612020-08-10 19:13:28 +0200322
323 ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
324 ScrollBar.vertical.policy: ScrollBar.AsNeeded
325
326 clip: true
327
Sébastien Blin1f915762020-08-03 13:27:42 -0400328 ColumnLayout {
Sébastien Blin1f915762020-08-03 13:27:42 -0400329 Layout.fillHeight: true
ababi6fa08612020-08-10 19:13:28 +0200330 Layout.fillWidth: true
331 Layout.alignment: Qt.AlignHCenter
Sébastien Blin1f915762020-08-03 13:27:42 -0400332
ababi6fa08612020-08-10 19:13:28 +0200333 spacing: 24
Sébastien Blin1f915762020-08-03 13:27:42 -0400334
ababi6fa08612020-08-10 19:13:28 +0200335 // Audio
Sébastien Blin1f915762020-08-03 13:27:42 -0400336 ColumnLayout {
ababi6fa08612020-08-10 19:13:28 +0200337 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400338 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200339 Layout.leftMargin: JamiTheme.preferredMarginSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400340
ababi6fa08612020-08-10 19:13:28 +0200341 ElidedTextLabel {
Sébastien Blin1f915762020-08-03 13:27:42 -0400342 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200343 Layout.minimumHeight: JamiTheme.preferredFieldHeight
344 Layout.preferredHeight: JamiTheme.preferredFieldHeight
345 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400346
ababi6fa08612020-08-10 19:13:28 +0200347 eText: qsTr("Audio")
348 fontSize: JamiTheme.headerFontSize
349 maxWidth: preferredColumnWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400350 }
351
352 ColumnLayout {
Sébastien Blin1f915762020-08-03 13:27:42 -0400353 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200354 Layout.leftMargin: JamiTheme.preferredMarginSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400355
356 RowLayout {
Sébastien Blin1f915762020-08-03 13:27:42 -0400357 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200358 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400359
ababi6fa08612020-08-10 19:13:28 +0200360 ElidedTextLabel {
Sébastien Blin1f915762020-08-03 13:27:42 -0400361 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200362 Layout.minimumHeight: JamiTheme.preferredFieldHeight
363 Layout.preferredHeight: JamiTheme.preferredFieldHeight
364 Layout.maximumHeight: JamiTheme.preferredFieldHeight
365
366 eText: qsTr("Microphone")
367 fontSize: JamiTheme.settingsFontSize
368 maxWidth: preferredColumnWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400369 }
370
ababi6fa08612020-08-10 19:13:28 +0200371
Sébastien Blin1f915762020-08-03 13:27:42 -0400372 SettingParaCombobox {
373 id: inputComboBox
374
ababi6fa08612020-08-10 19:13:28 +0200375 Layout.maximumWidth: preferredColumnWidth
376 Layout.preferredWidth: preferredColumnWidth
377 Layout.minimumWidth: preferredColumnWidth
378 Layout.minimumHeight: JamiTheme.preferredFieldHeight
379 Layout.preferredHeight: JamiTheme.preferredFieldHeight
380 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400381
ababi6fa08612020-08-10 19:13:28 +0200382 font.pointSize: JamiTheme.buttonFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400383 font.kerning: true
384
385 model: audioInputDeviceModel
Sébastien Blin1f915762020-08-03 13:27:42 -0400386 textRole: "ID_UTF8"
Yang Wangb97bde42020-08-07 11:24:18 -0400387 tooltipText: qsTr("Audio input device selector")
Sébastien Blin1f915762020-08-03 13:27:42 -0400388 onActivated: {
389 slotAudioInputIndexChanged(index)
390 }
391 }
392 }
393
394 // the audio level meter
395 LevelMeter {
396 id: audioInputMeter
397
ababi6fa08612020-08-10 19:13:28 +0200398 Layout.minimumWidth: preferredSettingsWidth
399 Layout.preferredWidth: preferredSettingsWidth
400 Layout.maximumWidth: preferredSettingsWidth
401 Layout.minimumHeight: JamiTheme.preferredFieldHeight
402 Layout.preferredHeight: JamiTheme.preferredFieldHeight
403 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400404
405 indeterminate: false
406 from: 0
407 to: 100
408 }
409
Sébastien Blin1f915762020-08-03 13:27:42 -0400410 RowLayout {
Sébastien Blin1f915762020-08-03 13:27:42 -0400411 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200412 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400413
ababi6fa08612020-08-10 19:13:28 +0200414 ElidedTextLabel {
Sébastien Blin1f915762020-08-03 13:27:42 -0400415 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200416 Layout.minimumHeight: JamiTheme.preferredFieldHeight
417 Layout.preferredHeight: JamiTheme.preferredFieldHeight
418 Layout.maximumHeight: JamiTheme.preferredFieldHeight
419
420 eText: qsTr("Output Device")
421 fontSize: JamiTheme.settingsFontSize
422 maxWidth: preferredColumnWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400423 }
424
ababi6fa08612020-08-10 19:13:28 +0200425
Sébastien Blin1f915762020-08-03 13:27:42 -0400426 SettingParaCombobox {
427 id: outputComboBox
428
ababi6fa08612020-08-10 19:13:28 +0200429 Layout.maximumWidth: preferredColumnWidth
430 Layout.preferredWidth: preferredColumnWidth
431 Layout.minimumWidth: preferredColumnWidth
432 Layout.minimumHeight: JamiTheme.preferredFieldHeight
433 Layout.preferredHeight: JamiTheme.preferredFieldHeight
434 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400435
ababi6fa08612020-08-10 19:13:28 +0200436 font.pointSize: JamiTheme.settingsFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400437 font.kerning: true
438
439 model: audioOutputDeviceModel
Sébastien Blin1f915762020-08-03 13:27:42 -0400440 textRole: "ID_UTF8"
Yang Wangb97bde42020-08-07 11:24:18 -0400441 tooltipText: qsTr("Choose the audio output device")
Sébastien Blin1f915762020-08-03 13:27:42 -0400442 onActivated: {
443 slotAudioOutputIndexChanged(index)
444 }
445 }
446 }
447
448 RowLayout {
Sébastien Blin1f915762020-08-03 13:27:42 -0400449 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200450 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400451
ababi6fa08612020-08-10 19:13:28 +0200452 ElidedTextLabel {
Sébastien Blin1f915762020-08-03 13:27:42 -0400453
Sébastien Blin1f915762020-08-03 13:27:42 -0400454 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200455 Layout.minimumHeight: JamiTheme.preferredFieldHeight
456 Layout.preferredHeight: JamiTheme.preferredFieldHeight
457 Layout.maximumHeight: JamiTheme.preferredFieldHeight
458
459 eText: qsTr("Ringtone Device")
460 font.pointSize: JamiTheme.settingsFontSize
461 maxWidth: preferredColumnWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400462 }
463
ababi6fa08612020-08-10 19:13:28 +0200464
Sébastien Blin1f915762020-08-03 13:27:42 -0400465 SettingParaCombobox {
466 id: ringtoneDeviceComboBox
467
ababi6fa08612020-08-10 19:13:28 +0200468 Layout.maximumWidth: preferredColumnWidth
469 Layout.preferredWidth: preferredColumnWidth
470 Layout.minimumWidth: preferredColumnWidth
471 Layout.minimumHeight: JamiTheme.preferredFieldHeight
472 Layout.preferredHeight: JamiTheme.preferredFieldHeight
473 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400474
ababi6fa08612020-08-10 19:13:28 +0200475 font.pointSize: JamiTheme.buttonFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400476 font.kerning: true
477
478 model: audioOutputDeviceModel
479
480 textRole: "ID_UTF8"
Yang Wangb97bde42020-08-07 11:24:18 -0400481 tooltipText: qsTr("Choose the ringtone output device")
Sébastien Blin1f915762020-08-03 13:27:42 -0400482 onActivated: {
483 slotRingtoneDeviceIndexChanged(index)
484 }
485 }
486 }
487
488 RowLayout {
489 id: audioManagerRowLayout
490
Sébastien Blin1f915762020-08-03 13:27:42 -0400491 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200492 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400493
ababi6fa08612020-08-10 19:13:28 +0200494 ElidedTextLabel {
495 Layout.fillWidth: true
496 Layout.minimumHeight: JamiTheme.preferredFieldHeight
497 Layout.preferredHeight: JamiTheme.preferredFieldHeight
498 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400499
500 text: qsTr("Audio Manager")
ababi6fa08612020-08-10 19:13:28 +0200501 fontSize: JamiTheme.settingsFontSize
502 maxWidth: preferredColumnWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400503 }
504
505 SettingParaCombobox {
506 id: audioManagerComboBox
507
ababi6fa08612020-08-10 19:13:28 +0200508 Layout.maximumWidth: preferredColumnWidth
509 Layout.preferredWidth: preferredColumnWidth
510 Layout.minimumWidth: preferredColumnWidth
511 Layout.minimumHeight: JamiTheme.preferredFieldHeight
512 Layout.preferredHeight: JamiTheme.preferredFieldHeight
513 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400514
ababi6fa08612020-08-10 19:13:28 +0200515 font.pointSize: JamiTheme.buttonFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400516 font.kerning: true
517
518 model: audioManagerListModel
519
520 textRole: "ID_UTF8"
521
522 onActivated: {
523 slotAudioManagerIndexChanged(index)
524 }
525 }
526 }
527 }
528 }
529
Sébastien Blin1f915762020-08-03 13:27:42 -0400530 ColumnLayout {
ababi6fa08612020-08-10 19:13:28 +0200531 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400532 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200533 Layout.leftMargin: JamiTheme.preferredMarginSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400534
ababi6fa08612020-08-10 19:13:28 +0200535 ElidedTextLabel {
Sébastien Blin1f915762020-08-03 13:27:42 -0400536 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200537 Layout.minimumHeight: JamiTheme.preferredFieldHeight
538 Layout.preferredHeight: JamiTheme.preferredFieldHeight
539 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400540
ababi6fa08612020-08-10 19:13:28 +0200541 eText: qsTr("Video")
542 fontSize: JamiTheme.headerFontSize
543 maxWidth: preferredSettingsWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400544 }
545
546 ColumnLayout {
ababi6fa08612020-08-10 19:13:28 +0200547 Layout.leftMargin: 16
Sébastien Blin1f915762020-08-03 13:27:42 -0400548
ababi6fa08612020-08-10 19:13:28 +0200549 RowLayout {
550 Layout.fillWidth: true
551 Layout.maximumHeight: JamiTheme.preferredFieldHeight
552
553 ElidedTextLabel {
Sébastien Blin1f915762020-08-03 13:27:42 -0400554 id: labelVideoDevice
555
Sébastien Blin1f915762020-08-03 13:27:42 -0400556 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200557 Layout.minimumHeight: JamiTheme.preferredFieldHeight
558 Layout.preferredHeight: JamiTheme.preferredFieldHeight
559 Layout.maximumHeight: JamiTheme.preferredFieldHeight
560
561 eText: qsTr("Device")
562 fontSize: JamiTheme.settingsFontSize
563 maxWidth: preferredColumnWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400564 }
565
ababi6fa08612020-08-10 19:13:28 +0200566
Sébastien Blin1f915762020-08-03 13:27:42 -0400567 SettingParaCombobox {
568 id: deviceBox
569
ababi6fa08612020-08-10 19:13:28 +0200570 Layout.maximumWidth: preferredColumnWidth
571 Layout.preferredWidth: preferredColumnWidth
572 Layout.minimumWidth: preferredColumnWidth
573 Layout.minimumHeight: JamiTheme.preferredFieldHeight
574 Layout.preferredHeight: JamiTheme.preferredFieldHeight
575 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400576
ababi6fa08612020-08-10 19:13:28 +0200577 font.pointSize: JamiTheme.buttonFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400578 font.kerning: true
579
580 model: videoInputDeviceModel
581
582 textRole: "DeviceName_UTF8"
Yang Wangb97bde42020-08-07 11:24:18 -0400583 tooltipText: qsTr("Video device selector")
Sébastien Blin1f915762020-08-03 13:27:42 -0400584 onActivated: {
585 slotDeviceBoxCurrentIndexChanged(index)
586 }
587 }
588 }
589
590 RowLayout {
Sébastien Blin1f915762020-08-03 13:27:42 -0400591 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200592 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400593
ababi6fa08612020-08-10 19:13:28 +0200594 ElidedTextLabel {
Sébastien Blin1f915762020-08-03 13:27:42 -0400595 id: labelVideoResolution
596
Sébastien Blin1f915762020-08-03 13:27:42 -0400597 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200598 Layout.minimumHeight: JamiTheme.preferredFieldHeight
599 Layout.preferredHeight: JamiTheme.preferredFieldHeight
600 Layout.maximumHeight: JamiTheme.preferredFieldHeight
601
602 eText: qsTr("Resolution")
603 fontSize: JamiTheme.settingsFontSize
604 maxWidth: preferredColumnWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400605 }
606
607 SettingParaCombobox {
608 id: resolutionBox
609
ababi6fa08612020-08-10 19:13:28 +0200610 Layout.maximumWidth: preferredColumnWidth
611 Layout.preferredWidth: preferredColumnWidth
612 Layout.minimumWidth: preferredColumnWidth
613 Layout.minimumHeight: JamiTheme.preferredFieldHeight
614 Layout.preferredHeight: JamiTheme.preferredFieldHeight
615 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400616
ababi6fa08612020-08-10 19:13:28 +0200617 font.pointSize: JamiTheme.buttonFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400618 font.kerning: true
619
620 model: videoFormatResolutionModel
621 textRole: "Resolution_UTF8"
622
Yang Wangb97bde42020-08-07 11:24:18 -0400623 tooltipText: qsTr("Video device resolution selector")
624
Sébastien Blin1f915762020-08-03 13:27:42 -0400625 onActivated: {
626 slotFormatCurrentIndexChanged(index,true)
627 }
628 }
629 }
630
631 RowLayout {
Sébastien Blin1f915762020-08-03 13:27:42 -0400632 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200633 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400634
ababi6fa08612020-08-10 19:13:28 +0200635 ElidedTextLabel {
Sébastien Blin1f915762020-08-03 13:27:42 -0400636 id: labelVideoFps
637
Sébastien Blin1f915762020-08-03 13:27:42 -0400638 Layout.fillWidth: true
ababi6fa08612020-08-10 19:13:28 +0200639 Layout.minimumHeight: JamiTheme.preferredFieldHeight
640 Layout.preferredHeight: JamiTheme.preferredFieldHeight
641 Layout.maximumHeight: JamiTheme.preferredFieldHeight
642
643 eText: qsTr("Fps")
644 fontSize: JamiTheme.settingsFontSize
645 maxWidth: preferredColumnWidth
Sébastien Blin1f915762020-08-03 13:27:42 -0400646 }
647
648 SettingParaCombobox {
649 id: fpsBox
650
ababi6fa08612020-08-10 19:13:28 +0200651 Layout.maximumWidth: preferredColumnWidth
652 Layout.preferredWidth: preferredColumnWidth
653 Layout.minimumWidth: preferredColumnWidth
654 Layout.minimumHeight: JamiTheme.preferredFieldHeight
655 Layout.preferredHeight: JamiTheme.preferredFieldHeight
656 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400657
ababi6fa08612020-08-10 19:13:28 +0200658 font.pointSize: JamiTheme.buttonFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400659 font.kerning: true
660
661 model: videoFormatFpsModel
662 textRole: "FPS_ToDisplay_UTF8"
663
Yang Wangb97bde42020-08-07 11:24:18 -0400664 tooltipText: qsTr("Video device fps selector")
665
Sébastien Blin1f915762020-08-03 13:27:42 -0400666 onActivated: {
667 slotFormatCurrentIndexChanged(index,false)
668 }
669 }
670 }
671 }
672 }
673
ababi6fa08612020-08-10 19:13:28 +0200674 Rectangle {
675 id: rectBox
Sébastien Blin1f915762020-08-03 13:27:42 -0400676 Layout.alignment: Qt.AlignHCenter
ababi6fa08612020-08-10 19:13:28 +0200677 Layout.maximumHeight: width * aspectRatio
678 Layout.minimumHeight: width * aspectRatio
679 Layout.preferredHeight: width * aspectRatio
Sébastien Blin1f915762020-08-03 13:27:42 -0400680
ababi6fa08612020-08-10 19:13:28 +0200681 Layout.minimumWidth: 200
682 Layout.maximumWidth: 400
683 Layout.preferredWidth: preferredSettingsWidth
684 color: "white"
685 radius: 5
Sébastien Blin1f915762020-08-03 13:27:42 -0400686
ababi6fa08612020-08-10 19:13:28 +0200687 PreviewRenderer {
688 id: previewWidget
689 anchors.fill: rectBox
690 anchors.centerIn: rectBox
Sébastien Blin1f915762020-08-03 13:27:42 -0400691
ababi6fa08612020-08-10 19:13:28 +0200692 layer.enabled: true
693 layer.effect: OpacityMask {
694 maskSource: rectBox
Sébastien Blin1f915762020-08-03 13:27:42 -0400695 }
696 }
697 }
698
ababi6fa08612020-08-10 19:13:28 +0200699
Sébastien Blin1f915762020-08-03 13:27:42 -0400700 Label {
701 visible: !previewAvailable
702
703 Layout.fillWidth: true
704
ababi6fa08612020-08-10 19:13:28 +0200705 Layout.minimumHeight: JamiTheme.preferredFieldHeight
706 Layout.preferredHeight: JamiTheme.preferredFieldHeight
707 Layout.maximumHeight: JamiTheme.preferredFieldHeight
Sébastien Blin1f915762020-08-03 13:27:42 -0400708
709 text: qsTr("Preview unavailable")
ababi6fa08612020-08-10 19:13:28 +0200710 font.pointSize: JamiTheme.settingsFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400711 font.kerning: true
712
713 horizontalAlignment: Text.AlignHCenter
714 verticalAlignment: Text.AlignVCenter
715 }
716
717 // Toggle switch to enable hardware acceleration
718 ToggleSwitch {
719 id: hardwareAccelControl
720
ababi6fa08612020-08-10 19:13:28 +0200721 Layout.fillWidth: true
722 Layout.leftMargin: JamiTheme.preferredMarginSize
723
724 labelText: hwAccelText.elidedText
725 fontPointSize: JamiTheme.settingsFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400726
727 onSwitchToggled: {
728 slotSetHardwareAccel(checked)
729 }
730 }
731
ababi6fa08612020-08-10 19:13:28 +0200732 TextMetrics {
733 id: hwAccelText
734 elide: Text.ElideRight
735 elideWidth: preferredSettingsWidth - 50
736 text: qsTr("Enable hardware acceleration")
737 }
738
Sébastien Blin1f915762020-08-03 13:27:42 -0400739 Item {
Sébastien Blin2eb16d72020-08-13 23:38:43 -0400740 Layout.preferredWidth: root.width - 32
741 Layout.minimumWidth: root.width - 32
ababi6fa08612020-08-10 19:13:28 +0200742 Layout.maximumWidth: JamiTheme.maximumWidthSettingsView - 32
Sébastien Blin1f915762020-08-03 13:27:42 -0400743 Layout.fillHeight: true
Sébastien Blin1f915762020-08-03 13:27:42 -0400744 }
745 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400746 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400747 }
748}