From de5c50a5b35f6b3111ea17dbe01009df8a5134f7 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sun, 5 Jul 2026 08:04:07 -0600 Subject: [PATCH] feat(playlist): restore the "Date added" sort option 2.0 dropped the v1.x "added" sort. Restore it with the same semantics: a positional proxy over the playlist's natural insertion order (the API returns tracks oldest-first; no added-at timestamp is deserialized), starting newest-first on first selection, re-click toggles direction. New msgid translated in all 7 locales. Fixes #546 cc --- crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po | 3 +++ crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po | 3 +++ crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po | 3 +++ crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po | 3 +++ crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po | 3 +++ crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po | 3 +++ crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po | 3 +++ crates/qbz-ui/ui/playlist/PlaylistView.slint | 11 +++++++++++ crates/qbz/src/playlist.rs | 12 +++++++++++- 9 files changed, 43 insertions(+), 1 deletion(-) diff --git a/crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po index 043424911..156f1b8d4 100644 --- a/crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po @@ -4355,3 +4355,6 @@ msgstr "DoP — DSD über PCM (bit-perfekt)" msgid "Native DSD (kernel support required)" msgstr "Natives DSD (Kernel-Unterstützung erforderlich)" + +msgid "Date added" +msgstr "Hinzugefügt am" diff --git a/crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po index 2231b9ef3..15fcd05e2 100644 --- a/crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po @@ -94,3 +94,6 @@ msgstr "Signing you in…" msgid "Sign-in failed" msgstr "Sign-in failed" + +msgid "Date added" +msgstr "Date added" diff --git a/crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po index 67dc45113..f2580e18d 100644 --- a/crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po @@ -4385,3 +4385,6 @@ msgstr "DoP — DSD sobre PCM (bit-perfect)" msgid "Native DSD (kernel support required)" msgstr "DSD nativo (requiere soporte del kernel)" + +msgid "Date added" +msgstr "Fecha de agregado" diff --git a/crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po index 40e4a99cc..3d3bab7c7 100644 --- a/crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po @@ -4355,3 +4355,6 @@ msgstr "DoP — DSD sur PCM (bit-perfect)" msgid "Native DSD (kernel support required)" msgstr "DSD natif (prise en charge du noyau requise)" + +msgid "Date added" +msgstr "Date d'ajout" diff --git a/crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po index 81f3a0755..3410e99be 100644 --- a/crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po @@ -4344,3 +4344,6 @@ msgstr "DoP — PCM上のDSD(ビットパーフェクト)" msgid "Native DSD (kernel support required)" msgstr "ネイティブDSD(カーネルサポートが必要)" + +msgid "Date added" +msgstr "追加日" diff --git a/crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po index 8f17c1eea..f7de69792 100644 --- a/crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po @@ -4355,3 +4355,6 @@ msgstr "DoP — DSD sobre PCM (bit-perfect)" msgid "Native DSD (kernel support required)" msgstr "DSD nativo (requer suporte do kernel)" + +msgid "Date added" +msgstr "Data de adição" diff --git a/crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po index 5dbe602e2..192bc30e9 100644 --- a/crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po @@ -4368,3 +4368,6 @@ msgstr "DoP — DSD поверх PCM (бит-перфект)" msgid "Native DSD (kernel support required)" msgstr "Нативный DSD (требуется поддержка ядра)" + +msgid "Date added" +msgstr "Дата добавления" diff --git a/crates/qbz-ui/ui/playlist/PlaylistView.slint b/crates/qbz-ui/ui/playlist/PlaylistView.slint index 59ea4362b..99254be05 100644 --- a/crates/qbz-ui/ui/playlist/PlaylistView.slint +++ b/crates/qbz-ui/ui/playlist/PlaylistView.slint @@ -333,6 +333,7 @@ export component PlaylistView inherits Rectangle { : PlaylistState.sort-field == "artist" ? @tr("Artist") : PlaylistState.sort-field == "album" ? @tr("Album") : PlaylistState.sort-field == "duration" ? @tr("Duration") + : PlaylistState.sort-field == "added" ? @tr("Date added") : PlaylistState.sort-field == "custom" ? @tr("Custom") : @tr("Default"); @@ -801,6 +802,16 @@ export component PlaylistView inherits Rectangle { asc: PlaylistState.sort-asc; chosen => { PlaylistActions.set-sort("duration"); } } + // Positional proxy for when each + // track entered the playlist (the + // API returns insertion order) — + // v1.x parity, starts newest-first. + SortOption { + label: @tr("Date added"); + active: PlaylistState.sort-field == "added"; + asc: PlaylistState.sort-asc; + chosen => { PlaylistActions.set-sort("added"); } + } // Manual order — enables the per-row // up/down reorder controls. Hidden on // LOCAL playlists (B2): their Default diff --git a/crates/qbz/src/playlist.rs b/crates/qbz/src/playlist.rs index 3f61d99a8..380b31938 100644 --- a/crates/qbz/src/playlist.rs +++ b/crates/qbz/src/playlist.rs @@ -106,6 +106,14 @@ fn refresh_view(window: &AppWindow) { .and_then(|k| order.get(&k).copied()) .unwrap_or(i32::MAX) }); + } else if field == "added" { + // "Date added" is a positional proxy (v1.x parity): FULL_ITEMS is in + // the playlist's natural insertion order (the API returns tracks + // oldest-first) and the filter above preserves it, so asc = oldest + // first and desc = newest first is a plain reversal. + if !asc { + view.reverse(); + } } else if field != "default" { view.sort_by(|a, b| { let ord = match field.as_str() { @@ -171,7 +179,9 @@ pub fn set_sort(window: &AppWindow, field: &str) { } else if cur.0 == field { cur.1 = !cur.1; } else { - *cur = (field.to_string(), true); + // "added" starts newest-first (desc) — v1.x parity; the other + // fields start ascending. + *cur = (field.to_string(), field != "added"); } }); let (field, asc) = SORT.with(|s| s.borrow().clone());