diff --git a/fonts/Glyphter.ttf b/fonts/Glyphter.ttf new file mode 100644 index 00000000..049c2609 Binary files /dev/null and b/fonts/Glyphter.ttf differ diff --git a/resources/glyph.svg b/resources/glyph.svg new file mode 100644 index 00000000..c150ba18 --- /dev/null +++ b/resources/glyph.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/logo.ico b/resources/logo.ico deleted file mode 100644 index 9077fe7c..00000000 Binary files a/resources/logo.ico and /dev/null differ diff --git a/resources/logo.svg b/resources/logo.svg deleted file mode 100644 index a2e118a8..00000000 --- a/resources/logo.svg +++ /dev/null @@ -1,517 +0,0 @@ - - - - diff --git a/resources/logo_in_app_day.png b/resources/logo_in_app_day.png deleted file mode 100644 index 9a52ce5a..00000000 Binary files a/resources/logo_in_app_day.png and /dev/null differ diff --git a/resources/logo_in_app_night.png b/resources/logo_in_app_night.png deleted file mode 100644 index f9117e48..00000000 Binary files a/resources/logo_in_app_night.png and /dev/null differ diff --git a/src/gui_initial_page.rs b/src/gui_initial_page.rs index ac6066e1..a80debc7 100644 --- a/src/gui_initial_page.rs +++ b/src/gui_initial_page.rs @@ -5,16 +5,11 @@ use pcap::Device; use iced_native::widget::image::Image; use crate::app::Message; use crate::{AppProtocol, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE, icon_sun_moon, Mode, Sniffer, TransProtocol}; -use crate::style::{COURIER_PRIME, COURIER_PRIME_BOLD_ITALIC, FONT_SIZE_FOOTER, FONT_SIZE_SNIFFNET, HEIGHT_BODY, HEIGHT_FOOTER, HEIGHT_HEADER, icon}; +use crate::style::{COURIER_PRIME, COURIER_PRIME_BOLD_ITALIC, FONT_SIZE_FOOTER, FONT_SIZE_SNIFFNET, HEIGHT_BODY, HEIGHT_FOOTER, HEIGHT_HEADER, icon, logo_glyph}; pub fn initial_page(sniffer: &mut Sniffer) -> Column { let headers_style = if sniffer.style == Mode::Day { Mode::HeadersDay } else { Mode::HeadersNight }; - let logo = if sniffer.style == Mode::Day { - Image::::new("resources/logo_in_app_day.png") - } - else { - Image::::new("resources/logo_in_app_night.png") - }; + let logo = logo_glyph().size(100); let button_style = Button::new( &mut sniffer.mode, @@ -32,9 +27,10 @@ pub fn initial_page(sniffer: &mut Sniffer) -> Column { .width(Length::Fill) .align_items(Alignment::Center) .push(Container::new(Row::new()).width(Length::FillPortion(1)).width(Length::FillPortion(1)).align_x(Horizontal::Center)) - .push(Container::new(Row::new().align_items(Alignment::Center).push(logo).push(Text::new("SNIFFNET").font(COURIER_PRIME).size(FONT_SIZE_SNIFFNET))).width(Length::FillPortion(6)).height(Length::Fill).align_x(Horizontal::Center).align_y(Vertical::Center)) + .push(Container::new(Row::new().height(Length::Fill).align_items(Alignment::Center).push(logo).push(Text::new("SNIFFNET").vertical_alignment(Vertical::Center).height(Length::Fill).size(FONT_SIZE_SNIFFNET))).width(Length::FillPortion(6)).height(Length::Fill).align_y(Vertical::Center).align_x(Horizontal::Center)) .push(Container::new(button_style).width(Length::FillPortion(1)).align_x(Horizontal::Center))) .height(Length::FillPortion(HEIGHT_HEADER)) + .align_y(Vertical::Center) .width(Length::Fill) .style(headers_style); diff --git a/src/gui_run_page.rs b/src/gui_run_page.rs index d8c4acb7..d1e864ea 100644 --- a/src/gui_run_page.rs +++ b/src/gui_run_page.rs @@ -15,18 +15,13 @@ use crate::style; use crate::{FONT_SIZE_TITLE, get_app_count_string, icon_sun_moon, InfoTraffic, Mode, Sniffer}; use crate::address_port_pair::AddressPortPair; use crate::info_address_port_pair::InfoAddressPortPair; -use crate::style::{COLOR_CHART_MIX_DAY, COLOR_CHART_MIX_NIGHT, COURIER_PRIME, COURIER_PRIME_BOLD_ITALIC, FONT_SIZE_FOOTER, FONT_SIZE_SNIFFNET, HEIGHT_BODY, HEIGHT_FOOTER, HEIGHT_HEADER, icon, SPECIAL_DAY_RGB, SPECIAL_NIGHT_RGB}; +use crate::style::{COLOR_CHART_MIX_DAY, COLOR_CHART_MIX_NIGHT, COURIER_PRIME, COURIER_PRIME_BOLD_ITALIC, FONT_SIZE_FOOTER, FONT_SIZE_SNIFFNET, HEIGHT_BODY, HEIGHT_FOOTER, HEIGHT_HEADER, icon, logo_glyph, SPECIAL_DAY_RGB, SPECIAL_NIGHT_RGB}; use plotters_iced::{Chart, ChartWidget, DrawingBackend, ChartBuilder}; use crate::Mode::{HeadersDay, HeadersNight}; pub fn run_page(sniffer: &mut Sniffer) -> Column { let headers_style = if sniffer.style == Mode::Day { Mode::HeadersDay } else { Mode::HeadersNight }; - let logo = if sniffer.style == Mode::Day { - Image::::new("resources/logo_in_app_day.png") - } - else { - Image::::new("resources/logo_in_app_night.png") - }; + let logo = logo_glyph().size(100); let button_style = Button::new( &mut sniffer.mode, diff --git a/src/style.rs b/src/style.rs index 9db885a4..1ea77385 100644 --- a/src/style.rs +++ b/src/style.rs @@ -1,4 +1,5 @@ use iced::{pick_list, Background, Color, Vector, button, Font, Text, Length, alignment}; +use iced::alignment::Horizontal; use iced::container::{Style, StyleSheet}; use iced_style::scrollable::{Scrollbar, Scroller}; use plotters::style::RGBColor; @@ -15,6 +16,13 @@ pub const COURIER_PRIME: Font = Font::External { bytes: include_bytes!("../fonts/CourierPrime.ttf"), }; + +pub const LOGO: Font = Font::External { + name: "Logo", + bytes: include_bytes!("../fonts/Glyphter.ttf"), +}; + + // pub const COURIER_PRIME_BOLD: Font = Font::External { // name: "CourierPrimeSansBold", // bytes: include_bytes!("../fonts/CourierPrimeSansBold.ttf"), @@ -29,12 +37,12 @@ pub const FONT_SIZE_FOOTER: u16 = 14; pub const FONT_SIZE_BODY: u16 = 16; pub const FONT_SIZE_SUBTITLE: u16 = 18; pub const FONT_SIZE_TITLE: u16 = 22; -pub const FONT_SIZE_SNIFFNET: u16 = 60; +pub const FONT_SIZE_SNIFFNET: u16 = 0; pub const BORDER_WIDTH: f32 = 2.0; -pub const HEIGHT_HEADER: u16 = 3; -pub const HEIGHT_BODY: u16 = 15; +pub const HEIGHT_HEADER: u16 = 2; +pub const HEIGHT_BODY: u16 = 12; pub const HEIGHT_FOOTER: u16 = 1; @@ -332,6 +340,13 @@ pub fn icon(unicode: char) -> Text { } +pub fn logo_glyph() -> Text { + Text::new('A'.to_string()) + .font(LOGO) + .horizontal_alignment(Horizontal::Center) +} + + pub fn icon_sun_moon(style: Mode) -> Text { match style { Mode::Night => {