From 2eb16d7442579b4ec70631f19feba2d01aa7cb3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Thu, 13 Aug 2020 23:38:43 -0400
Subject: [PATCH] avsettingpage: avoid to always start camera on plug

Only start if in the media settings

Change-Id: I5de1e407dcdee51c5d9e4753f2de54f871f7f516
---
 src/settingsview/components/AvSettingPage.qml | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/settingsview/components/AvSettingPage.qml b/src/settingsview/components/AvSettingPage.qml
index 288d9a9c1..d6451e937 100644
--- a/src/settingsview/components/AvSettingPage.qml
+++ b/src/settingsview/components/AvSettingPage.qml
@@ -27,7 +27,7 @@ import net.jami.Models 1.0
 import "../../commoncomponents"
 
 Rectangle {
-    id: avSettingsRect
+    id: root
 
     AudioInputDeviceModel{
         id: audioInputDeviceModel
@@ -237,6 +237,7 @@ Rectangle {
 
     Connections{
         target: ClientWrapper.avmodel
+        enabled: root.visible
 
         function onAudioMeter(id, level){
             slotAudioMeter(id,level)
@@ -245,6 +246,7 @@ Rectangle {
 
     Connections{
         target: ClientWrapper.renderManager
+        enabled: root.visible
 
         function onVideoDeviceListChanged(){
             slotVideoDeviceListChanged()
@@ -256,7 +258,7 @@ Rectangle {
     anchors.centerIn: parent
 
     ColumnLayout {
-        anchors.fill: avSettingsRect
+        anchors.fill: root
 
         RowLayout {
             id: avSettingsTitle
@@ -313,8 +315,8 @@ Rectangle {
 
             Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
 
-            width: avSettingsRect.width
-            height: avSettingsRect.height - avSettingsTitle.height
+            width: root.width
+            height: root.height - avSettingsTitle.height
 
             ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
             ScrollBar.vertical.policy: ScrollBar.AsNeeded
@@ -731,8 +733,8 @@ Rectangle {
                 }
 
                 Item {
-                    Layout.preferredWidth: avSettingsRect.width - 32
-                    Layout.minimumWidth: avSettingsRect.width - 32
+                    Layout.preferredWidth: root.width - 32
+                    Layout.minimumWidth: root.width - 32
                     Layout.maximumWidth: JamiTheme.maximumWidthSettingsView - 32
                     Layout.fillHeight: true
                 }
-- 
GitLab