S008: folder model, playlist sort and details view

FolderModel loads and watches folders off the UI thread, sorts (natural
name, size, type, modified, playlist), groups, filters and keeps the
selection; the details view shows it in a virtualized list with a
click-to-sort header, filter chip and empty/loading/error states.
tunal-core::playlist reads m3u/m3u8/pls/xspf/wpl (D-030). tunal <dir>
opens a folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-18 13:43:43 -06:00
commit 985f44f50f
2 changed files with 2425 additions and 42 deletions

View file

@ -10,14 +10,14 @@ A folder model fed from the location layer off the UI thread (sorting, grouping,
CLAUDE.md §3, §4; crates/tunal-core trait; crates/tunal/ui/components/list-row.slint, menu.slint.
## Steps
- [ ] `FolderModel`: load off-thread in chunks, apply watch diffs (insert/remove/change) keeping selection; a Slint `Model` that stays fast at 10 000+ rows.
- [ ] Sorting (natural name order, size, type, modified; folders first toggle; asc/desc) and grouping (none, type, modified date buckets, size buckets) with group header rows.
- [ ] Playlist sort (D-021): in folders under `XDG_MUSIC_DIR` that hold a playlist (`.m3u`, `.m3u8`, `.pls`, `.xspf`), the sort options show **Playlist sort** (one entry per playlist when there are several); files listed in the playlist come first in playlist order, the rest follow in natural name order; desc reverses; the playlist file is watched and re-sorts on change. Parser in `tunal-core::playlist` (relative/absolute paths, `file://` URLs, percent-decoding, `#EXT` lines skipped).
- [ ] Hidden files toggle (dot files) and type-to-filter (typing filters by substring, a filter chip shows the text, Esc clears).
- [ ] Mime → Material Symbols glyph map (folder, image, audio, video, text, code, archive, PDF, executable, generic, symlink badge).
- [ ] Details view: `ListView` rows on `ListRow`, column header with click-to-sort and animated indicator, empty/loading/error states.
- [ ] Selection: click, Ctrl, Shift range, Ctrl+A, arrows/Home/End/PageUp/PageDown, Enter on a folder opens it. Temporary: `tunal <dir>` opens that folder.
- [ ] PROGRESS entry, INDEX line, commit `S008: …`
- [x] `FolderModel`: load off-thread in chunks, apply watch diffs (insert/remove/change) keeping selection; a Slint `Model` that stays fast at 10 000+ rows.
- [x] Sorting (natural name order, size, type, modified; folders first toggle; asc/desc) and grouping (none, type, modified date buckets, size buckets) with group header rows.
- [x] Playlist sort (D-021, details D-030): in folders under `XDG_MUSIC_DIR`, playlists from the folder itself and from `<Music>/Playlists` (also `playlists`/`Playlist`/`playlist`) that place at least one entry here are offered as **Playlist sort** (one entry per playlist, the one named like the folder, else the one placing most entries, first); listed entries first in playlist order (subfolders by their first track, moved tracks by file name), the rest in natural name order; desc reverses; playlist changes re-sort. Parser in `tunal-core::playlist` (.m3u .m3u8 .pls .xspf .wpl; relative/absolute paths, `file://` URLs, percent-decoding, `#EXT` lines skipped; UTF-8 → UTF-16 → cp1252/Latin-1).
- [x] Hidden files toggle (dot files) and type-to-filter (typing filters by substring, a filter chip shows the text, Esc clears).
- [x] Mime → Material Symbols glyph map (folder, image, audio, video, text, code, archive, PDF, executable, generic, symlink badge).
- [x] Details view: `ListView` rows on `ListRow`, column header with click-to-sort and animated indicator, empty/loading/error states.
- [x] Selection: click, Ctrl, Shift range, Ctrl+A, arrows/Home/End/PageUp/PageDown, Enter on a folder opens it. Temporary: `tunal <dir>` opens that folder.
- [x] PROGRESS entry, INDEX line, commit `S008: …`
## End criteria
- `cargo build --workspace`, `cargo clippy --workspace --all-targets -- -D warnings` and `cargo fmt --check` pass.

View file

@ -19,7 +19,7 @@ Tracker: https://claude.ai/artifact/4X8YCk3cQjUGyuyCqGuU7v
- [x] [S006 — Location layer and local backend](03%20File%20browsing/S006-location-layer.md) · Opus medium
- [x] [S007 — File operations engine and trash](03%20File%20browsing/S007-file-ops-engine.md) · Opus medium
- [ ] [S008 — Folder model and details view](03%20File%20browsing/S008-folder-model-details.md) · Opus medium
- [x] [S008 — Folder model and details view](03%20File%20browsing/S008-folder-model-details.md) · Opus medium
- [ ] [S009 — Icon grid view and list motion](03%20File%20browsing/S009-grid-and-list-motion.md) · Opus high
- [ ] [S010 — Tabs, split view, breadcrumbs, history and places](03%20File%20browsing/S010-navigation-shell.md) · Opus medium
- [ ] [S011 — File operation actions](03%20File%20browsing/S011-file-op-actions.md) · Sonnet high