mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2025-12-23 22:29:01 -05:00
fixed open report tooltip alignment and moved fonts in resources folder
This commit is contained in:
@@ -58,7 +58,7 @@ ## 💅 Design relevant materials
|
||||
|
||||
### Fonts
|
||||
|
||||
I'm using `Inconsolata`. The fonts I used can be found [here](https://github.com/GyulyVGC/sniffnet/tree/main/fonts).
|
||||
I'm using `Inconsolata`. The fonts I used can be found [here](https://github.com/GyulyVGC/sniffnet/tree/main/resources/fonts).
|
||||
|
||||
### Colors
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ description = "Application to comfortably monitor your network traffic"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/GyulyVGC/sniffnet"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["filter", "network", "packet", "sniffer", "parser"]
|
||||
categories = ["command-line-utilities", "concurrency", "network-programming"]
|
||||
include = ["src/**/*", "LICENSE-*", "README.md", "CHANGELOG.md", "resources/countries_flags/**/*", "resources/DB/GeoLite2-Country.mmdb", "resources/palettes/*", "fonts/*", "resources/sounds/*"]
|
||||
keywords = ["filter", "network", "packet", "sniffer", "gui"]
|
||||
categories = ["visualization", "gui", "network-programming"]
|
||||
include = ["src/**/*", "LICENSE-*", "README.md", "CHANGELOG.md", "resources/countries_flags/**/*", "resources/DB/GeoLite2-Country.mmdb", "resources/palettes/*", "resources/fonts/*", "resources/sounds/*"]
|
||||
|
||||
|
||||
[package.metadata.bundle]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use crate::utility::countries::{get_flag, FLAGS_WIDTH};
|
||||
use crate::utility::get_formatted_strings::{
|
||||
get_active_filters_string, get_active_filters_string_nobr, get_app_count_string,
|
||||
get_connection_color, get_formatted_bytes_string, get_percentage_string,
|
||||
get_connection_color, get_formatted_bytes_string, get_percentage_string, get_report_path,
|
||||
};
|
||||
use crate::utility::style_constants::{get_font, HEIGHT_BODY, ICONS, INCONSOLATA_BOLD};
|
||||
use crate::utility::translations::{
|
||||
@@ -294,6 +294,14 @@ pub fn overview_page(sniffer: &Sniffer) -> Container<Message> {
|
||||
)),
|
||||
);
|
||||
|
||||
let open_report_translation = open_report_translation(sniffer.language);
|
||||
let report_path = get_report_path().to_string_lossy().to_string();
|
||||
let open_report_tooltip = format!(
|
||||
"{:^len$}\n{report_path}",
|
||||
open_report_translation,
|
||||
len = report_path.len()
|
||||
);
|
||||
|
||||
body = body
|
||||
.push(
|
||||
Row::new()
|
||||
@@ -333,7 +341,7 @@ pub fn overview_page(sniffer: &Sniffer) -> Container<Message> {
|
||||
StyleTuple(sniffer.style, ElementType::Standard).into(),
|
||||
)
|
||||
.on_press(Message::OpenReport),
|
||||
open_report_translation(sniffer.language),
|
||||
open_report_tooltip,
|
||||
Position::Top,
|
||||
)
|
||||
.gap(5)
|
||||
|
||||
@@ -26,6 +26,7 @@ fn appearance(&self, _: &Self::Style) -> Appearance {
|
||||
}),
|
||||
background: Some(Background::Color(match self {
|
||||
StyleTuple(_, ElementType::Headers) => colors.secondary,
|
||||
StyleTuple(_, ElementType::Tooltip) => colors.buttons,
|
||||
_ => colors.primary,
|
||||
})),
|
||||
border_radius: match self {
|
||||
|
||||
@@ -101,7 +101,7 @@ pub fn main() -> iced::Result {
|
||||
&config_settings,
|
||||
&config_device,
|
||||
),
|
||||
default_font: Some(include_bytes!("../fonts/inconsolata-regular.ttf")),
|
||||
default_font: Some(include_bytes!("../resources/fonts/inconsolata-regular.ttf")),
|
||||
default_text_size: FONT_SIZE_BODY,
|
||||
text_multithreading: true,
|
||||
antialiasing: false,
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
// };
|
||||
pub const INCONSOLATA_BOLD: Font = Font::External {
|
||||
name: "inconsolata_bold",
|
||||
bytes: include_bytes!("../../fonts/inconsolata-bold.ttf"),
|
||||
bytes: include_bytes!("../../resources/fonts/inconsolata-bold.ttf"),
|
||||
};
|
||||
|
||||
pub fn get_font(style: StyleType) -> Font {
|
||||
@@ -167,7 +167,7 @@ pub fn get_color_mix_chart(style: StyleType) -> f64 {
|
||||
//font to display icons
|
||||
pub const ICONS: Font = Font::External {
|
||||
name: "icons",
|
||||
bytes: include_bytes!("../../fonts/icons.ttf"),
|
||||
bytes: include_bytes!("../../resources/fonts/icons.ttf"),
|
||||
};
|
||||
|
||||
// palettes pictures
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::enums::language::Language;
|
||||
use crate::utility::get_formatted_strings::get_report_path;
|
||||
use iced::widget::Text;
|
||||
|
||||
pub fn choose_adapters_translation(language: Language) -> Text<'static> {
|
||||
@@ -572,16 +571,13 @@ pub fn sound_translation(language: Language) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn open_report_translation(language: Language) -> String {
|
||||
let open_report = match language {
|
||||
pub fn open_report_translation(language: Language) -> &'static str {
|
||||
match language {
|
||||
Language::EN => "Open full report",
|
||||
Language::IT => "Apri report completo",
|
||||
Language::FR => "Ouvrir le rapport complet",
|
||||
Language::ES => "Abrir el informe completo",
|
||||
};
|
||||
let mut ret_val = String::from(open_report);
|
||||
ret_val.push_str(&format!("\n({:?})", get_report_path()));
|
||||
ret_val
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bytes_exceeded_translation(language: Language) -> &'static str {
|
||||
|
||||
Reference in New Issue
Block a user