diff --git a/CMakeLists.txt b/CMakeLists.txt index 07d39678..e06a28f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,10 +183,15 @@ if (WIVRN_BUILD_SERVER) endif() if (WIVRN_BUILD_DASHBOARD) - find_package(Qt6 REQUIRED COMPONENTS Core Quick QuickControls2 Gui Widgets DBus Network LinguistTools) + find_package(Qt6 REQUIRED COMPONENTS Core Quick Test Gui QuickControls2 Widgets Network) + + find_package(ECM 5.115 REQUIRED NO_MODULE) + list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") + + find_package(KF6 REQUIRED COMPONENTS Kirigami I18n CoreAddons QQC2DesktopStyle IconThemes) + find_package(KF6Kirigami) find_package(nlohmann_json REQUIRED) find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml) - find_package(KF6Kirigami) qcoro_enable_coroutines() if (WIVRN_CHECK_CAPSYSNICE) diff --git a/dashboard/CMakeLists.txt b/dashboard/CMakeLists.txt index 51845d37..bdb0bb9a 100644 --- a/dashboard/CMakeLists.txt +++ b/dashboard/CMakeLists.txt @@ -1,36 +1,11 @@ -# cmake_minimum_required(VERSION 3.20) -# project(kirigami-tutorial) - -find_package(ECM 5.115 REQUIRED NO_MODULE) -list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") - include(KDEInstallDirs) include(KDECMakeSettings) -# include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMFindQmlModule) include(ECMQmlModule) include(I18n) -find_package(Qt6 REQUIRED COMPONENTS - Core - Quick - Test - Gui - QuickControls2 - Widgets -) - -find_package(KF6 REQUIRED COMPONENTS - Kirigami - I18n - CoreAddons - QQC2DesktopStyle - IconThemes -) - ecm_find_qmlmodule(org.kde.kirigami REQUIRED) - add_executable(wivrn-dashboard main.cpp wivrn_server.cpp @@ -65,8 +40,12 @@ qt_add_qml_module(wivrn-dashboard qml/ConnectUsbDialog.qml qml/SelectGame.qml qml/SteamLaunchOptions.qml + qml/TroubleshootPage.qml + qml/TroubleshootCard.qml RESOURCES ../images/wivrn.svg + qml/Discord.svg + qml/Github.svg ) diff --git a/dashboard/qml/Discord.svg b/dashboard/qml/Discord.svg new file mode 100644 index 00000000..4b91dc17 --- /dev/null +++ b/dashboard/qml/Discord.svg @@ -0,0 +1 @@ + diff --git a/dashboard/qml/Github.svg b/dashboard/qml/Github.svg new file mode 100644 index 00000000..9236fb2c --- /dev/null +++ b/dashboard/qml/Github.svg @@ -0,0 +1 @@ + diff --git a/dashboard/qml/Main.qml b/dashboard/qml/Main.qml index 0d0856a9..5efe771b 100644 --- a/dashboard/qml/Main.qml +++ b/dashboard/qml/Main.qml @@ -319,15 +319,13 @@ Kirigami.ApplicationWindow { 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 - }*/ - - + } ] } diff --git a/dashboard/qml/TroubleshootCard.qml b/dashboard/qml/TroubleshootCard.qml new file mode 100644 index 00000000..5f9a84d8 --- /dev/null +++ b/dashboard/qml/TroubleshootCard.qml @@ -0,0 +1,85 @@ +import org.kde.kirigami as Kirigami + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Templates as T + +// Kirigami.Card { +// id: card +// property string title +// property alias details: label.text +// +// banner.title: title +// contentItem: BetterLabel { +// id: label +// } +// } + +Control { + // T.ItemDelegate { + id: card + property alias title: label_title.text + property alias details: label_details.text + + Kirigami.Theme.inherit: false + // Kirigami.Theme.colorSet: Kirigami.Theme.View + Kirigami.Theme.colorSet: Kirigami.Theme.Button + + property double expanded: 0 + Behavior on expanded { + PropertyAnimation { + duration: Kirigami.Units.shortDuration + easing.type: Easing.InOutCubic + } + } + + implicitHeight: column.anchors.topMargin + label_title.implicitHeight + card.expanded * (column.spacing + label_details.implicitHeight + column.spacing + actionsToolBar.implicitHeight) + column.anchors.bottomMargin + implicitWidth: parent.width + clip: true + + // background: Kirigami.ShadowedRectangle { + // anchors.fill: parent + // border.width: 1 + // border.color: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, Kirigami.Theme.frameContrast) + // radius: Kirigami.Units.cornerRadius + // } + + ColumnLayout { + id: column + anchors.fill: parent + anchors.margins: Kirigami.Units.smallSpacing + + BetterLabel { + id: label_title + font.pixelSize: 20 + Layout.preferredWidth: Math.min(implicitWidth, parent.width) + // Layout.fillWidth: true + + MouseArea { + anchors.fill: parent + onClicked: card.expanded = 1 - card.expanded + cursorShape: Qt.PointingHandCursor + } + } + + BetterLabel { + id: label_details + Layout.fillWidth: true + } + + Kirigami.ActionToolBar { + id: actionsToolBar + actions: card.actions + position: ToolBar.Footer + flat: false + } + } + /* + Rectangle { + anchors.fill: column + color: Qt.rgba(0, 0, 0.5, 0.5) + }*/ + + property list actions +} diff --git a/dashboard/qml/TroubleshootPage.qml b/dashboard/qml/TroubleshootPage.qml new file mode 100644 index 00000000..e3c068f3 --- /dev/null +++ b/dashboard/qml/TroubleshootPage.qml @@ -0,0 +1,82 @@ +pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Controls as Controls +import org.kde.kirigami as Kirigami + +import io.github.wivrn.wivrn + +Kirigami.ScrollablePage { + title: i18n("Troubleshoot") + id: page + + Kirigami.Theme.colorSet: Kirigami.Theme.View + + Kirigami.CardsLayout { + maximumColumns: 1 + rowSpacing: Kirigami.Units.largeSpacing * 2 + + TroubleshootCard { + title: i18n("I cannot find the WiVRn app on my headset") + details: i18n("If you installed WiVRn over USB on a Meta headset, the app is in the \"unknown sources\" section.") + } + TroubleshootCard { + title: i18n("I cannot see my computer in the WiVRn app") + details: 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.") + } + TroubleshootCard { + title: i18n("I have an \"Incompatible WiVRn server\" error on my headset") + details: i18n("

