diff --git a/src/mainview/components/ChatViewFooter.qml b/src/mainview/components/ChatViewFooter.qml index b0f58069d21f3b8f2b43fda570477b7a73225a0a..8afa71d16783a94d694d7f148d3dd55f454f9f75 100644 --- a/src/mainview/components/ChatViewFooter.qml +++ b/src/mainview/components/ChatViewFooter.qml @@ -89,6 +89,11 @@ Rectangle { visible: false } + onVisibleChanged: { + if (!visible) { + recordBox.visible = false + } + } EmojiPicker { id: emojiPicker diff --git a/src/mainview/components/RecordBox.qml b/src/mainview/components/RecordBox.qml index b1740a1f7aaf1eb03b6f1f971e99898c2c02d4e7..bc997db9ba4c19f2e0c0b25c9942aaf1003c9f4b 100644 --- a/src/mainview/components/RecordBox.qml +++ b/src/mainview/components/RecordBox.qml @@ -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,13 @@ Rectangle { maskSource: rectBox } } + + onVisibleChanged: { + if (visible) { + openRecorder(true) + } else + VideoDevices.stopDevice(previewWidget.deviceId) + } } Label { @@ -269,11 +274,14 @@ Rectangle { width: root.width - visible: (isVideo && !previewAvailable) + visible: (isVideo && VideoDevices.listSize === 0) - text: qsTr("Preview unavailable") - font.pointSize: 10 + text: JamiStrings.previewUnavailable + font.pointSize: JamiTheme.settingsFontSize font.kerning: true + color: JamiTheme.primaryForegroundColor + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter } Timer { diff --git a/src/settingsview/components/AudioSettings.qml b/src/settingsview/components/AudioSettings.qml index 34649f31412551164e2783216ca81f9e30a09f4f..578aabca875cfb430d40a95c1a410b3880706ebd 100644 --- a/src/settingsview/components/AudioSettings.qml +++ b/src/settingsview/components/AudioSettings.qml @@ -30,6 +30,7 @@ ColumnLayout { id:root property int itemWidth + property int videoDevicesListSize: VideoDevices.listSize enum Setting { AUDIOINPUT, @@ -38,6 +39,19 @@ ColumnLayout { AUDIOMANAGER } + onVisibleChanged: { + if (visible) + populateAudioSettings() + } + + onVideoDevicesListSizeChanged: { + AvAdapter.stopAudioMeter() + var selectedAudioManager = inputComboBoxSetting.comboModel.data( + inputComboBoxSetting.comboModel.index(inputComboBoxSetting.modelIndex, 0), AudioDeviceModel.RawDeviceName) + AVModel.setInputDevice(selectedAudioManager) + AvAdapter.startAudioMeter() + } + function populateAudioSettings() { inputComboBoxSetting.modelIndex = inputComboBoxSetting.comboModel.getCurrentIndex() outputComboBoxSetting.modelIndex = outputComboBoxSetting.comboModel.getCurrentIndex() diff --git a/src/settingsview/components/AvSettingPage.qml b/src/settingsview/components/AvSettingPage.qml index 52cd2b50ffb5449abdfa899b91e4a8d0ac44ae3f..38003fb2b278acfe52a59c85ba280bd08c6f6817 100644 --- a/src/settingsview/components/AvSettingPage.qml +++ b/src/settingsview/components/AvSettingPage.qml @@ -32,10 +32,6 @@ Rectangle { property int contentWidth: avSettingsColumnLayout.width property int preferredHeight: avSettingsColumnLayout.implicitHeight - function populateAVSettings() { - audioSettings.populateAudioSettings() - } - color: JamiTheme.secondaryBackgroundColor ColumnLayout { diff --git a/src/settingsview/components/VideoSettings.qml b/src/settingsview/components/VideoSettings.qml index 19afe5ef0b87bf5beaf8344308563ea20c4e23ef..c6c705c1c9b2f14b77760de1ccb748e6282454e1 100644 --- a/src/settingsview/components/VideoSettings.qml +++ b/src/settingsview/components/VideoSettings.qml @@ -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 } } @@ -196,7 +194,7 @@ ColumnLayout { onSwitchToggled: { AvAdapter.setHardwareAcceleration(checked) - startPreviewing(true) + startPreviewing() } } @@ -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 @@ -243,6 +248,7 @@ ColumnLayout { text: JamiStrings.previewUnavailable font.pointSize: JamiTheme.settingsFontSize font.kerning: true + color: JamiTheme.primaryForegroundColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter