feat(slint): pre-launch dev panel, queue controls, appearance persistence, reco cache settings
Sleep timer (queue footer): tokio monotonic deadline + 1Hz countdown that fires core().pause() at expiry; presets + custom minutes via a popover. Stop after this song: 4 QbzCore passthroughs + playback consume-before-advance seam and the load-bearing gapless-prefetch gate, plus the queue marker/menu so the Queue persists when playback halts. qbz-log crate: TeeLogger wrapping env_logger (stderr + 5000-line ring + ~/.local/share/qbz/logs/qbz.log) with write-time secret redaction (regex + live-secret registry) and a diagnostics bundle builder. Dev panel logs: in-app viewer that shows content the moment it opens, advanced controls behind a discreet [+], "Copy all" as the sole footer button, a copy button on the upload URL, and a redacted public paste upload. Diagnostics: qbz-app::diagnostics (extracted, src-tauri untouched) feeding a 7-section panel with the live active output device + sample rate/format (pactl) and a complete redacted report for the upload. Report an Issue: wires the header menu item to a 1:1 Tauri modal that opens the GitHub bug-report template. Appearance persistence: 6 toggles that were live-only now persist via ui_prefs + handler arm + startup seed (window-title-show, show-volume-steppers, sidebar-playlist-collage, local-library-track-artwork, in-app-toasts, theme-filter). Recommendations cache (per-tab only): TTL select 24/36/48/72h + Refresh now in ExternalRecoView; no change to the other Discover tabs. Bump workspace version 0.1.0 -> 1.2.15 so app_version is correct in the diagnostics report and the QConnect About string. i18n es/de/fr/pt for all new strings. cc
This commit is contained in:
44 files changed
+5092
-71
No files matched your search
@@ -1,3 +1,6 @@
|
||||
//! Frontend-agnostic text/date utilities extracted from the qbz binary.
|
||||
pub mod dates;
|
||||
pub mod sleep;
|
||||
pub mod strip_html;
|
||||
|
||||
pub use sleep::format_sleep_remaining;
|
||||
@@ -0,0 +1,70 @@
|
||||
//! Sleep-timer countdown formatting (1:1 with the Tauri `formatSleepTimerRemaining`).
|
||||
|
||||
/// Format remaining seconds like the Tauri sleep timer.
|
||||
///
|
||||
/// - `h > 0` -> `"{h}h {m}m"`
|
||||
/// - `m > 0` -> `"{m}m {s}s"` only when under 5 minutes and there are stray seconds, else `"{m}m"`
|
||||
/// - else -> `"{s}s"`
|
||||
/// - `<= 0` -> `"0s"`
|
||||
///
|
||||
/// Seconds are shown only under 5 minutes, matching `sleepTimerStore.ts`.
|
||||
pub fn format_sleep_remaining(secs: i64) -> String {
|
||||
if secs <= 0 {
|
||||
return "0s".to_string();
|
||||
}
|
||||
let h = secs / 3600;
|
||||
let m = (secs % 3600) / 60;
|
||||
let s = secs % 60;
|
||||
if h > 0 {
|
||||
format!("{h}h {m}m")
|
||||
} else if m > 0 {
|
||||
if s > 0 && m < 5 {
|
||||
format!("{m}m {s}s")
|
||||
} else {
|
||||
format!("{m}m")
|
||||
}
|
||||
} else {
|
||||
format!("{s}s")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::format_sleep_remaining as f;
|
||||
|
||||
#[test]
|
||||
fn under_a_minute() {
|
||||
assert_eq!(f(45), "45s");
|
||||
assert_eq!(f(1), "1s");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn at_or_below_zero() {
|
||||
assert_eq!(f(0), "0s");
|
||||
assert_eq!(f(-3), "0s");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn under_five_min_shows_secs() {
|
||||
assert_eq!(f(125), "2m 5s");
|
||||
assert_eq!(f(61), "1m 1s");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exact_minute_no_stray_secs() {
|
||||
assert_eq!(f(120), "2m");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn five_min_or_more_minutes_only() {
|
||||
assert_eq!(f(305), "5m");
|
||||
assert_eq!(f(300), "5m");
|
||||
assert_eq!(f(599), "9m");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hours() {
|
||||
assert_eq!(f(3725), "1h 2m");
|
||||
assert_eq!(f(3600), "1h 0m");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user