mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-29 05:07:23 +01:00
editor: implement tracks editor parts list
This commit is contained in:
parent
642d9340e5
commit
53680df13d
15 changed files with 311 additions and 32 deletions
|
|
@ -149,14 +149,20 @@ impl Work {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn composers_string(&self) -> String {
|
||||
pub fn composers_string(&self) -> Option<String> {
|
||||
// TODO: Include roles except default composer.
|
||||
// TODO: Think about works without composers.
|
||||
self.persons
|
||||
let composers_string = self
|
||||
.persons
|
||||
.iter()
|
||||
.map(|p| p.person.name.get().to_string())
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ")
|
||||
.join(", ");
|
||||
|
||||
if composers_string.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(composers_string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,8 +175,11 @@ impl PartialEq for Work {
|
|||
|
||||
impl Display for Work {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
// TODO: Handle works without composers.
|
||||
write!(f, "{}: {}", self.composers_string(), self.name)
|
||||
if let Some(composers) = self.composers_string() {
|
||||
write!(f, "{}: {}", composers, self.name)
|
||||
} else {
|
||||
write!(f, "{}", self.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue