diff --git a/crates/qbz-i18n/translations/de/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/de/LC_MESSAGES/qbz-ui.po index bf5e4f6f0..b685b42b4 100644 --- a/crates/qbz-i18n/translations/de/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/de/LC_MESSAGES/qbz-ui.po @@ -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" diff --git a/crates/qbz-i18n/translations/en/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/en/LC_MESSAGES/qbz-ui.po index 238d16c3b..7c3e7838d 100644 --- a/crates/qbz-i18n/translations/en/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/en/LC_MESSAGES/qbz-ui.po @@ -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" diff --git a/crates/qbz-i18n/translations/es/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/es/LC_MESSAGES/qbz-ui.po index 7e5df00b3..d5712f803 100644 --- a/crates/qbz-i18n/translations/es/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/es/LC_MESSAGES/qbz-ui.po @@ -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" diff --git a/crates/qbz-i18n/translations/fr/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/fr/LC_MESSAGES/qbz-ui.po index 3f2d667ff..6a0505d2c 100644 --- a/crates/qbz-i18n/translations/fr/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/fr/LC_MESSAGES/qbz-ui.po @@ -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" diff --git a/crates/qbz-i18n/translations/ja/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/ja/LC_MESSAGES/qbz-ui.po index 69b32d59b..7fa0f48a9 100644 --- a/crates/qbz-i18n/translations/ja/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/ja/LC_MESSAGES/qbz-ui.po @@ -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 "ミックステープから削除" diff --git a/crates/qbz-i18n/translations/nl/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/nl/LC_MESSAGES/qbz-ui.po index 454bb23c8..84026eb2d 100644 --- a/crates/qbz-i18n/translations/nl/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/nl/LC_MESSAGES/qbz-ui.po @@ -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" diff --git a/crates/qbz-i18n/translations/pt/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/pt/LC_MESSAGES/qbz-ui.po index 2f5686692..1220a93aa 100644 --- a/crates/qbz-i18n/translations/pt/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/pt/LC_MESSAGES/qbz-ui.po @@ -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" diff --git a/crates/qbz-i18n/translations/ru/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/ru/LC_MESSAGES/qbz-ui.po index 7f9377f0c..2fb57a542 100644 --- a/crates/qbz-i18n/translations/ru/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/ru/LC_MESSAGES/qbz-ui.po @@ -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 "Удалить из микстейпа" diff --git a/crates/qbz-qt/qml/views/myqbz/MyQbzDetailRow.qml b/crates/qbz-qt/qml/views/myqbz/MyQbzDetailRow.qml index 1dac4a961..269ffc668 100644 --- a/crates/qbz-qt/qml/views/myqbz/MyQbzDetailRow.qml +++ b/crates/qbz-qt/qml/views/myqbz/MyQbzDetailRow.qml @@ -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 }, ] } diff --git a/crates/qbz-qt/qml/views/myqbz/MyQbzDetailView.qml b/crates/qbz-qt/qml/views/myqbz/MyQbzDetailView.qml index 4a6f6f942..9e4861440 100644 --- a/crates/qbz-qt/qml/views/myqbz/MyQbzDetailView.qml +++ b/crates/qbz-qt/qml/views/myqbz/MyQbzDetailView.qml @@ -768,6 +768,7 @@ Rectangle { showExpander: root.rowExpander dotPhase: root.dotPhase rev: root.patchRev + detailKind: root.kind } // Inline tracks (.slint :1151-1218): padding diff --git a/crates/qbz-qt/src/myqbz_detail_qt.rs b/crates/qbz-qt/src/myqbz_detail_qt.rs index 1adf2231a..e14b340d2 100644 --- a/crates/qbz-qt/src/myqbz_detail_qt.rs +++ b/crates/qbz-qt/src/myqbz_detail_qt.rs @@ -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, #[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, + #[serde(rename = "sourceKinds", skip_serializing_if = "Option::is_none")] + source_kinds: Option>, #[serde(rename = "qualityTier", skip_serializing_if = "Option::is_none")] quality_tier: Option, #[serde(rename = "qualityDetail", skip_serializing_if = "Option::is_none")] @@ -236,6 +246,10 @@ struct RowPatch { type_label: Option, #[serde(rename = "artistId", skip_serializing_if = "Option::is_none")] artist_id: Option, + #[serde(rename = "albumId", skip_serializing_if = "Option::is_none")] + album_id: Option, + #[serde(rename = "tracksText", skip_serializing_if = "Option::is_none")] + tracks_text: Option, #[serde(rename = "qualityResolving", skip_serializing_if = "Option::is_none")] quality_resolving: Option, #[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, + /// 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, } // --------------------------------------------------------------------------- @@ -596,12 +620,12 @@ fn classify_release_type(track_count: Option) -> &'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 = 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