diff --git a/app/gui/SettingsView.qml b/app/gui/SettingsView.qml index 8a3e3822..bbdb86f6 100644 --- a/app/gui/SettingsView.qml +++ b/app/gui/SettingsView.qml @@ -1,10 +1,20 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 +import StreamingPreferences 1.0 + ScrollView { id: settingsPage objectName: "Settings" + StreamingPreferences { + id: prefs + } + + Component.onDestruction: { + prefs.save() + } + Column { x: 10 y: 10 @@ -35,7 +45,7 @@ ScrollView { Label { width: parent.width id: resFPSdesc - text: qsTr("Setting values too high for your device may cause lag or crashing") + text: qsTr("Setting values too high for your device may cause lag or crashes") font.pointSize: 9 wrapMode: Text.Wrap color: "white" @@ -43,14 +53,12 @@ ScrollView { ComboBox { id: resolutionComboBox - currentIndex : 4 + currentIndex : 1 width: Math.min(bitrateDesc.implicitWidth, parent.width) font.pointSize: 9 model: ListModel { id: resolutionListModel // TODO have values associated with the text. - ListElement { text: "360p 30 FPS" } - ListElement { text: "360p 60 FPS" } ListElement { text: "720p 30 FPS" } ListElement { text: "720p 60 FPS" } ListElement { text: "1080p 30 FPS" } @@ -64,7 +72,7 @@ ScrollView { Label { width: parent.width id: bitrateTitle - text: qsTr("Video bitrate target") + text: qsTr("Video bitrate: ") font.pointSize: 12 wrapMode: Text.Wrap color: "white" @@ -73,7 +81,7 @@ ScrollView { Label { width: parent.width id: bitrateDesc - text: qsTr("Lower bitrate to reduce stuttering. Raise bitrate to increase image quality.") + text: qsTr("Lower bitrate to reduce lag and stuttering. Raise bitrate to increase image quality.") font.pointSize: 9 wrapMode: Text.Wrap color: "white" @@ -84,31 +92,27 @@ ScrollView { wheelEnabled: true // TODO value should be loaded as the current value. - value: 500 + value: prefs.bitrateKbps stepSize: 500 from : 500 - to: 10000 + to: 100000 snapMode: "SnapOnRelease" width: Math.min(bitrateDesc.implicitWidth, parent.width) - // TODO store the value - // TODO display the current value to the user - onValueChanged: - { - console.debug(slider.value + " Slider moved") + onValueChanged: { + bitrateTitle.text = "Video bitrate: " + (value / 1000.0) + " Mbps" + prefs.bitrateKbps = value } } CheckBox { id: fullScreenCheck - text: "Stretch video to full-screen" + text: "Full-screen" font.pointSize: 12 - } - - CheckBox { - id: pipObserverCheck - text: "Enable Picture-in-Picture observer mode" - font.pointSize: 12 + checked: prefs.fullScreen + onCheckedChanged: { + prefs.fullScreen = checked + } } } } @@ -147,6 +151,10 @@ ScrollView { id: multiControllerCheck text: "Multiple controller support" font.pointSize: 12 + checked: prefs.multiController + onCheckedChanged: { + prefs.multiController = checked + } } CheckBox { id: mouseEmulationCheck @@ -190,12 +198,20 @@ ScrollView { id: optimizeGameSettingsCheck text: "Optimize game settings" font.pointSize: 12 + checked: prefs.gameOptimizations + onCheckedChanged: { + prefs.gameOptimizations = checked + } } CheckBox { id: audioPcCheck - text: "Play audio on PC" + text: "Play audio on host PC" font.pointSize: 12 + checked: prefs.playAudioOnHost + onCheckedChanged: { + prefs.playAudioOnHost = checked + } } } }