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
@@ -20,20 +20,35 @@ Rectangle {
|
||||
property int popupWidth: 0
|
||||
property bool enabled: true
|
||||
property bool searchable: false
|
||||
// Bootstrap-style small variant (QbzSelect.slint:74-76). The default is the
|
||||
// standard Settings size; TOOLBARS opt in with `sm: true` — 30px tall, r6,
|
||||
// NO outline (it matches the favorites toolbar buttons), 12px label and a
|
||||
// 14px chevron, and 40px narrower because toolbar selects were needlessly
|
||||
// wide (QbzSelect.slint:86-88,102-105,118-119,126,147-148,299).
|
||||
property bool sm: false
|
||||
signal selected(int index)
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
id: selectRoot
|
||||
width: menuWidth
|
||||
height: 34
|
||||
radius: theme.radiusSm
|
||||
border.width: 1
|
||||
width: sm ? Math.max(0, menuWidth - 40) : menuWidth
|
||||
height: sm ? 30 : 34
|
||||
radius: sm ? 6 : theme.radiusSm
|
||||
border.width: sm ? 0 : 1
|
||||
border.color: theme.borderSubtle
|
||||
color: selArea.containsMouse && enabled ? theme.surfaceHover : theme.surfaceElevated
|
||||
opacity: enabled ? 1.0 : 0.4
|
||||
|
||||
readonly property int listWidth: Math.max(popupWidth, menuWidth)
|
||||
// `width`, NOT `menuWidth`: QbzSelect.slint:89-91 resolves the open list as
|
||||
// `max(popup-width, EFF-WIDTH)`, and eff-width is `menu-width - 40px` at
|
||||
// `sm` (:88) — the same value it uses for the collapsed control. Reading the
|
||||
// RAW menuWidth here made every toolbar dropdown's PANEL 40px wider than the
|
||||
// reference's (MyQBZ sort 180 vs 140, kind filter 200 vs 160, detail sort
|
||||
// 170 vs 130, and the Local Library toolbar / LabelReleases selects with it).
|
||||
// The three `popupWidth` callers (AudioSettings 480, CastPicker 260,
|
||||
// LyricsControlsFlyout 178) are all non-`sm`, where width === menuWidth and
|
||||
// popupWidth wins anyway, so none of them moves.
|
||||
readonly property int listWidth: Math.max(popupWidth, selectRoot.width)
|
||||
readonly property int rowHeight: 32
|
||||
readonly property int headerHeight: 24
|
||||
readonly property int searchHeight: searchable ? 42 : 0
|
||||
@@ -58,8 +73,8 @@ Rectangle {
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 10
|
||||
anchors.leftMargin: selectRoot.sm ? 10 : 12
|
||||
anchors.rightMargin: selectRoot.sm ? 8 : 10
|
||||
spacing: 8
|
||||
Text {
|
||||
width: parent.width - 16 - 8 - badgeSlot.width - (badgeSlot.visible ? 8 : 0)
|
||||
@@ -67,7 +82,7 @@ Rectangle {
|
||||
text: selectRoot.currentIndex >= 0 && selectRoot.currentIndex < selectRoot.options.length
|
||||
? selectRoot.optLabel(selectRoot.currentIndex) : ""
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontBody
|
||||
font.pixelSize: selectRoot.sm ? 12 : theme.fontBody
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
@@ -99,8 +114,8 @@ Rectangle {
|
||||
}
|
||||
QbzIcon {
|
||||
name: "chevron-down"
|
||||
width: 16
|
||||
height: 16
|
||||
width: selectRoot.sm ? 14 : 16
|
||||
height: selectRoot.sm ? 14 : 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
tintName: "muted"
|
||||
}
|
||||
@@ -247,7 +262,7 @@ Rectangle {
|
||||
text: optRow.label
|
||||
color: optRow.index === selectRoot.currentIndex
|
||||
? theme.accent : theme.textSecondary
|
||||
font.pixelSize: theme.fontBody
|
||||
font.pixelSize: selectRoot.sm ? 12 : theme.fontBody
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user