@@ -16,51 +16,98 @@ Page {
1616 id: navbar
1717 }
1818
19- Text {
19+ CoreText {
2020 anchors .top : parent .top
2121 anchors .horizontalCenter : parent .horizontalCenter
2222 id: description
23- height: 75
2423 width: Math .min (parent .width - 40 , 450 )
25- wrapMode: Text .WordWrap
2624 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." )
27- font .family : " Inter"
28- font .styleName : " Regular"
2925 font .pixelSize : 13
3026 color: Theme .color .neutral7
31- horizontalAlignment: Text .AlignHCenter
27+ }
28+
29+ Flow {
30+ id: sortSelection
31+ anchors .top : description .bottom
32+ anchors .topMargin : 20
33+ anchors .horizontalCenter : parent .horizontalCenter
34+ width: Math .min (parent .width - 40 , 450 )
35+ spacing: 10
36+ ToggleButton {
37+ text: qsTr (" ID" )
38+ autoExclusive: true
39+ checked: true
40+ onClicked: {
41+ peerListModelProxy .sortBy = " nodeId"
42+ }
43+ }
44+ ToggleButton {
45+ text: qsTr (" Direction" )
46+ autoExclusive: true
47+ onClicked: {
48+ peerListModelProxy .sortBy = " direction"
49+ }
50+ }
51+ ToggleButton {
52+ text: qsTr (" User Agent" )
53+ autoExclusive: true
54+ onClicked: {
55+ peerListModelProxy .sortBy = " subversion"
56+ }
57+ }
58+ ToggleButton {
59+ text: qsTr (" Type" )
60+ autoExclusive: true
61+ onClicked: {
62+ peerListModelProxy .sortBy = " connectionType"
63+ }
64+ }
65+ ToggleButton {
66+ text: qsTr (" Ip" )
67+ autoExclusive: true
68+ onClicked: {
69+ peerListModelProxy .sortBy = " address"
70+ }
71+ }
72+ ToggleButton {
73+ text: qsTr (" Network" )
74+ autoExclusive: true
75+ onClicked: {
76+ peerListModelProxy .sortBy = " network"
77+ }
78+ }
3279 }
3380
3481 ListView {
3582 id: listView
3683 clip: true
3784 width: Math .min (parent .width - 40 , 450 )
38- anchors .top : description .bottom
85+ anchors .top : sortSelection .bottom
86+ anchors .topMargin : 30
3987 anchors .bottom : parent .bottom
4088 anchors .horizontalCenter : parent .horizontalCenter
4189 model: peerListModelProxy
4290 spacing: 15
4391
4492 footer: Loader {
45- anchors .centerIn : parent
4693 height: 75
4794 active: nodeModel .numOutboundPeers < nodeModel .maxNumOutboundPeers
95+ width: listView .width
4896 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
97+ sourceComponent: Item {
98+ RowLayout {
99+ anchors .centerIn : parent
100+ spacing: 20
101+ PeersIndicator {
102+ numOutboundPeers: nodeModel .numOutboundPeers
103+ maxNumOutboundPeers: nodeModel .maxNumOutboundPeers
104+ }
105+ CoreText {
106+ text: qsTr (" Looking for %1 more peer(s)" ).arg (
107+ nodeModel .maxNumOutboundPeers - nodeModel .numOutboundPeers )
108+ font .pixelSize : 15
109+ color: Theme .color .neutral7
110+ }
64111 }
65112 }
66113 }
@@ -70,47 +117,90 @@ Page {
70117 required property string address;
71118 required property string subversion;
72119 required property string direction;
73- implicitHeight: 65
120+ required property string connectionType;
121+ required property string network;
122+ implicitHeight: 60
74123 implicitWidth: listView .width
75124
125+ Connections {
126+ target: peerListModelProxy
127+ function onSortByChanged (roleName ) {
128+ setTextByRole (roleName)
129+ }
130+ function onDataChanged (startIndex , endIndex ) {
131+ setTextByRole (peerListModelProxy .sortBy )
132+ }
133+ }
134+
135+ Component .onCompleted : {
136+ setTextByRole (peerListModelProxy .sortBy )
137+ }
138+
139+ function setTextByRole (roleName ) {
140+ if (roleName == " nodeId" ) {
141+ primary .text = " #" + nodeId
142+ secondary .text = direction
143+ tertiary .text = address
144+ quaternary .text = subversion
145+ } else if (roleName == " direction" ) {
146+ primary .text = direction
147+ secondary .text = " #" + nodeId
148+ tertiary .text = address
149+ quaternary .text = subversion
150+ } else if (roleName == " subversion" ) {
151+ primary .text = subversion
152+ secondary .text = " #" + nodeId
153+ tertiary .text = address
154+ quaternary .text = direction
155+ } else if (roleName == " address" ) {
156+ primary .text = address
157+ secondary .text = direction
158+ tertiary .text = " #" + nodeId
159+ quaternary .text = subversion
160+ } else if (roleName == " connectionType" ) {
161+ primary .text = connectionType
162+ secondary .text = direction
163+ tertiary .text = address
164+ quaternary .text = subversion
165+ } else if (roleName == " network" ) {
166+ primary .text = network
167+ secondary .text = direction
168+ tertiary .text = address
169+ quaternary .text = subversion
170+ } else {
171+ primary .text = " #" + nodeId
172+ secondary .text = direction
173+ tertiary .text = address
174+ quaternary .text = subversion
175+ }
176+ }
177+
76178 ColumnLayout {
77179 anchors .left : parent .left
78- Label {
180+ CoreText {
79181 Layout .alignment : Qt .AlignLeft
80182 id: primary
81- text: " #" + nodeId
82- font .family : " Inter"
83- font .styleName : " Regular"
84183 font .pixelSize : 18
85184 color: Theme .color .neutral9
86185 }
87- Label {
186+ CoreText {
88187 Layout .alignment : Qt .AlignLeft
89188 id: tertiary
90- text: address
91- font .family : " Inter"
92- font .styleName : " Regular"
93189 font .pixelSize : 15
94190 color: Theme .color .neutral7
95191 }
96192 }
97193 ColumnLayout {
98194 anchors .right : parent .right
99- Label {
195+ CoreText {
100196 Layout .alignment : Qt .AlignRight
101- id: secondary
102- text: direction
103- font .family : " Inter"
104- font .styleName : " Regular"
197+ id: secondary
105198 font .pixelSize : 18
106199 color: Theme .color .neutral9
107200 }
108- Label {
201+ CoreText {
109202 Layout .alignment : Qt .AlignRight
110203 id: quaternary
111- text: subversion
112- font .family : " Inter"
113- font .styleName : " Regular"
114204 font .pixelSize : 15
115205 color: Theme .color .neutral7
116206 }
0 commit comments