modified: src/main.rs
modified: src/widget.rs
This commit is contained in:
parent
3d89e51418
commit
b41e31b4be
18
src/main.rs
18
src/main.rs
@ -4,6 +4,7 @@ use iced::{Background, Border, Color};
|
|||||||
use iced::Length::Fill;
|
use iced::Length::Fill;
|
||||||
use iced::{widget::container, window, Theme, Element, Settings, Task as Command};
|
use iced::{widget::container, window, Theme, Element, Settings, Task as Command};
|
||||||
use iced::widget::{button, column, pick_list, radio, row, scrollable, text, Column, Container};
|
use iced::widget::{button, column, pick_list, radio, row, scrollable, text, Column, Container};
|
||||||
|
use widget::SplitView;
|
||||||
|
|
||||||
mod disk_util;
|
mod disk_util;
|
||||||
mod ipod_util;
|
mod ipod_util;
|
||||||
@ -23,12 +24,7 @@ pub enum Message {
|
|||||||
|
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
}
|
split_view: SplitView
|
||||||
|
|
||||||
impl State {
|
|
||||||
fn new() -> Self {
|
|
||||||
Self { }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum App {
|
enum App {
|
||||||
@ -48,8 +44,8 @@ impl App {
|
|||||||
}
|
}
|
||||||
App::Loaded(state) => {
|
App::Loaded(state) => {
|
||||||
//return state.tab_panel.view();
|
//return state.tab_panel.view();
|
||||||
|
return state.split_view.view();
|
||||||
return container(row![ widget::basic_btn("About iLoader") ]).into();
|
//return container(row![ widget::basic_btn("About iLoader") ]).into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,7 +53,11 @@ impl App {
|
|||||||
pub fn update(&mut self, message: Message) -> Command<Message> {
|
pub fn update(&mut self, message: Message) -> Command<Message> {
|
||||||
match self {
|
match self {
|
||||||
App::Preloaded => {
|
App::Preloaded => {
|
||||||
*self = App::Loaded(State {});
|
*self = App::Loaded(
|
||||||
|
State {
|
||||||
|
split_view: SplitView::new()
|
||||||
|
}
|
||||||
|
);
|
||||||
return Command::done(Message::ChangeUI);
|
return Command::done(Message::ChangeUI);
|
||||||
}
|
}
|
||||||
App::Loaded(state) => {
|
App::Loaded(state) => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use iced::{widget::{button, container, text}, Length::Fill, Padding, Task as Command, Element};
|
use iced::{widget::{button, column, container, row, text}, Element, Length::Fill, Padding, Task as Command};
|
||||||
|
|
||||||
use crate::{theme, Message};
|
use crate::{theme, Message};
|
||||||
|
|
||||||
@ -69,18 +69,29 @@ impl ActionWindow for YTWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SplitView<T> where T: ActionWindow {
|
pub struct SplitView {
|
||||||
sidebar: Vec<SidebarGroup>,
|
sidebar: Vec<SidebarGroup>,
|
||||||
selected: Option<(SidebarTab, Box<dyn ActionWindow>)>
|
selected: Option<(SidebarTab, Box<dyn ActionWindow>)>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ActionWindow> SplitView<T> {
|
impl SplitView {
|
||||||
pub fn view(&self) -> Element<Message> {
|
pub fn view(&self) -> Element<Message> {
|
||||||
|
if self.selected.is_none() {
|
||||||
|
return container("hey").into();
|
||||||
|
}
|
||||||
|
let a = &self.selected.as_ref().unwrap().1;
|
||||||
|
row![
|
||||||
|
column! [container("lol")],
|
||||||
|
if self.selected.is_some() { container(a.view()) } else { container(text!("None")) }
|
||||||
|
].into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&mut self, message: Message) -> Command<Message> {
|
pub fn update(&mut self, message: Message) -> Command<Message> {
|
||||||
|
if self.selected.is_some() {
|
||||||
|
let a = &mut self.selected.as_mut().unwrap().1;
|
||||||
|
return a.update(message);
|
||||||
|
}
|
||||||
|
Command::none()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user