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,88 @@ 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+ onClicked: {
43+ peerListModelProxy .sortBy = " nodeId"
44+ }
45+ }
46+ ToggleButton {
47+ text: qsTr (" Direction" )
48+ autoExclusive: true
49+ onClicked: {
50+ peerListModelProxy .sortBy = " direction"
51+ }
52+ }
53+ ToggleButton {
54+ text: qsTr (" User Agent" )
55+ autoExclusive: true
56+ onClicked: {
57+ peerListModelProxy .sortBy = " subversion"
58+ }
59+ }
60+ ToggleButton {
61+ text: qsTr (" Type" )
62+ autoExclusive: true
63+ onClicked: {
64+ peerListModelProxy .sortBy = " connectionType"
65+ }
66+ }
67+ ToggleButton {
68+ text: qsTr (" Ip" )
69+ autoExclusive: true
70+ onClicked: {
71+ peerListModelProxy .sortBy = " address"
72+ }
73+ }
74+ ToggleButton {
75+ text: qsTr (" Network" )
76+ autoExclusive: true
77+ onClicked: {
78+ peerListModelProxy .sortBy = " network"
79+ }
80+ }
81+ }
82+
3483 ListView {
3584 id: listView
3685 clip: true
3786 width: Math .min (parent .width - 40 , 450 )
38- anchors .top : description .bottom
87+ anchors .top : sortSelection .bottom
88+ anchors .topMargin : 35
3989 anchors .bottom : parent .bottom
4090 anchors .horizontalCenter : parent .horizontalCenter
4191 model: peerListModelProxy
4292 spacing: 15
4393
4494 footer: Loader {
45- anchors .centerIn : parent
4695 height: 75
4796 active: nodeModel .numOutboundPeers < nodeModel .maxNumOutboundPeers
97+ width: listView .width
4898 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
99+ sourceComponent: Item {
100+ RowLayout {
101+ anchors .centerIn : parent
102+ spacing: 20
103+ PeersIndicator {
104+ numOutboundPeers: nodeModel .numOutboundPeers
105+ maxNumOutboundPeers: nodeModel .maxNumOutboundPeers
106+ }
107+ Text {
108+ text: qsTr (" Looking for %1 more peer(s)" ).arg (
109+ nodeModel .maxNumOutboundPeers - nodeModel .numOutboundPeers )
110+ font .family : " Inter"
111+ font .styleName : " Regular"
112+ font .pixelSize : 15
113+ color: Theme .color .neutral7
114+ }
64115 }
65116 }
66117 }
@@ -70,15 +121,69 @@ Page {
70121 required property string address;
71122 required property string subversion;
72123 required property string direction;
124+ required property string connectionType;
125+ required property string network;
73126 implicitHeight: 65
74127 implicitWidth: listView .width
75128
129+ Connections {
130+ target: peerListModelProxy
131+ function onSortByChanged (roleName ) {
132+ setTextByRole (roleName)
133+ }
134+ function onDataChanged (startIndex , endIndex ) {
135+ setTextByRole (peerListModelProxy .sortBy )
136+ }
137+ }
138+
139+ Component .onCompleted : {
140+ setTextByRole (peerListModelProxy .sortBy )
141+ }
142+
143+ function setTextByRole (roleName ) {
144+ if (roleName == " nodeId" ) {
145+ primary .text = " #" + nodeId
146+ secondary .text = direction
147+ tertiary .text = address
148+ quaternary .text = subversion
149+ } else if (roleName == " direction" ) {
150+ primary .text = direction
151+ secondary .text = " #" + nodeId
152+ tertiary .text = address
153+ quaternary .text = subversion
154+ } else if (roleName == " subversion" ) {
155+ primary .text = subversion
156+ secondary .text = " #" + nodeId
157+ tertiary .text = address
158+ quaternary .text = direction
159+ } else if (roleName == " address" ) {
160+ primary .text = address
161+ secondary .text = direction
162+ tertiary .text = " #" + nodeId
163+ quaternary .text = subversion
164+ } else if (roleName == " connectionType" ) {
165+ primary .text = connectionType
166+ secondary .text = direction
167+ tertiary .text = address
168+ quaternary .text = subversion
169+ } else if (roleName == " network" ) {
170+ primary .text = network
171+ secondary .text = direction
172+ tertiary .text = address
173+ quaternary .text = subversion
174+ } else {
175+ primary .text = " #" + nodeId
176+ secondary .text = direction
177+ tertiary .text = address
178+ quaternary .text = subversion
179+ }
180+ }
181+
76182 ColumnLayout {
77183 anchors .left : parent .left
78184 Label {
79185 Layout .alignment : Qt .AlignLeft
80186 id: primary
81- text: " #" + nodeId
82187 font .family : " Inter"
83188 font .styleName : " Regular"
84189 font .pixelSize : 18
@@ -87,7 +192,6 @@ Page {
87192 Label {
88193 Layout .alignment : Qt .AlignLeft
89194 id: tertiary
90- text: address
91195 font .family : " Inter"
92196 font .styleName : " Regular"
93197 font .pixelSize : 15
@@ -98,8 +202,7 @@ Page {
98202 anchors .right : parent .right
99203 Label {
100204 Layout .alignment : Qt .AlignRight
101- id: secondary
102- text: direction
205+ id: secondary
103206 font .family : " Inter"
104207 font .styleName : " Regular"
105208 font .pixelSize : 18
@@ -108,7 +211,6 @@ Page {
108211 Label {
109212 Layout .alignment : Qt .AlignRight
110213 id: quaternary
111- text: subversion
112214 font .family : " Inter"
113215 font .styleName : " Regular"
114216 font .pixelSize : 15
0 commit comments