Rework dashboard main page

This commit is contained in:
Patrick Nicolas
2026-01-06 17:57:54 +01:00
parent 12cddd4d6f
commit d6768d59a7
+87 -74
View File
@@ -261,23 +261,25 @@ Kirigami.ApplicationWindow {
Layout.leftMargin: Kirigami.Units.largeSpacing Layout.leftMargin: Kirigami.Units.largeSpacing
Layout.rightMargin: Kirigami.Units.largeSpacing Layout.rightMargin: Kirigami.Units.largeSpacing
Item {}
Item {
Layout.fillWidth: true
}
Image { Image {
source: Qt.resolvedUrl("wivrn.svg") source: Qt.resolvedUrl("wivrn.svg")
Layout.columnSpan: parent.width < implicitWidth + parent.columnSpacing + main_form.implicitWidth ? 2 : 1
} }
GridLayout { Kirigami.FormLayout {
columns: 2 id: main_form
Layout.fillWidth: true Layout.alignment: Qt.AlignTop
Kirigami.Heading {
text: i18n("Server status")
level: 1
type: Kirigami.Heading.Type.Primary
}
Controls.Switch { Controls.Switch {
Kirigami.FormData.label: i18nc("whether the server is running, displayed in front of a checkbox", "Running")
id: switch_running 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 checked: true
onCheckedChanged: { onCheckedChanged: {
@@ -288,84 +290,95 @@ Kirigami.ApplicationWindow {
} }
} }
Controls.Switch { RowLayout {
id: switch_pairing Kirigami.FormData.label: i18nc("whether pairing is enabled, displayed in front of a checkbox", "Pairing")
Layout.row: 1 enabled: root.server_started
Layout.column: 0 Controls.Switch {
text: i18nc("whether pairing is enabled, displayed in front of a checkbox", "Pairing") id: switch_pairing
onCheckedChanged: { onCheckedChanged: {
if (checked && !WivrnServer.pairingEnabled) if (checked && !WivrnServer.pairingEnabled)
WivrnServer.enable_pairing(); WivrnServer.enable_pairing();
else if (!checked && WivrnServer.pairingEnabled) else if (!checked && WivrnServer.pairingEnabled)
WivrnServer.disable_pairing(); WivrnServer.disable_pairing();
}
} }
Controls.Label {
visible: WivrnServer.pairingEnabled
text: WivrnServer.pin
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.1
}
}
Kirigami.Heading {
text: i18n("Headset status")
level: 1
type: Kirigami.Heading.Type.Primary
enabled: root.server_started enabled: root.server_started
} }
Controls.Label { RowLayout {
Layout.row: 1 Kirigami.FormData.label: i18nc("label for headset name/status under server running switch", "Headset")
Layout.column: 1 enabled: root.server_started
text: WivrnServer.pairingEnabled ? i18n("PIN: %1", WivrnServer.pin) : "" Controls.Label {
wrapMode: Text.WordWrap text: WivrnServer.headsetConnected ? WivrnServer.systemName : i18n("Not connected")
Layout.fillWidth: true }
}
Controls.Button { Controls.Button {
Layout.row: 2 text: i18n("Disconnect")
Layout.column: 0 icon.name: "network-disconnect-symbolic"
text: i18n("Connect by USB") onClicked: WivrnServer.disconnect_headset()
onClicked: select_usb_device.connect() visible: root.server_started && WivrnServer.headsetConnected
enabled: root.server_started && Adb.adbInstalled && select_usb_device.connected_headset_count > 0
visible: !WivrnServer.headsetConnected
Controls.ToolTip.visible: root.server_started && hovered
Controls.ToolTip.delay: Kirigami.Units.toolTipDelay
Controls.ToolTip.text: {
if (!Adb.adbInstalled)
return i18n("ADB is not installed");
if (select_usb_device.connected_headset_count == 0)
return i18n("No headset is connected or your headset is not in developer mode");
return "";
} }
} }
// USB mode
Controls.Button { Controls.Button {
Layout.row: 2 Kirigami.FormData.label: i18nc("label for USB status or connect button", "USB")
Layout.column: 0 text: i18nc("usb connect button", "Connect (wired)")
text: i18n("Disconnect") onClicked: select_usb_device.connect()
icon.name: "network-disconnect-symbolic" enabled: root.server_started && !WivrnServer.headsetConnected
onClicked: WivrnServer.disconnect_headset() visible: Adb.adbInstalled && select_usb_device.connected_headset_count > 0
visible: root.server_started && WivrnServer.headsetConnected }
Controls.Label {
Kirigami.FormData.label: i18nc("label for USB status or connect button", "USB")
visible: !Adb.adbInstalled
enabled: root.server_started
text: i18n("ADB is not installed")
}
Controls.Label {
Kirigami.FormData.label: i18nc("label for USB status or connect button", "USB")
visible: Adb.adbInstalled && select_usb_device.connected_headset_count == 0
enabled: root.server_started
text: i18n("No headset is connected or your headset is not in developer mode");
Layout.fillWidth: true
wrapMode: Text.Wrap
} }
} }
}
Kirigami.Separator { Kirigami.Separator {
Layout.columnSpan: 2 Layout.fillWidth: true
Layout.fillWidth: true visible: steam_info.visible
opacity: steam_info.opacity }
visible: steam_info.visible
Layout.maximumHeight: root.server_started ? -1 : 0
}
Kirigami.Heading { Kirigami.Heading {
level: 1 level: 1
wrapMode: Text.WordWrap type: Kirigami.Heading.Type.Primary
text: i18n("Steam information") wrapMode: Text.WordWrap
opacity: steam_info.opacity text: i18n("Steam information")
visible: steam_info.visible visible: steam_info.visible
Layout.maximumHeight: root.server_started ? -1 : 0 }
} SteamLaunchOptions {
SteamLaunchOptions { id: steam_info
id: steam_info visible: root.server_started && WivrnServer.steamCommand != ""
visible: WivrnServer.steamCommand != "" }
opacity: root.server_started
Layout.maximumHeight: root.server_started ? -1 : 0
}
Item { Item {
// spacer item // spacer item
Layout.fillHeight: true Layout.fillHeight: true
}
} }
} }