mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2026-10-25 00:21:12 +00:00
created Icon enum to better manage icons
This commit is contained in:
parent
dc41bbdc5c
commit
c747f320c2
14 changed files with 226 additions and 131 deletions
113
Cargo.lock
generated
113
Cargo.lock
generated
|
|
@ -57,9 +57,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.0.2"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
|
||||
checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
@ -237,9 +237,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.3.3"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
|
||||
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
|
||||
|
||||
[[package]]
|
||||
name = "block"
|
||||
|
|
@ -790,9 +790,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.26"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743"
|
||||
checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
|
|
@ -1208,9 +1208,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
|||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
|
|
@ -1667,9 +1667,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.19"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
|
|
@ -2183,9 +2183,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "palette"
|
||||
version = "0.7.2"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1641aee47803391405d0a1250e837d2336fdddd18b27f3ddb8c1d80ce8d7f43"
|
||||
checksum = "b2e2f34147767aa758aa649415b50a69eeb46a67f9dc7db8011eeb3d84b351dc"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"fast-srgb8",
|
||||
|
|
@ -2195,9 +2195,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "palette_derive"
|
||||
version = "0.7.2"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c02bfa6b3ba8af5434fa0531bf5701f750d983d4260acd6867faca51cdc4484"
|
||||
checksum = "b7db010ec5ff3d4385e4f133916faacd9dad0f6a09394c92d825b3aed310fa0a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -2249,7 +2249,7 @@ dependencies = [
|
|||
"libc",
|
||||
"redox_syscall 0.3.5",
|
||||
"smallvec",
|
||||
"windows-targets 0.48.1",
|
||||
"windows-targets 0.48.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2329,9 +2329,9 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
|
|||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c516611246607d0c04186886dbb3a754368ef82c79e9827a802c6d836dd111c"
|
||||
checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
|
|
@ -2758,9 +2758,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.101.2"
|
||||
version = "0.101.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "513722fd73ad80a71f72b61009ea1b584bcfa1483ca93949c8f290298837fa59"
|
||||
checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
|
|
@ -3203,18 +3203,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.44"
|
||||
version = "1.0.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
|
||||
checksum = "dedd246497092a89beedfe2c9f176d44c1b672ea6090edc20544ade01fbb7ea0"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.44"
|
||||
version = "1.0.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
|
||||
checksum = "7d7b1fadccbbc7e19ea64708629f9d8dccd007c260d66485f20a6d41bc1cf4b3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -3289,18 +3289,17 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.29.1"
|
||||
version = "1.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da"
|
||||
checksum = "40de3a2ba249dcb097e01be5e67a5ff53cf250397715a071a81543e8a832a920"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"pin-project-lite",
|
||||
"socket2 0.4.9",
|
||||
"socket2 0.5.3",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
|
|
@ -3870,7 +3869,7 @@ checksum = "8f478237b4bf0d5b70a39898a66fa67ca3a007d79f2520485b8b0c3dfc46f8c2"
|
|||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
"bitflags 2.3.3",
|
||||
"bitflags 2.4.0",
|
||||
"codespan-reporting",
|
||||
"log",
|
||||
"naga",
|
||||
|
|
@ -3895,7 +3894,7 @@ dependencies = [
|
|||
"arrayvec",
|
||||
"ash",
|
||||
"bit-set",
|
||||
"bitflags 2.3.3",
|
||||
"bitflags 2.4.0",
|
||||
"block",
|
||||
"core-graphics-types",
|
||||
"d3d12",
|
||||
|
|
@ -3933,7 +3932,7 @@ version = "0.16.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0c153280bb108c2979eb5c7391cb18c56642dd3c072e55f52065e13e2a1252a"
|
||||
dependencies = [
|
||||
"bitflags 2.3.3",
|
||||
"bitflags 2.4.0",
|
||||
"js-sys",
|
||||
"web-sys",
|
||||
]
|
||||
|
|
@ -4022,7 +4021,7 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.1",
|
||||
"windows-targets 0.48.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4053,7 +4052,7 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.1",
|
||||
"windows-targets 0.48.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4073,17 +4072,17 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.1"
|
||||
version = "0.48.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
|
||||
checksum = "d1eeca1c172a285ee6c2c84c341ccea837e7c01b12fbb2d0fe3c9e550ce49ec8"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.0",
|
||||
"windows_aarch64_msvc 0.48.0",
|
||||
"windows_i686_gnu 0.48.0",
|
||||
"windows_i686_msvc 0.48.0",
|
||||
"windows_x86_64_gnu 0.48.0",
|
||||
"windows_x86_64_gnullvm 0.48.0",
|
||||
"windows_x86_64_msvc 0.48.0",
|
||||
"windows_aarch64_gnullvm 0.48.2",
|
||||
"windows_aarch64_msvc 0.48.2",
|
||||
"windows_i686_gnu 0.48.2",
|
||||
"windows_i686_msvc 0.48.2",
|
||||
"windows_x86_64_gnu 0.48.2",
|
||||
"windows_x86_64_gnullvm 0.48.2",
|
||||
"windows_x86_64_msvc 0.48.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4094,9 +4093,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.0"
|
||||
version = "0.48.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
|
||||
checksum = "b10d0c968ba7f6166195e13d593af609ec2e3d24f916f081690695cf5eaffb2f"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
|
|
@ -4112,9 +4111,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.0"
|
||||
version = "0.48.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
|
||||
checksum = "571d8d4e62f26d4932099a9efe89660e8bd5087775a2ab5cdd8b747b811f1058"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
|
|
@ -4130,9 +4129,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.0"
|
||||
version = "0.48.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
|
||||
checksum = "2229ad223e178db5fbbc8bd8d3835e51e566b8474bfca58d2e6150c48bb723cd"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
|
|
@ -4148,9 +4147,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.0"
|
||||
version = "0.48.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
|
||||
checksum = "600956e2d840c194eedfc5d18f8242bc2e17c7775b6684488af3a9fff6fe3287"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
|
|
@ -4166,9 +4165,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.0"
|
||||
version = "0.48.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
|
||||
checksum = "ea99ff3f8b49fb7a8e0d305e5aec485bd068c2ba691b6e277d29eaeac945868a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
|
|
@ -4178,9 +4177,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.0"
|
||||
version = "0.48.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
|
||||
checksum = "8f1a05a1ece9a7a0d5a7ccf30ba2c33e3a61a30e042ffd247567d1de1d94120d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
|
|
@ -4196,9 +4195,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.0"
|
||||
version = "0.48.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
||||
checksum = "d419259aba16b663966e29e6d7c6ecfa0bb8425818bb96f6f1f3c3eb71a6e7b9"
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
|
|
@ -4237,9 +4236,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.4"
|
||||
version = "0.5.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acaaa1190073b2b101e15083c38ee8ec891b5e05cbee516521e94ec008f61e64"
|
||||
checksum = "5504cc7644f4b593cbc05c4a55bf9bd4e94b867c3c0bd440934174d50482427d"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -10,13 +10,14 @@ use iced::{Alignment, Font, Length, Renderer};
|
|||
|
||||
use crate::gui::styles::button::ButtonType;
|
||||
use crate::gui::styles::container::ContainerType;
|
||||
use crate::gui::styles::style_constants::{FONT_SIZE_FOOTER, FONT_SIZE_SUBTITLE, ICONS};
|
||||
use crate::gui::styles::style_constants::{FONT_SIZE_FOOTER, FONT_SIZE_SUBTITLE};
|
||||
use crate::gui::styles::text::TextType;
|
||||
use crate::gui::styles::types::gradient_type::GradientType;
|
||||
use crate::gui::styles::types::style_type::StyleType;
|
||||
use crate::gui::types::message::Message;
|
||||
use crate::translations::translations_2::new_version_available_translation;
|
||||
use crate::utils::formatted_strings::APP_VERSION;
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::utils::types::web_page::WebPage;
|
||||
use crate::Language;
|
||||
|
||||
|
|
@ -57,8 +58,8 @@ pub fn footer(
|
|||
|
||||
fn get_button_website(font: Font) -> Tooltip<'static, Message, Renderer<StyleType>> {
|
||||
let content = button(
|
||||
Text::new('c'.to_string())
|
||||
.font(ICONS)
|
||||
Icon::Globe
|
||||
.to_text()
|
||||
.size(17)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.vertical_alignment(Vertical::Center),
|
||||
|
|
@ -74,8 +75,8 @@ fn get_button_website(font: Font) -> Tooltip<'static, Message, Renderer<StyleTyp
|
|||
|
||||
fn get_button_github(font: Font) -> Tooltip<'static, Message, Renderer<StyleType>> {
|
||||
let content = button(
|
||||
Text::new('H'.to_string())
|
||||
.font(ICONS)
|
||||
Icon::GitHub
|
||||
.to_text()
|
||||
.size(26)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.vertical_alignment(Vertical::Center),
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
use iced::alignment::{Horizontal, Vertical};
|
||||
use iced::widget::text::LineHeight;
|
||||
use iced::widget::tooltip::Position;
|
||||
use iced::widget::{button, Container, Row, Text, Tooltip};
|
||||
use iced::widget::{button, Container, Row, Tooltip};
|
||||
use iced::Length::FillPortion;
|
||||
use iced::{Alignment, Font, Length, Renderer};
|
||||
|
||||
use crate::gui::pages::types::settings_page::SettingsPage;
|
||||
use crate::gui::styles::container::ContainerType;
|
||||
use crate::gui::styles::style_constants::ICONS;
|
||||
use crate::gui::styles::types::gradient_type::GradientType;
|
||||
use crate::gui::types::message::Message;
|
||||
use crate::translations::translations::{quit_analysis_translation, settings_translation};
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{Language, StyleType};
|
||||
|
||||
pub fn header(
|
||||
|
|
@ -22,8 +22,8 @@ pub fn header(
|
|||
language: Language,
|
||||
last_opened_setting: SettingsPage,
|
||||
) -> Container<'static, Message, Renderer<StyleType>> {
|
||||
let logo = Text::new('A'.to_string())
|
||||
.font(ICONS)
|
||||
let logo = Icon::Sniffnet
|
||||
.to_text()
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.width(FillPortion(6))
|
||||
|
|
@ -63,8 +63,8 @@ fn get_button_reset(
|
|||
language: Language,
|
||||
) -> Tooltip<'static, Message, Renderer<StyleType>> {
|
||||
let content = button(
|
||||
Text::new('C'.to_string())
|
||||
.font(ICONS)
|
||||
Icon::ArrowBack
|
||||
.to_text()
|
||||
.size(20)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.vertical_alignment(Vertical::Center),
|
||||
|
|
@ -89,8 +89,8 @@ pub fn get_button_settings(
|
|||
open_overlay: SettingsPage,
|
||||
) -> Tooltip<'static, Message, Renderer<StyleType>> {
|
||||
let content = button(
|
||||
Text::new("a")
|
||||
.font(ICONS)
|
||||
Icon::Settings
|
||||
.to_text()
|
||||
.size(20.5)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.vertical_alignment(Vertical::Center),
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use iced::{Alignment, Font, Length, Renderer};
|
|||
use crate::countries::country_utils::{get_computer_tooltip, get_flag_tooltip};
|
||||
use crate::countries::flags_pictures::FLAGS_WIDTH_BIG;
|
||||
use crate::gui::styles::container::ContainerType;
|
||||
use crate::gui::styles::style_constants::{get_font, get_font_headers, FONT_SIZE_TITLE, ICONS};
|
||||
use crate::gui::styles::style_constants::{get_font, get_font_headers, FONT_SIZE_TITLE};
|
||||
use crate::gui::styles::text::TextType;
|
||||
use crate::gui::styles::types::gradient_type::GradientType;
|
||||
use crate::gui::types::message::Message;
|
||||
|
|
@ -29,6 +29,7 @@ use crate::translations::translations_2::{
|
|||
transmitted_data_translation,
|
||||
};
|
||||
use crate::utils::formatted_strings::{get_formatted_bytes_string_with_b, get_socket_address};
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{Language, Sniffer, StyleType};
|
||||
|
||||
pub fn connection_details_page(
|
||||
|
|
@ -201,7 +202,7 @@ fn col_info(
|
|||
.width(Length::FillPortion(2))
|
||||
.push(vertical_space(Length::FillPortion(1)))
|
||||
.push(
|
||||
Row::new().spacing(5).push(Text::new("9").font(ICONS)).push(
|
||||
Row::new().spacing(5).push(Icon::Clock.to_text()).push(
|
||||
Text::new(format!(
|
||||
"{} - {}",
|
||||
val.initial_timestamp.to_string().get(11..19).unwrap(),
|
||||
|
|
@ -350,7 +351,7 @@ fn assemble_widgets(
|
|||
.spacing(5)
|
||||
.push(vertical_space(Length::FillPortion(1)))
|
||||
.push(source_container)
|
||||
.push(Text::new(":").font(ICONS))
|
||||
.push(Icon::ArrowsDown.to_text())
|
||||
.push(dest_container)
|
||||
.push(vertical_space(Length::FillPortion(1))),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use crate::gui::components::radio::{ip_version_radios, transport_protocol_radios
|
|||
use crate::gui::styles::button::ButtonType;
|
||||
use crate::gui::styles::container::ContainerType;
|
||||
use crate::gui::styles::scrollbar::ScrollbarType;
|
||||
use crate::gui::styles::style_constants::{get_font, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE, ICONS};
|
||||
use crate::gui::styles::style_constants::{get_font, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE};
|
||||
use crate::gui::styles::text::TextType;
|
||||
use crate::gui::styles::types::gradient_type::GradientType;
|
||||
use crate::gui::types::message::Message;
|
||||
|
|
@ -25,6 +25,7 @@ use crate::translations::translations::{
|
|||
address_translation, addresses_translation, all_translation, application_protocol_translation,
|
||||
choose_adapters_translation, select_filters_translation, start_translation,
|
||||
};
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{AppProtocol, Language, StyleType};
|
||||
|
||||
/// Computes the body of gui initial page
|
||||
|
|
@ -116,8 +117,8 @@ fn button_start(
|
|||
color_gradient: GradientType,
|
||||
) -> Tooltip<'static, Message, Renderer<StyleType>> {
|
||||
let content = button(
|
||||
Text::new("S")
|
||||
.font(ICONS)
|
||||
Icon::Rocket
|
||||
.to_text()
|
||||
.size(25)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.vertical_alignment(alignment::Vertical::Center),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use crate::gui::components::types::my_modal::MyModal;
|
|||
use crate::gui::styles::button::ButtonType;
|
||||
use crate::gui::styles::container::ContainerType;
|
||||
use crate::gui::styles::scrollbar::ScrollbarType;
|
||||
use crate::gui::styles::style_constants::{get_font, get_font_headers, FONT_SIZE_TITLE, ICONS};
|
||||
use crate::gui::styles::style_constants::{get_font, get_font_headers, FONT_SIZE_TITLE};
|
||||
use crate::gui::styles::text::TextType;
|
||||
use crate::gui::styles::text_input::TextInputType;
|
||||
use crate::gui::types::message::Message;
|
||||
|
|
@ -26,6 +26,7 @@ use crate::translations::translations_2::{
|
|||
showing_results_translation, sort_by_translation,
|
||||
};
|
||||
use crate::utils::formatted_strings::get_open_report_tooltip;
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{Language, ReportSortType, RunningPage, Sniffer, StyleType};
|
||||
|
||||
/// Computes the body of gui inspect page
|
||||
|
|
@ -184,7 +185,7 @@ fn lazy_report(sniffer: &Sniffer) -> Row<'static, Message, Renderer<StyleType>>
|
|||
.padding(20)
|
||||
.align_items(Alignment::Center)
|
||||
.push(vertical_space(Length::FillPortion(1)))
|
||||
.push(Text::new('V'.to_string()).font(ICONS).size(60))
|
||||
.push(Icon::Funnel.to_text().size(60))
|
||||
.push(vertical_space(Length::Fixed(15.0)))
|
||||
.push(Text::new(no_search_results_translation(sniffer.language)).font(font))
|
||||
.push(vertical_space(Length::FillPortion(2))),
|
||||
|
|
@ -378,11 +379,15 @@ fn filter_input(
|
|||
|
||||
fn get_button_change_page(increment: bool) -> Button<'static, Message, Renderer<StyleType>> {
|
||||
button(
|
||||
Text::new(if increment { "j" } else { "i" })
|
||||
.size(8.0)
|
||||
.font(ICONS)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.vertical_alignment(alignment::Vertical::Center),
|
||||
if increment {
|
||||
Icon::ArrowRight
|
||||
} else {
|
||||
Icon::ArrowLeft
|
||||
}
|
||||
.to_text()
|
||||
.size(8.0)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.vertical_alignment(alignment::Vertical::Center),
|
||||
)
|
||||
.padding(2)
|
||||
.height(Length::Fixed(20.0))
|
||||
|
|
@ -429,8 +434,8 @@ fn get_button_open_report(
|
|||
font: Font,
|
||||
) -> Tooltip<'static, Message, Renderer<StyleType>> {
|
||||
let content = button(
|
||||
Text::new('8'.to_string())
|
||||
.font(ICONS)
|
||||
Icon::File
|
||||
.to_text()
|
||||
.size(21)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.vertical_alignment(alignment::Vertical::Center),
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use crate::gui::components::types::my_modal::MyModal;
|
|||
use crate::gui::pages::types::settings_page::SettingsPage;
|
||||
use crate::gui::styles::container::ContainerType;
|
||||
use crate::gui::styles::scrollbar::ScrollbarType;
|
||||
use crate::gui::styles::style_constants::{get_font, get_font_headers, FONT_SIZE_FOOTER, ICONS};
|
||||
use crate::gui::styles::style_constants::{get_font, get_font_headers, FONT_SIZE_FOOTER};
|
||||
use crate::gui::styles::text::TextType;
|
||||
use crate::gui::types::message::Message;
|
||||
use crate::notifications::types::logged_notification::{
|
||||
|
|
@ -28,6 +28,7 @@ use crate::translations::translations::{
|
|||
threshold_translation,
|
||||
};
|
||||
use crate::utils::formatted_strings::get_formatted_bytes_string_with_b;
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{Language, RunningPage, Sniffer, StyleType};
|
||||
|
||||
/// Computes the body of gui notifications page
|
||||
|
|
@ -171,7 +172,7 @@ fn packets_notification_log(
|
|||
.spacing(30)
|
||||
.push(
|
||||
Tooltip::new(
|
||||
Text::new("e").font(ICONS).size(80),
|
||||
Icon::PacketsThreshold.to_text().size(80),
|
||||
packets_exceeded_translation(language),
|
||||
Position::FollowCursor,
|
||||
)
|
||||
|
|
@ -185,7 +186,7 @@ fn packets_notification_log(
|
|||
.push(
|
||||
Row::new()
|
||||
.spacing(5)
|
||||
.push(Text::new("9").font(ICONS))
|
||||
.push(Icon::Clock.to_text())
|
||||
.push(Text::new(logged_notification.timestamp).font(font)),
|
||||
)
|
||||
.push(
|
||||
|
|
@ -250,7 +251,7 @@ fn bytes_notification_log(
|
|||
.height(Length::Fill)
|
||||
.push(
|
||||
Tooltip::new(
|
||||
Text::new("f").font(ICONS).size(80),
|
||||
Icon::BytesThreshold.to_text().size(80),
|
||||
bytes_exceeded_translation(language),
|
||||
Position::FollowCursor,
|
||||
)
|
||||
|
|
@ -264,7 +265,7 @@ fn bytes_notification_log(
|
|||
.push(
|
||||
Row::new()
|
||||
.spacing(5)
|
||||
.push(Text::new("9").font(ICONS))
|
||||
.push(Icon::Clock.to_text())
|
||||
.push(Text::new(logged_notification.timestamp).font(font)),
|
||||
)
|
||||
.push(
|
||||
|
|
@ -334,7 +335,7 @@ fn favorite_notification_log(
|
|||
.height(Length::Fill)
|
||||
.push(
|
||||
Tooltip::new(
|
||||
Text::new("g").font(ICONS).size(80),
|
||||
Icon::Star.to_text().size(80),
|
||||
favorite_transmitted_translation(language),
|
||||
Position::FollowCursor,
|
||||
)
|
||||
|
|
@ -348,7 +349,7 @@ fn favorite_notification_log(
|
|||
.push(
|
||||
Row::new()
|
||||
.spacing(5)
|
||||
.push(Text::new("9").font(ICONS))
|
||||
.push(Icon::Clock.to_text())
|
||||
.push(Text::new(logged_notification.timestamp).font(font)),
|
||||
)
|
||||
.push(
|
||||
|
|
@ -375,8 +376,8 @@ fn get_button_clear_all(
|
|||
language: Language,
|
||||
) -> Tooltip<'static, Message, Renderer<StyleType>> {
|
||||
let content = button(
|
||||
Text::new('h'.to_string())
|
||||
.font(ICONS)
|
||||
Icon::Bin
|
||||
.to_text()
|
||||
.size(20)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.vertical_alignment(Vertical::Center),
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use crate::gui::styles::button::ButtonType;
|
|||
use crate::gui::styles::container::ContainerType;
|
||||
use crate::gui::styles::rule::RuleType;
|
||||
use crate::gui::styles::scrollbar::ScrollbarType;
|
||||
use crate::gui::styles::style_constants::{get_font, get_font_headers, FONT_SIZE_TITLE, ICONS};
|
||||
use crate::gui::styles::style_constants::{get_font, get_font_headers, FONT_SIZE_TITLE};
|
||||
use crate::gui::styles::text::TextType;
|
||||
use crate::gui::types::message::Message;
|
||||
use crate::gui::types::sniffer::Sniffer;
|
||||
|
|
@ -40,6 +40,7 @@ use crate::translations::translations_2::{
|
|||
use crate::utils::formatted_strings::{
|
||||
get_active_filters_col, get_formatted_bytes_string_with_b, get_percentage_string,
|
||||
};
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{AppProtocol, ChartType, Language, RunningPage, StyleType};
|
||||
|
||||
/// Computes the body of gui overview page
|
||||
|
|
@ -190,14 +191,14 @@ fn body_no_packets(
|
|||
let adapter_name = device.name.clone();
|
||||
let (icon_text, nothing_to_see_text) = if device.addresses.lock().unwrap().is_empty() {
|
||||
(
|
||||
Text::new('T'.to_string()).font(ICONS).size(60),
|
||||
Icon::Warning.to_text().size(60),
|
||||
no_addresses_translation(language, &adapter_name)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.font(font),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
Text::new(waiting.len().to_string()).font(ICONS).size(60),
|
||||
Icon::get_hourglass(waiting.len()).size(60),
|
||||
waiting_translation(language, &adapter_name)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.font(font),
|
||||
|
|
@ -234,7 +235,7 @@ fn body_no_observed(
|
|||
.spacing(10)
|
||||
.align_items(Alignment::Center)
|
||||
.push(vertical_space(FillPortion(1)))
|
||||
.push(Text::new('V'.to_string()).font(ICONS).size(60))
|
||||
.push(Icon::Funnel.to_text().size(60))
|
||||
.push(vertical_space(Length::Fixed(15.0)))
|
||||
.push(tot_packets_text)
|
||||
.push(get_active_filters_col(filters, language, font))
|
||||
|
|
@ -259,7 +260,7 @@ fn body_pcap_error(
|
|||
.spacing(10)
|
||||
.align_items(Alignment::Center)
|
||||
.push(vertical_space(FillPortion(1)))
|
||||
.push(Text::new('U'.to_string()).font(ICONS).size(60))
|
||||
.push(Icon::Error.to_text().size(60))
|
||||
.push(vertical_space(Length::Fixed(15.0)))
|
||||
.push(error_text)
|
||||
.push(Text::new(waiting.to_owned()).font(font).size(50))
|
||||
|
|
@ -316,8 +317,8 @@ fn col_host(width: f32, sniffer: &Sniffer) -> Column<'static, Message, Renderer<
|
|||
);
|
||||
|
||||
let star_button = button(
|
||||
Text::new('g'.to_string())
|
||||
.font(ICONS)
|
||||
Icon::Star
|
||||
.to_text()
|
||||
.size(20)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.vertical_alignment(Vertical::Center),
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use crate::gui::pages::types::settings_page::SettingsPage;
|
|||
use crate::gui::styles::container::ContainerType;
|
||||
use crate::gui::styles::scrollbar::ScrollbarType;
|
||||
use crate::gui::styles::style_constants::{
|
||||
get_font, get_font_headers, FONT_SIZE_FOOTER, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE, ICONS,
|
||||
get_font, get_font_headers, FONT_SIZE_FOOTER, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE,
|
||||
};
|
||||
use crate::gui::styles::text::TextType;
|
||||
use crate::gui::styles::types::gradient_type::GradientType;
|
||||
|
|
@ -30,6 +30,7 @@ use crate::translations::translations::{
|
|||
notifications_title_translation, packets_threshold_translation, per_second_translation,
|
||||
settings_translation, specify_multiples_translation, threshold_translation, volume_translation,
|
||||
};
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{Language, Sniffer, StyleType};
|
||||
|
||||
pub fn settings_notifications_page(sniffer: &Sniffer) -> Container<Message, Renderer<StyleType>> {
|
||||
|
|
@ -370,11 +371,11 @@ fn volume_slider(
|
|||
.push(
|
||||
Row::new()
|
||||
.push(
|
||||
Text::new('Y'.to_string())
|
||||
Icon::AudioMute
|
||||
.to_text()
|
||||
.width(Fixed(30.0))
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.size(20)
|
||||
.font(ICONS),
|
||||
.size(20),
|
||||
)
|
||||
.push(
|
||||
Slider::new(0..=100, volume, Message::ChangeVolume)
|
||||
|
|
@ -383,10 +384,10 @@ fn volume_slider(
|
|||
)
|
||||
.push(horizontal_space(Length::Fixed(15.0)))
|
||||
.push(
|
||||
Text::new("Z")
|
||||
Icon::AudioHigh
|
||||
.to_text()
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.size(20)
|
||||
.font(ICONS),
|
||||
.size(20),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use crate::gui::styles::container::ContainerType;
|
|||
use crate::gui::styles::rule::RuleType;
|
||||
use crate::gui::styles::scrollbar::ScrollbarType;
|
||||
use crate::gui::styles::style_constants::{
|
||||
get_font, get_font_headers, BORDER_WIDTH, FONT_SIZE_SUBTITLE, ICONS,
|
||||
get_font, get_font_headers, BORDER_WIDTH, FONT_SIZE_SUBTITLE,
|
||||
};
|
||||
use crate::gui::styles::text::TextType;
|
||||
use crate::gui::styles::types::custom_palette::ExtraStyles;
|
||||
|
|
@ -24,6 +24,7 @@ use crate::translations::translations::{
|
|||
yeti_day_translation, yeti_night_translation,
|
||||
};
|
||||
use crate::translations::translations_2::color_gradients_translation;
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::StyleType::{Day, DeepSea, MonAmour, Night};
|
||||
use crate::{Language, Sniffer, StyleType};
|
||||
|
||||
|
|
@ -123,8 +124,8 @@ fn gradients_row(
|
|||
.push(Text::new(format!("{}:", color_gradients_translation(language))).font(font))
|
||||
.push(
|
||||
button(
|
||||
Text::new("x")
|
||||
.font(ICONS)
|
||||
Icon::Forbidden
|
||||
.to_text()
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.size(12),
|
||||
|
|
@ -141,8 +142,8 @@ fn gradients_row(
|
|||
)
|
||||
.push(
|
||||
button(
|
||||
Text::new("y")
|
||||
.font(ICONS)
|
||||
Icon::Waves
|
||||
.to_text()
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.size(13),
|
||||
|
|
@ -159,8 +160,8 @@ fn gradients_row(
|
|||
)
|
||||
.push(
|
||||
button(
|
||||
Text::new("z")
|
||||
.font(ICONS)
|
||||
Icon::Lightning
|
||||
.to_text()
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.size(13),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
use iced::widget::Text;
|
||||
use iced::Renderer;
|
||||
|
||||
use crate::gui::styles::style_constants::ICONS;
|
||||
use crate::gui::types::message::Message;
|
||||
use crate::translations::translations::{notifications_translation, overview_translation};
|
||||
use crate::translations::translations_2::inspect_translation;
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{Language, StyleType};
|
||||
|
||||
/// This enum defines the current running page.
|
||||
|
|
@ -50,12 +49,12 @@ impl RunningPage {
|
|||
}
|
||||
|
||||
pub fn icon(self) -> iced::advanced::widget::Text<'static, Renderer<StyleType>> {
|
||||
let char = match self {
|
||||
RunningPage::Overview => "d",
|
||||
RunningPage::Inspect => "5",
|
||||
RunningPage::Notifications => "7",
|
||||
};
|
||||
Text::new(char).font(ICONS)
|
||||
match self {
|
||||
RunningPage::Overview => Icon::Overview,
|
||||
RunningPage::Inspect => Icon::Inspect,
|
||||
RunningPage::Notifications => Icon::Notification,
|
||||
}
|
||||
.to_text()
|
||||
}
|
||||
|
||||
pub fn action(self) -> Message {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
use iced::widget::Text;
|
||||
use iced::Renderer;
|
||||
|
||||
use crate::gui::styles::style_constants::ICONS;
|
||||
use crate::gui::types::message::Message;
|
||||
use crate::translations::translations::{
|
||||
language_translation, notifications_translation, style_translation,
|
||||
};
|
||||
use crate::utils::types::icon::Icon;
|
||||
use crate::{Language, StyleType};
|
||||
|
||||
/// This enum defines the current running page.
|
||||
|
|
@ -51,12 +50,12 @@ impl SettingsPage {
|
|||
}
|
||||
|
||||
pub fn icon(self) -> iced::advanced::widget::Text<'static, Renderer<StyleType>> {
|
||||
let char = match self {
|
||||
SettingsPage::Notifications => "7",
|
||||
SettingsPage::Appearance => "K",
|
||||
SettingsPage::Language => "c",
|
||||
};
|
||||
Text::new(char).font(ICONS)
|
||||
match self {
|
||||
SettingsPage::Notifications => Icon::Notification,
|
||||
SettingsPage::Appearance => Icon::HalfSun,
|
||||
SettingsPage::Language => Icon::Globe,
|
||||
}
|
||||
.to_text()
|
||||
}
|
||||
|
||||
pub fn action(self) -> Message {
|
||||
|
|
|
|||
85
src/utils/types/icon.rs
Normal file
85
src/utils/types/icon.rs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
use iced::widget::Text;
|
||||
use iced::Renderer;
|
||||
|
||||
use crate::gui::styles::style_constants::ICONS;
|
||||
use crate::StyleType;
|
||||
|
||||
pub enum Icon {
|
||||
ArrowBack,
|
||||
ArrowLeft,
|
||||
ArrowRight,
|
||||
ArrowsDown,
|
||||
AudioHigh,
|
||||
AudioMute,
|
||||
Bin,
|
||||
BytesThreshold,
|
||||
Clock,
|
||||
Error,
|
||||
File,
|
||||
Forbidden,
|
||||
Funnel,
|
||||
GitHub,
|
||||
Globe,
|
||||
HalfSun,
|
||||
Hourglass1,
|
||||
Hourglass2,
|
||||
Hourglass3,
|
||||
Inspect,
|
||||
Lightning,
|
||||
Notification,
|
||||
Overview,
|
||||
PacketsThreshold,
|
||||
Rocket,
|
||||
Settings,
|
||||
Sniffnet,
|
||||
Star,
|
||||
Warning,
|
||||
Waves,
|
||||
}
|
||||
|
||||
impl Icon {
|
||||
pub fn to_text(&self) -> iced::advanced::widget::Text<'static, Renderer<StyleType>> {
|
||||
Text::new(match self {
|
||||
Icon::ArrowBack => "C",
|
||||
Icon::ArrowLeft => "i",
|
||||
Icon::ArrowRight => "j",
|
||||
Icon::ArrowsDown => ":",
|
||||
Icon::AudioHigh => "Z",
|
||||
Icon::AudioMute => "Y",
|
||||
Icon::Bin => "h",
|
||||
Icon::BytesThreshold => "f",
|
||||
Icon::Clock => "9",
|
||||
Icon::Error => "U",
|
||||
Icon::File => "8",
|
||||
Icon::Forbidden => "x",
|
||||
Icon::Funnel => "V",
|
||||
Icon::GitHub => "H",
|
||||
Icon::Globe => "c",
|
||||
Icon::HalfSun => "K",
|
||||
Icon::Hourglass1 => "1",
|
||||
Icon::Hourglass2 => "2",
|
||||
Icon::Hourglass3 => "3",
|
||||
Icon::Inspect => "5",
|
||||
Icon::Lightning => "z",
|
||||
Icon::Notification => "7",
|
||||
Icon::Overview => "d",
|
||||
Icon::PacketsThreshold => "e",
|
||||
Icon::Rocket => "S",
|
||||
Icon::Settings => "a",
|
||||
Icon::Sniffnet => "A",
|
||||
Icon::Star => "g",
|
||||
Icon::Warning => "T",
|
||||
Icon::Waves => "y",
|
||||
})
|
||||
.font(ICONS)
|
||||
}
|
||||
|
||||
pub fn get_hourglass(num: usize) -> iced::advanced::widget::Text<'static, Renderer<StyleType>> {
|
||||
match num {
|
||||
1 => Icon::Hourglass1.to_text(),
|
||||
2 => Icon::Hourglass2.to_text(),
|
||||
3 => Icon::Hourglass3.to_text(),
|
||||
_ => Text::new(""),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1,2 @@
|
|||
pub mod icon;
|
||||
pub mod web_page;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue