Skip to content

Commit

Permalink
Merge bitcoin-core#371: Remember user's peer sort preference
Browse files Browse the repository at this point in the history
9cd558e qml: remember user's peer sort preference (jarolrod)

Pull request description:

  This sets the sort preference for the peers table in qsettings so that
  it can be remembered. Also addresses an issue where the `id` toggle button is always checked when you go back to the table even though the table is not sorted by `id`.

  [![Build Artifacts](https://img.shields.io/badge/Build%20Artifacts-green
  )](https://github.com/bitcoin-core/gui-qml/actions/runs/6819663186)

ACKs for top commit:
  pablomartin4btc:
    tACK 9cd558e

Tree-SHA512: 18f6a42969f1d5099dcfdbb14bfd366e90977a5aa7c730ab516dc0e4d67687159f6e6daa356a2f2a8111a856932624a772c1f076353ef69c5c707708a9c9df58
  • Loading branch information
hebasto committed Nov 27, 2023
2 parents 2f08efc + 9cd558e commit bc6f872
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/qml/pages/node/Peers.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Qt.labs.settings 1.0
import org.bitcoincore.qt 1.0
import "../../controls"
import "../../components"
Expand All @@ -28,6 +29,15 @@ Page {
}
}

Settings {
id: settings
property string peerListSortBy: "nodeId"
}

Component.onCompleted: {
peerListModelProxy.sortBy = settings.peerListSortBy
}

ListView {
id: listView
clip: true
Expand Down Expand Up @@ -64,44 +74,55 @@ Page {
ToggleButton {
text: qsTr("ID")
autoExclusive: true
checked: true
checked: settings.peerListSortBy === "nodeId"
onClicked: {
peerListModelProxy.sortBy = "nodeId"
settings.peerListSortBy = "nodeId"
}
}
ToggleButton {
text: qsTr("Direction")
autoExclusive: true
checked: settings.peerListSortBy === "direction"
onClicked: {
peerListModelProxy.sortBy = "direction"
settings.peerListSortBy = "direction"
}
}
ToggleButton {
text: qsTr("User Agent")
autoExclusive: true
checked: settings.peerListSortBy === "subversion"
onClicked: {
peerListModelProxy.sortBy = "subversion"
settings.peerListSortBy = "subversion"
}
}
ToggleButton {
text: qsTr("Type")
autoExclusive: true
checked: settings.peerListSortBy === "connectionType"
onClicked: {
peerListModelProxy.sortBy = "connectionType"
settings.peerListSortBy = "connectionType"
}
}
ToggleButton {
text: qsTr("Ip")
autoExclusive: true
checked: settings.peerListSortBy === "address"
onClicked: {
peerListModelProxy.sortBy = "address"
settings.peerListSortBy = "address"
}
}
ToggleButton {
text: qsTr("Network")
autoExclusive: true
checked: settings.peerListSortBy === "network"
onClicked: {
peerListModelProxy.sortBy = "network"
settings.peerListSortBy = "network"
}
}
}
Expand Down

0 comments on commit bc6f872

Please sign in to comment.