play next (#278)

* add play next feature

* fix play_next insertion order

* fix play_next call for playable

* document play_next shortcut + reformat

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
Moshe Sherman
2020-10-04 17:58:55 +03:00
committed by GitHub
parent 7bf0cac6c0
commit fc79889665
15 changed files with 97 additions and 4 deletions

View File

@@ -338,6 +338,15 @@ impl<I: ListItem + Clone> ViewExt for ListView<I> {
return Ok(CommandResult::Consumed(None));
}
Command::PlayNext => {
info!("played next");
let mut content = self.content.write().unwrap();
if let Some(item) = content.get_mut(self.selected) {
item.play_next(self.queue.clone());
}
return Ok(CommandResult::Consumed(None));
}
Command::Queue => {
let mut content = self.content.write().unwrap();
if let Some(item) = content.get_mut(self.selected) {

View File

@@ -95,6 +95,9 @@ impl ViewExt for QueueView {
self.queue.play(self.list.get_selected_index(), true, false);
return Ok(CommandResult::Consumed(None));
}
Command::PlayNext => {
return Ok(CommandResult::Ignored);
}
Command::Queue => {
return Ok(CommandResult::Ignored);
}