diff --git a/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml b/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml index aaf6e2a2a..4beb5e16d 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml @@ -16,11 +16,10 @@ TabContainer { label: qsTr('playbackDeviceLabel') ComboBox { - model: SettingsModel.audioDevices - - Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) { + currentIndex: Utils.findIndex(model, function (device) { return device === SettingsModel.playbackDevice }) + model: SettingsModel.audioDevices onActivated: SettingsModel.playbackDevice = model[index] } @@ -32,11 +31,10 @@ TabContainer { label: qsTr('captureDeviceLabel') ComboBox { - model: SettingsModel.audioDevices - - Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) { + currentIndex: Utils.findIndex(model, function (device) { return device === SettingsModel.captureDevice }) + model: SettingsModel.audioDevices onActivated: SettingsModel.captureDevice = model[index] } @@ -48,11 +46,10 @@ TabContainer { label: qsTr('ringerDeviceLabel') ComboBox { - model: SettingsModel.audioDevices - - Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) { + currentIndex: Utils.findIndex(model, function (device) { return device === SettingsModel.ringerDevice }) + model: SettingsModel.audioDevices onActivated: SettingsModel.ringerDevice = model[index] } diff --git a/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml b/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml index f2c344d7c..843475921 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml @@ -16,11 +16,10 @@ TabContainer { label: qsTr('videoInputDeviceLabel') ComboBox { - model: SettingsModel.videoDevices - - Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) { + currentIndex: Utils.findIndex(model, function (device) { return device === SettingsModel.videoDevice }) + model: SettingsModel.videoDevices onActivated: SettingsModel.videoDevice = model[index] } @@ -32,6 +31,14 @@ TabContainer { label: qsTr('videoPresetLabel') ComboBox { + currentIndex: { + var preset = SettingsModel.videoPreset + + return Number(Utils.findIndex([ 'default', 'high-fps', 'custom' ], function (value) { + return preset === value + })) + } + model: ListModel { id: presets @@ -53,13 +60,6 @@ TabContainer { textRole: 'key' - Component.onCompleted: { - var preset = SettingsModel.videoPreset - currentIndex = Number(Utils.findIndex([ 'default', 'high-fps', 'custom' ], function (value) { - return preset === value - })) - } - onActivated: SettingsModel.videoPreset = presets.get(index).value } }