From cb6beb71d88c607902b5a8526528607a395c4413 Mon Sep 17 00:00:00 2001 From: "alterwain@protonmail.com" Date: Sat, 14 Dec 2024 05:12:03 +0300 Subject: [PATCH] GUI modified: src/main.rs modified: src/theme.rs modified: src/widget.rs --- src/main.rs | 3 ++- src/theme.rs | 2 +- src/widget.rs | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index ff8fe64..e8c5b86 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,9 +80,10 @@ fn main() -> iced::Result { println!("{}", ipod_util::get_ipod_path().is_some()); } }*/ - + // sidebar width 200px iced::application("iLoader", App::update, App::view) .theme(App::theme) + //.transparent(true) .window_size((980.0, 700.0)) .run_with(App::new) } diff --git a/src/theme.rs b/src/theme.rs index 446a4dc..2ad02ba 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -14,7 +14,7 @@ pub const SF_FONT: iced::Font = Font { pub fn get_default_theme() -> Theme { Theme::custom("Glossy".to_string(), Palette { - background: Color::TRANSPARENT, // Color::from_rgb8(236, 236, 236) + background: Color::from_rgba8(244, 245, 245, 1.0), text: Color::from_rgb8(0, 0, 0), primary: Color::from_rgb8(0, 122, 255), success: Color::from_rgb8(52, 199, 89), diff --git a/src/widget.rs b/src/widget.rs index 101379f..17bd43e 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -1,4 +1,4 @@ -use iced::{widget::{button, container, text}, Length::Fill, Padding}; +use iced::{widget::{button, container, text}, Length::Fill, Padding, Task as Command, Element}; use crate::{theme, Message}; @@ -10,4 +10,68 @@ pub fn basic_btn(s: &str) -> button::Button { bottom: 1.5, left: 2., })).style(theme::basic_button_theme) +} + +// the value T should be something, that inherits ActionWindow +enum SidebarTab where T: ActionWindow { + Youtube(T), + /*Spotify(T), + Soundcloud(T), + ITunes(T), + Playlists(T), + FileSystem(T), + Metadata(T), + FindCopies(T),*/ + Settings(SettingsWindow) +} + +pub struct SidebarGroup { + tabs: Vec>, + name: String +} + +impl SidebarGroup { + pub fn new(name: String) -> Self { + Self{tabs: Vec::new(), name} + } + + pub fn name(&self) -> &String { + &self.name + } +} + +trait ActionWindow { + fn view(&self) -> Element; + fn update(&mut self, message: Message) -> Command; +} + +pub struct SettingsWindow {} + +impl ActionWindow for SettingsWindow { + fn view(&self) -> Element { + todo!() + } + + fn update(&mut self, message: Message) -> Command { + todo!() + } +} + +pub struct SplitView where T: ActionWindow { + sidebar: Vec, + main: Option +} + +impl SplitView { + pub fn view(&self) -> Element { + + } + + pub fn update(&mut self, message: Message) -> Command { + + } + + pub fn new() -> Self { + Self{ sidebar: Vec::new(), main: None } + } } \ No newline at end of file