modified:   src/main.rs
	modified:   src/theme.rs
	modified:   src/widget.rs
This commit is contained in:
Michael Wain 2024-12-14 05:12:03 +03:00
parent 66722e8313
commit cb6beb71d8
3 changed files with 68 additions and 3 deletions

View File

@ -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)
}

View File

@ -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),

View File

@ -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<Message> {
bottom: 1.5,
left: 2.,
})).style(theme::basic_button_theme)
}
// the value T should be something, that inherits ActionWindow
enum SidebarTab<T> 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<SidebarTab<dyn ActionWindow>>,
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<Message>;
fn update(&mut self, message: Message) -> Command<Message>;
}
pub struct SettingsWindow {}
impl ActionWindow for SettingsWindow {
fn view(&self) -> Element<Message> {
todo!()
}
fn update(&mut self, message: Message) -> Command<Message> {
todo!()
}
}
pub struct SplitView<T> where T: ActionWindow {
sidebar: Vec<SidebarGroup>,
main: Option<T>
}
impl<T: ActionWindow> SplitView<T> {
pub fn view(&self) -> Element<Message> {
}
pub fn update(&mut self, message: Message) -> Command<Message> {
}
pub fn new() -> Self {
Self{ sidebar: Vec::new(), main: None }
}
}