fix: quality badge accuracy and queue drag-to-reorder
Quality Badge Fix: - Extended BackendQueueTrack with hires, bit_depth, sample_rate fields - Updated all queue track builder functions to pass quality data - Fixed quality badge showing CD instead of Hi-Res for playlist tracks - Extended session persistence to save/restore quality info Queue Drag-to-Reorder: - Added move_track function to Rust QueueManager - Added move_queue_track Tauri command - Implemented HTML5 drag-and-drop in QueuePanel - Visual feedback with drag-over indicator and dragging opacity - Disabled drag when search filter is active - Prevented text selection during drag operations
This commit is contained in:
1 parent
24c8ee5cad
commit
70f03a1003
9 files changed
+256
-18
No files matched your search
@@ -19,6 +19,10 @@ pub struct QueueTrack {
|
||||
pub album: String,
|
||||
pub duration_secs: u64,
|
||||
pub artwork_url: Option<String>,
|
||||
#[serde(default)]
|
||||
pub hires: bool,
|
||||
pub bit_depth: Option<u32>,
|
||||
pub sample_rate: Option<f64>,
|
||||
}
|
||||
|
||||
/// Repeat mode options
|
||||
@@ -193,6 +197,34 @@ impl QueueManager {
|
||||
Some(removed)
|
||||
}
|
||||
|
||||
/// Move a track from one position to another
|
||||
pub fn move_track(&self, from_index: usize, to_index: usize) -> bool {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
if from_index >= state.tracks.len() || to_index >= state.tracks.len() || from_index == to_index {
|
||||
return false;
|
||||
}
|
||||
|
||||
let track = state.tracks.remove(from_index);
|
||||
state.tracks.insert(to_index, track);
|
||||
|
||||
// Adjust current index if needed
|
||||
if let Some(curr_idx) = state.current_index {
|
||||
if from_index == curr_idx {
|
||||
// The current track was moved
|
||||
state.current_index = Some(to_index);
|
||||
} else if from_index < curr_idx && to_index >= curr_idx {
|
||||
// Track moved from before current to at/after current
|
||||
state.current_index = Some(curr_idx - 1);
|
||||
} else if from_index > curr_idx && to_index <= curr_idx {
|
||||
// Track moved from after current to at/before current
|
||||
state.current_index = Some(curr_idx + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Self::regenerate_shuffle_order_internal(&mut state);
|
||||
true
|
||||
}
|
||||
|
||||
/// Get current track
|
||||
pub fn current_track(&self) -> Option<QueueTrack> {
|
||||
let state = self.state.lock().unwrap();
|
||||
|
||||
Reference in new issue
Block a user