fix(slint): typed drag payload and add-to-playlist paths for local/plex rows

The drag payload was an untyped Vec<u64>, so dropping a LOCAL album row
onto a local playlist stored its library row id as a qobuz_track_id - the
D11 resolver could not resolve the fake id and hid the row (the
empty-playlist report). New DragTrack {Qobuz|LocalRow|Plex} typed per
originating view; the drop arm stores source-aware refs (qobuz_download
rows keep their real Qobuz ref, plex rows their key, local rows their
path) for both local and Qobuz playlist targets.

Add-to-playlist had collapsed to play-track in LocalAlbumView (entry
rendered, action ignored) and was an unhandled arm in the Tracks tab; both
now route to the source-aware picker, Plex rows gain the entry everywhere
(gate was excluding them), folder-detail rows route through the shared
track-action arm, and bulk arms stop skipping Plex.

D11 nuance: a local-path row missing from the library index but present on
disk renders with a filename fallback instead of hiding; only genuinely
missing files stay hidden (logged distinctly). main.rs also carries the
recovery handler hunks for the sign-in flow fix (Login screen first,
browser OAuth after, no unlocked-empty shell).

cc
This commit is contained in:
vicrodh committed 2026-06-10 09:04:27 -06:00
1 parent d5bd43aca3
commit a5b4c9ba1c
9 files changed
+514 -145

No files matched your search

+26 -6
View File
@@ -1,19 +1,39 @@
//! Track drag-and-drop state — the ids currently being dragged onto a
//! Track drag-and-drop state — the tracks currently being dragged onto a
//! sidebar playlist. The UI (DragState global) drives the ghost +
//! drop highlight; the actual track ids live here (the global only
//! drop highlight; the actual track refs live here (the global only
//! carries a count + ghost text).
//!
//! The payload is SOURCE-TYPED: a row dragged from a Qobuz surface carries
//! its catalog id, a LocalLibrary file row its `local_tracks` row id, a
//! Plex row its rating key. The drop arm maps each variant to the right
//! playlist ref (`qobuz_track_id` / `local_path` / `plex_key`) — storing a
//! library row id as a Qobuz id is what made dropped local rows resolve
//! as unavailable (hidden, D11).
use std::sync::{LazyLock, Mutex};
static DRAGGED: LazyLock<Mutex<Vec<u64>>> = LazyLock::new(|| Mutex::new(Vec::new()));
/// One dragged track, typed by its source namespace.
#[derive(Debug, Clone)]
pub enum DragTrack {
/// Qobuz catalog track id (also offline-cached rows — those ARE
/// catalog ids with a local copy).
Qobuz(u64),
/// LocalLibrary `local_tracks` row id (resolved source-aware at
/// insert: offline copies -> Qobuz ref, user files -> local_path).
LocalRow(i64),
/// Plex track — the rating key.
Plex(String),
}
pub fn set_dragged(ids: Vec<u64>) {
static DRAGGED: LazyLock<Mutex<Vec<DragTrack>>> = LazyLock::new(|| Mutex::new(Vec::new()));
pub fn set_dragged(tracks: Vec<DragTrack>) {
if let Ok(mut d) = DRAGGED.lock() {
*d = ids;
*d = tracks;
}
}
pub fn dragged() -> Vec<u64> {
pub fn dragged() -> Vec<DragTrack> {
DRAGGED.lock().map(|d| d.clone()).unwrap_or_default()
}