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
104 lines
3.8 KiB
QML
104 lines
3.8 KiB
QML
// QbzToolButton — the MyQBZ detail toolbar's `ToolBtn`
|
|
// (myqbz/MixtapeDetailView.slint:85-151): a 30px bordered chip that is
|
|
// icon-only, icon+label, or icon+label+badge, with TWO distinct active looks.
|
|
//
|
|
// Why not controls/BrowseGenreButton.qml: that one is hard-bound to
|
|
// `QbzBridge.genreFilterJson` and builds its own label out of it, so a generic
|
|
// label/badge/active-mode contract cannot be a parameter of it.
|
|
//
|
|
// THE TWO ACTIVE MODES are the whole point, and they are not interchangeable:
|
|
// * `fillActive: true` — active paints an ACCENT FILL (the Filter button,
|
|
// which is labelled and carries the filter count).
|
|
// * `fillActive: false` — active paints an accent BORDER on the normal
|
|
// elevated fill (the icon-only Select / Reset buttons). Never a fill.
|
|
//
|
|
// Numbers: height 30, r6, width = the row's own padded width (:97-99, so the
|
|
// padding centres the content rather than an absolute x offset), 1px border;
|
|
// padding 8/side icon-only and 10/side labelled (:108-109); row spacing 6;
|
|
// glyph 15x15; label 12px; badge 16x16 r8 with 10px semibold text.
|
|
//
|
|
// Where the .slint hardcodes `#ffffff` on the accent fill (:120, :127, :137)
|
|
// this uses `theme.accentGlyphTint` / `theme.accentGlyphColor` — the measured
|
|
// on-accent selector (theme/QbzTheme.qml, "ON AN ACCENT FILL"). The badge's
|
|
// non-filled text stays `accentText` because there it sits on the accent disc,
|
|
// which is what that token is for.
|
|
|
|
import QtQuick
|
|
import com.blitzfc.qbz
|
|
import "../theme"
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
property string name: ""
|
|
property string label: ""
|
|
/// > 0 renders the trailing count disc.
|
|
property int badge: 0
|
|
property bool active: false
|
|
/// Active = accent FILL (labelled buttons) vs accent BORDER (icon-only).
|
|
property bool fillActive: false
|
|
signal clicked()
|
|
|
|
QbzTheme { id: theme }
|
|
|
|
readonly property bool filled: root.active && root.fillActive
|
|
readonly property int padH: root.label === "" ? 8 : 10
|
|
|
|
height: 30
|
|
implicitWidth: 2 * root.padH + row.implicitWidth
|
|
radius: 6
|
|
color: root.filled ? theme.accent
|
|
: (toolArea.containsMouse ? theme.surfaceHover : theme.surfaceElevated)
|
|
border.width: 1
|
|
border.color: (root.active && !root.fillActive) ? theme.accent : theme.borderSubtle
|
|
|
|
Row {
|
|
id: row
|
|
anchors.centerIn: parent
|
|
spacing: 6
|
|
|
|
QbzIcon {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
name: root.name
|
|
width: 15
|
|
height: 15
|
|
tintName: root.filled ? theme.accentGlyphTint
|
|
: (root.active ? "textPrimary" : "muted")
|
|
}
|
|
Text {
|
|
visible: root.label !== ""
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: root.label
|
|
color: root.filled ? theme.accentGlyphColor
|
|
: (root.active ? theme.textPrimary : theme.textSecondary)
|
|
font.pixelSize: 12
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
Rectangle {
|
|
visible: root.badge > 0
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
width: root.badge > 0 ? 16 : 0
|
|
height: 16
|
|
radius: 8
|
|
color: root.filled ? theme.accentGlyphColor : theme.accent
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: root.badge
|
|
color: root.filled ? theme.accent : theme.accentText
|
|
font.pixelSize: 10
|
|
font.weight: theme.weightSemibold
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
id: toolArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: root.clicked()
|
|
}
|
|
}
|