372 lines
14 KiB
QML
372 lines
14 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtCore as Core
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls as Controls
|
|
import QtQuick.Dialogs as Dialogs
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
import io.github.wivrn.wivrn
|
|
|
|
Kirigami.ScrollablePage {
|
|
id: settings
|
|
title: i18n("Settings")
|
|
|
|
flickable.interactive: false // Make sure the Kirigami.ScrollablePage does not eat the vertical mouse dragging events
|
|
|
|
property bool allowUpdates: false // ignore onXXX events until document is loaded
|
|
|
|
ColumnLayout {
|
|
id: column
|
|
anchors.fill: parent
|
|
|
|
Kirigami.FormLayout {
|
|
|
|
Kirigami.InlineMessage {
|
|
Layout.fillWidth: true
|
|
text: i18n("The current encoder configuration is not supported")
|
|
type: Kirigami.MessageType.Information
|
|
visible: !Settings.simpleConfig
|
|
actions: [
|
|
Kirigami.Action {
|
|
text: i18n("Reset")
|
|
onTriggered: Settings.encoder = Settings.EncoderAuto
|
|
}
|
|
]
|
|
}
|
|
|
|
RowLayout {
|
|
Kirigami.FormData.label: i18n("Encoder:")
|
|
enabled: Settings.simpleConfig
|
|
Controls.ComboBox {
|
|
id: encoder_combo
|
|
model: [
|
|
{
|
|
label: i18nc("automatic encoder setup", "Auto"),
|
|
encoder: Settings.EncoderAuto
|
|
},
|
|
{
|
|
label: i18n("nvenc (NVIDIA GPUs)"),
|
|
encoder: Settings.Nvenc
|
|
},
|
|
{
|
|
label: i18n("vaapi (AMD and Intel GPUs)"),
|
|
encoder: Settings.Vaapi
|
|
},
|
|
{
|
|
label: i18n("Vulkan (Any modern GPU)"),
|
|
encoder: Settings.Vulkan
|
|
},
|
|
{
|
|
label: i18n("x264 (software encoding)"),
|
|
encoder: Settings.X264
|
|
}
|
|
]
|
|
onCurrentIndexChanged: if (settings.allowUpdates) {Settings.encoder = model[currentIndex].encoder}
|
|
textRole: "label"
|
|
Connections {
|
|
target: Settings
|
|
function onEncoderChanged() {
|
|
var encoder = Settings.encoder;
|
|
var i = encoder_combo.model.findIndex( item => item.encoder == encoder)
|
|
if (i > -1)
|
|
encoder_combo.currentIndex = i
|
|
}
|
|
}
|
|
}
|
|
Kirigami.ContextualHelpButton {
|
|
toolTipText: i18n("\"Auto\" will use hardware acceleration if it is available")
|
|
}
|
|
}
|
|
|
|
Kirigami.Separator {
|
|
Kirigami.FormData.isSection: true
|
|
}
|
|
|
|
SelectGame {
|
|
id: select_game
|
|
Kirigami.FormData.label: i18n("Autostart application:")
|
|
}
|
|
|
|
Controls.CheckBox {
|
|
id: auto_connect_usb
|
|
text: i18n("Auto connect from USB")
|
|
}
|
|
|
|
Kirigami.Separator {
|
|
Kirigami.FormData.isSection: true
|
|
}
|
|
|
|
Kirigami.Heading {
|
|
text: i18n("Advanced options")
|
|
level: 1
|
|
type: Kirigami.Heading.Type.Primary
|
|
}
|
|
Controls.CheckBox {
|
|
id: show_system_checks
|
|
text: i18n("Check system configuration on start")
|
|
}
|
|
RowLayout {
|
|
visible: Settings.hid_forwarding_supported
|
|
Controls.CheckBox {
|
|
id: hid_forwarding
|
|
text: i18n("Expose forwarded input devices via uinput")
|
|
}
|
|
Kirigami.ContextualHelpButton {
|
|
toolTipText: i18n("Replicate mouse, keyboard and gamepad connected to the headset as virtual devices on PC.\nReplicated devices will appear as if they were plugged to the PC, some keys may be reserved by the headset OS and not be available. Gamepad is also available without virtual devices for applications that access it through OpenXR.")
|
|
}
|
|
}
|
|
Controls.CheckBox {
|
|
id: debug_gui
|
|
text: i18n("Enable debug window")
|
|
visible: Settings.debug_gui_supported
|
|
}
|
|
RowLayout {
|
|
visible: Settings.steamvr_lh_supported
|
|
Controls.CheckBox {
|
|
id: steamvr_lh
|
|
text: i18n("Enable SteamVR tracked devices support")
|
|
}
|
|
Kirigami.ContextualHelpButton {
|
|
toolTipText: i18n("Allows the use of lighthouse-based controllers and trackers.\nRequires SteamVR to be installed.\nDevices must be be powered on before connecting to WiVRn.\nAn external tool such as motoc is needed for calibration.")
|
|
}
|
|
}
|
|
Controls.CheckBox {
|
|
id: lh_max_extrapolation_enabled
|
|
visible: Settings.steamvr_lh_supported && steamvr_lh.checked
|
|
text: i18n("Clamp extrapolation for SteamVR tracked devices")
|
|
}
|
|
RowLayout {
|
|
visible: Settings.steamvr_lh_supported && steamvr_lh.checked && lh_max_extrapolation_enabled.checked
|
|
Kirigami.FormData.label: i18n("SteamVR max pose extrapolation")
|
|
Controls.Slider {
|
|
id: lh_max_extrapolation
|
|
Layout.fillWidth: true
|
|
from: 0.0
|
|
to: 100.0
|
|
stepSize: 1.0
|
|
value: Settings.lhMaxExtrapolation
|
|
}
|
|
Controls.Label {
|
|
text: i18ncp("value display for SteamVR max pose extrapolation", "%1ms", "%1ms", lh_max_extrapolation.value)
|
|
Layout.preferredWidth: 35
|
|
Layout.alignment: Qt.AlignRight
|
|
}
|
|
Kirigami.ContextualHelpButton {
|
|
toolTipText: i18n("Maximum time in milliseconds that poses may be extrapolated ahead for SteamVR tracked devices. Tune this value if you experience jittery or wobbly tracking.")
|
|
}
|
|
}
|
|
RowLayout {
|
|
visible: Settings.steamvr_lh_supported && steamvr_lh.checked
|
|
Kirigami.FormData.label: i18n("SteamVR joystick deadzone")
|
|
Controls.Slider {
|
|
id: lh_stick_deadzone
|
|
Layout.fillWidth: true
|
|
from: 0.0
|
|
to: 0.9
|
|
stepSize: 0.05
|
|
value: Settings.lhStickDeadzone
|
|
}
|
|
Controls.Label {
|
|
text: lh_stick_deadzone.value.toFixed(2)
|
|
Layout.preferredWidth: 35
|
|
Layout.alignment: Qt.AlignRight
|
|
}
|
|
Kirigami.ContextualHelpButton {
|
|
toolTipText: i18n("Deadzone to apply to joysticks on lighthouse-tracked controllers, such as Index.\nFor standalone controllers, deadzones may be adjusted via the headset's system settings.")
|
|
}
|
|
}
|
|
|
|
Controls.CheckBox {
|
|
id: adb_custom
|
|
Layout.row: 0
|
|
Layout.column: 0
|
|
text: i18n("Custom adb location")
|
|
}
|
|
|
|
Dialogs.FileDialog {
|
|
id: adb_browse
|
|
onAccepted: {
|
|
adb_location.text = WivrnServer.host_path(new URL(selectedFile).pathname);
|
|
}
|
|
}
|
|
|
|
RowLayout {
|
|
Kirigami.FormData.label: i18n("Adb location:")
|
|
Layout.fillWidth: true
|
|
enabled: adb_custom.checked
|
|
Controls.TextField {
|
|
id: adb_location
|
|
placeholderText: DashboardSettings.adb_location
|
|
Layout.fillWidth: true
|
|
}
|
|
Controls.Button {
|
|
text: i18nc("browse a file to choose the adb binary", "Browse")
|
|
onClicked: adb_browse.open()
|
|
}
|
|
}
|
|
|
|
ListModel {
|
|
id: openvr_libs
|
|
|
|
function init() {
|
|
openvr_libs.append({
|
|
"name": i18n("Default"),
|
|
"value": "",
|
|
"is_custom": false
|
|
});
|
|
var libs = WivrnServer.openVRCompat;
|
|
for (var i = 0; i < libs.length; i++) {
|
|
openvr_libs.append({
|
|
"name": libs[i].name,
|
|
"value": libs[i].path,
|
|
"is_custom": false
|
|
});
|
|
}
|
|
|
|
openvr_libs.append({
|
|
"name": i18nc("set a custom OpenVR compatibility library", "Custom"),
|
|
"is_custom": true
|
|
});
|
|
|
|
openvr_libs.append({
|
|
"name": i18n("Disabled"),
|
|
"value": "-",
|
|
"is_custom": false
|
|
});
|
|
}
|
|
}
|
|
|
|
Dialogs.FolderDialog{
|
|
id: openvr_browse
|
|
onAccepted: {
|
|
currentFolder = selectedFolder
|
|
openvr_text.text = WivrnServer.host_path(new URL(selectedFolder).pathname);
|
|
openvr_text.text = openvr_text.text.replace(/\/linux64$/, "").replace(/\/bin$/, "")
|
|
}
|
|
}
|
|
RowLayout {
|
|
Kirigami.FormData.label: i18n("OpenVR compatibility library:")
|
|
Layout.fillWidth: true
|
|
Controls.ComboBox {
|
|
id: openvr_combobox
|
|
Layout.columnSpan: 2
|
|
textRole: "name"
|
|
model: openvr_libs
|
|
|
|
function load() {
|
|
for(let i=0 ; i < openvr_libs.count; i++) {
|
|
if (openvr_libs.get(i).value == Settings.openvr) {
|
|
openvr_combobox.currentIndex = i;
|
|
return;
|
|
}
|
|
}
|
|
for(let i=0 ; i < openvr_libs.count; i++) {
|
|
if (openvr_libs.get(i).is_custom) {
|
|
openvr_text.text = Settings.openvr
|
|
openvr_combobox.currentIndex = i;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
onActivated: index => {
|
|
if (openvr_libs.get(index).is_custom && openvr_text.text == "")
|
|
openvr_browse.open()
|
|
}
|
|
}
|
|
Controls.TextField {
|
|
id: openvr_text
|
|
placeholderText: i18n("Library path, excluding bin/linux64/vrclient.so")
|
|
visible: !!openvr_combobox.model.get(openvr_combobox.currentIndex)?.is_custom
|
|
Layout.fillWidth: true
|
|
}
|
|
Controls.Button {
|
|
text: i18nc("browse to choose the OpenVR compatibility to use", "Browse")
|
|
visible: openvr_text.visible
|
|
onClicked: openvr_browse.open()
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
Item {
|
|
// spacer item
|
|
Layout.fillHeight: true
|
|
}
|
|
}
|
|
|
|
footer: Controls.DialogButtonBox {
|
|
standardButtons: Controls.DialogButtonBox.Ok | Controls.DialogButtonBox.Cancel | Controls.DialogButtonBox.Reset
|
|
|
|
onAccepted: {
|
|
settings.save();
|
|
Settings.save(WivrnServer);
|
|
|
|
applicationWindow().pageStack.pop();
|
|
}
|
|
onReset: {
|
|
Settings.restore_defaults();
|
|
settings.load();
|
|
}
|
|
onRejected: applicationWindow().pageStack.pop()
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
openvr_libs.init()
|
|
Settings.load(WivrnServer);
|
|
settings.allowUpdates = true;
|
|
settings.load();
|
|
}
|
|
|
|
function save() {
|
|
let openvr = openvr_combobox.model.get(openvr_combobox.currentIndex)
|
|
if (openvr.is_custom) {
|
|
Settings.openvr = openvr_text.text;
|
|
} else {
|
|
Settings.openvr = openvr.value
|
|
}
|
|
DashboardSettings.adb_custom = adb_custom.checked;
|
|
DashboardSettings.adb_location = adb_location.text;
|
|
Adb.setPath(adb_custom.checked ? adb_location.text : "adb");
|
|
|
|
DashboardSettings.show_system_checks = show_system_checks.checked;
|
|
|
|
Settings.debugGui = debug_gui.checked;
|
|
Settings.steamVrLh = steamvr_lh.checked;
|
|
if (lh_max_extrapolation_enabled.checked) {
|
|
Settings.lhMaxExtrapolation = lh_max_extrapolation.value;
|
|
} else {
|
|
Settings.lhMaxExtrapolation = -1;
|
|
}
|
|
Settings.lhStickDeadzone = lh_stick_deadzone.value;
|
|
Settings.hidForwarding = hid_forwarding.checked;
|
|
|
|
DashboardSettings.auto_connect_usb = auto_connect_usb.checked;
|
|
}
|
|
|
|
function load() {
|
|
select_game.load();
|
|
debug_gui.checked = Settings.debugGui;
|
|
steamvr_lh.checked = Settings.steamVrLh;
|
|
lh_max_extrapolation_enabled.checked = Settings.lhMaxExtrapolationEnabled;
|
|
lh_max_extrapolation.value = Settings.lhMaxExtrapolation;
|
|
lh_stick_deadzone.value = Settings.lhStickDeadzone;
|
|
hid_forwarding.checked = Settings.hidForwarding;
|
|
|
|
auto_connect_usb.checked = DashboardSettings.auto_connect_usb;
|
|
|
|
openvr_combobox.load()
|
|
|
|
adb_custom.checked = DashboardSettings.adb_custom;
|
|
adb_location.text = DashboardSettings.adb_location;
|
|
|
|
show_system_checks.checked = DashboardSettings.show_system_checks;
|
|
}
|
|
|
|
Shortcut {
|
|
sequences: [StandardKey.Cancel]
|
|
onActivated: {if (isCurrentPage) applicationWindow().pageStack.pop();}
|
|
}
|
|
}
|