Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from GyulyVGC:main #17

Merged
merged 6 commits into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changed header and footer proportions to
  • Loading branch information
GyulyVGC committed Mar 24, 2023
commit 3bab0ba2b4c71b3aebe39c22b800710d502fbac5
1 change: 1 addition & 0 deletions resources/fonts/full/subset_characters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ z
ї
Expand Down
Binary file modified resources/fonts/subset/sarasa-mono-sc-bold.subset.ttf
Binary file not shown.
Binary file modified resources/fonts/subset/sarasa-mono-sc-regular.subset.ttf
Binary file not shown.
29 changes: 17 additions & 12 deletions src/gui/components/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,36 @@ use crate::enums::message::Message;
use crate::enums::style_type::StyleType;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::get_formatted_strings::APP_VERSION;
use crate::utility::style_constants::{
get_font, get_font_headers, FONT_SIZE_FOOTER, HEIGHT_FOOTER, ICONS,
};
use crate::utility::style_constants::{get_font, get_font_headers, FONT_SIZE_FOOTER, ICONS};
use iced::alignment::{Horizontal, Vertical};
use iced::widget::{button, Container, Row, Text, Tooltip};
use iced::Length::FillPortion;
use iced::{Alignment, Length};
use iced_native::widget::horizontal_space;
use iced_native::widget::tooltip::Position;

pub fn footer(style: StyleType) -> Container<'static, Message> {
let font = get_font(style);
let font_footer = get_font_headers(style);

let footer_row = Row::new()
.width(Length::Fill)
.padding([0, 20])
.align_items(Alignment::Center)
.push(
Text::new(format!("Sniffnet v{APP_VERSION} - by Giuliano Bellini "))
Text::new(format!("Version {APP_VERSION} "))
.size(FONT_SIZE_FOOTER)
.font(font_footer),
)
.push(horizontal_space(Length::FillPortion(1)))
.push(get_button_github(style))
.push(Text::new(" ").font(font));
.push(horizontal_space(Length::FillPortion(1)))
.push(
Text::new("Made with ❤ by Giuliano Bellini")
.size(FONT_SIZE_FOOTER)
.font(font_footer),
);

Container::new(footer_row)
.height(FillPortion(HEIGHT_FOOTER))
.height(Length::Fixed(45.0))
.width(Length::Fill)
.align_y(Vertical::Center)
.align_x(Horizontal::Center)
Expand All @@ -42,16 +47,16 @@ pub fn get_button_github(style: StyleType) -> Tooltip<'static, Message> {
let content = button(
Text::new('H'.to_string())
.font(ICONS)
.size(24)
.size(28)
.horizontal_alignment(Horizontal::Center)
.vertical_alignment(Vertical::Center),
)
.height(Length::Fixed(35.0))
.width(Length::Fixed(35.0))
.height(Length::Fixed(40.0))
.width(Length::Fixed(40.0))
.style(StyleTuple(style, ElementType::Standard).into())
.on_press(Message::OpenGithub);

