diff --git a/crates/qbz-slint/ui/assets/icons/heart-filled.svg b/crates/qbz-slint/ui/assets/icons/heart-filled.svg new file mode 100644 index 000000000..6beddf866 --- /dev/null +++ b/crates/qbz-slint/ui/assets/icons/heart-filled.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/qbz-slint/ui/assets/icons/infinity.svg b/crates/qbz-slint/ui/assets/icons/infinity.svg new file mode 100644 index 000000000..300bb19bd --- /dev/null +++ b/crates/qbz-slint/ui/assets/icons/infinity.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/qbz-slint/ui/assets/icons/list-x.svg b/crates/qbz-slint/ui/assets/icons/list-x.svg new file mode 100644 index 000000000..2398d0ec8 --- /dev/null +++ b/crates/qbz-slint/ui/assets/icons/list-x.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/crates/qbz-slint/ui/foundation/semantic-colors.slint b/crates/qbz-slint/ui/foundation/semantic-colors.slint index 6b39ffb87..45bf5ef50 100644 --- a/crates/qbz-slint/ui/foundation/semantic-colors.slint +++ b/crates/qbz-slint/ui/foundation/semantic-colors.slint @@ -24,6 +24,9 @@ export global Theme { out property accent-pressed: Palette.blue-active; out property accent-text: Palette.white; + // Favorite (heart) — the active "loved" state. + out property favorite: Palette.danger; + // Surfaces — interaction out property surface-hover: Palette.alpha-6; diff --git a/crates/qbz-slint/ui/state.slint b/crates/qbz-slint/ui/state.slint index 8d51c3d32..9cd650375 100644 --- a/crates/qbz-slint/ui/state.slint +++ b/crates/qbz-slint/ui/state.slint @@ -193,6 +193,8 @@ export struct QueueItem { artist: string, artwork: image, playing: bool, + duration: string, // "M:SS" + explicit: bool, } // Now-playing / transport state. The Rust playback poll loop pushes the @@ -230,9 +232,70 @@ export global NowPlayingState { } // Playback queue model, for the Queue sidebar. +// +// The sidebar shows two tabs. The Queue tab renders `now-playing` plus a +// paginated slice of `upcoming` (40 per page). The History tab renders +// `history` (most-recent first). The Rust queue controller owns the full +// upcoming/history lists and the pagination maths; it pushes the current +// page's slice into `upcoming-page` and the counters that label it. export global QueueState { - in property <[QueueItem]> items: []; - in property current-index: -1; - // Play the queue entry at `index`. - callback play-index(int); + // --- Queue tab ------------------------------------------------------- + // Current track card. `has-current` gates the NOW PLAYING section. + in property has-current: false; + in property now-playing; + // Whether the now-playing track is in the user's favorites. + in property now-playing-favorite: false; + + // The slice of upcoming tracks for the current page (<= 40 entries). + in property <[QueueItem]> upcoming-page: []; + // Total upcoming-track count (post-filter when a search is active). + in property upcoming-total: 0; + // Tracks remaining after the current one (total - played - 1). + in property upcoming-remaining: 0; + // Zero-based page index and total page count for the paginator. + in-out property page: 0; + in property page-count: 1; + // Index of the first upcoming entry shown, 1-based, for the counter. + in property page-start: 0; + // Index of the last upcoming entry shown, 1-based, for the counter. + in property page-end: 0; + + // --- History tab ----------------------------------------------------- + in property <[QueueItem]> history: []; + + // --- Shared ---------------------------------------------------------- + // Active tab: 0 = Queue, 1 = History. + in-out property tab: 0; + // Live search query; the Rust controller re-filters `upcoming-page`. + in-out property search-query: ""; + + // --- Callbacks (wired to the Rust queue controller) ------------------ + // Play the upcoming entry at `index` within the current page slice. + callback play-upcoming(int); + // Play a history entry by its `index` in the `history` list. + callback play-history(int); + // Remove the upcoming entry at `index` within the current page slice. + callback remove-upcoming(int); + // Empty the queue. + callback clear-queue(); + // Toggle the favorite state of the now-playing track. + callback toggle-now-playing-favorite(); + // Save the current queue as a new playlist. + callback save-as-playlist(); + // Toggle infinite-play (auto-refill the queue with similar tracks). + callback toggle-infinite-play(); + // Re-filter the upcoming list after `search-query` changed. + callback search-changed(); + // Move to the previous / next paginator page. + callback prev-page(); + callback next-page(); + // Switch the active tab (0 = Queue, 1 = History). + callback set-tab(int); + // Fired when the sidebar becomes visible, so the Rust controller can + // pull a fresh queue snapshot (the queue may have changed while the + // panel was closed, e.g. after a session restore). + callback panel-opened(); + + // Reflects whether infinite-play is currently enabled. + in property infinite-play: false; }