@@ -16,51 +16,98 @@ Page {
16
16
id: navbar
17
17
}
18
18
19
- Text {
19
+ CoreText {
20
20
anchors .top : parent .top
21
21
anchors .horizontalCenter : parent .horizontalCenter
22
22
id: description
23
- height: 75
24
23
width: Math .min (parent .width - 40 , 450 )
25
- wrapMode: Text .WordWrap
26
24
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"
29
25
font .pixelSize : 13
30
26
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
+ }
32
79
}
33
80
34
81
ListView {
35
82
id: listView
36
83
clip: true
37
84
width: Math .min (parent .width - 40 , 450 )
38
- anchors .top : description .bottom
85
+ anchors .top : sortSelection .bottom
86
+ anchors .topMargin : 30
39
87
anchors .bottom : parent .bottom
40
88
anchors .horizontalCenter : parent .horizontalCenter
41
89
model: peerListModelProxy
42
90
spacing: 15
43
91
44
92
footer: Loader {
45
- anchors .centerIn : parent
46
93
height: 75
47
94
active: nodeModel .numOutboundPeers < nodeModel .maxNumOutboundPeers
95
+ width: listView .width
48
96
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
+ }
64
111
}
65
112
}
66
113
}
@@ -70,47 +117,90 @@ Page {
70
117
required property string address;
71
118
required property string subversion;
72
119
required property string direction;
73
- implicitHeight: 65
120
+ required property string connectionType;
121
+ required property string network;
122
+ implicitHeight: 60
74
123
implicitWidth: listView .width
75
124
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
+
76
178
ColumnLayout {
77
179
anchors .left : parent .left
78
- Label {
180
+ CoreText {
79
181
Layout .alignment : Qt .AlignLeft
80
182
id: primary
81
- text: " #" + nodeId
82
- font .family : " Inter"
83
- font .styleName : " Regular"
84
183
font .pixelSize : 18
85
184
color: Theme .color .neutral9
86
185
}
87
- Label {
186
+ CoreText {
88
187
Layout .alignment : Qt .AlignLeft
89
188
id: tertiary
90
- text: address
91
- font .family : " Inter"
92
- font .styleName : " Regular"
93
189
font .pixelSize : 15
94
190
color: Theme .color .neutral7
95
191
}
96
192
}
97
193
ColumnLayout {
98
194
anchors .right : parent .right
99
- Label {
195
+ CoreText {
100
196
Layout .alignment : Qt .AlignRight
101
- id: secondary
102
- text: direction
103
- font .family : " Inter"
104
- font .styleName : " Regular"
197
+ id: secondary
105
198
font .pixelSize : 18
106
199
color: Theme .color .neutral9
107
200
}
108
- Label {
201
+ CoreText {
109
202
Layout .alignment : Qt .AlignRight
110
203
id: quaternary
111
- text: subversion
112
- font .family : " Inter"
113
- font .styleName : " Regular"
114
204
font .pixelSize : 15
115
205
color: Theme .color .neutral7
116
206
}
0 commit comments