fix(myqbz): mixtape/collection detail row corrections (#766)
- A song row opens the album it is on (its resolved, source-aware albumId) instead of a blank page; the album id is plumbed from the first resolved track through the resolve pass, and an unresolved click is ignored like the artist link. (#766 problem 1) - The row menu says "Remove from Mixtape" on a mixtape, "Remove from collection" elsewhere. (#766 problem 2) - A playlist inside a mixtape hides its quality cell (per-track quality is varied); collections keep it. - The source column shows one glyph per DISTINCT source across the item's tracks, so a mixed-source playlist shows them all. - The tracks column is empty only for a track; an album or playlist shows its resolved track count instead of a dash. cc
This commit is contained in:
11 files changed
+142
-25
No files matched your search
@@ -7036,3 +7036,6 @@ msgstr "Das kann einige Minuten dauern, wenn MusicBrainz ausgelastet ist."
|
||||
|
||||
msgid "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
msgstr "Das dauert länger als gewöhnlich — MusicBrainz ist möglicherweise ausgelastet. Versuche es gleich noch einmal."
|
||||
|
||||
msgid "Remove from Mixtape"
|
||||
msgstr "Aus Mixtape entfernen"
|
||||
@@ -2636,3 +2636,6 @@ msgstr "This can take a few minutes when MusicBrainz is busy."
|
||||
|
||||
msgid "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
msgstr "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
|
||||
msgid "Remove from Mixtape"
|
||||
msgstr "Remove from Mixtape"
|
||||
@@ -7042,3 +7042,6 @@ msgstr "Esto puede tardar algunos minutos cuando MusicBrainz está ocupado."
|
||||
|
||||
msgid "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
msgstr "Esto está tardando más de lo normal — MusicBrainz puede estar ocupado. Inténtalo de nuevo en un momento."
|
||||
|
||||
msgid "Remove from Mixtape"
|
||||
msgstr "Quitar del mixtape"
|
||||
@@ -7034,3 +7034,6 @@ msgstr "Cela peut prendre quelques minutes lorsque MusicBrainz est occupé."
|
||||
|
||||
msgid "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
msgstr "Cela prend plus de temps que d'habitude — MusicBrainz est peut-être occupé. Réessayez dans un instant."
|
||||
|
||||
msgid "Remove from Mixtape"
|
||||
msgstr "Retirer de la mixtape"
|
||||
@@ -7017,3 +7017,6 @@ msgstr "MusicBrainzが混雑している場合、数分かかることがあり
|
||||
|
||||
msgid "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
msgstr "通常より時間がかかっています。MusicBrainzが混雑している可能性があります。しばらくしてからもう一度お試しください。"
|
||||
|
||||
msgid "Remove from Mixtape"
|
||||
msgstr "ミックステープから削除"
|
||||
@@ -7024,3 +7024,6 @@ msgstr "Dit kan enkele minuten duren wanneer MusicBrainz het druk heeft."
|
||||
|
||||
msgid "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
msgstr "Dit duurt langer dan normaal — MusicBrainz heeft het mogelijk druk. Probeer het zo opnieuw."
|
||||
|
||||
msgid "Remove from Mixtape"
|
||||
msgstr "Verwijderen uit mixtape"
|
||||
@@ -7034,3 +7034,6 @@ msgstr "Isto pode levar alguns minutos quando o MusicBrainz está ocupado."
|
||||
|
||||
msgid "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
msgstr "Isto está a demorar mais do que o normal — o MusicBrainz pode estar ocupado. Tente novamente daqui a pouco."
|
||||
|
||||
msgid "Remove from Mixtape"
|
||||
msgstr "Remover do mixtape"
|
||||
@@ -7055,3 +7055,6 @@ msgstr "Это может занять несколько минут, когда
|
||||
|
||||
msgid "This is taking longer than usual — MusicBrainz may be busy. Try again in a moment."
|
||||
msgstr "Это занимает больше времени, чем обычно — MusicBrainz может быть загружен. Попробуйте ещё раз через минуту."
|
||||
|
||||
msgid "Remove from Mixtape"
|
||||
msgstr "Удалить из микстейпа"
|
||||
@@ -92,7 +92,15 @@ Rectangle {
|
||||
readonly property string rowSubtitle: root.rev >= 0 ? (root.item.subtitle || "") : ""
|
||||
readonly property bool subtitleIsLink: root.rev >= 0 && root.item.subtitleIsLink === true
|
||||
readonly property string artistId: root.rev >= 0 ? (root.item.artistId || "") : ""
|
||||
readonly property string albumId: root.rev >= 0 ? (root.item.albumId || "") : ""
|
||||
// The parent collection kind ("mixtape" | "collection" | "artist_collection"),
|
||||
// passed from the view so the menu says "Remove from Mixtape" vs "…collection".
|
||||
property string detailKind: ""
|
||||
// Fix #766: a playlist inside a MIXTAPE has varied per-track quality, so its
|
||||
// quality cell is hidden there (collections keep it).
|
||||
readonly property bool hideQuality: root.detailKind === "mixtape" && root.itemType === "playlist"
|
||||
readonly property string sourceKind: root.rev >= 0 ? (root.item.sourceKind || "") : ""
|
||||
readonly property var sourceKinds: root.rev >= 0 ? (root.item.sourceKinds || []) : []
|
||||
readonly property string typeLabel: root.rev >= 0 ? (root.item.typeLabel || "") : ""
|
||||
readonly property string qualityTier: root.rev >= 0 ? (root.item.qualityTier || "") : ""
|
||||
readonly property string qualityDetail: root.rev >= 0 ? (root.item.qualityDetail || "") : ""
|
||||
@@ -164,7 +172,7 @@ Rectangle {
|
||||
onClicked: function (mouse) {
|
||||
if (mouse.button !== Qt.LeftButton) return
|
||||
if (root.selectMode) QbzMyQbz.detailToggleItemSelect(root.itemPosition)
|
||||
else QbzMyQbz.openItem(root.itemSource, root.itemType, root.sourceItemId)
|
||||
else root.openThis()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +323,7 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: QbzMyQbz.openItem(root.itemSource, root.itemType, root.sourceItemId)
|
||||
onClicked: root.openThis()
|
||||
}
|
||||
}
|
||||
// Subtitle — 16px hit area, pointer only when it is a link.
|
||||
@@ -376,21 +384,25 @@ Rectangle {
|
||||
Item {
|
||||
width: 80
|
||||
height: parent.height
|
||||
SourceIcon {
|
||||
visible: root.sourceKind !== ""
|
||||
x: 0
|
||||
// #766: a playlist can mix Qobuz + local/media-server tracks, so the
|
||||
// source column shows one glyph per DISTINCT source. Falls back to
|
||||
// the single resolved kind while the list is empty (pre-resolve).
|
||||
Row {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
kind: root.sourceKind
|
||||
// A dense ROW: the media marks draw monochrome and tinted, like the
|
||||
// hard-drive beside them. Colour logos are for cards — a list of
|
||||
// them fights the text it labels.
|
||||
mono: true
|
||||
// Row glyph, so SourceGlyph.slint's numbers (:31 — 15px, the
|
||||
// three Qobuz kinds 16px, muted local tint), not the version
|
||||
// picker's flat-14 defaults.
|
||||
glyphSize: 15
|
||||
qobuzSize: 16
|
||||
localTint: "muted"
|
||||
spacing: 4
|
||||
Repeater {
|
||||
model: root.sourceKinds.length > 0
|
||||
? root.sourceKinds
|
||||
: (root.sourceKind !== "" ? [root.sourceKind] : [])
|
||||
SourceIcon {
|
||||
kind: modelData
|
||||
// Monochrome tinted marks (colour logos are for cards).
|
||||
mono: true
|
||||
glyphSize: 15
|
||||
qobuzSize: 16
|
||||
localTint: "muted"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +411,7 @@ Rectangle {
|
||||
width: 160
|
||||
height: parent.height
|
||||
QualityBadgeFull {
|
||||
visible: root.qualityTier !== ""
|
||||
visible: root.qualityTier !== "" && !root.hideQuality
|
||||
x: 0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
tier: root.qualityTier
|
||||
@@ -409,7 +421,7 @@ Rectangle {
|
||||
// 160px cell and centres its dot row in it (LoadingDots.slint
|
||||
// :26-35) — hence `anchors.fill`, not `x: 0`.
|
||||
QbzLoadingDots {
|
||||
visible: root.qualityTier === "" && root.qualityResolving
|
||||
visible: root.qualityTier === "" && root.qualityResolving && !root.hideQuality
|
||||
anchors.fill: parent
|
||||
phase: root.dotPhase
|
||||
}
|
||||
@@ -478,6 +490,20 @@ Rectangle {
|
||||
onPicked: function (a) { root.rowMenuAction(a) }
|
||||
}
|
||||
|
||||
// A track opens the ALBUM it is on (its resolved `albumId`), routed
|
||||
// source-aware by `open_item("album", …)` (Qobuz vs local). An album or
|
||||
// playlist opens itself. A track whose album has NOT resolved yet (empty id)
|
||||
// is ignored — like the artist link — instead of sending "" and landing on a
|
||||
// blank page (#766, problem 1).
|
||||
function openThis() {
|
||||
if (root.itemType === "track") {
|
||||
if (root.albumId !== "")
|
||||
QbzMyQbz.openItem(root.itemSource, "album", root.albumId)
|
||||
} else {
|
||||
QbzMyQbz.openItem(root.itemSource, root.itemType, root.sourceItemId)
|
||||
}
|
||||
}
|
||||
|
||||
function rowMenuModel() {
|
||||
var t = QbzSession.tr
|
||||
var r = QbzSession.trRev
|
||||
@@ -487,8 +513,9 @@ Rectangle {
|
||||
{ "label": t("Play later", r), "icon": "list-plus", "action": "play-later" },
|
||||
{ "label": t("Add to queue", r), "icon": "list-end", "action": "add-to-queue" },
|
||||
{ "sep": true },
|
||||
{ "label": t("Remove from collection", r), "icon": "trash-2",
|
||||
"action": "remove", "danger": true },
|
||||
{ "label": root.detailKind === "mixtape"
|
||||
? t("Remove from Mixtape", r) : t("Remove from collection", r),
|
||||
"icon": "trash-2", "action": "remove", "danger": true },
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -768,6 +768,7 @@ Rectangle {
|
||||
showExpander: root.rowExpander
|
||||
dotPhase: root.dotPhase
|
||||
rev: root.patchRev
|
||||
detailKind: root.kind
|
||||
}
|
||||
|
||||
// Inline tracks (.slint :1151-1218): padding
|
||||
|
||||
@@ -112,6 +112,10 @@ pub struct DetailRow {
|
||||
/// local/Plex items, whose tracks carry none).
|
||||
#[serde(rename = "artistId")]
|
||||
pub artist_id: String,
|
||||
/// Resolved album id for a TRACK row (source-aware), so its click opens the
|
||||
/// album it is on; "" until `resolve_items` lands. Albums use `sourceItemId`.
|
||||
#[serde(rename = "albumId")]
|
||||
pub album_id: String,
|
||||
/// RESOLVED source ("qobuz" | "plex" | "local" | "offline") — this is how a
|
||||
/// Plex item stored as `AlbumSource::Local` finally reads "plex", and a
|
||||
/// Qobuz download stored the same way reads "offline". Both come from the
|
||||
@@ -119,6 +123,10 @@ pub struct DetailRow {
|
||||
/// literal.
|
||||
#[serde(rename = "sourceKind")]
|
||||
pub source_kind: String,
|
||||
/// Every distinct source across the item's tracks (a playlist can mix them);
|
||||
/// empty until `resolve_items` lands. `source_kind` stays the primary one.
|
||||
#[serde(rename = "sourceKinds")]
|
||||
pub source_kinds: Vec<String>,
|
||||
#[serde(rename = "typeLabel")]
|
||||
pub type_label: String,
|
||||
#[serde(rename = "qualityTier")]
|
||||
@@ -228,6 +236,8 @@ struct RowPatch {
|
||||
source_item_id: String,
|
||||
#[serde(rename = "sourceKind", skip_serializing_if = "Option::is_none")]
|
||||
source_kind: Option<String>,
|
||||
#[serde(rename = "sourceKinds", skip_serializing_if = "Option::is_none")]
|
||||
source_kinds: Option<Vec<String>>,
|
||||
#[serde(rename = "qualityTier", skip_serializing_if = "Option::is_none")]
|
||||
quality_tier: Option<String>,
|
||||
#[serde(rename = "qualityDetail", skip_serializing_if = "Option::is_none")]
|
||||
@@ -236,6 +246,10 @@ struct RowPatch {
|
||||
type_label: Option<String>,
|
||||
#[serde(rename = "artistId", skip_serializing_if = "Option::is_none")]
|
||||
artist_id: Option<String>,
|
||||
#[serde(rename = "albumId", skip_serializing_if = "Option::is_none")]
|
||||
album_id: Option<String>,
|
||||
#[serde(rename = "tracksText", skip_serializing_if = "Option::is_none")]
|
||||
tracks_text: Option<String>,
|
||||
#[serde(rename = "qualityResolving", skip_serializing_if = "Option::is_none")]
|
||||
quality_resolving: Option<bool>,
|
||||
#[serde(rename = "artUrl", skip_serializing_if = "Option::is_none")]
|
||||
@@ -387,6 +401,16 @@ struct ResolvedItem {
|
||||
/// backfilling rows stored with empty art.
|
||||
artwork_url: String,
|
||||
artist_id: String,
|
||||
/// The first resolved track's album id (source-aware: a Qobuz album id, or a
|
||||
/// local/media-server album key), so a TRACK row can open the album it is on.
|
||||
album_id: String,
|
||||
/// Resolved track count for an ALBUM or PLAYLIST row (`None` for a track), so
|
||||
/// the tracks column shows a real number instead of staying empty.
|
||||
tracks_count: Option<u32>,
|
||||
/// Every DISTINCT source across the item's tracks, in first-seen order: a
|
||||
/// playlist can mix Qobuz + local/media-server, so its row shows one glyph
|
||||
/// per source. An album/track resolves to a single entry.
|
||||
source_kinds: Vec<String>,
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -596,12 +620,12 @@ fn classify_release_type(track_count: Option<u32>) -> &'static str {
|
||||
|
||||
/// TRACKS column: "1" for a track, else the count or an em-dash (U+2014).
|
||||
fn tracks_text(item: &MixtapeCollectionItem) -> String {
|
||||
// A track has no track count — the column stays EMPTY for it. An album or
|
||||
// playlist shows its count: the stored one if present, otherwise "" until
|
||||
// `resolve_items` backfills the resolved track count (#766).
|
||||
match item.item_type {
|
||||
ItemType::Track => "1".to_string(),
|
||||
_ => match item.track_count {
|
||||
Some(n) => n.to_string(),
|
||||
None => "\u{2014}".to_string(),
|
||||
},
|
||||
ItemType::Track => String::new(),
|
||||
_ => item.track_count.map(|n| n.to_string()).unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -826,7 +850,9 @@ fn to_item(
|
||||
.map(|s| !s.is_empty())
|
||||
.unwrap_or(false),
|
||||
artist_id,
|
||||
album_id: String::new(),
|
||||
source_kind,
|
||||
source_kinds: Vec::new(),
|
||||
type_label: type_label_text,
|
||||
quality_tier,
|
||||
quality_detail,
|
||||
@@ -1536,6 +1562,27 @@ fn resolve_from_tracks(item: &MixtapeCollectionItem, tracks: &[QueueTrack]) -> R
|
||||
.map(|id| id.to_string())
|
||||
.unwrap_or_default();
|
||||
|
||||
// The first resolved track's album id, so a TRACK row opens its album.
|
||||
// Whatever the source hands back (a Qobuz album id, a media-server album
|
||||
// key) — `crate::open_album` already routes Qobuz-vs-local by its shape.
|
||||
let album_id = first.and_then(|t| t.album_id.clone()).unwrap_or_default();
|
||||
|
||||
// Track count for the tracks column — a track carries none; an album or
|
||||
// playlist reports how many tracks resolved.
|
||||
let tracks_count = match item.item_type {
|
||||
ItemType::Track => None,
|
||||
_ => Some(tracks.len() as u32),
|
||||
};
|
||||
|
||||
// Every distinct source across the tracks (a playlist can mix them).
|
||||
let mut source_kinds: Vec<String> = Vec::new();
|
||||
for track in tracks {
|
||||
let sk = source_kind_of(track).to_string();
|
||||
if !source_kinds.contains(&sk) {
|
||||
source_kinds.push(sk);
|
||||
}
|
||||
}
|
||||
|
||||
ResolvedItem {
|
||||
source_kind,
|
||||
quality_tier: quality_tier.to_string(),
|
||||
@@ -1543,6 +1590,9 @@ fn resolve_from_tracks(item: &MixtapeCollectionItem, tracks: &[QueueTrack]) -> R
|
||||
type_label: type_label_text,
|
||||
artwork_url,
|
||||
artist_id,
|
||||
album_id,
|
||||
tracks_count,
|
||||
source_kinds,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1611,6 +1661,9 @@ async fn resolve_offline_cached(item: &MixtapeCollectionItem) -> Option<Resolved
|
||||
type_label: type_label_text,
|
||||
artwork_url: String::new(),
|
||||
artist_id: String::new(),
|
||||
album_id: String::new(),
|
||||
tracks_count: None,
|
||||
source_kinds: vec!["qobuz".to_string()],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1646,18 +1699,30 @@ fn apply_resolved(item: &MixtapeCollectionItem, resolved: ResolvedItem, collecti
|
||||
.filter(|r| r.source_item_id == item.source_item_id)
|
||||
{
|
||||
row.source_kind = resolved.source_kind.clone();
|
||||
row.source_kinds = resolved.source_kinds.clone();
|
||||
row.quality_tier = resolved.quality_tier.clone();
|
||||
row.quality_detail = resolved.quality_detail.clone();
|
||||
row.type_label = resolved.type_label.clone();
|
||||
row.artist_id = resolved.artist_id.clone();
|
||||
row.album_id = resolved.album_id.clone();
|
||||
// Album/playlist tracks column: show the resolved count (a track keeps
|
||||
// its empty cell).
|
||||
if !matches!(item.item_type, ItemType::Track) {
|
||||
if let Some(n) = resolved.tracks_count {
|
||||
row.tracks_text = n.to_string();
|
||||
}
|
||||
}
|
||||
row.quality_resolving = false;
|
||||
|
||||
let mut patch = RowPatch::of(row);
|
||||
patch.source_kind = Some(row.source_kind.clone());
|
||||
patch.source_kinds = Some(row.source_kinds.clone());
|
||||
patch.quality_tier = Some(row.quality_tier.clone());
|
||||
patch.quality_detail = Some(row.quality_detail.clone());
|
||||
patch.type_label = Some(row.type_label.clone());
|
||||
patch.artist_id = Some(row.artist_id.clone());
|
||||
patch.album_id = Some(row.album_id.clone());
|
||||
patch.tracks_text = Some(row.tracks_text.clone());
|
||||
patch.quality_resolving = Some(false);
|
||||
|
||||
if row.art_url.is_empty() && !resolved.artwork_url.is_empty() {
|
||||
|
||||
Reference in new issue
Block a user