The version of the headset app and the server on your computer must match.

", ApkInstaller.currentVersion) + } + TroubleshootCard { + title: i18n("I have a \"Pairing is disabled\" error") + details: i18n("If you have reinstalled the server or the client or if you want to connect another headset, you must enable pairing before connecting.") + "\n\n" + (WivrnServer.pairingEnabled ? i18n("Pairing is currently enabled with PIN %1.", WivrnServer.pin) : i18n("Pairing is currently disabled.")) + + actions: [ + Kirigami.Action { + text: i18n("Enable pairing") + visible: !WivrnServer.pairingEnabled + onTriggered: WivrnServer.enable_pairing() + }, + Kirigami.Action { + text: i18n("Disable pairing") + visible: WivrnServer.pairingEnabled + onTriggered: WivrnServer.disable_pairing() + } + ] + } + TroubleshootCard { + title: i18n("I have no sound on my headset") + details: i18n("When the headset is connected, select \"WiVRn\" as the default audio output device for applications to use it.") + } + } + + 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("Report an issue") + icon.source: Qt.resolvedUrl("Github.svg") + onTriggered: Qt.openUrlExternally("https://github.com/WiVRn/WiVRn/issues") + }, + Kirigami.Action { + text: i18n("Ask on Discord") + icon.source: Qt.resolvedUrl("Discord.svg") + onTriggered: Qt.openUrlExternally("https://discord.gg/EHAYe3tTYa") + } + ] + + Shortcut { + sequences: [StandardKey.Cancel] + onActivated: applicationWindow().pageStack.pop() + } +}