Add a field that indicates album ownership #156
@ -5,11 +5,9 @@ use std::{
|
|||||||
|
|
||||||
use crate::core::collection::{
|
use crate::core::collection::{
|
||||||
merge::{Merge, MergeSorted, WithId},
|
merge::{Merge, MergeSorted, WithId},
|
||||||
track::Track,
|
track::{Track, TrackFormat},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::track::TrackFormat;
|
|
||||||
|
|
||||||
/// An album is a collection of tracks that were released together.
|
/// An album is a collection of tracks that were released together.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Album {
|
pub struct Album {
|
||||||
|
@ -302,7 +302,6 @@ impl<'a, 'b> AlbumState<'a, 'b> {
|
|||||||
.map(|a| Self::display_album_date(&a.date))
|
.map(|a| Self::display_album_date(&a.date))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
album
|
album
|
||||||
.filter(|a| a.seq.0 > 0)
|
|
||||||
.map(|a| Self::display_album_seq(&a.seq))
|
.map(|a| Self::display_album_seq(&a.seq))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
album
|
album
|
||||||
@ -340,7 +339,11 @@ impl<'a, 'b> AlbumState<'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn display_album_seq(seq: &AlbumSeq) -> String {
|
fn display_album_seq(seq: &AlbumSeq) -> String {
|
||||||
|
if seq.0 > 0 {
|
||||||
format!(" ({})", seq.0)
|
format!(" ({})", seq.0)
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_album_status(status: &AlbumStatus) -> &'static str {
|
fn display_album_status(status: &AlbumStatus) -> &'static str {
|
||||||
@ -495,7 +498,7 @@ impl Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn highlight_style(active: bool) -> Style {
|
fn highlight_style(active: bool) -> Style {
|
||||||
// Do not set foreground colour to not overwrite any list-specific customisation.
|
// Do not set the fg color here as it will overwrite any list-specific customisation.
|
||||||
if active {
|
if active {
|
||||||
Style::default().bg(COLOR_BG_HL)
|
Style::default().bg(COLOR_BG_HL)
|
||||||
} else {
|
} else {
|
||||||
@ -818,7 +821,8 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn display_album_seq() {
|
fn display_album_seq() {
|
||||||
assert_eq!(AlbumState::display_album_seq(&AlbumSeq::default()), " (0)");
|
assert_eq!(AlbumState::display_album_seq(&AlbumSeq::default()), "");
|
||||||
|
assert_eq!(AlbumState::display_album_seq(&AlbumSeq(0)), "");
|
||||||
assert_eq!(AlbumState::display_album_seq(&AlbumSeq(5)), " (5)");
|
assert_eq!(AlbumState::display_album_seq(&AlbumSeq(5)), " (5)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user