Skip to content

Commit 9014671

Browse files
committed
unify packets & bytes threshold notifications
1 parent 29d42b4 commit 9014671

15 files changed

Lines changed: 236 additions & 494 deletions

File tree

resources/fonts/subset/icons.ttf

1.84 KB
Binary file not shown.

src/chart/types/chart_type.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use crate::Language;
22
use crate::translations::translations::{bytes_translation, packets_translation};
3+
use serde::{Deserialize, Serialize};
34

45
/// Enum representing the possible kind of chart displayed.
5-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
67
pub enum ChartType {
78
Packets,
89
Bytes,

src/cli/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ mod tests {
9898
),
9999
notifications: Notifications {
100100
volume: 100,
101-
packets_notification: Default::default(),
102-
bytes_notification: Default::default(),
101+
data_notification: Default::default(),
103102
favorite_notification: Default::default(),
104103
},
105104
style: StyleType::Custom(ExtraStyles::DraculaDark),

src/gui/pages/notifications_page.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ pub fn notifications_page(sniffer: &Sniffer) -> Container<Message, StyleType> {
6262

6363
tab_and_body = tab_and_body.push(tabs);
6464

65-
if notifications.packets_notification.threshold.is_none()
66-
&& notifications.bytes_notification.threshold.is_none()
65+
if notifications.data_notification.threshold.is_none()
6766
&& !notifications.favorite_notification.notify_on_favorite
6867
&& sniffer.logged_notifications.0.is_empty()
6968
{
@@ -157,10 +156,10 @@ fn data_notification_log<'a>(
157156
} else {
158157
logged_notification.threshold.to_string()
159158
};
160-
let icon = if chart_type == ChartType::Bytes {
161-
Icon::BytesThreshold
162-
} else {
159+
let icon = if chart_type == ChartType::Packets {
163160
Icon::PacketsThreshold
161+
} else {
162+
Icon::BytesThreshold
164163
}
165164
.to_text()
166165
.size(80)
@@ -244,7 +243,6 @@ fn favorite_notification_log<'a>(
244243
Icon::Star
245244
.to_text()
246245
.size(80)
247-
.class(TextType::Starred)
248246
.line_height(LineHeight::Relative(1.0)),
249247
)
250248
.push(

0 commit comments

Comments
 (0)