Files
pay/desktop/NetView.qml
T

85 lines
2.8 KiB
QML
Raw Permalink Normal View History

2020-05-24 13:20:03 +02:00
/*
* This file is part of the Flowee project
2021-02-04 18:54:05 +01:00
* Copyright (C) 2020-2021 Tom Zander <tom@flowee.org>
2020-05-24 13:20:03 +02:00
*
* 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/>.
*/
import QtQuick 2.14
2020-10-14 18:29:10 +02:00
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import QtQuick.Window 2.15
2020-05-24 13:20:03 +02:00
2020-10-14 18:29:10 +02:00
ApplicationWindow {
2020-05-24 13:20:03 +02:00
id: netView
2020-10-14 18:29:10 +02:00
visible: false
minimumWidth: 300
minimumHeight: 400
width: 500
height: 400
2021-01-29 10:27:24 +01:00
title: qsTr("Peers (%1)", "", net.peers.length).arg(net.peers.length)
2020-10-14 18:29:10 +02:00
modality: Qt.NonModal
flags: Qt.Dialog
2020-05-24 13:20:03 +02:00
2020-10-14 18:29:10 +02:00
ListView {
id: peerList
model: net.peers
2020-05-24 13:20:03 +02:00
anchors.fill: parent
2020-10-14 18:29:10 +02:00
delegate: Rectangle {
width: peerList.width
height: peerPane.height + 12
color: index % 2 === 0 ? netView.palette.button : netView.palette.alternateBase
ColumnLayout {
id: peerPane
2021-02-04 18:54:05 +01:00
width: peerList.width - 20
x: 10
2020-10-14 18:29:10 +02:00
y: 6
2020-05-24 13:20:03 +02:00
2020-10-14 18:29:10 +02:00
Label {
id: mainLabel
text: modelData.userAgent
}
2021-02-04 18:54:05 +01:00
Label {
text: qsTr("Address:", "network address (IP)") + " " + modelData.address
}
2020-10-14 18:29:10 +02:00
RowLayout {
id: rowLayout
height: secondRow.height
Label {
id: secondRow
text: qsTr("Start-height: %1").arg(modelData.startHeight)
2020-05-24 13:20:03 +02:00
}
2020-10-14 18:29:10 +02:00
Label {
text: qsTr("ban-score: %1").arg(modelData.banScore)
2020-05-24 13:20:03 +02:00
}
}
Label {
id : accountName
2021-02-04 18:54:05 +01:00
font.bold: true
text: {
var id = modelData.segmentId;
var accounts = portfolio.accounts;
for (var i = 0; i < accounts.length; ++i) {
if (accounts[i].id === id)
return qsTr("Peer for account: %1").arg(accounts[i].name);
}
2021-02-04 18:54:05 +01:00
return ""; // not peered yet
}
visible: text !== ""
}
2020-05-24 13:20:03 +02:00
}
}
}
}