UI: BlockedPage: Add "Copy..." button.

This commit is contained in:
Nodir Temirkhodjaev 2017-12-25 21:01:42 +05:00
parent 12a5002e46
commit f1eed902f4
9 changed files with 141 additions and 90 deletions

View File

@ -417,8 +417,8 @@ fort_stat_flow_associate (PFORT_STAT stat, UINT64 flow_id,
flow_context = (UINT64) flow_index
| ((UINT64) stat->version << 32)
| ((UINT64) proc_index << 40)
| ((UINT64) group_index << 56);
| ((UINT64) group_index << 40)
| ((UINT64) proc_index << 48);
status = fort_stat_flow_set_context(stat, flow_id, flow_context, is_udp);
@ -448,7 +448,7 @@ fort_stat_flow_delete (PFORT_STAT stat, UINT64 flow_context)
{
KLOCK_QUEUE_HANDLE lock_queue;
const UINT32 flow_index = (UINT32) flow_context;
const UINT16 proc_index = (UINT16) (flow_context >> 40);
const UINT16 proc_index = (UINT16) (flow_context >> 48);
const UCHAR stat_version = (UCHAR) (flow_context >> 32);
if (stat->closing)
@ -468,7 +468,7 @@ fort_stat_flow_classify (PFORT_STAT stat, UINT64 flow_context,
{
PFORT_STAT_PROC proc;
KLOCK_QUEUE_HANDLE lock_queue;
const UINT16 proc_index = (UINT16) (flow_context >> 40);
const UINT16 proc_index = (UINT16) (flow_context >> 48);
const UCHAR stat_version = (UCHAR) (flow_context >> 32);
if (stat->closing)

View File

@ -3,6 +3,7 @@
<file>qml/controls/ButtonMenu.qml</file>
<file>qml/controls/ButtonPopup.qml</file>
<file>qml/controls/LinkButton.qml</file>
<file>qml/controls/ListViewControl.qml</file>
<file>qml/controls/RoundButtonTip.qml</file>
<file>qml/controls/ScrollBarControl.qml</file>
<file>qml/controls/SpinCombo.qml</file>
@ -24,6 +25,7 @@
<file>qml/pages/apps/AppsTextColumn.qml</file>
<file>qml/pages/apps/SpeedLimitButton.qml</file>
<file>qml/pages/log/AppListView.qml</file>
<file>qml/pages/log/IpListView.qml</file>
<file>qml/pages/log/TrafKeepButton.qml</file>
<file>qml/pages/log/TrafRow.qml</file>
<file>qml/pages/schedule/TaskRow.qml</file>

Binary file not shown.

View File

@ -14,22 +14,22 @@
<translation>Некорректный IP адрес для исключения: %1</translation>
</message>
<message>
<location filename="../util/confutil.cpp" line="63"/>
<location filename="../util/confutil.cpp" line="65"/>
<source>Size of configuration is too big</source>
<translation>Конфигурация слишком большая</translation>
</message>
<message>
<location filename="../util/confutil.cpp" line="113"/>
<location filename="../util/confutil.cpp" line="117"/>
<source>Number of Application Groups must be &lt; %1</source>
<translation>Количество групп приложений должно быть &lt; %1</translation>
</message>
<message>
<location filename="../util/confutil.cpp" line="125"/>
<location filename="../util/confutil.cpp" line="129"/>
<source>Length of Application Group&apos;s Name must be &lt; %1</source>
<translation>Длина наименования группы приложения должна быть &lt; %1</translation>
</message>
<message>
<location filename="../util/confutil.cpp" line="167"/>
<location filename="../util/confutil.cpp" line="175"/>
<source>Length of Application&apos;s Path must be &lt; %1</source>
<translation>Длина пути приложения должна быть &lt; %1</translation>
</message>
@ -148,7 +148,7 @@
<context>
<name>TaskUpdateChecker</name>
<message>
<location filename="../task/taskupdatechecker.cpp" line="35"/>
<location filename="../task/taskupdatechecker.cpp" line="36"/>
<source>New version!</source>
<translation>Новая версия!</translation>
</message>
@ -185,29 +185,44 @@
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="32"/>
<location filename="../qml/pages/StatisticsPage.qml" line="57"/>
<location filename="../qml/pages/StatisticsPage.qml" line="55"/>
<source>Clear</source>
<translation>Очистить</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="37"/>
<location filename="../qml/pages/StatisticsPage.qml" line="62"/>
<location filename="../qml/pages/StatisticsPage.qml" line="60"/>
<source>Remove Application</source>
<translation>Удалить приложение</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="43"/>
<location filename="../qml/pages/StatisticsPage.qml" line="73"/>
<location filename="../qml/pages/StatisticsPage.qml" line="71"/>
<source>Clear All</source>
<translation>Очистить всё</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="53"/>
<location filename="../qml/pages/BlockedPage.qml" line="55"/>
<source>Copy</source>
<translation>Копировать</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="60"/>
<source>Application Path</source>
<translation>Путь приложения</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="66"/>
<source>IP Address</source>
<translation>IP Адрес</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="73"/>
<source>Resolve Addresses</source>
<translation>Преобразовать адреса</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="74"/>
<location filename="../qml/pages/BlockedPage.qml" line="94"/>
<source>Log Blocked Applications</source>
<translation>Показ блокированных приложений</translation>
</message>
@ -500,101 +515,101 @@
<translation>Успешный запуск</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="32"/>
<location filename="../qml/pages/StatisticsPage.qml" line="30"/>
<source>Adaptive</source>
<translation>Адаптивный</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="33"/>
<location filename="../qml/pages/StatisticsPage.qml" line="31"/>
<source>Bytes</source>
<translation>Байты</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="34"/>
<location filename="../qml/pages/StatisticsPage.qml" line="32"/>
<source>KiB</source>
<translation>KiB</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="35"/>
<location filename="../qml/pages/StatisticsPage.qml" line="33"/>
<source>MiB</source>
<translation>MiB</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="36"/>
<location filename="../qml/pages/StatisticsPage.qml" line="34"/>
<source>GiB</source>
<translation>GiB</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="37"/>
<location filename="../qml/pages/StatisticsPage.qml" line="35"/>
<source>TiB</source>
<translation>TiB</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="49"/>
<location filename="../qml/pages/StatisticsPage.qml" line="47"/>
<source>Refresh</source>
<translation>Обновить</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="94"/>
<location filename="../qml/pages/StatisticsPage.qml" line="92"/>
<source>Units:</source>
<translation>Единицы:</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="68"/>
<location filename="../qml/pages/StatisticsPage.qml" line="66"/>
<source>Reset Total</source>
<translation>Сбросить общую</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="124"/>
<location filename="../qml/pages/StatisticsPage.qml" line="122"/>
<source>Collect Traffic Statistics</source>
<translation>Собирать статистику трафика</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="155"/>
<location filename="../qml/pages/StatisticsPage.qml" line="153"/>
<source>All</source>
<translation>Все</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="172"/>
<location filename="../qml/pages/StatisticsPage.qml" line="170"/>
<source>Hourly</source>
<comment>Stat</comment>
<translation>Почасовая</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="176"/>
<location filename="../qml/pages/StatisticsPage.qml" line="174"/>
<source>Daily</source>
<comment>Stat</comment>
<translation>Ежедневная</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="180"/>
<location filename="../qml/pages/StatisticsPage.qml" line="178"/>
<source>Monthly</source>
<comment>Stat</comment>
<translation>Ежемесячная</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="184"/>
<location filename="../qml/pages/StatisticsPage.qml" line="182"/>
<source>Total</source>
<comment>Stat</comment>
<translation>Общая</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="195"/>
<location filename="../qml/pages/StatisticsPage.qml" line="193"/>
<source>Date</source>
<translation>Дата</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="200"/>
<location filename="../qml/pages/StatisticsPage.qml" line="198"/>
<source>Download</source>
<translation>Загрузка</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="205"/>
<location filename="../qml/pages/StatisticsPage.qml" line="203"/>
<source>Upload</source>
<translation>Выгрузка</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="210"/>
<location filename="../qml/pages/StatisticsPage.qml" line="208"/>
<source>Sum</source>
<translation>Сумма</translation>
</message>

View File

@ -1,5 +1,43 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
Item {
ListView {
id: listView
signal clicked(int index)
readonly property string currentItemText:
(currentIndex >= 0 && currentIndex < count && currentItem)
? currentItem.displayText : ""
Keys.onUpPressed: decrementCurrentIndex()
Keys.onDownPressed: incrementCurrentIndex()
ScrollBar.vertical: ScrollBarControl {}
highlightRangeMode: ListView.ApplyRange
highlightResizeDuration: 0
highlightMoveDuration: 200
highlight: Item {
Rectangle {
anchors.fill: parent
anchors.margins: 1 - listView.spacing / 2 - border.width
radius: 2
border.width: 3
border.color: palette.highlight
color: "transparent"
}
}
MouseArea {
anchors.fill: parent
onClicked: {
const index = listView.indexAt(mouse.x, mouse.y);
if (index >= 0) {
listView.currentIndex = index;
listView.clicked(index);
}
}
}
}

View File

@ -12,9 +12,9 @@ BasePage {
readonly property IpListModel ipListModel:
appBlockedModel.ipListModel(currentAppPath)
readonly property string currentAppPath:
(appListView.currentIndex >= 0 && appListView.currentItem)
? appListView.currentItem.appPath : ""
readonly property string currentAppPath: appListView.currentItemText
readonly property string currentIpText: ipListView.currentItemText
HostInfoCache {
id: hostInfoCache
@ -48,6 +48,26 @@ BasePage {
}
}
ButtonMenu {
enabled: appListView.count
icon.source: "qrc:/images/page_copy.png"
text: translationManager.dummyBool
&& qsTranslate("qml", "Copy…")
MenuItem {
enabled: !!currentAppPath
text: translationManager.dummyBool
&& qsTranslate("qml", "Application Path")
onTriggered: guiUtil.setClipboardData(currentAppPath)
}
MenuItem {
enabled: !!currentIpText
text: translationManager.dummyBool
&& qsTranslate("qml", "IP Address")
onTriggered: guiUtil.setClipboardData(currentIpText)
}
}
CheckBox {
text: translationManager.dummyBool
&& qsTranslate("qml", "Resolve Addresses")
@ -101,25 +121,12 @@ BasePage {
model: appBlockedModel
}
ListView {
IpListView {
id: ipListView
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 5
model: ipListModel
delegate: Label {
width: ipListView.width
elide: Text.ElideRight
text: (firewallConf.resolveAddress
&& hostInfoCache.dummyBool
&& hostInfoCache.hostName(ipText)) || ipText
readonly property string ipText: display
}
ScrollBar.vertical: ScrollBarControl {}
}
}
}

View File

@ -15,9 +15,7 @@ BasePage {
appListView.currentIndex,
currentAppPath)
readonly property string currentAppPath:
(appListView.currentIndex >= 0 && appListView.currentItem)
? appListView.currentItem.appPath : ""
readonly property string currentAppPath: appListView.currentItemText
readonly property var trafCellWidths: [
trafsContainer.width * 0.34,

View File

@ -3,7 +3,7 @@ import QtQuick.Controls 2.2
import "../../controls"
import com.fortfirewall 1.0
ListView {
ListViewControl {
id: appListView
spacing: 10
@ -11,56 +11,27 @@ ListView {
property string emptyText
property string emptyIcon
Keys.onUpPressed: decrementCurrentIndex()
Keys.onDownPressed: incrementCurrentIndex()
ScrollBar.vertical: ScrollBarControl {}
highlightRangeMode: ListView.ApplyRange
highlightResizeDuration: 0
highlightMoveDuration: 200
highlight: Item {
Rectangle {
anchors.fill: parent
anchors.margins: -7
radius: 2
border.width: 3
border.color: palette.highlight
color: "transparent"
}
}
onClicked: forceActiveFocus()
delegate: Row {
id: appItem
width: appListView.width
spacing: 6
readonly property string appPath: display
readonly property string displayText: display
// TODO: Use SHGetFileInfo() to get app's display name and icon
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 1
source: (!appItem.appPath && emptyIcon)
source: (!appItem.displayText && emptyIcon)
|| "qrc:/images/application.png"
}
Label {
font.pixelSize: 20
elide: Text.ElideRight
text: (!appItem.appPath && emptyText)
|| fileUtil.fileName(appItem.appPath)
}
}
MouseArea {
anchors.fill: parent
onClicked: {
const index = appListView.indexAt(mouse.x, mouse.y);
if (index >= 0) {
appListView.currentIndex = index;
appListView.forceActiveFocus();
}
text: (!appItem.displayText && emptyText)
|| fileUtil.fileName(appItem.displayText)
}
}
}

View File

@ -0,0 +1,20 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import "../../controls"
import com.fortfirewall 1.0
ListViewControl {
id: ipListView
spacing: 6
delegate: Label {
width: ipListView.width
elide: Text.ElideRight
text: (firewallConf.resolveAddress
&& hostInfoCache.dummyBool
&& hostInfoCache.hostName(displayText)) || displayText
readonly property string displayText: display
}
}