From ff5f94b34a717752d35db221c2f274af22902776 Mon Sep 17 00:00:00 2001
From: kkostiuk <kateryna.kostiuk@savoirfairelinux.com>
Date: Thu, 17 Feb 2022 14:33:26 -0500
Subject: [PATCH] settings: update devices list when devices changed

When a new device is connected/disconnected update audio devices list in
the media settings.

This commit also bumps jami-daemon to support DevicesChanged events on
Windows.

Gitlab: #689
Gitlab: #1878
Change-Id: Ibb607939897853794fdbd09eab72f378257d458c
---
 daemon                                        |  2 +-
 .../components/AudioSettingsPage.qml          | 28 +++++++++++++++----
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/daemon b/daemon
index 2771304c..95832cfc 160000
--- a/daemon
+++ b/daemon
@@ -1 +1 @@
-Subproject commit 2771304c7065de05cd78712c76f81cb643824e10
+Subproject commit 95832cfc9d5f4bd09a7f3e3e7d26d8227b1fa3f2
diff --git a/src/app/settingsview/components/AudioSettingsPage.qml b/src/app/settingsview/components/AudioSettingsPage.qml
index 2483cfec..e78551e1 100644
--- a/src/app/settingsview/components/AudioSettingsPage.qml
+++ b/src/app/settingsview/components/AudioSettingsPage.qml
@@ -25,7 +25,7 @@ import "../../commoncomponents"
 SettingsPageBase {
     id: root
 
-    property int itemWidth: 188
+    property int itemWidth: 250
     title: JamiStrings.audio
 
     flickableContent: ColumnLayout {
@@ -45,16 +45,34 @@ SettingsPageBase {
             target: UtilsAdapter
 
             function onChangeLanguage() {
-                inputAudioModel.reset();
-                outputAudioModel.reset();
-                ringtoneAudioModel.reset();
+                rootLayout.resetDeviceModels();
+                rootLayout.resetDeviceIndices();
             }
         }
 
-        function populateAudioSettings() {
+        function resetDeviceModels() {
+            inputAudioModel.reset();
+            outputAudioModel.reset();
+            ringtoneAudioModel.reset();
+        }
+
+        function resetDeviceIndices() {
             inputComboBoxSetting.modelIndex = inputComboBoxSetting.comboModel.getCurrentIndex();
             outputComboBoxSetting.modelIndex = outputComboBoxSetting.comboModel.getCurrentIndex();
             ringtoneComboBoxSetting.modelIndex = ringtoneComboBoxSetting.comboModel.getCurrentIndex();
+        }
+
+        Connections {
+            target: AvAdapter
+
+            function onAudioDeviceListChanged(inputs, outputs) {
+                rootLayout.resetDeviceModels();
+                rootLayout.resetDeviceIndices();
+            }
+        }
+
+        function populateAudioSettings() {
+            rootLayout.resetDeviceIndices();
             if (audioManagerComboBoxSetting.comboModel.rowCount() > 0) {
                 audioManagerComboBoxSetting.modelIndex = audioManagerComboBoxSetting.comboModel.getCurrentSettingIndex();
             }
-- 
GitLab