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
width: settingsPage.width
height: 400
GroupBox {
// TODO save the settings
id: basicSettingsGroupBox
width: (parent.width - 20)
padding: 12
title: "Basic Settings"
font.pointSize: 12
Column {
anchors.fill: parent
spacing: 5
Label {
width: parent.width
id: resFPStitle
text: qsTr("Resolution and FPS target")
font.pointSize: 12
wrapMode: Text.Wrap
color: "white"
}
Label {
width: parent.width
id: resFPSdesc
text: qsTr("Setting values too high for your device may cause lag or crashes")
font.pointSize: 9
wrapMode: Text.Wrap
color: "white"
}
ComboBox {
id: resolutionComboBox
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: "720p 30 FPS" }
ListElement { text: "720p 60 FPS" }
ListElement { text: "1080p 30 FPS" }
ListElement { text: "1080p 60 FPS" }
ListElement { text: "4K 30 FPS" }
ListElement { text: "4K 60 FPS" }
}
onCurrentIndexChanged: console.debug(resolutionListModel.get(currentIndex).text + " selected resolution")
}
Label {
width: parent.width
id: bitrateTitle
text: qsTr("Video bitrate: ")
font.pointSize: 12
wrapMode: Text.Wrap
color: "white"
}
Label {
width: parent.width
id: bitrateDesc
text: qsTr("Lower bitrate to reduce lag and stuttering. Raise bitrate to increase image quality.")
font.pointSize: 9
wrapMode: Text.Wrap
color: "white"
}
Slider {
id: slider
wheelEnabled: true
// TODO value should be loaded as the current value.
value: prefs.bitrateKbps
stepSize: 500
from : 500
to: 100000
snapMode: "SnapOnRelease"
width: Math.min(bitrateDesc.implicitWidth, parent.width)
onValueChanged: {
bitrateTitle.text = "Video bitrate: " + (value / 1000.0) + " Mbps"
prefs.bitrateKbps = value
}
}
CheckBox {
id: fullScreenCheck
text: "Full-screen"
font.pointSize: 12
checked: prefs.fullScreen
onCheckedChanged: {
prefs.fullScreen = checked
}
}
}
}
GroupBox {
id: audioSettingsGroupBox
width: (parent.width - 20)
padding: 12
title: "Audio Settings"
font.pointSize: 12
Column {
anchors.fill: parent
spacing: 5
CheckBox {
id: surroundSoundCheck
text: "Enable 5.1 surround sound"
font.pointSize: 12
}
}
}
GroupBox {
id: gamepadSettingsGroupBox
width: (parent.width - 20)
padding: 12
title: "Gamepad Settings"
font.pointSize: 12
Column {
anchors.fill: parent
spacing: 5
CheckBox {
id: multiControllerCheck
text: "Multiple controller support"
font.pointSize: 12
checked: prefs.multiController
onCheckedChanged: {
prefs.multiController = checked
}
}
CheckBox {
id: mouseEmulationCheck
text: "Mouse emulation via gamepad"
font.pointSize: 12
}
}
}
GroupBox {
id: onScreenControlsGroupBox
width: (parent.width - 20)
padding: 12
title: "On-screen Controls Settings"
font.pointSize: 12
Column {
anchors.fill: parent
spacing: 5
CheckBox {
id: onScreenControlsCheck
text: "Show on-screen controls"
font.pointSize: 12
}
}
}
GroupBox {
id: hostSettingsGroupBox
width: (parent.width - 20)
padding: 12
title: "Host Settings"
font.pointSize: 12
Column {
anchors.fill: parent
spacing: 5
CheckBox {
id: optimizeGameSettingsCheck
text: "Optimize game settings"
font.pointSize: 12
checked: prefs.gameOptimizations
onCheckedChanged: {
prefs.gameOptimizations = checked
}
}
CheckBox {
id: audioPcCheck
text: "Play audio on host PC"
font.pointSize: 12
checked: prefs.playAudioOnHost
onCheckedChanged: {
prefs.playAudioOnHost = checked
}
}
}
}
GroupBox {
id: advancedSettingsGroupBox
width: (parent.width - 20)
padding: 12
title: "Advanced Settings"
font.pointSize: 12
Column {
anchors.fill: parent
spacing: 5
CheckBox {
id: neverDropFramesCheck
text: "Never drop frames"
font.pointSize: 12
}
}
}
}
}