Skip to content

Commit d0596ce

Browse files
committed
made some UI texts less verbose
1 parent e237f05 commit d0596ce

3 files changed

Lines changed: 229 additions & 252 deletions

File tree

src/gui/pages/overview_page.rs

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ use crate::report::get_report_entries::{get_host_entries, get_service_entries};
2424
use crate::report::types::search_parameters::SearchParameters;
2525
use crate::report::types::sort_type::SortType;
2626
use crate::translations::translations::{
27-
active_filters_translation, bytes_chart_translation, error_translation, incoming_translation,
27+
active_filters_translation, error_translation, incoming_translation,
2828
network_adapter_translation, no_addresses_translation, none_translation, outgoing_translation,
29-
packets_chart_translation, some_observed_translation, traffic_rate_translation,
30-
waiting_translation,
29+
some_observed_translation, traffic_rate_translation, waiting_translation,
3130
};
3231
use crate::translations::translations_2::{
3332
data_representation_translation, dropped_translation, host_translation,
@@ -477,33 +476,16 @@ fn container_chart(sniffer: &Sniffer, font: Font) -> Container<Message, StyleTyp
477476
let ConfigSettings { language, .. } = sniffer.configs.lock().unwrap().settings;
478477
let traffic_chart = &sniffer.traffic_chart;
479478

480-
let mut chart_info_string = String::from("(");
481-
chart_info_string.push_str(if traffic_chart.chart_type.eq(&ChartType::Packets) {
482-
packets_chart_translation(language)
483-
} else {
484-
bytes_chart_translation(language)
485-
});
486-
chart_info_string.push(')');
487-
488479
Container::new(
489480
Column::new()
490481
.align_x(Alignment::Center)
491482
.push(
492-
Row::new()
493-
.padding([10, 0])
494-
.spacing(10)
495-
.align_y(Alignment::Center)
496-
.push(
497-
traffic_rate_translation(language)
498-
.font(font)
499-
.class(TextType::Title)
500-
.size(FONT_SIZE_TITLE),
501-
)
502-
.push(
503-
Text::new(chart_info_string)
504-
.class(TextType::Subtitle)
505-
.font(font),
506-
),
483+
Row::new().padding([10, 0]).align_y(Alignment::Center).push(
484+
traffic_rate_translation(language)
485+
.font(font)
486+
.class(TextType::Title)
487+
.size(FONT_SIZE_TITLE),
488+
),
507489
)
508490
.push(traffic_chart.view()),
509491
)

src/gui/pages/settings_notifications_page.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ use crate::notifications::types::notifications::{
1818
};
1919
use crate::notifications::types::sound::Sound;
2020
use crate::translations::translations::{
21-
bytes_threshold_translation, favorite_notification_translation,
22-
notifications_title_translation, packets_threshold_translation, per_second_translation,
23-
settings_translation, sound_translation, specify_multiples_translation, threshold_translation,
24-
volume_translation,
21+
bytes_exceeded_translation, favorite_transmitted_translation, notifications_title_translation,
22+
packets_exceeded_translation, per_second_translation, settings_translation, sound_translation,
23+
threshold_translation, volume_translation,
2524
};
2625
use crate::utils::types::icon::Icon;
2726
use crate::{ConfigSettings, Language, Sniffer, StyleType};
@@ -101,7 +100,7 @@ fn get_packets_notify<'a>(
101100
font: Font,
102101
) -> Column<'a, Message, StyleType> {
103102
let checkbox = Checkbox::new(
104-
packets_threshold_translation(language),
103+
packets_exceeded_translation(language),
105104
packets_notification.threshold.is_some(),
106105
)
107106
.on_toggle(move |toggled| {
@@ -154,7 +153,7 @@ fn get_bytes_notify<'a>(
154153
font: Font,
155154
) -> Column<'a, Message, StyleType> {
156155
let checkbox = Checkbox::new(
157-
bytes_threshold_translation(language),
156+
bytes_exceeded_translation(language),
158157
bytes_notification.threshold.is_some(),
159158
)
160159
.on_toggle(move |toggled| {
@@ -207,7 +206,7 @@ fn get_favorite_notify<'a>(
207206
font: Font,
208207
) -> Column<'a, Message, StyleType> {
209208
let checkbox = Checkbox::new(
210-
favorite_notification_translation(language),
209+
favorite_transmitted_translation(language),
211210
favorite_notification.notify_on_favorite,
212211
)
213212
.on_toggle(move |toggled| {
@@ -299,11 +298,6 @@ fn input_group_bytes<'a>(
299298
font: Font,
300299
language: Language,
301300
) -> Container<'a, Message, StyleType> {
302-
let info_str = format!(
303-
"{}; {}",
304-
per_second_translation(language),
305-
specify_multiples_translation(language)
306-
);
307301
let mut curr_threshold_str = (bytes_notification.threshold.unwrap_or_default()
308302
/ bytes_notification.byte_multiple.multiplier())
309303
.to_string();
@@ -331,7 +325,7 @@ fn input_group_bytes<'a>(
331325
.width(100),
332326
)
333327
.push(
334-
Text::new(info_str)
328+
Text::new(per_second_translation(language))
335329
.font(font)
336330
.align_y(Alignment::Center)
337331
.size(FONT_SIZE_FOOTER),
@@ -353,6 +347,7 @@ fn volume_slider<'a>(
353347
.push(Text::new(format!("{}: {volume:^3}%", volume_translation(language))).font(font))
354348
.push(
355349
Row::new()
350+
.align_y(Alignment::Center)
356351
.push(
357352
Icon::AudioMute
358353
.to_text()

0 commit comments

Comments
 (0)