mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 22:23:31 +00:00
Apply changes to preferences when loading the settings page
This commit is contained in:
@@ -118,6 +118,9 @@ ScrollView {
|
|||||||
currentIndex = i
|
currentIndex = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Persist the selected value
|
||||||
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: resolutionComboBox
|
id: resolutionComboBox
|
||||||
@@ -150,13 +153,19 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
onActivated : {
|
onActivated : {
|
||||||
prefs.width = parseInt(resolutionListModel.get(currentIndex).video_width)
|
var selectedWidth = parseInt(resolutionListModel.get(currentIndex).video_width)
|
||||||
prefs.height = parseInt(resolutionListModel.get(currentIndex).video_height)
|
var selectedHeight = parseInt(resolutionListModel.get(currentIndex).video_height)
|
||||||
|
|
||||||
|
// Only modify the bitrate if the values actually changed
|
||||||
|
if (prefs.width !== selectedWidth || prefs.height !== selectedHeight) {
|
||||||
|
prefs.width = selectedWidth
|
||||||
|
prefs.height = selectedHeight
|
||||||
|
|
||||||
prefs.bitrateKbps = prefs.getDefaultBitrate(prefs.width, prefs.height, prefs.fps);
|
prefs.bitrateKbps = prefs.getDefaultBitrate(prefs.width, prefs.height, prefs.fps);
|
||||||
slider.value = prefs.bitrateKbps
|
slider.value = prefs.bitrateKbps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
// ignore setting the index at first, and actually set it when the component is loaded
|
// ignore setting the index at first, and actually set it when the component is loaded
|
||||||
@@ -180,6 +189,9 @@ ScrollView {
|
|||||||
currentIndex = i
|
currentIndex = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Persist the selected value
|
||||||
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: fpsComboBox
|
id: fpsComboBox
|
||||||
@@ -199,13 +211,18 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
onActivated : {
|
onActivated : {
|
||||||
prefs.fps = parseInt(fpsListModel.get(currentIndex).video_fps)
|
var selectedFps = parseInt(fpsListModel.get(currentIndex).video_fps)
|
||||||
|
|
||||||
|
// Only modify the bitrate if the values actually changed
|
||||||
|
if (prefs.fps !== selectedFps) {
|
||||||
|
prefs.fps = selectedFps
|
||||||
|
|
||||||
prefs.bitrateKbps = prefs.getDefaultBitrate(prefs.width, prefs.height, prefs.fps);
|
prefs.bitrateKbps = prefs.getDefaultBitrate(prefs.width, prefs.height, prefs.fps);
|
||||||
slider.value = prefs.bitrateKbps
|
slider.value = prefs.bitrateKbps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -262,8 +279,10 @@ ScrollView {
|
|||||||
var thisWm = windowModeListModel.get(i).val;
|
var thisWm = windowModeListModel.get(i).val;
|
||||||
if (savedWm === thisWm) {
|
if (savedWm === thisWm) {
|
||||||
currentIndex = i
|
currentIndex = i
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: windowModeComboBox
|
id: windowModeComboBox
|
||||||
@@ -332,8 +351,10 @@ ScrollView {
|
|||||||
var el_audio = audioListModel.get(i).val;
|
var el_audio = audioListModel.get(i).val;
|
||||||
if (saved_audio === el_audio) {
|
if (saved_audio === el_audio) {
|
||||||
currentIndex = i
|
currentIndex = i
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: audioComboBox
|
id: audioComboBox
|
||||||
@@ -459,8 +480,10 @@ ScrollView {
|
|||||||
var el_vds = decoderListModel.get(i).val;
|
var el_vds = decoderListModel.get(i).val;
|
||||||
if (saved_vds === el_vds) {
|
if (saved_vds === el_vds) {
|
||||||
currentIndex = i
|
currentIndex = i
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: decoderComboBox
|
id: decoderComboBox
|
||||||
@@ -505,8 +528,10 @@ ScrollView {
|
|||||||
var el_vcc = codecListModel.get(i).val;
|
var el_vcc = codecListModel.get(i).val;
|
||||||
if (saved_vcc === el_vcc) {
|
if (saved_vcc === el_vcc) {
|
||||||
currentIndex = i
|
currentIndex = i
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: codecComboBox
|
id: codecComboBox
|
||||||
|
|||||||
Reference in New Issue
Block a user