diff --git a/src/gui/pages/settings_notifications_page.rs b/src/gui/pages/settings_notifications_page.rs index 4ac9069f..25825f27 100644 --- a/src/gui/pages/settings_notifications_page.rs +++ b/src/gui/pages/settings_notifications_page.rs @@ -65,7 +65,7 @@ pub fn settings_notifications_page(sniffer: &Sniffer) -> Container Container>::into(ScrollbarStyleTuple( - sniffer.style, - ScrollbarType::Standard, - )), - ), + .style(ScrollbarType::Standard), ); content = content.push(volume_notification_col); @@ -148,9 +143,7 @@ fn get_packets_notify( ) .size(18) .font(font) - .style(>::into( - CheckboxStyleTuple(style, CheckboxType::Standard), - )); + .style(CheckboxType::Standard); let mut ret_val = Column::new().spacing(5).push(checkbox); @@ -219,9 +212,7 @@ fn get_bytes_notify( ) .size(18) .font(font) - .style(>::into( - CheckboxStyleTuple(style, CheckboxType::Standard), - )); + .style(CheckboxType::Standard); let mut ret_val = Column::new().spacing(5).push(checkbox); @@ -281,9 +272,7 @@ fn get_favorite_notify( ) .size(18) .font(font) - .style(>::into( - CheckboxStyleTuple(style, CheckboxType::Standard), - )); + .style(CheckboxType::Standard); let mut ret_val = Column::new().spacing(5).push(checkbox); @@ -342,9 +331,7 @@ fn input_group_packets( .padding([0, 0, 0, 10]) .font(font) .width(Length::Fixed(100.0)) - .style(>::into( - TextInputStyleTuple(style, TextInputType::Standard), - )), + .style(TextInputType::Standard), ) .push( Text::new(per_second_translation(language)) @@ -387,9 +374,7 @@ fn input_group_bytes( .padding([0, 0, 0, 10]) .font(font) .width(Length::Fixed(100.0)) - .style(>::into( - TextInputStyleTuple(style, TextInputType::Standard), - )), + .style(TextInputType::Standard), ) .push( Text::new(info_str) @@ -426,9 +411,7 @@ fn volume_slider( Slider::new(0..=100, volume, Message::ChangeVolume) .step(5) .width(Fixed(200.0)) - .style(>::into( - SliderStyleTuple(style, SliderType::Standard), - )), + .style(SliderType::Standard), ) .push(horizontal_space(Length::Fixed(15.0))) .push( diff --git a/src/gui/styles/checkbox.rs b/src/gui/styles/checkbox.rs index fddffcab..80ddabc4 100644 --- a/src/gui/styles/checkbox.rs +++ b/src/gui/styles/checkbox.rs @@ -13,17 +13,17 @@ pub enum CheckboxType { #[derive(Clone)] pub struct CheckboxStyleTuple(pub StyleType, pub CheckboxType); -impl From for iced::theme::Checkbox { - fn from(tuple: CheckboxStyleTuple) -> Self { - iced::theme::Checkbox::Custom(Box::new(tuple)) - } -} +// impl From for iced::theme::Checkbox { +// fn from(tuple: CheckboxStyleTuple) -> Self { +// iced::theme::Checkbox::Custom(Box::new(tuple)) +// } +// } -impl iced::widget::checkbox::StyleSheet for CheckboxStyleTuple { - type Style = iced::Theme; +impl iced::widget::checkbox::StyleSheet for StyleType { + type Style = CheckboxType; fn active(&self, _: &Self::Style, is_checked: bool) -> Appearance { - let colors = get_colors(self.0); + let colors = get_colors(*self); Appearance { background: Background::Color(colors.buttons), icon_color: colors.text_body, @@ -35,7 +35,7 @@ impl iced::widget::checkbox::StyleSheet for CheckboxStyleTuple { } fn hovered(&self, _: &Self::Style, _is_checked: bool) -> Appearance { - let colors = get_colors(self.0); + let colors = get_colors(*self); Appearance { background: Background::Color(colors.buttons), icon_color: colors.text_body, diff --git a/src/gui/styles/slider.rs b/src/gui/styles/slider.rs index 82f45e98..29890a4d 100644 --- a/src/gui/styles/slider.rs +++ b/src/gui/styles/slider.rs @@ -15,17 +15,17 @@ pub enum SliderType { #[derive(Clone)] pub struct SliderStyleTuple(pub StyleType, pub SliderType); -impl From for iced::theme::Slider { - fn from(tuple: SliderStyleTuple) -> Self { - iced::theme::Slider::Custom(Box::new(tuple)) - } -} +// impl From for iced::theme::Slider { +// fn from(tuple: SliderStyleTuple) -> Self { +// iced::theme::Slider::Custom(Box::new(tuple)) +// } +// } -impl iced::widget::slider::StyleSheet for SliderStyleTuple { - type Style = iced::Theme; +impl iced::widget::slider::StyleSheet for StyleType { + type Style = SliderType; fn active(&self, _: &Self::Style) -> Appearance { - let colors = get_colors(self.0); + let colors = get_colors(*self); Appearance { rail: Rail { colors: (mix_colors(colors.secondary, colors.buttons), colors.buttons), @@ -42,7 +42,7 @@ impl iced::widget::slider::StyleSheet for SliderStyleTuple { } fn hovered(&self, _: &Self::Style) -> Appearance { - let colors = get_colors(self.0); + let colors = get_colors(*self); Appearance { rail: Rail { colors: (colors.secondary, colors.buttons), @@ -59,7 +59,7 @@ impl iced::widget::slider::StyleSheet for SliderStyleTuple { } fn dragging(&self, _: &Self::Style) -> Appearance { - let colors = get_colors(self.0); + let colors = get_colors(*self); Appearance { rail: Rail { colors: (colors.secondary, colors.buttons), diff --git a/src/gui/styles/text_input.rs b/src/gui/styles/text_input.rs index aa15a8f7..bc19736c 100644 --- a/src/gui/styles/text_input.rs +++ b/src/gui/styles/text_input.rs @@ -16,28 +16,28 @@ pub enum TextInputType { #[derive(Clone)] pub struct TextInputStyleTuple(pub StyleType, pub TextInputType); -impl From for iced::theme::TextInput { - fn from(tuple: TextInputStyleTuple) -> Self { - iced::theme::TextInput::Custom(Box::new(tuple)) - } -} +// impl From for iced::theme::TextInput { +// fn from(tuple: TextInputStyleTuple) -> Self { +// iced::theme::TextInput::Custom(Box::new(tuple)) +// } +// } -impl iced::widget::text_input::StyleSheet for TextInputStyleTuple { - type Style = iced::Theme; +impl iced::widget::text_input::StyleSheet for StyleType { + type Style = TextInputType; - fn active(&self, _: &Self::Style) -> iced::widget::text_input::Appearance { - let colors = get_colors(self.0); + fn active(&self, style: &Self::Style) -> iced::widget::text_input::Appearance { + let colors = get_colors(*self); Appearance { - background: Background::Color(match self.1 { + background: Background::Color(match style { TextInputType::Badge => Color::TRANSPARENT, TextInputType::Standard => colors.buttons, }), border_radius: 0.0.into(), border_width: 1.0, - border_color: match self.1 { + border_color: match style { TextInputType::Badge => Color::TRANSPARENT, TextInputType::Standard => Color { - a: get_alpha_round_borders(self.0), + a: get_alpha_round_borders(*self), ..colors.buttons }, }, @@ -45,8 +45,8 @@ impl iced::widget::text_input::StyleSheet for TextInputStyleTuple { } } - fn focused(&self, _: &Self::Style) -> iced::widget::text_input::Appearance { - let colors = get_colors(self.0); + fn focused(&self, style: &Self::Style) -> iced::widget::text_input::Appearance { + let colors = get_colors(*self); Appearance { background: Background::Color(colors.primary), border_radius: 0.0.into(), @@ -57,15 +57,15 @@ impl iced::widget::text_input::StyleSheet for TextInputStyleTuple { } fn placeholder_color(&self, _: &Self::Style) -> Color { - let color = get_colors(self.0).text_body; + let color = get_colors(*self).text_body; Color { - a: if color.eq(&Color::BLACK) { 0.7 } else { 0.2 }, + a: if self.is_nightly() { 0.2 } else { 0.7 }, ..color } } fn value_color(&self, _: &Self::Style) -> Color { - get_colors(self.0).text_body + get_colors(*self).text_body } fn disabled_color(&self, _style: &Self::Style) -> Color { @@ -73,17 +73,17 @@ impl iced::widget::text_input::StyleSheet for TextInputStyleTuple { } fn selection_color(&self, _: &Self::Style) -> Color { - let color = get_colors(self.0).text_body; + let color = get_colors(*self).text_body; Color { - a: if color.eq(&Color::BLACK) { 0.4 } else { 0.05 }, + a: if self.is_nightly() { 0.05 } else { 0.4 }, ..color } } - fn hovered(&self, _: &Self::Style) -> iced::widget::text_input::Appearance { - let colors = get_colors(self.0); + fn hovered(&self, style: &Self::Style) -> iced::widget::text_input::Appearance { + let colors = get_colors(*self); Appearance { - background: Background::Color(match self.1 { + background: Background::Color(match style { TextInputType::Badge => Color::TRANSPARENT, TextInputType::Standard => colors.buttons, }),