Tooltip::new(content, "GitHub", Position::Right)
Tooltip::new(content, "GitHub", Position::Top)
.font(get_font(style))
.style(<StyleTuple as Into<iced::theme::Container>>::into(
StyleTuple(style, ElementType::Tooltip),
Expand Down
6 changes: 3 additions & 3 deletions src/gui/components/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::enums::element_type::ElementType;
use crate::enums::message::Message;
use crate::enums::settings_page::SettingsPage;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::style_constants::{get_font, HEIGHT_HEADER, ICONS};
use crate::utility::style_constants::{get_font, ICONS};
use crate::utility::translations::{quit_analysis_translation, settings_translation};
use crate::{Language, StyleType};
use iced::alignment::{Horizontal, Vertical};
Expand All @@ -22,7 +22,7 @@ pub fn header(
let logo = Text::new('A'.to_string())
.font(ICONS)
.horizontal_alignment(Horizontal::Center)
.size(95);
.size(100);

Container::new(
Row::new()
Expand Down Expand Up @@ -57,7 +57,7 @@ pub fn header(
)
.push(horizontal_space(Length::Fixed(15.0))),
)
.height(FillPortion(HEIGHT_HEADER))
.height(Length::Fixed(95.0))
.align_y(Vertical::Center)
.width(Length::Fill)
.style(<StyleTuple as Into<iced::theme::Container>>::into(
Expand Down
15 changes: 7 additions & 8 deletions src/gui/pages/initial_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use crate::enums::message::Message;
use crate::gui::components::radio::{ip_version_radios, transport_protocol_radios};
use crate::structs::sniffer::Sniffer;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::style_constants::{
get_font, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE, HEIGHT_BODY, ICONS,
};
use crate::utility::style_constants::{get_font, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE, ICONS};
use crate::utility::translations::{
address_translation, addresses_translation, all_translation, application_protocol_translation,
choose_adapters_translation, select_filters_translation, start_translation,
Expand Down Expand Up @@ -103,11 +101,12 @@ pub fn initial_page(sniffer: &Sniffer) -> Container<Message> {
.push(filters),
);

Container::new(body)
.height(FillPortion(HEIGHT_BODY))
.style(<StyleTuple as Into<iced::theme::Container>>::into(
StyleTuple(sniffer.style, ElementType::Standard),
))
Container::new(body).height(Length::Fill).style(
<StyleTuple as Into<iced::theme::Container>>::into(StyleTuple(
sniffer.style,
ElementType::Standard,
)),
)
}

pub fn button_start(style: StyleType, language: Language) -> Tooltip<'static, Message> {
Expand Down
6 changes: 3 additions & 3 deletions src/gui/pages/notifications_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::gui::components::tab::get_pages_tabs;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::countries::get_flag_from_country_code;
use crate::utility::get_formatted_strings::get_formatted_bytes_string;
use crate::utility::style_constants::{get_font, FONT_SIZE_FOOTER, HEIGHT_BODY, ICONS};
use crate::utility::style_constants::{get_font, FONT_SIZE_FOOTER, ICONS};
use crate::utility::translations::{
application_protocol_translation, bytes_exceeded_translation, bytes_exceeded_value_translation,
clear_all_translation, favorite_transmitted_translation, incoming_translation,
Expand Down Expand Up @@ -40,7 +40,7 @@ pub fn notifications_page(sniffer: &Sniffer) -> Container<Message> {

let mut tab_and_body = Column::new()
.align_items(Alignment::Center)
.height(FillPortion(HEIGHT_BODY));
.height(Length::Fill);

let tabs = get_pages_tabs(
[
Expand Down Expand Up @@ -171,7 +171,7 @@ pub fn notifications_page(sniffer: &Sniffer) -> Container<Message> {
}

Container::new(Column::new().push(tab_and_body))
.height(FillPortion(HEIGHT_BODY))
.height(Length::Fill)
.style(<StyleTuple as Into<iced::theme::Container>>::into(
StyleTuple(sniffer.style, ElementType::Standard),
))
Expand Down
6 changes: 3 additions & 3 deletions src/gui/pages/overview_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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_report_path,
};
use crate::utility::style_constants::{get_font, HEIGHT_BODY, ICONS, SARASA_MONO_SC_BOLD};
use crate::utility::style_constants::{get_font, ICONS, SARASA_MONO_SC_BOLD};
use crate::utility::translations::{
error_translation, filtered_application_translation, filtered_bytes_translation,
filtered_packets_translation, no_addresses_translation, no_favorites_translation,
Expand All @@ -41,7 +41,7 @@ pub fn overview_page(sniffer: &Sniffer) -> Container<Message> {
.spacing(5)
.align_items(Alignment::Center);

let mut tab_and_body = Column::new().height(FillPortion(HEIGHT_BODY));
let mut tab_and_body = Column::new().height(Length::Fill);

if sniffer.pcap_error.is_none() {
// NO pcap error detected
Expand Down Expand Up @@ -380,7 +380,7 @@ pub fn overview_page(sniffer: &Sniffer) -> Container<Message> {
}

Container::new(Column::new().push(tab_and_body.push(body)))
.height(FillPortion(HEIGHT_BODY))
.height(Length::Fill)
.style(<StyleTuple as Into<iced::theme::Container>>::into(
StyleTuple(sniffer.style, ElementType::Standard),
))
Expand Down
7 changes: 1 addition & 6 deletions src/utility/style_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub const DEEP_SEA: &[u8] = include_bytes!("../../resources/palettes/DeepSea.png
pub const MON_AMOUR: &[u8] = include_bytes!("../../resources/palettes/MonAmour.png");

// font sizes
pub const FONT_SIZE_FOOTER: f32 = 17.0;
pub const FONT_SIZE_FOOTER: f32 = 18.0;
pub const FONT_SIZE_BODY: f32 = 21.0;
pub const FONT_SIZE_SUBTITLE: f32 = 23.0;
pub const FONT_SIZE_TITLE: f32 = 25.0;
Expand All @@ -183,11 +183,6 @@ pub const CHARTS_LINE_BORDER: u32 = 1;
pub const BORDER_ROUNDED_RADIUS: f32 = 15.0;
pub const BORDER_BUTTON_RADIUS: f32 = 180.0;

// body proportions
pub const HEIGHT_HEADER: u16 = 2;
pub const HEIGHT_BODY: u16 = 12;
pub const HEIGHT_FOOTER: u16 = 1;

// stars yellow colors
pub const STARRED: Color = Color {
r: 245.0 / 255.0,
Expand Down