Add track_format config option (#800)
* Added track_name_first config option to allow choosing if artists' names should be shown before or after the track name.
* Added active_fields config option, which allows configuration of which columns are visible in Queue/Library view.
This also removes the need for a separate track_name_first and album_column option.
* Fixed README
* Made custom tracklist formatting more flexible.
Updated readme with new instructions.
Reformatted impl member order to match the definitions in traits.rs.
* Added track_name_first config option to allow choosing if artists' names should be shown before or after the track name.
* Added active_fields config option, which allows configuration of which columns are visible in Queue/Library view.
This also removes the need for a separate track_name_first and album_column option.
* Fixed README
* Made custom tracklist formatting more flexible.
Updated readme with new instructions.
Reformatted impl member order to match the definitions in traits.rs.
* Fetch formatting config from library config
Instead of the lazy static mutex
* Moved custom format function to Playable impl as it's a better location to handle both Tracks and Episodes
* Rename from `tracklist_formatting` to `track_format`
Also shorten `format_{left|center|right}` to `{left|center|right}`
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
committed by
Henrik Friedrichsen
parent
0e50466a5e
commit
f7450321da
@@ -215,48 +215,51 @@ impl ContextMenu {
|
||||
}
|
||||
|
||||
// open detail view of artist/album
|
||||
content.set_on_submit(move |s: &mut Cursive, action: &ContextMenuAction| {
|
||||
s.pop_layer();
|
||||
let queue = queue.clone();
|
||||
{
|
||||
let library = library.clone();
|
||||
content.set_on_submit(move |s: &mut Cursive, action: &ContextMenuAction| {
|
||||
let queue = queue.clone();
|
||||
let library = library.clone();
|
||||
s.pop_layer();
|
||||
|
||||
match action {
|
||||
ContextMenuAction::PlayTrack(track) => {
|
||||
let dialog = Self::play_track_dialog(queue, *track.clone());
|
||||
s.add_layer(dialog);
|
||||
}
|
||||
ContextMenuAction::ShowItem(item) => {
|
||||
if let Some(view) = item.open(queue, library) {
|
||||
s.call_on_name("main", move |v: &mut Layout| v.push_view(view));
|
||||
match action {
|
||||
ContextMenuAction::PlayTrack(track) => {
|
||||
let dialog = Self::play_track_dialog(queue, *track.clone());
|
||||
s.add_layer(dialog);
|
||||
}
|
||||
ContextMenuAction::ShowItem(item) => {
|
||||
if let Some(view) = item.open(queue, library) {
|
||||
s.call_on_name("main", move |v: &mut Layout| v.push_view(view));
|
||||
}
|
||||
}
|
||||
ContextMenuAction::ShareUrl(url) => {
|
||||
#[cfg(feature = "share_clipboard")]
|
||||
write_share(url.to_string());
|
||||
}
|
||||
ContextMenuAction::AddToPlaylist(track) => {
|
||||
let dialog =
|
||||
Self::add_track_dialog(library, queue.get_spotify(), *track.clone());
|
||||
s.add_layer(dialog);
|
||||
}
|
||||
ContextMenuAction::ShowRecommendations(item) => {
|
||||
if let Some(view) = item.to_owned().open_recommendations(queue, library) {
|
||||
s.call_on_name("main", move |v: &mut Layout| v.push_view(view));
|
||||
}
|
||||
}
|
||||
ContextMenuAction::ToggleTrackSavedStatus(track) => {
|
||||
let mut track: Track = *track.clone();
|
||||
track.toggle_saved(library);
|
||||
}
|
||||
ContextMenuAction::SelectArtist(artists) => {
|
||||
let dialog = Self::select_artist_dialog(library, queue, artists.clone());
|
||||
s.add_layer(dialog);
|
||||
}
|
||||
}
|
||||
ContextMenuAction::ShareUrl(url) => {
|
||||
#[cfg(feature = "share_clipboard")]
|
||||
write_share(url.to_string());
|
||||
}
|
||||
ContextMenuAction::AddToPlaylist(track) => {
|
||||
let dialog =
|
||||
Self::add_track_dialog(library, queue.get_spotify(), *track.clone());
|
||||
s.add_layer(dialog);
|
||||
}
|
||||
ContextMenuAction::ShowRecommendations(item) => {
|
||||
if let Some(view) = item.to_owned().open_recommendations(queue, library) {
|
||||
s.call_on_name("main", move |v: &mut Layout| v.push_view(view));
|
||||
}
|
||||
}
|
||||
ContextMenuAction::ToggleTrackSavedStatus(track) => {
|
||||
let mut track: Track = *track.clone();
|
||||
track.toggle_saved(library);
|
||||
}
|
||||
ContextMenuAction::SelectArtist(artists) => {
|
||||
let dialog = Self::select_artist_dialog(library, queue, artists.clone());
|
||||
s.add_layer(dialog);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
let dialog = Dialog::new()
|
||||
.title(item.display_left())
|
||||
.title(item.display_left(library))
|
||||
.dismiss_button("Cancel")
|
||||
.padding(Margins::lrtb(1, 1, 1, 0))
|
||||
.content(content.with_name("contextmenu_select"));
|
||||
|
||||
@@ -108,7 +108,7 @@ impl<I: ListItem> ListView<I> {
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, i)| {
|
||||
i.display_left()
|
||||
i.display_left(self.library.clone())
|
||||
.to_lowercase()
|
||||
.contains(&query[..].to_lowercase())
|
||||
})
|
||||
@@ -189,7 +189,7 @@ impl<I: ListItem> View for ListView<I> {
|
||||
ColorStyle::primary()
|
||||
};
|
||||
|
||||
let left = item.display_left();
|
||||
let left = item.display_left(self.library.clone());
|
||||
let center = item.display_center(self.library.clone());
|
||||
let right = item.display_right(self.library.clone());
|
||||
let draw_center = !center.is_empty();
|
||||
|
||||
Reference in New Issue
Block a user