Added QML dashboard
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Controls
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: apk_install
|
||||
title: i18n("Install the WiVRn app on your headset")
|
||||
|
||||
flickable.interactive: false
|
||||
|
||||
Kirigami.CardsListView {
|
||||
model: Adb
|
||||
delegate: DeviceCard {
|
||||
id: device_card
|
||||
required property string serial
|
||||
required property string model
|
||||
required property string manufacturer
|
||||
required property bool isWivrnInstalled
|
||||
|
||||
name: device_card.manufacturer + " " + device_card.model
|
||||
serial_number: device_card.serial
|
||||
is_wivrn_installed: device_card.isWivrnInstalled
|
||||
}
|
||||
|
||||
Kirigami.PlaceholderMessage {
|
||||
id: placeholder_message
|
||||
anchors.centerIn: parent
|
||||
width: parent.width - (Kirigami.Units.largeSpacing * 4)
|
||||
|
||||
visible: parent.count == 0
|
||||
|
||||
text: Adb.adbInstalled ? i18n("Connect a headset and make sure developper mode is enabled.") : i18n("ADB is not installed.")
|
||||
}
|
||||
}
|
||||
|
||||
footer: Controls.DialogButtonBox {
|
||||
standardButtons: Controls.DialogButtonBox.NoButton
|
||||
onAccepted: applicationWindow().pageStack.pop()
|
||||
|
||||
Controls.Button {
|
||||
text: i18nc("go back to the home page", "Back")
|
||||
icon.name: "go-previous"
|
||||
Controls.DialogButtonBox.buttonRole: Controls.DialogButtonBox.AcceptRole
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequences: [StandardKey.Cancel]
|
||||
onActivated: applicationWindow().pageStack.pop()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls as Controls
|
||||
|
||||
Controls.Label {
|
||||
// Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
onLinkActivated: link => Qt.openUrlExternally(link)
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: (parent as Controls.Label).hoveredLink == "" ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import QtQuick
|
||||
import org.kde.kirigami as Kirigami
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
Kirigami.MenuDialog {
|
||||
id: select_usb_device
|
||||
|
||||
property int connected_headset_count: 0
|
||||
property string connected_headset_serial: ""
|
||||
|
||||
title: i18n("Select your headset")
|
||||
showCloseButton: true
|
||||
|
||||
Connections {
|
||||
target: Adb
|
||||
|
||||
function onRowsInserted() {
|
||||
select_usb_device.connected_devices_changed();
|
||||
}
|
||||
|
||||
function onRowsRemoved() {
|
||||
select_usb_device.connected_devices_changed();
|
||||
}
|
||||
|
||||
function onDataChanged() {
|
||||
select_usb_device.connected_devices_changed();
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: usb_device_component
|
||||
Kirigami.Action {
|
||||
property string serial
|
||||
property string label
|
||||
|
||||
text: label
|
||||
onTriggered: Adb.startUsbConnection(serial, WivrnServer.pin)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: select_usb_device.connected_devices_changed()
|
||||
|
||||
actions: []
|
||||
|
||||
function connect() {
|
||||
if (select_usb_device.connected_headset_count == 1) {
|
||||
Adb.startUsbConnection(select_usb_device.connected_headset_serial, WivrnServer.pin);
|
||||
} else {
|
||||
select_usb_device.open();
|
||||
}
|
||||
}
|
||||
|
||||
function connected_devices_changed() {
|
||||
var n = Adb.rowCount();
|
||||
var nb_found = 0;
|
||||
|
||||
select_usb_device.actions.length = 0;
|
||||
|
||||
for (var i = 0; i < n; i++) {
|
||||
var serial = Adb.data(Adb.index(i, 0), 257);
|
||||
var isWivrnInstalled = Adb.data(Adb.index(i, 0), 258);
|
||||
var manufacturer = Adb.data(Adb.index(i, 0), 259);
|
||||
var model = Adb.data(Adb.index(i, 0), 260);
|
||||
|
||||
if (isWivrnInstalled) {
|
||||
nb_found++;
|
||||
select_usb_device.connected_headset_serial = serial;
|
||||
|
||||
select_usb_device.actions.push(usb_device_component.createObject(select_usb_device, {
|
||||
"label": manufacturer + " " + model,
|
||||
"serial": serial
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
select_usb_device.connected_headset_count = nb_found;
|
||||
if (nb_found != 1)
|
||||
select_usb_device.connected_headset_serial = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Controls
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
Kirigami.Card {
|
||||
id: device_card
|
||||
|
||||
property alias name: label_name.text
|
||||
property string serial_number
|
||||
property bool is_wivrn_installed
|
||||
property bool installing: false
|
||||
|
||||
Connections {
|
||||
target: ApkInstaller
|
||||
function onBusyChanged(value) {
|
||||
if (!value)
|
||||
device_card.installing = false;
|
||||
}
|
||||
}
|
||||
|
||||
implicitHeight: contentItem.implicitHeight + 2 * Kirigami.Units.largeSpacing
|
||||
|
||||
contentItem: GridLayout {
|
||||
id: delegate_layout
|
||||
rowSpacing: Kirigami.Units.largeSpacing
|
||||
columnSpacing: Kirigami.Units.largeSpacing
|
||||
columns: 2
|
||||
|
||||
Controls.Label {
|
||||
id: label_name
|
||||
Layout.fillWidth: true
|
||||
Layout.column: 0
|
||||
Layout.row: 0
|
||||
font.pixelSize: 20
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.column: 0
|
||||
Layout.row: 1
|
||||
text: device_card.is_wivrn_installed ? i18n("WiVRn is already installed on this device") : ""
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
id: install_button
|
||||
Layout.column: 1
|
||||
Layout.row: 0
|
||||
Layout.rowSpan: 2
|
||||
text: device_card.is_wivrn_installed ? i18n("Reinstall WiVRn") : i18n("Install WiVRn")
|
||||
icon.name: "install-symbolic"
|
||||
onClicked: device_card.install()
|
||||
enabled: !ApkInstaller.busy
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
id: progress_label
|
||||
Layout.column: 0
|
||||
Layout.row: 2
|
||||
Layout.columnSpan: 2
|
||||
visible: device_card.installing
|
||||
text: ApkInstaller.installStatus
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.column: 0
|
||||
Layout.row: 3
|
||||
Layout.columnSpan: 2
|
||||
visible: device_card.installing
|
||||
|
||||
Controls.ProgressBar {
|
||||
id: progress
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
to: ApkInstaller.bytesTotal > 0 ? ApkInstaller.bytesTotal : 1
|
||||
indeterminate: ApkInstaller.bytesTotal < 0
|
||||
value: ApkInstaller.bytesReceived
|
||||
}
|
||||
Controls.Button {
|
||||
icon.name: "dialog-cancel"
|
||||
onClicked: device_card.cancel_install()
|
||||
enabled: ApkInstaller.cancellable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function install() {
|
||||
console.log("Installing WiVRn on " + device_card.serial_number);
|
||||
installing = true;
|
||||
ApkInstaller.installApk(device_card.serial_number).then(() => {
|
||||
Adb.checkIfWivrnIsInstalled(device_card.serial_number);
|
||||
applicationWindow().showPassiveNotification(ApkInstaller.installStatus);
|
||||
});
|
||||
}
|
||||
|
||||
function cancel_install() {
|
||||
console.log("Cancelling installation");
|
||||
ApkInstaller.cancelInstallApk();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Controls
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: headsets
|
||||
title: i18n("Headset statistics")
|
||||
|
||||
Connections {
|
||||
target: WivrnServer
|
||||
function onHeadsetConnectedChanged(value) {
|
||||
if (!value)
|
||||
applicationWindow().pageStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: bling
|
||||
|
||||
// Controls.Label {
|
||||
// anchors.fill: parent
|
||||
// horizontalAlignment: Qt.AlignHCenter
|
||||
// verticalAlignment: Qt.AlignVCenter
|
||||
// text: i18n("Connected headset")
|
||||
// }
|
||||
|
||||
footer: Controls.DialogButtonBox {
|
||||
standardButtons: Controls.DialogButtonBox.NoButton
|
||||
onAccepted: applicationWindow().pageStack.pop()
|
||||
|
||||
Controls.Button {
|
||||
text: i18nc("go back to the home page", "Back")
|
||||
icon.name: "go-previous"
|
||||
Controls.DialogButtonBox.buttonRole: Controls.DialogButtonBox.AcceptRole
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequences: [StandardKey.Cancel]
|
||||
onActivated: applicationWindow().pageStack.pop()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Controls
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: headsets
|
||||
title: i18n("Headsets")
|
||||
|
||||
// flickable.interactive: false
|
||||
|
||||
Kirigami.PromptDialog {
|
||||
id: rename_headset
|
||||
title: i18n("Rename headset")
|
||||
|
||||
property string publicKey
|
||||
property alias headset_name: text_field.text
|
||||
|
||||
standardButtons: Kirigami.Dialog.NoButton
|
||||
customFooterActions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Rename")
|
||||
icon.name: "dialog-ok"
|
||||
onTriggered: rename_headset.accept()
|
||||
|
||||
enabled: rename_headset.headset_name != ""
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Cancel")
|
||||
icon.name: "dialog-cancel"
|
||||
onTriggered: rename_headset.close();
|
||||
}
|
||||
]
|
||||
ColumnLayout {
|
||||
Controls.TextField {
|
||||
id: text_field
|
||||
Layout.fillWidth: true
|
||||
placeholderText: i18n("Headset name…")
|
||||
}
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
WivrnServer.rename_key(rename_headset.publicKey, rename_headset.headset_name);
|
||||
rename_headset.close();
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequences: ["Enter", "Return"]
|
||||
onActivated: rename_headset.accept()
|
||||
}
|
||||
|
||||
onAboutToShow: text_field.selectAll()
|
||||
}
|
||||
|
||||
Component {
|
||||
id: headset_delegate
|
||||
Kirigami.Card {
|
||||
id: headset
|
||||
required property string name
|
||||
required property string publicKey
|
||||
|
||||
contentItem: GridLayout {
|
||||
id: delegate_layout
|
||||
rowSpacing: Kirigami.Units.largeSpacing
|
||||
columnSpacing: Kirigami.Units.largeSpacing
|
||||
columns: 3
|
||||
|
||||
Controls.Label {
|
||||
// TextInput {
|
||||
Layout.fillWidth: true
|
||||
Layout.column: 0
|
||||
Layout.row: 0
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: 20
|
||||
text: headset.name
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.column: 0
|
||||
Layout.row: 1
|
||||
wrapMode: Text.WordWrap
|
||||
// text: "Last connection: unknown"
|
||||
text: ""
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
Layout.column: 1
|
||||
Layout.rowSpan: 2
|
||||
text: i18n("Rename")
|
||||
icon.name: "edit-symbolic"
|
||||
onClicked: {
|
||||
rename_headset.publicKey = headset.publicKey;
|
||||
rename_headset.headset_name = headset.name;
|
||||
rename_headset.open();
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
Layout.column: 2
|
||||
Layout.rowSpan: 2
|
||||
text: i18n("Remove")
|
||||
icon.name: "delete-symbolic"
|
||||
onClicked: WivrnServer.revoke_key(headset.publicKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header: RowLayout {
|
||||
Kirigami.InlineMessage {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.topMargin: 2 * Kirigami.Units.largeSpacing
|
||||
Layout.leftMargin: 2 * Kirigami.Units.largeSpacing
|
||||
Layout.rightMargin: 2 * Kirigami.Units.largeSpacing
|
||||
text: i18n("Pairing enabled, PIN: %1", WivrnServer.pin)
|
||||
type: Kirigami.MessageType.Information
|
||||
visible: WivrnServer.pairingEnabled && !placeholder_message.visible
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Disable pairing")
|
||||
onTriggered: WivrnServer.disable_pairing()
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.CardsListView {
|
||||
model: WivrnServer.knownKeys
|
||||
delegate: headset_delegate
|
||||
|
||||
Kirigami.PlaceholderMessage {
|
||||
id: placeholder_message
|
||||
anchors.centerIn: parent
|
||||
width: parent.width - (Kirigami.Units.largeSpacing * 4)
|
||||
|
||||
visible: parent.count == 0
|
||||
|
||||
text: WivrnServer.pairingEnabled ? i18n("Start the WiVRn app on your headset and use the PIN: %1", WivrnServer.pin) : i18n("Enable pairing to allow your headset to connect to this computer")
|
||||
|
||||
// explanation: ""
|
||||
|
||||
helpfulAction: Kirigami.Action {
|
||||
text: i18n("Enable pairing")
|
||||
onTriggered: WivrnServer.enable_pairing()
|
||||
enabled: !WivrnServer.pairingEnabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
footer: Controls.DialogButtonBox {
|
||||
standardButtons: Controls.DialogButtonBox.NoButton
|
||||
onAccepted: applicationWindow().pageStack.pop()
|
||||
|
||||
Controls.Button {
|
||||
text: i18nc("go back to the home page", "Back")
|
||||
icon.name: "go-previous"
|
||||
Controls.DialogButtonBox.buttonRole: Controls.DialogButtonBox.AcceptRole
|
||||
}
|
||||
}
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Pair a new headset")
|
||||
icon.name: "list-add-symbolic"
|
||||
onTriggered: WivrnServer.enable_pairing()
|
||||
enabled: !WivrnServer.pairingEnabled
|
||||
}
|
||||
]
|
||||
|
||||
Shortcut {
|
||||
sequences: [StandardKey.Cancel]
|
||||
onActivated: applicationWindow().pageStack.pop()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
import QtCore as Core
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs as Dialogs
|
||||
import QtQuick.Controls as Controls
|
||||
import Qt.labs.platform
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
Kirigami.ApplicationWindow {
|
||||
id: root
|
||||
title: i18n("WiVRn dashboard")
|
||||
|
||||
Settings {
|
||||
id: config
|
||||
}
|
||||
|
||||
ConnectUsbDialog {
|
||||
id: select_usb_device
|
||||
}
|
||||
|
||||
SystemTrayIcon {
|
||||
id: systray
|
||||
visible: true
|
||||
icon.source: Qt.resolvedUrl("wivrn.svg")
|
||||
onActivated: root.visible = !root.visible
|
||||
}
|
||||
onClosing: Qt.quit()
|
||||
|
||||
Core.Settings {
|
||||
id: settings
|
||||
property alias first_run: root.first_run
|
||||
}
|
||||
property bool first_run: true
|
||||
|
||||
width: 900
|
||||
height: 800
|
||||
|
||||
property bool server_started: WivrnServer.serverStatus == WivrnServer.Started
|
||||
property bool json_loaded: false
|
||||
property bool prev_headset_connected: false
|
||||
|
||||
Connections {
|
||||
target: WivrnServer
|
||||
function onCapSysNiceChanged(value) {
|
||||
if (WivrnServer.serverStatus != WivrnServer.Stopped)
|
||||
restart_capsysnice.visible = true;
|
||||
}
|
||||
|
||||
function onServerStatusChanged(value) {
|
||||
var started = value == WivrnServer.Started;
|
||||
|
||||
if (switch_running.checked != started)
|
||||
switch_running.checked = started;
|
||||
}
|
||||
|
||||
function onPairingEnabledChanged(value) {
|
||||
if (switch_pairing.checked != WivrnServer.pairingEnabled)
|
||||
switch_pairing.checked = WivrnServer.pairingEnabled;
|
||||
}
|
||||
|
||||
// function onHeadsetConnectedChanged(value) {
|
||||
// if (value != root.prev_headset_connected) {
|
||||
// root.prev_headset_connected = value;
|
||||
//
|
||||
// if (value && root.pageStack.depth == 1)
|
||||
// root.pageStack.push(Qt.resolvedUrl("HeadsetStatsPage.qml"));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (WivrnServer.serverStatus == WivrnServer.Stopped)
|
||||
WivrnServer.start_server();
|
||||
|
||||
console.log("Settings at " + settings.location);
|
||||
if (root.first_run)
|
||||
{
|
||||
console.log("First run");
|
||||
root.pageStack.push(Qt.resolvedUrl("WizardPage.qml"));
|
||||
root.first_run = false;
|
||||
}
|
||||
}
|
||||
|
||||
pageStack.globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.NoNavigationButtons
|
||||
pageStack.defaultColumnWidth: width // Force non-wide mode
|
||||
pageStack.interactive: false // Don't let the back/forward mouse button handle the pagestack
|
||||
|
||||
pageStack.initialPage: Kirigami.ScrollablePage {
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Kirigami.InlineMessage {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("The server does not have CAP_SYS_NICE capabilities.")
|
||||
// type: Kirigami.MessageType.Warning
|
||||
type: Kirigami.MessageType.Information
|
||||
showCloseButton: true
|
||||
visible: !WivrnServer.capSysNice
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Fix it")
|
||||
onTriggered: WivrnServer.grant_cap_sys_nice()
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
id: restart_capsysnice
|
||||
Layout.fillWidth: true
|
||||
text: i18n("The CAP_SYS_NICE capability will be used when the server is restarted.")
|
||||
type: Kirigami.MessageType.Information
|
||||
showCloseButton: true
|
||||
visible: false
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18nc("restart the server", "Restart now")
|
||||
onTriggered: {
|
||||
WivrnServer.restart_server();
|
||||
restart_capsysnice.visible = false;
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("ADB is not installed.")
|
||||
type: Kirigami.MessageType.Information
|
||||
showCloseButton: true
|
||||
visible: !Adb.adbInstalled
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("NVIDIA GPUs require at least driver version 565.77, current version is %1", VulkanInfo.driverVersion)
|
||||
type: Kirigami.MessageType.Error
|
||||
showCloseButton: true
|
||||
visible: VulkanInfo.driverId == "NvidiaProprietary" && VulkanInfo.driverVersionCode < 2371043328 /* Version 565.77 */
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("More info")
|
||||
onTriggered: Qt.openUrlExternally("https://github.com/WiVRn/WiVRn/issues/180")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("Use the Mesa (radv) driver for AMD GPUs\nHardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO")
|
||||
type: Kirigami.MessageType.Warning
|
||||
showCloseButton: true
|
||||
visible: VulkanInfo.driverId == "AmdProprietary" || VulkanInfo.driverId == "AmdOpenSource"
|
||||
}
|
||||
|
||||
// RowLayout {
|
||||
// Controls.Button {
|
||||
// text: "refresh latest version"
|
||||
// onClicked: ApkInstaller.refreshLatestVersion()
|
||||
// }
|
||||
// Controls.Label {
|
||||
// text: "current version " + ApkInstaller.currentVersion + "\nlatest version " + ApkInstaller.latestVersion
|
||||
// }
|
||||
// }
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
|
||||
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||
Item {}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Image {
|
||||
source: Qt.resolvedUrl("wivrn.svg")
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
Layout.fillWidth: true
|
||||
Controls.Switch {
|
||||
id: switch_running
|
||||
Layout.row: 0
|
||||
Layout.column: 0
|
||||
text: i18nc("whether the server is running, displayed in front of a checkbox", "Running")
|
||||
|
||||
checked: true
|
||||
onCheckedChanged: {
|
||||
if (checked && !root.server_started)
|
||||
WivrnServer.start_server();
|
||||
else if (!checked && root.server_started)
|
||||
WivrnServer.stop_server();
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Switch {
|
||||
id: switch_pairing
|
||||
Layout.row: 1
|
||||
Layout.column: 0
|
||||
text: i18nc("whether pairing is enabled, displayed in front of a checkbox", "Pairing")
|
||||
onCheckedChanged: {
|
||||
if (checked && !WivrnServer.pairingEnabled)
|
||||
WivrnServer.enable_pairing();
|
||||
else if (!checked && WivrnServer.pairingEnabled)
|
||||
WivrnServer.disable_pairing();
|
||||
}
|
||||
enabled: root.server_started
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.row: 1
|
||||
Layout.column: 1
|
||||
text: WivrnServer.pairingEnabled ? i18n("PIN: %1", WivrnServer.pin) : ""
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
Layout.row: 2
|
||||
Layout.column: 0
|
||||
text: i18n("Connect by USB")
|
||||
onClicked: select_usb_device.connect()
|
||||
enabled: root.server_started && Adb.adbInstalled && !WivrnServer.headsetConnected && select_usb_device.connected_headset_count > 0
|
||||
visible: !WivrnServer.headsetConnected
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
Layout.row: 2
|
||||
Layout.column: 0
|
||||
text: i18n("Disconnect")
|
||||
icon.name: "network-disconnect-symbolic"
|
||||
onClicked: WivrnServer.disconnect_headset()
|
||||
visible: root.server_started && WivrnServer.headsetConnected
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
opacity: root.server_started
|
||||
Layout.maximumHeight: root.server_started ? -1 : 0
|
||||
}
|
||||
|
||||
Kirigami.Heading {
|
||||
level: 1
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18nc("automatically started application", "Application")
|
||||
opacity: root.server_started
|
||||
Layout.maximumHeight: root.server_started ? -1 : 0
|
||||
}
|
||||
|
||||
SelectGame {
|
||||
id: select_game
|
||||
opacity: root.server_started
|
||||
Layout.maximumHeight: root.server_started ? -1 : 0
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
opacity: root.server_started
|
||||
Layout.maximumHeight: root.server_started ? -1 : 0
|
||||
}
|
||||
|
||||
Kirigami.Heading {
|
||||
level: 1
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Steam informations")
|
||||
opacity: root.server_started
|
||||
Layout.maximumHeight: root.server_started ? -1 : 0
|
||||
}
|
||||
SteamLaunchOptions {
|
||||
opacity: root.server_started
|
||||
Layout.maximumHeight: root.server_started ? -1 : 0
|
||||
}
|
||||
|
||||
Item {
|
||||
// spacer item
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Wizard")
|
||||
icon.name: "tools-wizard-symbolic"
|
||||
onTriggered: root.pageStack.push(Qt.resolvedUrl("WizardPage.qml"))
|
||||
visible: root.pageStack.depth == 1
|
||||
enabled: root.server_started
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Install the app")
|
||||
icon.name: "install-symbolic"
|
||||
onTriggered: root.pageStack.push(Qt.resolvedUrl("ApkInstallPage.qml"))
|
||||
visible: root.pageStack.depth == 1
|
||||
enabled: root.server_started && Adb.adbInstalled
|
||||
},
|
||||
// Kirigami.Action {
|
||||
// text: i18n("Statistics")
|
||||
// icon.name: "office-chart-line-symbolic"
|
||||
// onTriggered: root.pageStack.push(Qt.resolvedUrl("HeadsetStatsPage.qml"))
|
||||
// visible: root.pageStack.depth == 1
|
||||
// enabled: root.server_started && Adb.adbInstalled && WivrnServer.headsetConnected
|
||||
// },
|
||||
|
||||
Kirigami.Action {
|
||||
text: i18n("Headsets")
|
||||
icon.name: "item-symbolic"
|
||||
onTriggered: root.pageStack.push(Qt.resolvedUrl("HeadsetsPage.qml"))
|
||||
visible: root.pageStack.depth == 1
|
||||
enabled: root.server_started
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Settings")
|
||||
icon.name: "settings-configure-symbolic"
|
||||
onTriggered: root.pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
|
||||
visible: root.pageStack.depth == 1
|
||||
enabled: root.server_started
|
||||
}/*,
|
||||
Kirigami.Action {
|
||||
text: i18n("Troubleshoot")
|
||||
icon.name: "help-contents-symbolic"
|
||||
onTriggered: root.pageStack.push(Qt.resolvedUrl("TroubleshootPage.qml"))
|
||||
enabled: root.server_started && root.pageStack.depth == 1
|
||||
}*/
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
pageStack.onCurrentItemChanged: select_game.reload()
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs as Dialogs
|
||||
import QtQuick.Controls as Controls
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
ColumnLayout {
|
||||
id: select_game
|
||||
|
||||
property bool json_loaded: false
|
||||
|
||||
Component.onCompleted: {
|
||||
apps.append({
|
||||
"name": i18nc("don't start an application automatically", "None"),
|
||||
"image_path": "",
|
||||
"command": "",
|
||||
"is_custom": false
|
||||
});
|
||||
|
||||
apps.append({
|
||||
"name": i18nc("choose a custom application to start", "Custom"),
|
||||
"image_path": "",
|
||||
"command": "",
|
||||
"is_custom": true
|
||||
});
|
||||
|
||||
var steam_apps = SteamApps.apps;
|
||||
for (var i = 0; i < steam_apps.length; i++) {
|
||||
apps.append({
|
||||
"name": steam_apps[i].name,
|
||||
"image_path": steam_apps[i].imagePath,
|
||||
"command": steam_apps[i].command,
|
||||
"is_custom": false
|
||||
});
|
||||
}
|
||||
|
||||
select_game.load();
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: apps
|
||||
}
|
||||
|
||||
Settings {
|
||||
id: config
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: WivrnServer
|
||||
function onJsonConfigurationChanged() {
|
||||
select_game.load();
|
||||
}
|
||||
}
|
||||
|
||||
Dialogs.FileDialog {
|
||||
id: app_browse
|
||||
onAccepted: {
|
||||
app_text.text = new URL(selectedFile).pathname;
|
||||
select_game.save();
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Controls.ComboBox {
|
||||
id: app_combobox
|
||||
Layout.columnSpan: 2
|
||||
textRole: "name"
|
||||
model: apps
|
||||
onActivated: select_game.save()
|
||||
}
|
||||
Controls.TextField {
|
||||
id: app_text
|
||||
placeholderText: app_combobox.currentText
|
||||
visible: !!app_combobox.model.get(app_combobox.currentIndex)?.is_custom && WivrnServer.serverStatus == WivrnServer.Started
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: select_game.save()
|
||||
}
|
||||
Controls.Button {
|
||||
text: i18nc("browse a file to choose the application to start", "Browse")
|
||||
visible: app_text.visible
|
||||
onClicked: app_browse.open()
|
||||
}
|
||||
}
|
||||
|
||||
function reload() {
|
||||
select_game.json_loaded = false;
|
||||
load();
|
||||
}
|
||||
|
||||
function load() {
|
||||
if (select_game.json_loaded || WivrnServer.serverStatus != WivrnServer.Started || WivrnServer.jsonConfiguration == "")
|
||||
return;
|
||||
|
||||
config.load(WivrnServer);
|
||||
|
||||
var found = false;
|
||||
var custom_idx = -1;
|
||||
for (var i = 0; i < apps.count; i++) {
|
||||
var app = apps.get(i);
|
||||
if (app.is_custom)
|
||||
custom_idx = i;
|
||||
else if (app.command == config.application) {
|
||||
app_combobox.currentIndex = i;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
app_text.text = config.application;
|
||||
app_combobox.currentIndex = custom_idx;
|
||||
}
|
||||
|
||||
select_game.json_loaded = true;
|
||||
}
|
||||
|
||||
function save() {
|
||||
var new_application;
|
||||
|
||||
if (apps.get(app_combobox.currentIndex).is_custom)
|
||||
new_application = app_text.text;
|
||||
else
|
||||
new_application = apps.get(app_combobox.currentIndex).command;
|
||||
|
||||
config.load(WivrnServer);
|
||||
if (config.application != new_application) {
|
||||
config.application = new_application;
|
||||
config.save(WivrnServer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Controls
|
||||
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
|
||||
|
||||
Settings {
|
||||
id: config
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
|
||||
Kirigami.FormLayout {
|
||||
|
||||
Controls.CheckBox {
|
||||
id: manual_foveation
|
||||
checked: true
|
||||
Layout.row: 0
|
||||
Layout.column: 0
|
||||
text: i18nc("automatic foveation setup", "Manual foveation")
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 5
|
||||
enabled: manual_foveation.checked
|
||||
Kirigami.FormData.label: i18n("Foveation strength:")
|
||||
|
||||
Controls.Slider {
|
||||
id: scale_slider
|
||||
Layout.row: 0
|
||||
Layout.column: 0
|
||||
Layout.columnSpan: 3
|
||||
implicitWidth: 20 * Kirigami.Units.gridUnit
|
||||
from: 0
|
||||
to: 80
|
||||
stepSize: 1
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.row: 0
|
||||
Layout.column: 3
|
||||
text: i18n("%1 %", scale_slider.value)
|
||||
}
|
||||
|
||||
Kirigami.ContextualHelpButton {
|
||||
Layout.row: 0
|
||||
Layout.column: 4
|
||||
toolTipText: i18n("A stronger foveation makes the image sharper in the center than in the periphery and makes the decoding faster. This is better for fast paced games.\n\nA weaker foveation gives a uniform sharpness in the whole image.\n\nThe recommended values are between 20% and 50% for headsets without eye tracking and between 50% and 70% for headsets with eye tracking.")
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.row: 1
|
||||
Layout.column: 0
|
||||
text: i18nc("weaker foveation", "Weaker")
|
||||
}
|
||||
Item {
|
||||
Layout.row: 1
|
||||
Layout.column: 1
|
||||
// spacer item
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.row: 1
|
||||
Layout.column: 2
|
||||
text: i18nc("stronger foveation", "Stronger")
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
Kirigami.FormData.isSection: true
|
||||
}
|
||||
|
||||
Controls.SpinBox {
|
||||
id: bitrate
|
||||
Kirigami.FormData.label: i18n("Bitrate:")
|
||||
from: 1
|
||||
to: 200
|
||||
|
||||
textFromValue: (value, locale) => i18nc("bitrate", "%1 Mbit/s", value)
|
||||
valueFromText: function (text, locale) {
|
||||
var prefix_suffix = i18nc("bitrate", "%1 Mbit/s", "%1").split('%1');
|
||||
for (var i of prefix_suffix) {
|
||||
text = text.replace(i, "");
|
||||
}
|
||||
return Number.fromLocaleString(text);
|
||||
}
|
||||
}
|
||||
|
||||
Controls.ComboBox {
|
||||
id: encoder_layout
|
||||
Kirigami.FormData.label: i18n("Encoder layout:")
|
||||
model: [
|
||||
{
|
||||
label: i18nc("encoder preset", "Automatic"),
|
||||
value: null
|
||||
},
|
||||
{
|
||||
label: i18nc("encoder preset", "Manual"),
|
||||
value: null
|
||||
},
|
||||
{
|
||||
label: i18nc("encoder preset", "Default preset"),
|
||||
value: [
|
||||
{
|
||||
width: 0.5,
|
||||
height: 1,
|
||||
offset_x: 0,
|
||||
offset_y: 0
|
||||
},
|
||||
{
|
||||
width: 0.5,
|
||||
height: 0.75,
|
||||
offset_x: 0.5,
|
||||
offset_y: 0
|
||||
},
|
||||
{
|
||||
width: 0.5,
|
||||
height: 0.25,
|
||||
offset_x: 0.5,
|
||||
offset_y: 0.75
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: i18nc("encoder preset", "Low latency preset"),
|
||||
value: [
|
||||
{
|
||||
width: 0.5,
|
||||
height: 1,
|
||||
offset_x: 0.5,
|
||||
offset_y: 0,
|
||||
encoder: 'x264',
|
||||
codec: 'h264'
|
||||
},
|
||||
{
|
||||
width: 0.5,
|
||||
height: 0.75,
|
||||
offset_x: 0,
|
||||
offset_y: 0
|
||||
},
|
||||
{
|
||||
width: 0.5,
|
||||
height: 0.25,
|
||||
offset_x: 0,
|
||||
offset_y: 0.75
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: i18nc("encoder preset", "Safe preset"),
|
||||
value: [
|
||||
{
|
||||
width: 1,
|
||||
height: 1,
|
||||
offset_x: 0,
|
||||
offset_y: 0
|
||||
}]
|
||||
}
|
||||
]
|
||||
textRole: "label"
|
||||
valueRole: "value"
|
||||
onCurrentValueChanged: {
|
||||
if (currentValue)
|
||||
{
|
||||
config.set_encoder_preset(currentValue);
|
||||
partitionner.currentIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
visible: encoder_layout.currentIndex > 0
|
||||
text: i18n("To add a new encoder, split an existing encoder by clicking near an edge.\nDrag an edge to resize or remove encoders.")
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RectanglePartitionner {
|
||||
id: partitionner
|
||||
implicitWidth: 600
|
||||
implicitHeight: 300
|
||||
visible: encoder_layout.currentIndex > 0
|
||||
settings: config
|
||||
onCodecChanged: {
|
||||
for (var i = 0; i < codec_combo.model.length; i++) {
|
||||
if (codec_combo.model[i].name == codec)
|
||||
codec_combo.currentIndex = i;
|
||||
}
|
||||
}
|
||||
onEncoderChanged: {
|
||||
for (var i = 0; i < encoder_combo.model.length; i++) {
|
||||
if (encoder_combo.model[i].name == encoder)
|
||||
encoder_combo.currentIndex = i;
|
||||
}
|
||||
}
|
||||
onEncoderLayoutChanged: encoder_layout.currentIndex = 1 // Manual layout
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Kirigami.FormData.label: i18n("Encoder:")
|
||||
enabled: partitionner.selected
|
||||
visible: encoder_layout.currentIndex > 0
|
||||
Controls.ComboBox {
|
||||
id: encoder_combo
|
||||
model: [
|
||||
// Keep it in sync with rectangle_partitionner.h (encoder_name_from_setting)
|
||||
{
|
||||
name: "auto",
|
||||
label: i18nc("automatic encoder setup", "Auto"),
|
||||
codecs: "auto"
|
||||
},
|
||||
{
|
||||
name: "nvenc",
|
||||
label: i18n("nvenc (NVIDIA GPUs)"),
|
||||
codecs: "auto,h264,h265"
|
||||
},
|
||||
{
|
||||
name: "vaapi",
|
||||
label: i18n("vaapi (AMD and Intel GPUs)"),
|
||||
codecs: "auto,h264,h265,av1"
|
||||
},
|
||||
{
|
||||
name: "x264",
|
||||
label: i18n("x264 (software encoding)"),
|
||||
codecs: "h264"
|
||||
},
|
||||
{
|
||||
name: "vulkan",
|
||||
label: i18n("Vulkan (Vulkan Video)"),
|
||||
codecs: "h264"
|
||||
}
|
||||
]
|
||||
textRole: "label"
|
||||
onCurrentIndexChanged: {
|
||||
partitionner.encoder = encoder_combo.model[currentIndex].name;
|
||||
|
||||
// Check if the currently selected codec is supported by the new encoder
|
||||
var supported_codecs = model[currentIndex].codecs.split(",");
|
||||
var current_codec = codec_combo.model[codec_combo.currentIndex].name;
|
||||
|
||||
if (!supported_codecs.includes(current_codec)) {
|
||||
for (var i = 0; i < codec_combo.model.length; i++) {
|
||||
if (supported_codecs.includes(codec_combo.model[i].name)) {
|
||||
codec_combo.currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Kirigami.ContextualHelpButton {
|
||||
toolTipText: i18n("\"Auto\" will use hardware acceleration if it is available")
|
||||
}
|
||||
}
|
||||
|
||||
Controls.ComboBox {
|
||||
id: codec_combo
|
||||
Kirigami.FormData.label: i18n("Codec:")
|
||||
enabled: partitionner.selected
|
||||
visible: encoder_layout.currentIndex > 0
|
||||
model: [
|
||||
// Keep it in sync with rectangle_partitionner.h (codec_name_from_setting)
|
||||
{
|
||||
name: "auto",
|
||||
label: i18nc("automatic codec setup", "Auto")
|
||||
},
|
||||
{
|
||||
name: "h264",
|
||||
label: i18n("H.264")
|
||||
},
|
||||
{
|
||||
name: "h265",
|
||||
label: i18n("H.265")
|
||||
},
|
||||
{
|
||||
name: "av1",
|
||||
label: i18n("AV1")
|
||||
}
|
||||
]
|
||||
textRole: "label"
|
||||
onCurrentIndexChanged: partitionner.codec = model[currentIndex].name
|
||||
|
||||
delegate: Controls.ItemDelegate {
|
||||
required property int index
|
||||
required property string label
|
||||
required property string name
|
||||
|
||||
width: codec_combo.width
|
||||
text: i18n(label)
|
||||
highlighted: ListView.isCurrentItem
|
||||
enabled: encoder_combo.model[encoder_combo.currentIndex].codecs.split(",").includes(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
// spacer item
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
footer: Controls.DialogButtonBox {
|
||||
standardButtons: Controls.DialogButtonBox.Ok | Controls.DialogButtonBox.Cancel | Controls.DialogButtonBox.Reset
|
||||
|
||||
onAccepted: {
|
||||
settings.save();
|
||||
config.save(WivrnServer);
|
||||
|
||||
applicationWindow().pageStack.pop();
|
||||
}
|
||||
onReset: {
|
||||
config.restore_defaults();
|
||||
settings.load();
|
||||
}
|
||||
onRejected: applicationWindow().pageStack.pop()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
config.load(WivrnServer);
|
||||
settings.load();
|
||||
}
|
||||
|
||||
function save() {
|
||||
config.bitrate = bitrate.value * 1000000;
|
||||
config.scale = manual_foveation.checked ? 1 - scale_slider.value / 100.0 : -1;
|
||||
config.manualEncoders = encoder_layout.currentIndex > 0;
|
||||
}
|
||||
|
||||
function load() {
|
||||
bitrate.value = config.bitrate / 1000000;
|
||||
|
||||
if (config.scale > 0) {
|
||||
scale_slider.value = Math.round(100 - config.scale * 100);
|
||||
manual_foveation.checked = true;
|
||||
} else {
|
||||
manual_foveation.checked = false;
|
||||
}
|
||||
|
||||
if (config.manualEncoders) {
|
||||
// auto_encoders.checked = false;
|
||||
encoder_layout.currentIndex = 1;
|
||||
} else {
|
||||
// auto_encoders.checked = true;
|
||||
encoder_layout.currentIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequences: [StandardKey.Cancel]
|
||||
onActivated: applicationWindow().pageStack.pop()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Controls
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
ColumnLayout {
|
||||
Controls.Label {
|
||||
text: i18n("For Steam games, right click on the game in Steam, go in Properties > Shortcut and paste this in \"Launch options\":")
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Controls.TextField {
|
||||
text: WivrnServer.steamCommand
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
readOnly: true
|
||||
// cursorVisible: true
|
||||
Controls.ToolTip.text: i18n("Paste this in the Steam launch options for the app you want to start")
|
||||
Controls.ToolTip.visible: hovered
|
||||
Controls.ToolTip.delay: 1000
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
text: i18nc("copy text to the clipboard", "Copy")
|
||||
icon.name: "edit-copy-symbolic"
|
||||
onClicked: {
|
||||
WivrnServer.copy_steam_command();
|
||||
showPassiveNotification(i18n("Copied Steam launch command"), 2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,531 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs as Dialogs
|
||||
import QtQuick.Controls as Controls
|
||||
import QtQuick.Templates as Templates
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import io.github.wivrn.wivrn
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: wizard
|
||||
title: i18n("Getting started")
|
||||
|
||||
// flickable.interactive: false
|
||||
|
||||
Component {
|
||||
id: page_component
|
||||
WizardStep {
|
||||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
|
||||
}
|
||||
Component.onDestruction: console.log("page destroyed")
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Back")
|
||||
icon.name: "go-previous"
|
||||
onTriggered: pageStack.pop()
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: "test"
|
||||
onTriggered: pageStack.push(page_component.createObject(pageStack))
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Cancel")
|
||||
onTriggered: wizard.cancel()
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
property bool is_tagged: ApkInstaller.isTagged
|
||||
property bool is_latest: ApkInstaller.currentVersion == ApkInstaller.latestVersion
|
||||
property bool checking_newer: ApkInstaller.latestVersion == "" && ApkInstaller.isTagged
|
||||
property bool newer_version: ApkInstaller.currentVersion != ApkInstaller.latestVersion && ApkInstaller.latestVersion != "" && ApkInstaller.isTagged
|
||||
|
||||
ConnectUsbDialog {
|
||||
id: select_usb_device
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
ApkInstaller.refreshLatestVersion();
|
||||
}
|
||||
|
||||
Component {
|
||||
id: page_welcome_component
|
||||
WizardStep {
|
||||
id: page_welcome
|
||||
Controls.Label {
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Welcome to WiVRn")
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("This wizard will help you set up WiVRn on your headset and connect it to your computer.")
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Back")
|
||||
icon.name: "go-previous"
|
||||
enabled: false
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Next")
|
||||
icon.name: "go-next"
|
||||
onTriggered: pageStack.push(page_install_component.createObject(pageStack))
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Cancel")
|
||||
onTriggered: wizard.cancel()
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: devmode_url
|
||||
ListElement {
|
||||
manufacturer: "HTC"
|
||||
url: "https://developer.vive.com/resources/hardware-guides/vive-focus-specs-user-guide/how-do-i-put-focus-developer-mode/"
|
||||
}
|
||||
ListElement {
|
||||
manufacturer: "Meta"
|
||||
url: "https://developers.meta.com/horizon/documentation/native/android/mobile-device-setup/#enable-developer-mode"
|
||||
}
|
||||
ListElement {
|
||||
manufacturer: "Pico"
|
||||
url: "https://developer.picoxr.com/document/unreal/test-and-build/#Enable%20developer%20mode"
|
||||
}
|
||||
}
|
||||
Kirigami.Dialog {
|
||||
id: devmode_dialog
|
||||
title: i18n("How to enable developper mode")
|
||||
showCloseButton: false
|
||||
padding: 2 * Kirigami.Units.largeSpacing
|
||||
ColumnLayout {
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Follow the manufacturer's instructions below:")
|
||||
}
|
||||
Repeater {
|
||||
model: devmode_url
|
||||
delegate: BetterLabel {
|
||||
required property string manufacturer
|
||||
required property string url
|
||||
Layout.fillWidth: true
|
||||
text: "<a href=\"%1\">%2</a>".arg(url).arg(manufacturer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: page_install_component
|
||||
WizardStep {
|
||||
Controls.Label {
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Install the WiVRn app on your headset")
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("In order to use WiVRn, you will have to install the client app on your headset.\nYou can either install it from the Meta store or directly over USB.")
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.topMargin: 4 * Kirigami.Units.largeSpacing
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Install from the Meta store")
|
||||
}
|
||||
BetterLabel {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("For the Quest 2, 3, 3S, and Pro, you can get the app from the <a href=\"https://www.meta.com/experiences/7959676140827574/\">Meta store</a>.")
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Checking latest release...")
|
||||
visible: wizard.checking_newer
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("A newer release is available: %1 → %2, the client app on the Meta store may not be compatible.", ApkInstaller.currentVersion, ApkInstaller.latestVersion)
|
||||
visible: wizard.newer_version
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("This is a nightly build, the client app on the Meta store may not be compatible.")
|
||||
visible: !wizard.is_tagged
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5
|
||||
Layout.topMargin: 4 * Kirigami.Units.largeSpacing
|
||||
Layout.bottomMargin: 4 * Kirigami.Units.largeSpacing
|
||||
Layout.preferredWidth: 20 * Kirigami.Units.largeSpacing
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
text: i18nc("displayed between 'meta store' and 'install over USB' in the wizard", "Or")
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.bottomMargin: 2 * Kirigami.Units.largeSpacing
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Install over USB")
|
||||
}
|
||||
|
||||
BetterLabel {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("No precompiled APK is available for this version. Follow the instructions in the <a href=\"https://github.com/WiVRn/WiVRn/blob/master/docs/building.md#client-headset\">documentation</a> to build your own client.")
|
||||
visible: !ApkInstaller.apkAvailable
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("ADB is not installed")
|
||||
visible: device_list.count == 0 && !Adb.adbInstalled
|
||||
}
|
||||
|
||||
// TODO link to adb/udev rules depending on the distribution
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("<p>No headset detected. Make sure that:\n<ul><li>The ADB udev rules are installed</li><li>The headset is in <a href=\"#\">developper mode</a></li></ul></p>")
|
||||
onLinkActivated: devmode_dialog.open()
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: (parent as Controls.Label).hoveredLink == "" ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
}
|
||||
visible: device_list.count == 0 && Adb.adbInstalled && ApkInstaller.apkAvailable
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: device_list
|
||||
model: Adb
|
||||
delegate: DeviceCard {
|
||||
id: device_card
|
||||
required property string serial
|
||||
required property string model
|
||||
required property string manufacturer
|
||||
required property bool isWivrnInstalled
|
||||
|
||||
name: device_card.manufacturer + " " + device_card.model
|
||||
serial_number: device_card.serial
|
||||
is_wivrn_installed: device_card.isWivrnInstalled
|
||||
}
|
||||
visible: ApkInstaller.apkAvailable
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
// image: Qt.resolvedUrl("wivrn.svg")
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Back")
|
||||
icon.name: "go-previous"
|
||||
onTriggered: pageStack.goBack()
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Next")
|
||||
icon.name: "go-next"
|
||||
onTriggered: pageStack.push(page_selectgame_component.createObject(pageStack))
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Cancel")
|
||||
onTriggered: wizard.cancel()
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: page_selectgame_component
|
||||
|
||||
WizardStep {
|
||||
id: page_selectgame
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Select the application you want to start")
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("The application you choose will be started automatically when you connect your headset.")
|
||||
Layout.topMargin: 2 * Kirigami.Units.largeSpacing
|
||||
}
|
||||
|
||||
SelectGame {}
|
||||
|
||||
SteamLaunchOptions {
|
||||
Layout.topMargin: 2 * Kirigami.Units.largeSpacing
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Back")
|
||||
icon.name: "go-previous"
|
||||
onTriggered: pageStack.goBack()
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Next")
|
||||
icon.name: "go-next"
|
||||
onTriggered: pageStack.push(page_startwivrn_component.createObject(pageStack))
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Cancel")
|
||||
onTriggered: wizard.cancel()
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: page_startwivrn_component
|
||||
|
||||
WizardStep {
|
||||
id: page_startwivrn
|
||||
Component.onCompleted: {
|
||||
WivrnServer.headsetConnectedChanged.connect(onHeadsetConnectedChanged);
|
||||
WivrnServer.pairingEnabledChanged.connect(onCurrentItemChanged_or_PairingEnabledChanged);
|
||||
pageStack.currentItemChanged.connect(onCurrentItemChanged_or_PairingEnabledChanged);
|
||||
}
|
||||
|
||||
function onCurrentItemChanged_or_PairingEnabledChanged() {
|
||||
if (pageStack?.currentItem === page_startwivrn && !WivrnServer.pairingEnabled)
|
||||
WivrnServer.enable_pairing();
|
||||
}
|
||||
|
||||
function onHeadsetConnectedChanged(value) {
|
||||
if (value && pageStack?.currentItem === page_startwivrn)
|
||||
pageStack.push(page_connected_component.createObject(pageStack));
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Start the WiVRn app on your headset")
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("To connect over WiFi, start the WiVRn app on your headset, connect to \"%1\" and enter PIN \"%2\".", WivrnServer.hostname, WivrnServer.pin)
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("To connect over USB, click on \"Connect by USB\".")
|
||||
}
|
||||
Controls.Button {
|
||||
text: i18n("Connect by USB")
|
||||
onClicked: select_usb_device.connect()
|
||||
enabled: select_usb_device.connected_headset_count > 0
|
||||
}
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.topMargin: 4 * Kirigami.Units.largeSpacing
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Troubleshooting")
|
||||
}
|
||||
BetterLabel {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("If you installed WiVRn over USB on a Meta headset, the app is in the \"unknown sources\" section.")
|
||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||
}
|
||||
BetterLabel {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("If the server is not visible or the connection fails, check that port 5353 (UDP) and 9757 (TCP and UDP) are open in your firewall.")
|
||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Back")
|
||||
icon.name: "go-previous"
|
||||
onTriggered: pageStack.goBack()
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Skip")
|
||||
// icon.name: "go-next"
|
||||
onTriggered: pageStack.push(page_connection_skipped_component.createObject(pageStack))
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Cancel")
|
||||
onTriggered: wizard.cancel()
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: page_connected_component
|
||||
WizardStep {
|
||||
id: page_connected
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Connection established")
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Your headset is now connected.")
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("To connect another headset, make sure pairing is enabled in the dashboard before connecting.")
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("When the headset is connected, select \"WiVRn\" as the default audio output device for applications to use it.")
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Back")
|
||||
icon.name: "go-previous"
|
||||
onTriggered: pageStack.goBack()
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Next")
|
||||
icon.name: "go-next"
|
||||
enabled: false
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Finish")
|
||||
onTriggered: wizard.cancel()
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: page_connection_skipped_component
|
||||
WizardStep {
|
||||
id: page_finished
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.35
|
||||
text: i18n("Finished")
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("To connect another headset, make sure pairing is enabled in the dashboard before connecting.")
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Back")
|
||||
icon.name: "go-previous"
|
||||
onTriggered: pageStack.goBack()
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Next")
|
||||
icon.name: "go-next"
|
||||
enabled: false
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Finish")
|
||||
onTriggered: wizard.cancel()
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.PageRow {
|
||||
id: pageStack
|
||||
globalToolBar.style: Kirigami.ApplicationHeaderStyle.Auto
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
|
||||
globalToolBar {
|
||||
showNavigationButtons: Kirigami.ApplicationHeaderStyle.NoNavigationButtons
|
||||
// style: Kirigami.ApplicationHeaderStyle.None
|
||||
}
|
||||
|
||||
defaultColumnWidth: width // Force non-wide mode
|
||||
interactive: false // Don't let the back/forward mouse button handle the pagestack
|
||||
popHiddenPages: true // pop hidden pages and use goBack() instead of pop() to animate the pages correctly when going back
|
||||
|
||||
initialPage: page_welcome_component.createObject(pageStack)
|
||||
}
|
||||
|
||||
footer: Item {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: footer_row.implicitHeight + 2 * Kirigami.Units.largeSpacing
|
||||
|
||||
ColumnLayout {
|
||||
id: footer_row
|
||||
anchors.fill: parent
|
||||
Kirigami.Separator {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
RowLayout {
|
||||
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||
|
||||
spacing: Kirigami.Units.largeSpacing
|
||||
|
||||
Item {
|
||||
// spacer item
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: (pageStack.trailingVisibleItem as WizardStep)?.actions
|
||||
Controls.Button {
|
||||
required property Kirigami.Action modelData
|
||||
action: modelData
|
||||
// enabled: pageStack.trailingVisibleItem == pageStack.leadingVisibleItem && modelData.enabled
|
||||
visible: modelData.visible
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
applicationWindow().pageStack.pop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
Kirigami.Page {
|
||||
default property alias content: inner.children
|
||||
property alias image: img.source
|
||||
|
||||
property list<Kirigami.Action> actions
|
||||
|
||||
globalToolBarStyle: Kirigami.ApplicationHeaderStyle.None
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
ColumnLayout {
|
||||
Image {
|
||||
id: img
|
||||
source: Qt.resolvedUrl("wivrn.svg")
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: inner
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user