Commit 9f7f455a authored by Ronan Abhamon's avatar Ronan Abhamon

fix(ui/views/App/Settings): avoid useless `Component.onCompleted` on `ComboBox`

parent 83bf254d
...@@ -16,11 +16,10 @@ TabContainer { ...@@ -16,11 +16,10 @@ TabContainer {
label: qsTr('playbackDeviceLabel') label: qsTr('playbackDeviceLabel')
ComboBox { ComboBox {
model: SettingsModel.audioDevices currentIndex: Utils.findIndex(model, function (device) {
Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) {
return device === SettingsModel.playbackDevice return device === SettingsModel.playbackDevice
}) })
model: SettingsModel.audioDevices
onActivated: SettingsModel.playbackDevice = model[index] onActivated: SettingsModel.playbackDevice = model[index]
} }
...@@ -32,11 +31,10 @@ TabContainer { ...@@ -32,11 +31,10 @@ TabContainer {
label: qsTr('captureDeviceLabel') label: qsTr('captureDeviceLabel')
ComboBox { ComboBox {
model: SettingsModel.audioDevices currentIndex: Utils.findIndex(model, function (device) {
Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) {
return device === SettingsModel.captureDevice return device === SettingsModel.captureDevice
}) })
model: SettingsModel.audioDevices
onActivated: SettingsModel.captureDevice = model[index] onActivated: SettingsModel.captureDevice = model[index]
} }
...@@ -48,11 +46,10 @@ TabContainer { ...@@ -48,11 +46,10 @@ TabContainer {
label: qsTr('ringerDeviceLabel') label: qsTr('ringerDeviceLabel')
ComboBox { ComboBox {
model: SettingsModel.audioDevices currentIndex: Utils.findIndex(model, function (device) {
Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) {
return device === SettingsModel.ringerDevice return device === SettingsModel.ringerDevice
}) })
model: SettingsModel.audioDevices
onActivated: SettingsModel.ringerDevice = model[index] onActivated: SettingsModel.ringerDevice = model[index]
} }
......
...@@ -16,11 +16,10 @@ TabContainer { ...@@ -16,11 +16,10 @@ TabContainer {
label: qsTr('videoInputDeviceLabel') label: qsTr('videoInputDeviceLabel')
ComboBox { ComboBox {
model: SettingsModel.videoDevices currentIndex: Utils.findIndex(model, function (device) {
Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) {
return device === SettingsModel.videoDevice return device === SettingsModel.videoDevice
}) })
model: SettingsModel.videoDevices
onActivated: SettingsModel.videoDevice = model[index] onActivated: SettingsModel.videoDevice = model[index]
} }
...@@ -32,6 +31,14 @@ TabContainer { ...@@ -32,6 +31,14 @@ TabContainer {
label: qsTr('videoPresetLabel') label: qsTr('videoPresetLabel')
ComboBox { ComboBox {
currentIndex: {
var preset = SettingsModel.videoPreset
return Number(Utils.findIndex([ 'default', 'high-fps', 'custom' ], function (value) {
return preset === value
}))
}
model: ListModel { model: ListModel {
id: presets id: presets
...@@ -53,13 +60,6 @@ TabContainer { ...@@ -53,13 +60,6 @@ TabContainer {
textRole: 'key' 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 onActivated: SettingsModel.videoPreset = presets.get(index).value
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment