Skip to content

Commit

Permalink
Change state to unknown + skip invisible manual hosts in host view
Browse files Browse the repository at this point in the history
  • Loading branch information
streetpea committed Sep 7, 2024
1 parent 4967466 commit bb97f1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
23 changes: 18 additions & 5 deletions gui/src/qml/MainView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -112,6 +120,7 @@ Pane {

ListView {
id: hostsView
keyNavigationWraps: true
anchors {
top: toolBar.bottom
left: parent.left
Expand All @@ -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()

Expand All @@ -146,7 +156,6 @@ Pane {
}

RowLayout {
visible: modelData.display
anchors {
fill: parent
leftMargin: 30
Expand Down Expand Up @@ -179,6 +188,7 @@ Pane {
t += "\n" + qsTr("Remote Connection via PSN");
}
else
{
t += "\n";
if(modelData.discovered)
{
Expand All @@ -189,6 +199,7 @@ Pane {
}
else
t += qsTr("manual");
}
return t;
}
}
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions gui/src/qmlbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down

0 comments on commit bb97f1f

Please sign in to comment.