diff --git a/src/app/node/core.nim b/src/app/node/core.nim index a7707aec20..a40e8be05e 100644 --- a/src/app/node/core.nim +++ b/src/app/node/core.nim @@ -30,7 +30,9 @@ proc init*(self: NodeController) = self.view.setLastMessage($WalletSignal(e).blockNumber) self.status.events.on(SignalType.DiscoverySummary.event) do(e:Args): - self.status.network.peerSummaryChange(DiscoverySummarySignal(e).enodes) + var data = DiscoverySummarySignal(e) + self.status.network.peerSummaryChange(data.enodes) + self.view.setPeerSize(data.enodes.len) self.status.events.on(SignalType.Stats.event) do (e:Args): self.view.setStats(StatsSignal(e).stats) diff --git a/src/app/node/view.nim b/src/app/node/view.nim index 195f4487e8..55bf904ee8 100644 --- a/src/app/node/view.nim +++ b/src/app/node/view.nim @@ -13,6 +13,7 @@ QtObject: wakuBloomFilterMode*: bool fullNode*: bool stats*: Stats + peerSize: int proc setup(self: NodeView) = self.QObject.setup @@ -142,4 +143,19 @@ QtObject: QtProperty[string] downloadRate: read = downloadRate - notify = statsChanged \ No newline at end of file + notify = statsChanged + + proc getPeerSize*(self: NodeView): int {.slot.} = self.peerSize + + proc peerSizeChanged*(self: NodeView, value: int) {.signal.} + + proc setPeerSize*(self: NodeView, value: int) {.slot.} = + self.peerSize = value + self.peerSizeChanged(value) + + proc resetPeers*(self: NodeView) {.slot.} = + self.setPeerSize(0) + + QtProperty[int] peerSize: + read = getPeerSize + notify = peerSizeChanged diff --git a/ui/app/AppLayouts/Node/NodeLayout.qml b/ui/app/AppLayouts/Node/NodeLayout.qml index 6236a3e42d..beb89058cf 100644 --- a/ui/app/AppLayouts/Node/NodeLayout.qml +++ b/ui/app/AppLayouts/Node/NodeLayout.qml @@ -20,6 +20,31 @@ Item { } + RowLayout { + id: peerContainer2 + Layout.fillWidth: true + StyledText { + id: peerDescription + color: Style.current.lightBlueText + text: "Peers" + Layout.rightMargin: Style.current.padding + Layout.leftMargin: Style.current.padding + Layout.fillWidth: true + font.weight: Font.Medium + font.pixelSize: 20 + } + StyledText { + id: peerNumber + color: Style.current.lightBlueText + text: nodeModel.peerSize + Layout.rightMargin: Style.current.padding + Layout.leftMargin: Style.current.padding + Layout.fillWidth: true + font.weight: Font.Medium + font.pixelSize: 20 + } + } + ColumnLayout { id: messageContainer Layout.fillHeight: true