mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-03 08:15:37 +00:00
Now with using, saving, and loading of the resolution and FPS settings
This commit is contained in:
parent
a6ac893e1e
commit
8c65ee8bc5
@ -52,21 +52,75 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
|
// ignore setting the index at first, and actually set it when the component is loaded
|
||||||
|
Component.onCompleted: {
|
||||||
|
// load the saved width/height/fps, and iterate through the ComboBox until a match is found
|
||||||
|
// set it to that index.
|
||||||
|
var saved_width = prefs.width
|
||||||
|
var saved_height = prefs.height
|
||||||
|
var saved_fps = prefs.fps
|
||||||
|
currentIndex = 0
|
||||||
|
for(var i = 0; i < resolutionComboBox.count; i++) {
|
||||||
|
var el_width = parseInt(resolutionListModel.get(i).video_width);
|
||||||
|
var el_height = parseInt(resolutionListModel.get(i).video_height);
|
||||||
|
var el_fps = parseInt(resolutionListModel.get(i).video_fps);
|
||||||
|
if(saved_width === el_width &&
|
||||||
|
saved_height === el_height &&
|
||||||
|
saved_fps === el_fps) {
|
||||||
|
currentIndex = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
id: resolutionComboBox
|
id: resolutionComboBox
|
||||||
currentIndex : 1
|
|
||||||
width: Math.min(bitrateDesc.implicitWidth, parent.width)
|
width: Math.min(bitrateDesc.implicitWidth, parent.width)
|
||||||
font.pointSize: 9
|
font.pointSize: 9
|
||||||
|
textRole: "text"
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
id: resolutionListModel
|
id: resolutionListModel
|
||||||
// TODO have values associated with the text.
|
ListElement {
|
||||||
ListElement { text: "720p 30 FPS" }
|
text: "720p 30 FPS"
|
||||||
ListElement { text: "720p 60 FPS" }
|
video_width: "1280"
|
||||||
ListElement { text: "1080p 30 FPS" }
|
video_height: "720"
|
||||||
ListElement { text: "1080p 60 FPS" }
|
video_fps: "30"
|
||||||
ListElement { text: "4K 30 FPS" }
|
}
|
||||||
ListElement { text: "4K 60 FPS" }
|
ListElement {
|
||||||
|
text: "720p 60 FPS"
|
||||||
|
video_width: "1280"
|
||||||
|
video_height: "720"
|
||||||
|
video_fps: "60"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "1080p 30 FPS"
|
||||||
|
video_width: "1920"
|
||||||
|
video_height: "1080"
|
||||||
|
video_fps: "30"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "1080p 60 FPS"
|
||||||
|
video_width: "1920"
|
||||||
|
video_height: "1080"
|
||||||
|
video_fps: "60"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "4K 30 FPS"
|
||||||
|
video_width: "3840"
|
||||||
|
video_height: "2160"
|
||||||
|
video_fps: "30"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "4K 60 FPS"
|
||||||
|
video_width: "3840"
|
||||||
|
video_height: "2160"
|
||||||
|
video_fps: "60"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
|
onActivated : {
|
||||||
|
prefs.width = parseInt(resolutionListModel.get(currentIndex).video_width)
|
||||||
|
prefs.height = parseInt(resolutionListModel.get(currentIndex).video_height)
|
||||||
|
prefs.fps = parseInt(resolutionListModel.get(currentIndex).video_fps)
|
||||||
}
|
}
|
||||||
onCurrentIndexChanged: console.debug(resolutionListModel.get(currentIndex).text + " selected resolution")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@ -132,6 +186,7 @@ ScrollView {
|
|||||||
id: surroundSoundCheck
|
id: surroundSoundCheck
|
||||||
text: "<font color=\"white\">Enable 5.1 surround sound</font>"
|
text: "<font color=\"white\">Enable 5.1 surround sound</font>"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
|
// TODO: make this actually do anything
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,6 +215,7 @@ ScrollView {
|
|||||||
id: mouseEmulationCheck
|
id: mouseEmulationCheck
|
||||||
text: "<font color=\"white\">Mouse emulation via gamepad</font>"
|
text: "<font color=\"white\">Mouse emulation via gamepad</font>"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
|
// TODO: make this actually do anything
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,6 +235,7 @@ ScrollView {
|
|||||||
id: onScreenControlsCheck
|
id: onScreenControlsCheck
|
||||||
text: "<font color=\"white\">Show on-screen controls</font>"
|
text: "<font color=\"white\">Show on-screen controls</font>"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
|
// TODO: make this actually do anything
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user