Skip to content
Snippets Groups Projects
Unverified Commit 81934737 authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Sébastien Blin
Browse files

video: fix camera preview opening

 - Camera preview in av settings now opens after inserting USB camera on a device with `No video device`;
 - Same for recording video message window.

Change-Id: I34ad9b6900865fdc7c4acf861527e4bf8e336123
GitLab: #610
parent afcee374
No related branches found
No related tags found
Loading
......@@ -84,7 +84,7 @@ Rectangle {
}
}
RecordBox{
RecordBox {
id: recordBox
visible: false
......
......@@ -41,7 +41,6 @@ Rectangle {
property int duration: 0
property int state: RecordBox.States.INIT
property bool isVideo: false
property bool previewAvailable: false
property int preferredWidth: 320
property int preferredHeight: 240
property int btnSize: 40
......@@ -61,7 +60,6 @@ Rectangle {
if (isVideo) {
previewWidget.deviceId = VideoDevices.getDefaultDevice()
previewWidget.rendererId = VideoDevices.startDevice(previewWidget.deviceId)
previewAvailable = true
}
}
......@@ -243,7 +241,7 @@ Rectangle {
anchors.fill: parent
visible: (isVideo && previewAvailable)
visible: (isVideo && VideoDevices.listSize !== 0)
color: JamiTheme.blackColor
radius: 5
......@@ -262,6 +260,14 @@ Rectangle {
maskSource: rectBox
}
}
onVisibleChanged: {
if (visible) {
previewWidget.deviceId = VideoDevices.getDefaultDevice()
previewWidget.rendererId = VideoDevices.startDevice(previewWidget.deviceId)
} else
VideoDevices.stopDevice(previewWidget.deviceId)
}
}
Label {
......@@ -269,7 +275,13 @@ Rectangle {
width: root.width
visible: (isVideo && !previewAvailable)
visible: (isVideo && VideoDevices.listSize === 0)
onVisibleChanged: {
if (visible) {
closeRecorder()
}
}
text: JamiStrings.previewUnavailable
font.pointSize: JamiTheme.settingsFontSize
......
......@@ -32,14 +32,12 @@ ColumnLayout {
id: root
property real aspectRatio: 0.75
property bool previewAvailable: false
property int itemWidth
function startPreviewing(force = false) {
if (root.visible) {
previewWidget.deviceId = VideoDevices.getDefaultDevice()
previewWidget.rendererId = VideoDevices.startDevice(previewWidget.deviceId, force)
previewAvailable = true
}
}
......@@ -230,11 +228,18 @@ ColumnLayout {
maskSource: rectBox
}
}
onVisibleChanged: {
if (visible) {
VideoDevices.stopDevice(previewWidget.deviceId)
startPreviewing(true)
} else
VideoDevices.stopDevice(previewWidget.deviceId)
}
}
Label {
// TODO: proper use of previewAvailable
visible: !previewAvailable
visible: VideoDevices.listSize === 0
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment