From 5d4e69ef09537cd55f99b7cd026f84c98798883c Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Mon, 21 Sep 2020 11:47:59 -0400
Subject: [PATCH] settings: make fps option in av settings respond correctly

Gitlab: #97
Change-Id: I6419f8eca7d38a1816c684d106f72129ea26cdab
---
 src/settingsview/components/VideoSettings.qml | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/settingsview/components/VideoSettings.qml b/src/settingsview/components/VideoSettings.qml
index 9ed319c64..c2f12d709 100644
--- a/src/settingsview/components/VideoSettings.qml
+++ b/src/settingsview/components/VideoSettings.qml
@@ -106,18 +106,28 @@ ColumnLayout {
         var resolution
         var rate
         if(isResolutionIndex) {
-            resolution = resolutionComboBoxSetting.comboModel.data(resolutionComboBoxSetting.comboModel.index(index, 0), VideoFormatResolutionModel.Resolution)
+            resolution = resolutionComboBoxSetting.comboModel.data(
+                        resolutionComboBoxSetting.comboModel.index(index, 0),
+                        VideoFormatResolutionModel.Resolution)
             fpsComboBoxSetting.comboModel.currentResolution = resolution
             fpsComboBoxSetting.setCurrentIndex(fpsComboBoxSetting.comboModel.getCurrentSettingIndex())
-            rate = fpsComboBoxSetting.comboModel.data(fpsComboBoxSetting.comboModel.index(index, 0), VideoFormatFpsModel.FPS)
+            rate = fpsComboBoxSetting.comboModel.data(
+                        fpsComboBoxSetting.comboModel.index(0, 0),
+                        VideoFormatFpsModel.FPS)
         } else {
-            resolution = resolutionComboBoxSetting.comboModel.data(resolutionComboBoxSetting.comboModel.index(index, 0), VideoFormatResolutionModel.Resolution)
+            resolution = resolutionComboBoxSetting.comboModel.data(
+                        resolutionComboBoxSetting.comboModel.index(
+                            resolutionComboBoxSetting.modelIndex, 0),
+                        VideoFormatResolutionModel.Resolution)
             fpsComboBoxSetting.comboModel.currentResolution = resolution
-            rate = fpsComboBoxSetting.comboModel.data(fpsComboBoxSetting.comboModel.model.index(index, 0), VideoFormatFpsModel.FPS)
+            rate = fpsComboBoxSetting.comboModel.data(
+                        fpsComboBoxSetting.comboModel.index(index, 0),
+                        VideoFormatFpsModel.FPS)
         }
 
         try {
-           SettingsAdapter.set_Video_Settings_Rate_And_Resolution(AVModel.getCurrentVideoCaptureDevice(),rate,resolution)
+           SettingsAdapter.set_Video_Settings_Rate_And_Resolution(
+               AVModel.getCurrentVideoCaptureDevice(),rate, resolution)
             updatePreviewRatio(resolution)
         } catch(error){ console.warn(error.message) }
     }
@@ -255,4 +265,4 @@ ColumnLayout {
         horizontalAlignment: Text.AlignHCenter
         verticalAlignment: Text.AlignVCenter
     }
-}
\ No newline at end of file
+}
-- 
GitLab