From 6190bc5ceddbba5bc216eb0c08f1cb50c466bbbf Mon Sep 17 00:00:00 2001 From: B0ney <40839054+B0ney@users.noreply.github.com> Date: Sun, 5 Nov 2023 16:33:32 +0000 Subject: [PATCH] add hint for file size filter --- data/src/config/filters/size.rs | 6 +++--- src/screen/config/custom_filters/file_size.rs | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/data/src/config/filters/size.rs b/data/src/config/filters/size.rs index ef886d59..9b8a2047 100644 --- a/data/src/config/filters/size.rs +++ b/data/src/config/filters/size.rs @@ -66,9 +66,9 @@ impl std::fmt::Display for Modifier { f, "{}", match self { - Modifier::B => "Bytes", - Modifier::KB => "KiloBytes", - Modifier::MB => "MegaBytes", + Modifier::B => "bytes", + Modifier::KB => "KB", + Modifier::MB => "MB", } ) } diff --git a/src/screen/config/custom_filters/file_size.rs b/src/screen/config/custom_filters/file_size.rs index c3e622fb..bbce752a 100644 --- a/src/screen/config/custom_filters/file_size.rs +++ b/src/screen/config/custom_filters/file_size.rs @@ -4,7 +4,7 @@ use crate::widget::helpers::control; use crate::theme::TextInputStyle; use crate::widget::Element; use data::config::filters::{size::Modifier, Size}; -use iced::widget::{column, pick_list, row, slider, text_input}; +use iced::widget::{column, pick_list, row, slider, text_input, text, horizontal_rule}; #[derive(Debug, Clone, Copy)] pub enum Message { @@ -18,7 +18,7 @@ pub enum Message { pub fn view<'a>(filter: &Size) -> Element<'a, Message> { let settings = column![ row![ - "MIN:", + "Min:", text_input("", &format!("{}", filter.min)).on_input(|input| { if input.is_empty() { return Message::SetMin(0); @@ -34,7 +34,7 @@ pub fn view<'a>(filter: &Size) -> Element<'a, Message> { .spacing(8) .align_items(iced::Alignment::Center), row![ - "MAX:", + "Max:", text_input("", &format!("{}", filter.max)).on_input(|input| { if input.is_empty() { return Message::SetMax(0); @@ -49,7 +49,9 @@ pub fn view<'a>(filter: &Size) -> Element<'a, Message> { pick_list(Modifier::ALL, Some(filter.max_modifier), Message::SetMaxModifier) ] .spacing(8) - .align_items(iced::Alignment::Center) + .align_items(iced::Alignment::Center), + horizontal_rule(1), + text("Hint: 1000 bytes = 1 KB, 1000 KB = 1 MB"), ] .spacing(8); control("File Size", settings).into()