Files

128 lines
3.7 KiB
QML
Raw Permalink Normal View History

2024-01-06 21:33:28 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2024 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/>.
*/
import QtQuick
import QtQuick.Layouts
2025-06-18 17:48:29 +02:00
import QtQuick.Controls.Basic as QQC2
2024-01-06 21:33:28 +01:00
import "../Flowee" as Flowee
2024-01-26 13:37:08 +01:00
QQC2.ApplicationWindow {
2024-01-06 21:33:28 +01:00
id: root
visible: false
minimumWidth: 200
minimumHeight: 200
width: 400
height: 300
title: qsTr("IP Addresses");
modality: Qt.NonModal
flags: Qt.Dialog
property QtObject stats: net.createStats(root);
2024-05-28 23:23:31 +02:00
background: Rectangle {
color: palette.window
}
2024-01-06 21:33:28 +01:00
GridLayout {
columns: 2
rowSpacing: 10
columnSpacing: 6
width: parent.width - 20
x: 10
y: 10
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: qsTr("Total found") + ":"
Layout.alignment: Qt.AlignRight
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: root.stats.count;
Layout.fillWidth: true
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: qsTr("Tried") + ":"
Layout.alignment: Qt.AlignRight
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
text: root.stats.tried;
2024-01-06 21:33:28 +01:00
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: qsTr("Punished count") + ":"
Layout.alignment: Qt.AlignRight
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: root.stats.partialBanned;
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: qsTr("Banned count") + ":"
Layout.alignment: Qt.AlignRight
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: root.stats.banned;
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: qsTr("IP-v4 count") + ":"
Layout.alignment: Qt.AlignRight
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: root.stats.count - root.stats.ipv6Addresses
font.strikeout: root.stats.usesIPv4 === false
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: qsTr("IP-v6 count") + ":"
Layout.alignment: Qt.AlignRight
}
2024-05-28 23:23:31 +02:00
Flowee.Label {
2024-01-06 21:33:28 +01:00
text: root.stats.ipv6Addresses
font.strikeout: root.stats.usesIPv6 === false
}
2024-01-26 13:37:08 +01:00
Flowee.Button {
Layout.columnSpan: 2
text: qsTr("Pardon the Banned")
onClicked: {
net.pardonBanned();
var newStats = net.createStats(root);
root.stats.count = newStats.count;
root.stats.tried = newStats.tried;
2024-01-26 13:37:08 +01:00
root.stats.everConnected = newStats.everConnected;
root.stats.partialBanned = newStats.partialBanned;
root.stats.banned = newStats.banned;
root.stats.ipv6Addresses = newStats.ipv6Addresses;
root.stats.usesIPv6 = newStats.usesIPv6;
root.stats.usesIPv4 = newStats.usesIPv4;
enabled = false;
}
}
2024-01-06 21:33:28 +01:00
}
footer: Item {
width: parent.width
height: closeButton.height + 20
2024-01-26 13:37:08 +01:00
Flowee.Button {
2024-01-06 21:33:28 +01:00
id: closeButton
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 10
text: qsTr("Close")
onClicked: root.visible = false
}
}
}