feat(qt): port the My QBZ domain — mixtapes, collections and the discography builder
The Slint reference is 3,885 lines of .slint across ten files plus 5,514 lines
of Rust glue over the shared qbz-mixtape crate. None of it existed in the Qt
port; the nav flyout carried a "GAP:" comment and two disabled entries.
Rust (flat in src/, per QTBUG-93443): three bridges rather than one God-object
— QbzMyQbz (grids + detail + edit + cover + mix), QbzMyQbzAdd (the app-wide
picker, kept apart so TrackRow, PlayerBar and the Local Library bulk bars
cannot couple to detail state) and QbzDisco (artist-scoped, reached from the
artist page, never coexisting with the MyQBZ views). Twelve controllers behind
them, ported function by function from myqbz{,_detail,_play,_edit,_cover,_mix,
_add,_prefs,_view_prefs,_builder}.rs. src/toast_qt.rs finally gives the port a
toast host.
QML in qml/views/myqbz/ plus four global overlays. Reused rather than forked:
TrackRow, TrackListHeader, QualityBadgeFull, QbzContextMenu, CardMenu,
QbzCheckbox, QbzSkeleton, QbzScrollBar, RoundedImage. LocalSegToggle and
LocalMultiSelectBar are PROMOTED to controls/QbzSegToggle and
controls/QbzMultiSelectBar (they were ports of shared Slint primitives that
MyQBZ needs too) — a move plus an import fix, with the Local metrics kept as
the defaults so the four Local Library toggles are byte-unchanged and the MyQBZ
call sites pass ViewToggle's own numbers.
Every list is windowed at write time: GridView/ListView with reuseItems and a
cacheBuffer, and expanded mode is an outer recycled ListView whose delegate is
a Column + Repeater, because a nested ListView inside a recycled delegate
cannot size itself. Single-row updates patch in place; replacing the array
resets contentY and throws the user to the top.
Shared controls gained the arms the new views need, with the numbers taken from
the .slint and not guessed: SettingsButton (btnHeight / minWidth /
trailingIconName), QbzEmptyState's four metrics, QbzSelect's `sm` variant
(30px, r6, no outline, 12px label, 14px chevron, 40px narrower —
QbzSelect.slint:74-148), QbzContextMenu.openBelowLeft, and QbzLineEdit gains a
distinct `accepted` signal fired on ENTER ONLY: a modal that submits on
`committed` submits TWICE, because closing it removes focus and fires
`committed` again — a rename would have run twice and a create made two
collections. clearSearch() no longer assigns root.text either; that JS write
destroyed the call site's binding permanently, so Rust could never re-seed the
field after one click on the X.
SourceIcon gained the plain "qobuz" arm it was missing, which had every Qobuz
row in a collection drawing itself as a local file.
Two icons (turntable, image) are baked from the Slint masters into the seven
full tint dirs and registered in MASTERS; three more (circle-check-big,
circle-alert, triangle-alert) back the toast. A missing tint dir or glyph
renders nothing and logs nothing, so this class never surfaces in a build.
cc
This commit is contained in:
107 files changed
+14608
-226
No files matched your search
@@ -0,0 +1,151 @@
|
||||
// MyQbzCard — the Mixtape/Collection index tile. ONE file for BOTH of
|
||||
// MyQbzShared.slint's index widgets, because they render the same fields with
|
||||
// the same affordance and differ only in shape:
|
||||
// * default arm = `MyQbzCard` (:76-116) — the 208x296 grid card;
|
||||
// * `compact` = `MyQbzListRow` (:120-163) — the 64px list row.
|
||||
// Slint keeps them apart only because its layouts are declarative; folding
|
||||
// them here is the same call MyQbzGridView.qml makes for the two views.
|
||||
//
|
||||
// Grid card: 208 wide x (184 + 12 + 12 + 18 + 2*20 + 18 + 12) = 296 tall, r8,
|
||||
// bg hover -> surface-hover, border 1px that ALSO goes surface-hover on hover
|
||||
// (:82-84); inner padding 12 all round, spacing 8, top-aligned: 184 mosaic, a
|
||||
// 2px spacer, a 40px 2-line name clamp (so cards with a one-line and a two-line
|
||||
// name still align), then the muted subtitle.
|
||||
// List row: 64 tall, r6, bg hover -> surface-hover else TRANSPARENT, padding
|
||||
// 12 left/right, spacing 12, a 48px mosaic and a 2px-spaced text column.
|
||||
//
|
||||
// Both are entirely `item.*` driven (the GridDoc `GridCard` object) and the
|
||||
// WHOLE tile is the hit target with a pointer cursor. There is NO context menu
|
||||
// on either shape in Slint and no hover animation is declared — do not add
|
||||
// either.
|
||||
//
|
||||
// The two arms live behind a Loader because the mosaic is a Canvas with up to
|
||||
// nine image probes: mounting both trees would double that per delegate.
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
import "../../cards"
|
||||
import "../../theme"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
/// One GridDoc `GridCard`: id, name, kind, label, meta, itemCount,
|
||||
/// hasCustomCover, customCoverPath, coverCount, cellUrls, cellPaths.
|
||||
property var item: ({})
|
||||
/// false = 208x296 grid card, true = 64px list row.
|
||||
property bool compact: false
|
||||
signal clicked()
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
// implicitWidth (not width): the grid delegate wants the fixed 208 and the
|
||||
// list delegate assigns the view's width over it.
|
||||
implicitWidth: 208
|
||||
height: root.compact ? 64 : (184 + 12 + 12 + 18 + 2 * 20 + 18 + 12)
|
||||
radius: root.compact ? 6 : 8
|
||||
color: cardArea.containsMouse ? theme.surfaceHover
|
||||
: (root.compact ? "transparent" : theme.surfaceCard)
|
||||
border.width: root.compact ? 0 : 1
|
||||
border.color: cardArea.containsMouse ? theme.surfaceHover : theme.surfaceElevated
|
||||
|
||||
readonly property string subtitle: (root.item.label || "") + " · " + (root.item.meta || "")
|
||||
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
sourceComponent: root.compact ? rowBody : cardBody
|
||||
}
|
||||
|
||||
// --- Grid card ------------------------------------------------------
|
||||
Component {
|
||||
id: cardBody
|
||||
Column {
|
||||
x: 12
|
||||
y: 12
|
||||
width: parent.width - 24
|
||||
spacing: 8
|
||||
|
||||
CollectionMosaic {
|
||||
size: 184
|
||||
urls: root.item.cellUrls || []
|
||||
paths: root.item.cellPaths || []
|
||||
coverCount: root.item.coverCount || 0
|
||||
kind: root.item.kind || ""
|
||||
itemCount: root.item.itemCount || 0
|
||||
hasCustomCover: root.item.hasCustomCover === true
|
||||
customCoverPath: root.item.customCoverPath || ""
|
||||
}
|
||||
Item { width: 1; height: 2 }
|
||||
Text {
|
||||
width: parent.width
|
||||
// 2 lines RESERVED, not "up to 2" — the clamp is what keeps a
|
||||
// row of cards aligned (MyQbzShared.slint:102).
|
||||
height: 40
|
||||
text: root.item.name || ""
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontBody
|
||||
font.weight: theme.weightSemibold
|
||||
wrapMode: Text.WordWrap
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Text {
|
||||
width: parent.width
|
||||
text: root.subtitle
|
||||
color: theme.textMuted
|
||||
font.pixelSize: theme.fontLegal
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- List row -------------------------------------------------------
|
||||
Component {
|
||||
id: rowBody
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 12
|
||||
|
||||
CollectionMosaic {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
size: 48
|
||||
urls: root.item.cellUrls || []
|
||||
paths: root.item.cellPaths || []
|
||||
coverCount: root.item.coverCount || 0
|
||||
kind: root.item.kind || ""
|
||||
itemCount: root.item.itemCount || 0
|
||||
hasCustomCover: root.item.hasCustomCover === true
|
||||
customCoverPath: root.item.customCoverPath || ""
|
||||
}
|
||||
Column {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Math.max(0, parent.width - 48 - 12)
|
||||
spacing: 2
|
||||
Text {
|
||||
width: parent.width
|
||||
text: root.item.name || ""
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontBody
|
||||
font.weight: theme.weightSemibold
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Text {
|
||||
width: parent.width
|
||||
text: root.subtitle
|
||||
color: theme.textMuted
|
||||
font.pixelSize: theme.fontLegal
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: cardArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.clicked()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user