Files
qbz/crates/qbz-qt/qml/shell/InfoCreditCell.qml
T
vicrodh 3f3c4ad548 feat(qt): Track info and Album info are selectable and copy basic or full text
Every field of both modals is a QbzSelectableText — artist, label and
musician names stay links. A copy button beside the close cross opens a
flyout: "Copy basic data" puts "{Track} - {Album} - {Artist}" (or
"{Album} - {Artist}") on the clipboard; "Copy full" formats the whole sheet
as plain text — the track's metadata, credits and copyright, or the album's
header plus the ACTIVE tab: credits per track with performers, or the
review. Album credit row heads stay plain because their click expands the
row. The two new strings ship in all eight catalogs.

cc
2026-09-13 20:03:36 -06:00

69 lines
2.4 KiB
QML

// InfoCreditCell — one credit cell of the Track Info modal: the role label
// (11px semibold muted, letter-spacing 0.5) over the performer names, ONE
// CLICKABLE NAME PER LINE. 1:1 with `CreditCell` in
// crates/qbz-ui/ui/album/TrackInfoModal.slint, including its reasoning: there
// is no flow layout, so a wrapping row of links would clip — a vertical stack
// keeps click-to-musician AND never overflows the column.
//
// `cell` is one entry of the trackInfo document's `credits` array:
// { "role": "PRODUCER", "roleRaw": "Producer", "names": ["A", "B"] }
import QtQuick
import "../controls"
import "../theme"
Column {
id: cc
property var cell: null
/// Fixed cell width handed down by the modal so the two columns stay
/// aligned and the value text wraps inside the column instead of
/// dictating its width.
property int colW: 280
/// Immersive-panel legibility mode (see TrackInfoBody.qml): fixed light
/// colors + native shadow instead of the theme tokens.
property bool overAmbient: false
/// Hover color for clickable names — the host swaps in the album-palette
/// accent over ambient (theme accent has no contrast guarantee there).
property color accentColor: theme.accent
signal nameClicked(string name, string roleRaw)
QbzTheme { id: theme }
width: colW
spacing: 6
QbzSelectableText {
width: cc.colW
text: cc.cell ? (cc.cell.role || "") : ""
color: cc.overAmbient ? "#b3ffffff" : theme.textMuted
raised: cc.overAmbient
pixelSize: 11
weight: theme.weightSemibold
letterSpacing: 0.5
}
Column {
spacing: 2
Repeater {
model: cc.cell ? (cc.cell.names || []) : []
// Selectable AND a link: a click lands on the musician, a drag
// selects the name (QbzSelectableText, rich-text anchor).
delegate: QbzSelectableText {
id: nameRow
required property string modelData
width: cc.colW
text: nameRow.modelData
color: cc.overAmbient ? "#f2ffffff" : theme.textPrimary
linkHref: "musician"
linkHoverColor: cc.accentColor
raised: cc.overAmbient
pixelSize: 14
onLinkActivated: cc.nameClicked(nameRow.modelData,
cc.cell ? (cc.cell.roleRaw || "") : "")
}
}
}
}