Files
pay/guis/mobile/NetView.qml
T

101 lines
3.5 KiB
QML
Raw Permalink Normal View History

2022-11-15 12:08:30 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2020-2022 Tom Zander <tom@flowee.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2022-11-26 10:44:52 +01:00
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
2022-11-15 12:08:30 +01:00
import "../Flowee" as Flowee
Page {
headerText: qsTr("Peers")
ListView {
id: listView
model: net.peers
2022-12-05 20:31:00 +01:00
anchors.fill: parent
2022-11-15 12:08:30 +01:00
QQC2.ScrollBar.vertical: QQC2.ScrollBar { }
focus: true
Keys.onPressed: (event)=> {
if (event.key === Qt.Key_Escape) {
2023-02-09 18:21:57 +01:00
thePile.pop();
2022-11-15 12:08:30 +01:00
event.accepted = true
}
}
delegate: Rectangle {
width: listView.width
height: peerPane.height + 12
2023-02-21 16:40:46 +01:00
color: index % 2 === 0 ? palette.button : palette.base
2022-12-19 16:14:12 +01:00
opacity: modelData.headersReceived ? 1 : 0.5
2022-11-15 12:08:30 +01:00
ColumnLayout {
id: peerPane
width: listView.width - 20
x: 10
y: 6
Flowee.Label {
2022-11-15 12:08:30 +01:00
text: modelData.userAgent
}
Flowee.Label {
2022-11-15 12:08:30 +01:00
text: qsTr("Address", "network address (IP)") + ": " + modelData.address
}
RowLayout {
height: secondRow.height
Flowee.Label {
2022-11-15 12:08:30 +01:00
id: secondRow
text: qsTr("Start-height: %1").arg(modelData.startHeight)
}
Flowee.Label {
2022-11-15 12:08:30 +01:00
text: qsTr("ban-score: %1").arg(modelData.banScore)
}
}
Flowee.Label {
2022-11-15 12:08:30 +01:00
id : accountStatus
font.bold: true
text: {
var id = modelData.segmentId;
if (id === 0) {
// not peered yet.
if (modelData.services.Length === 0)
return qsTr("initializing connection")
if (!modelData.headersReceived)
return qsTr("Verifying peer")
return ""
}
var accounts = portfolio.accounts;
for (var i = 0; i < accounts.length; ++i) {
if (accounts[i].id === id)
return qsTr("Peer for wallet: %1").arg(accounts[i].name);
}
return qsTr("Peer for wallet");
}
visible: text !== ""
}
Flow {
Repeater {
model: modelData.services
delegate: Flowee.Label { text: modelData }
2022-11-15 12:08:30 +01:00
}
}
}
}
Keys.forwardTo: Flowee.ListViewKeyHandler {
target: listView
}
}
}