From bb97f1f17ee63ddd483d63c7e054f3f659134f73 Mon Sep 17 00:00:00 2001 From: Street Pea Date: Fri, 6 Sep 2024 20:22:13 -0700 Subject: [PATCH] Change state to unknown + skip invisible manual hosts in host view --- gui/src/qml/MainView.qml | 23 ++++++++++++++++++----- gui/src/qmlbackend.cpp | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gui/src/qml/MainView.qml b/gui/src/qml/MainView.qml index 8be363ea..4828df82 100644 --- a/gui/src/qml/MainView.qml +++ b/gui/src/qml/MainView.qml @@ -9,8 +9,16 @@ Pane { padding: 0 StackView.onActivated: forceActiveFocus() - Keys.onUpPressed: hostsView.decrementCurrentIndex() - Keys.onDownPressed: hostsView.incrementCurrentIndex() + Keys.onUpPressed: { + hostsView.decrementCurrentIndex() + while(hostsView.currentItem && !hostsView.currentItem.visible) + hostsView.decrementCurrentIndex() + } + Keys.onDownPressed: { + hostsView.incrementCurrentIndex() + while(hostsView.currentItem && !hostsView.currentItem.visible) + hostsView.incrementCurrentIndex() + } Keys.onMenuPressed: settingsButton.clicked() Keys.onReturnPressed: if (hostsView.currentItem) hostsView.currentItem.connectToHost() Keys.onYesPressed: if (hostsView.currentItem) hostsView.currentItem.wakeUpHost() @@ -112,6 +120,7 @@ Pane { ListView { id: hostsView + keyNavigationWraps: true anchors { top: toolBar.bottom left: parent.left @@ -122,9 +131,10 @@ Pane { clip: true model: Chiaki.hosts delegate: ItemDelegate { + visible: modelData.display id: delegate width: parent ? parent.width : 0 - height: 180 + height: modelData.display ? 180 : 0 highlighted: ListView.isCurrentItem onClicked: connectToHost() @@ -146,7 +156,6 @@ Pane { } RowLayout { - visible: modelData.display anchors { fill: parent leftMargin: 30 @@ -179,6 +188,7 @@ Pane { t += "\n" + qsTr("Remote Connection via PSN"); } else + { t += "\n"; if(modelData.discovered) { @@ -189,6 +199,7 @@ Pane { } else t += qsTr("manual"); + } return t; } } @@ -197,9 +208,11 @@ Pane { Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter text: { let t = ""; - if (!modelData.discovered) + if(modelData.duid) return t; t += qsTr("State: %1").arg(modelData.state); + if(!modelData.discovered) + return t; if (modelData.app) t += "\n" + qsTr("App: %1").arg(modelData.app); if (modelData.titleId) diff --git a/gui/src/qmlbackend.cpp b/gui/src/qmlbackend.cpp index db411dc7..71db5c41 100644 --- a/gui/src/qmlbackend.cpp +++ b/gui/src/qmlbackend.cpp @@ -462,6 +462,7 @@ QVariantList QmlBackend::hosts() const m["name"] = host.GetHost(); m["duid"] = ""; m["address"] = host.GetHost(); + m["state"] = "unknown"; m["registered"] = false; m["display"] = discovered_manual_hosts.contains(host) ? false : true; if (host.GetRegistered() && settings->GetRegisteredHostRegistered(host.GetMAC())) {