2020 anchors .top : parent .top
2121 anchors .horizontalCenter : parent .horizontalCenter
2222 id: description
23- height: 75
2423 width: Math .min (parent .width - 40 , 450 )
2524 wrapMode: Text .WordWrap
2625 text: qsTr (" Peers are nodes you are connected to. You want to ensure that you are connected to x, y and z, but not a, b, and c. Learn more." )
@@ -31,36 +30,89 @@ Page {
3130 horizontalAlignment: Text .AlignHCenter
3231 }
3332
33+ RowLayout {
34+ id: sortSelection
35+ anchors .top : description .bottom
36+ anchors .topMargin : 20
37+ anchors .horizontalCenter : parent .horizontalCenter
38+ spacing: 10
39+ ToggleButton {
40+ text: qsTr (" ID" )
41+ autoExclusive: true
42+ checked: true
43+ onClicked: {
44+ peerListModelProxy .sortBy = " nodeId"
45+ }
46+ }
47+ ToggleButton {
48+ text: qsTr (" Direction" )
49+ autoExclusive: true
50+ onClicked: {
51+ peerListModelProxy .sortBy = " direction"
52+ }
53+ }
54+ ToggleButton {
55+ text: qsTr (" User Agent" )
56+ autoExclusive: true
57+ onClicked: {
58+ peerListModelProxy .sortBy = " subversion"
59+ }
60+ }
61+ ToggleButton {
62+ text: qsTr (" Type" )
63+ autoExclusive: true
64+ onClicked: {
65+ peerListModelProxy .sortBy = " connectionType"
66+ }
67+ }
68+ ToggleButton {
69+ text: qsTr (" Ip" )
70+ autoExclusive: true
71+ onClicked: {
72+ peerListModelProxy .sortBy = " address"
73+ }
74+ }
75+ ToggleButton {
76+ text: qsTr (" Network" )
77+ autoExclusive: true
78+ onClicked: {
79+ peerListModelProxy .sortBy = " network"
80+ }
81+ }
82+ }
83+
3484 ListView {
3585 id: listView
3686 clip: true
3787 width: Math .min (parent .width - 40 , 450 )
38- anchors .top : description .bottom
88+ anchors .top : sortSelection .bottom
89+ anchors .topMargin : 30
3990 anchors .bottom : parent .bottom
4091 anchors .horizontalCenter : parent .horizontalCenter
4192 model: peerListModelProxy
4293 spacing: 15
4394
4495 footer: Loader {
45- anchors .centerIn : parent
4696 height: 75
4797 active: nodeModel .numOutboundPeers < nodeModel .maxNumOutboundPeers
98+ width: listView .width
4899 visible: active
49- sourceComponent: RowLayout {
50- spacing: 20
51- PeersIndicator {
52- Layout .alignment : Qt .AlignHCenter
53- numOutboundPeers: nodeModel .numOutboundPeers
54- maxNumOutboundPeers: nodeModel .maxNumOutboundPeers
55- }
56- Text {
57- Layout .alignment : Qt .AlignHCenter
58- text: qsTr (" Looking for %1 more peer(s)" ).arg (
59- nodeModel .maxNumOutboundPeers - nodeModel .numOutboundPeers )
60- font .family : " Inter"
61- font .styleName : " Regular"
62- font .pixelSize : 15
63- color: Theme .color .neutral7
100+ sourceComponent: Item {
101+ RowLayout {
102+ anchors .centerIn : parent
103+ spacing: 20
104+ PeersIndicator {
105+ numOutboundPeers: nodeModel .numOutboundPeers
106+ maxNumOutboundPeers: nodeModel .maxNumOutboundPeers
107+ }
108+ Text {
109+ text: qsTr (" Looking for %1 more peer(s)" ).arg (
110+ nodeModel .maxNumOutboundPeers - nodeModel .numOutboundPeers )
111+ font .family : " Inter"
112+ font .styleName : " Regular"
113+ font .pixelSize : 15
114+ color: Theme .color .neutral7
115+ }
64116 }
65117 }
66118 }
@@ -70,15 +122,69 @@ Page {
70122 required property string address;
71123 required property string subversion;
72124 required property string direction;
73- implicitHeight: 65
125+ required property string connectionType;
126+ required property string network;
127+ implicitHeight: 60
74128 implicitWidth: listView .width
75129
130+ Connections {
131+ target: peerListModelProxy
132+ function onSortByChanged (roleName ) {
133+ setTextByRole (roleName)
134+ }
135+ function onDataChanged (startIndex , endIndex ) {
136+ setTextByRole (peerListModelProxy .sortBy )
137+ }
138+ }
139+
140+ Component .onCompleted : {
141+ setTextByRole (peerListModelProxy .sortBy )
142+ }
143+
144+ function setTextByRole (roleName ) {
145+ if (roleName == " nodeId" ) {
146+ primary .text = " #" + nodeId
147+ secondary .text = direction
148+ tertiary .text = address
149+ quaternary .text = subversion
150+ } else if (roleName == " direction" ) {
151+ primary .text = direction
152+ secondary .text = " #" + nodeId
153+ tertiary .text = address
154+ quaternary .text = subversion
155+ } else if (roleName == " subversion" ) {
156+ primary .text = subversion
157+ secondary .text = " #" + nodeId
158+ tertiary .text = address
159+ quaternary .text = direction
160+ } else if (roleName == " address" ) {
161+ primary .text = address
162+ secondary .text = direction
163+ tertiary .text = " #" + nodeId
164+ quaternary .text = subversion
165+ } else if (roleName == " connectionType" ) {
166+ primary .text = connectionType
167+ secondary .text = direction
168+ tertiary .text = address
169+ quaternary .text = subversion
170+ } else if (roleName == " network" ) {
171+ primary .text = network
172+ secondary .text = direction
173+ tertiary .text = address
174+ quaternary .text = subversion
175+ } else {
176+ primary .text = " #" + nodeId
177+ secondary .text = direction
178+ tertiary .text = address
179+ quaternary .text = subversion
180+ }
181+ }
182+
76183 ColumnLayout {
77184 anchors .left : parent .left
78185 Label {
79186 Layout .alignment : Qt .AlignLeft
80187 id: primary
81- text: " #" + nodeId
82188 font .family : " Inter"
83189 font .styleName : " Regular"
84190 font .pixelSize : 18
@@ -87,7 +193,6 @@ Page {
87193 Label {
88194 Layout .alignment : Qt .AlignLeft
89195 id: tertiary
90- text: address
91196 font .family : " Inter"
92197 font .styleName : " Regular"
93198 font .pixelSize : 15
@@ -98,8 +203,7 @@ Page {
98203 anchors .right : parent .right
99204 Label {
100205 Layout .alignment : Qt .AlignRight
101- id: secondary
102- text: direction
206+ id: secondary
103207 font .family : " Inter"
104208 font .styleName : " Regular"
105209 font .pixelSize : 18
@@ -108,7 +212,6 @@ Page {
108212 Label {
109213 Layout .alignment : Qt .AlignRight
110214 id: quaternary
111- text: subversion
112215 font .family : " Inter"
113216 font .styleName : " Regular"
114217 font .pixelSize : 15
0 commit comments