2017-11-20 07:50:16 +00:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.2
|
2017-12-14 08:44:10 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
2017-11-20 07:50:16 +00:00
|
|
|
import "../controls"
|
2017-12-05 05:06:15 +00:00
|
|
|
import "log"
|
2017-11-20 07:50:16 +00:00
|
|
|
import com.fortfirewall 1.0
|
|
|
|
|
|
|
|
BasePage {
|
2017-12-05 13:23:44 +00:00
|
|
|
id: statisticsPage
|
2017-11-20 07:50:16 +00:00
|
|
|
|
|
|
|
readonly property LogManager logManager: fortManager.logManager
|
2017-12-05 05:06:15 +00:00
|
|
|
readonly property AppStatModel appStatModel: logManager.appStatModel
|
2017-12-10 07:07:36 +00:00
|
|
|
readonly property TrafListModel trafListModel:
|
2017-12-14 04:39:57 +00:00
|
|
|
appStatModel.trafListModel(tabBar.currentIndex,
|
|
|
|
appListView.currentIndex,
|
|
|
|
currentAppPath)
|
2017-12-05 05:06:15 +00:00
|
|
|
|
2017-12-25 16:01:42 +00:00
|
|
|
readonly property string currentAppPath: appListView.currentItemText
|
2017-11-20 07:50:16 +00:00
|
|
|
|
2017-12-05 13:23:44 +00:00
|
|
|
readonly property var trafCellWidths: [
|
2017-12-12 02:48:26 +00:00
|
|
|
trafsContainer.width * 0.34,
|
|
|
|
trafsContainer.width * 0.22,
|
|
|
|
trafsContainer.width * 0.22,
|
|
|
|
trafsContainer.width * 0.22
|
2017-12-05 13:23:44 +00:00
|
|
|
]
|
|
|
|
|
2017-12-11 06:05:49 +00:00
|
|
|
readonly property var trafUnitNames:
|
|
|
|
translationManager.dummyBool
|
|
|
|
&& [
|
|
|
|
qsTranslate("qml", "Adaptive"),
|
|
|
|
qsTranslate("qml", "Bytes"),
|
|
|
|
qsTranslate("qml", "KiB"),
|
|
|
|
qsTranslate("qml", "MiB"),
|
|
|
|
qsTranslate("qml", "GiB"),
|
|
|
|
qsTranslate("qml", "TiB")
|
|
|
|
]
|
|
|
|
|
2017-11-20 07:50:16 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
RowLayout {
|
2018-01-10 10:13:24 +00:00
|
|
|
RoundButtonTip {
|
2017-12-12 02:48:26 +00:00
|
|
|
enabled: appListView.count
|
2017-12-14 04:39:57 +00:00
|
|
|
icon.source: "qrc:/images/arrow_refresh.png"
|
2018-01-10 10:13:24 +00:00
|
|
|
tipText: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Refresh")
|
2017-12-10 07:07:36 +00:00
|
|
|
onClicked: trafListModel.refresh()
|
|
|
|
}
|
|
|
|
|
2017-12-14 10:40:39 +00:00
|
|
|
ButtonMenu {
|
|
|
|
enabled: appListView.count
|
|
|
|
icon.source: "qrc:/images/bin_empty.png"
|
|
|
|
text: translationManager.dummyBool
|
2017-12-19 11:20:14 +00:00
|
|
|
&& qsTranslate("qml", "Clear…")
|
2017-12-14 10:40:39 +00:00
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
enabled: appListView.currentIndex > 0
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Remove Application")
|
|
|
|
onTriggered: appStatModel.remove(
|
|
|
|
appListView.currentIndex)
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Reset Total")
|
|
|
|
onTriggered: trafListModel.resetAppTotals()
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Clear All")
|
|
|
|
onTriggered: {
|
|
|
|
appListView.currentIndex = 0;
|
|
|
|
appStatModel.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-12 11:21:38 +00:00
|
|
|
TrafOptionsButton {}
|
2017-12-14 10:40:39 +00:00
|
|
|
|
2017-12-11 06:05:49 +00:00
|
|
|
Row {
|
|
|
|
spacing: 5
|
|
|
|
|
2017-12-14 04:39:57 +00:00
|
|
|
Item {
|
|
|
|
width: 1
|
|
|
|
height: 1
|
|
|
|
}
|
|
|
|
|
2017-12-11 06:05:49 +00:00
|
|
|
Label {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Units:")
|
|
|
|
}
|
|
|
|
|
|
|
|
ComboBox {
|
|
|
|
id: comboTrafUnit
|
|
|
|
|
|
|
|
currentIndex: firewallConf.trafUnit
|
|
|
|
model: trafUnitNames
|
|
|
|
|
2017-12-14 05:03:23 +00:00
|
|
|
onModelChanged: {
|
|
|
|
currentIndex = firewallConf.trafUnit;
|
|
|
|
}
|
2017-12-11 06:05:49 +00:00
|
|
|
onActivated: {
|
|
|
|
firewallConf.trafUnit = index;
|
|
|
|
|
2017-12-14 10:23:40 +00:00
|
|
|
fortManager.applyConfImmediateFlags();
|
2017-12-11 06:05:49 +00:00
|
|
|
|
|
|
|
trafListModel.refresh();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-20 07:50:16 +00:00
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Switch {
|
|
|
|
id: cbShowBlockedApps
|
|
|
|
font.weight: Font.DemiBold
|
|
|
|
text: translationManager.dummyBool
|
2017-11-20 14:39:57 +00:00
|
|
|
&& qsTranslate("qml", "Collect Traffic Statistics")
|
|
|
|
checked: firewallConf.logStat
|
|
|
|
onToggled: {
|
|
|
|
if (firewallConf.logStat === checked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
firewallConf.logStat = checked;
|
|
|
|
|
2017-12-14 10:23:40 +00:00
|
|
|
fortManager.applyConfImmediateFlags();
|
2017-11-20 14:39:57 +00:00
|
|
|
}
|
2017-11-20 07:50:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Frame {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
clip: true
|
2017-12-05 05:06:15 +00:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
spacing: 20
|
|
|
|
|
|
|
|
AppListView {
|
|
|
|
id: appListView
|
|
|
|
Layout.fillWidth: true
|
2017-12-05 12:50:10 +00:00
|
|
|
Layout.preferredWidth: 100
|
2017-12-05 05:06:15 +00:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
model: appStatModel
|
2017-12-05 12:50:10 +00:00
|
|
|
|
|
|
|
emptyText: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "All")
|
2017-12-08 02:38:38 +00:00
|
|
|
emptyIcon: "qrc:/images/application_double.png"
|
2017-12-05 05:06:15 +00:00
|
|
|
}
|
|
|
|
|
2017-12-05 13:23:44 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: trafsContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredWidth: 200
|
|
|
|
Layout.fillHeight: true
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
TabBar {
|
|
|
|
id: tabBar
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
TabButton {
|
|
|
|
text: translationManager.dummyBool
|
2017-12-06 02:07:30 +00:00
|
|
|
&& qsTranslate("qml", "Hourly", "Stat")
|
2017-12-05 13:23:44 +00:00
|
|
|
}
|
|
|
|
TabButton {
|
|
|
|
text: translationManager.dummyBool
|
2017-12-06 02:07:30 +00:00
|
|
|
&& qsTranslate("qml", "Daily", "Stat")
|
2017-12-05 13:23:44 +00:00
|
|
|
}
|
|
|
|
TabButton {
|
|
|
|
text: translationManager.dummyBool
|
2017-12-06 02:07:30 +00:00
|
|
|
&& qsTranslate("qml", "Monthly", "Stat")
|
2017-12-05 13:23:44 +00:00
|
|
|
}
|
|
|
|
TabButton {
|
|
|
|
text: translationManager.dummyBool
|
2017-12-06 02:07:30 +00:00
|
|
|
&& qsTranslate("qml", "Total", "Stat")
|
2017-12-05 13:23:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Row {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
Label {
|
|
|
|
width: trafCellWidths[0]
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Date")
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
width: trafCellWidths[1]
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Download")
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
width: trafCellWidths[2]
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Upload")
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
width: trafCellWidths[3]
|
|
|
|
text: translationManager.dummyBool
|
|
|
|
&& qsTranslate("qml", "Sum")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-11 04:23:51 +00:00
|
|
|
HSeparator {}
|
2017-12-05 13:23:44 +00:00
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: trafListView
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2017-12-12 10:43:49 +00:00
|
|
|
spacing: 5
|
2017-12-05 13:23:44 +00:00
|
|
|
clip: true
|
|
|
|
|
2017-12-10 07:07:36 +00:00
|
|
|
model: trafListModel
|
2017-12-06 14:43:33 +00:00
|
|
|
|
|
|
|
delegate: TrafRow {}
|
2017-12-14 09:24:09 +00:00
|
|
|
|
|
|
|
ScrollBar.vertical: ScrollBarControl {}
|
2017-12-05 13:23:44 +00:00
|
|
|
}
|
|
|
|
}
|
2017-12-05 05:06:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TextFieldFrame {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: currentAppPath || ""
|
2017-11-20 07:50:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|