mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
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
This commit is contained in:
parent
afcee37430
commit
819347370a
3 changed files with 26 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue