Skip to content

Commit

Permalink
gui is lookin better (shoutout #34), and bulletproofing the player ev…
Browse files Browse the repository at this point in the history
…en more!
  • Loading branch information
nednoodlehead committed Jun 3, 2024
1 parent fa63106 commit 8c00973
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/gui/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ pub enum Context {
PlayPause,
SkippedForward,
SkippedBackwards,
Seeked,
SkippedTo, // skipping to the seconds part
Seeked, // searching for a song!
AutoPlay,
}

Expand Down
34 changes: 24 additions & 10 deletions src/gui/persistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ impl App {
})
.collect();
btn.push(row![text(" "), menu].into()); // the stupid button clips over the container border. so add this so it doesnt ...
btn.push(self.separator().into()); // separater between buttons and playlists :)
btn.push(self.horizontal_separator().into()); // separater between buttons and playlists :)
btn.extend(playlist_buttons);
container(Column::with_children(btn).spacing(5))
container(row![Column::with_children(btn), self.vertical_separator()].spacing(5))
.height(Length::Fill)
.style(iced::theme::Container::Custom(Box::new(
ContainerWithBorder,
)))
// .style(iced::theme::Container::Custom(Box::new(
// ContainerWithBorder,
// )))
.into()
}
// pub fn render_search_result_box(
Expand All @@ -192,19 +192,33 @@ impl App {
// // also downloads the images. they should be flushed on each search
// container()
// }
fn separator(&self) -> quad::Quad {
let mut quader = quad::Quad {
fn horizontal_separator(&self) -> quad::Quad {
quad::Quad {
quad_color: Color::from([0.5; 3]).into(),
quad_border: Border {
radius: [3.0; 4].into(),
..Default::default()
},
inner_bounds: InnerBounds::Ratio(0.98, 0.2),
height: Length::Fixed(20.0),
width: Length::Fixed(140.0),
..Default::default()
};
}
// is this like the only way to set it ..?
}

pub fn vertical_separator(&self) -> quad::Quad {
quad::Quad {
quad_color: Color::from([0.5; 3]).into(),
quad_border: Border {
radius: [3.0; 4].into(),
..Default::default()
},
inner_bounds: InnerBounds::Ratio(1.0, 1.0),
height: Length::Fill,
width: Length::Fixed(4.0),
..Default::default()
}
// is this like the only way to set it ..?
quader.width = Length::Fixed(150.0);
quader
}
}
6 changes: 1 addition & 5 deletions src/gui/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl Application for App {
match &data.context {
&Context::Default => {}
&Context::PlayPause => {}
&Context::Seeked => {}
&Context::SkippedTo => {}

_ => {
println!("resetting scrubber to 0");
Expand Down Expand Up @@ -1023,10 +1023,6 @@ impl Application for App {
// playlist data
text(active_playlist.title).size(35),
text(active_playlist.description),
horizontal_space(),
button(text("Toggle table"))
.style(iced::theme::Button::Custom(Box::new(JustText)))
.on_press(ProgramCommands::ToggleList)
]
.padding(5)
.align_items(iced_core::Alignment::End)
Expand Down
5 changes: 2 additions & 3 deletions src/gui/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ impl App {
music_obj.sink.set_volume((val as f32) / 80.0)
}
PungeCommand::ChangeSong(uuid) => {
println!("here?");
let index = music_obj
.list
.iter()
Expand Down Expand Up @@ -310,7 +309,7 @@ impl App {
shuffle: music_obj.shuffle,
playlist: music_obj.playlist.clone(),
threshold: music_obj.current_object.threshold,
context: Context::Seeked,
context: Context::SkippedTo,
length: music_obj.current_object.length,
}))
.await
Expand Down Expand Up @@ -543,7 +542,7 @@ impl App {
shuffle: music_obj.shuffle,
playlist: music_obj.playlist.clone(),
threshold: music_obj.current_object.threshold,
context: Context::Seeked,
context: Context::SkippedTo,
length: music_obj.current_object.length,
}))
.await
Expand Down
4 changes: 2 additions & 2 deletions src/gui/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ impl<'a> table::Column<'a, ProgramCommands, Theme, Renderer> for Column {
ColumnKind::Author => text("Author").into(),
ColumnKind::Title => text("Title").into(),
ColumnKind::Album => text("Album").into(),
ColumnKind::Edit => button(text("edit").size(10))
ColumnKind::Edit => button(text("tog").size(10))
.width(100)
.height(100)
.on_press(ProgramCommands::OpenSongEditPage)
.on_press(ProgramCommands::ToggleList)
.into(),
};

Expand Down

0 comments on commit 8c00973

Please sign in to comment.