Ephemeral folders: open / browse / play a folder without indexing it — album-grouped pane, CUE seek fast-path (no full re-decode per virtual track), folder-path persistence + rehydrate, "already playing" add-vs-replace choice dialog (ephemeral-only), and now-playing / queue / menu gating so an ephemeral track exposes no persistence actions. Folders tree brought 1:1 with Tauri: - Rail header: select-mode, collapse-all, open-ephemeral, tree search. - Resizable rail (default ~20% narrower; drag handle, min 50% default / max 50% of the content area). - Subfolder cover grid + grid/list toggle, recursive track count, name search; compact icon bulk bar (folder-check / play-next / queue / playlist / clear). - Tree is the default mode; circular checkboxes homologated with TrackRow; compact rows (smaller type + icon, no ambiguous trailing count). - Flat/Tree icon toggle (disc-album / folder-tree), floated right. Per-source TrackRow context menu (logic, not a blanket trim): Qobuz/offline = full; local = play/next/queue + add-to-playlist; plex/ephemeral = play/next/ queue only. App-wide standard: Math.round pixel-snap on icon centering across the UI to kill sub-pixel blur (CircleAction, header back/forward/collapse, and the rest). NowPlayingBar context icon -> turntable (frees disc-album for the Folders toggle). New assets: folder-check, folder-tree, turntable. cc
144 lines
6.0 KiB
Plaintext
144 lines
6.0 KiB
Plaintext
// "Edit playlist" modal — rename + delete. Opened from the playlist
|
|
// detail header's edit button (EditPlaylistState.open).
|
|
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { Typography } from "../foundation/typography.slint";
|
|
import { Radius } from "../foundation/radius.slint";
|
|
import { EditPlaylistState, EditPlaylistActions } from "../state.slint";
|
|
import { QbzIcon } from "QbzIcon.slint";
|
|
import { LineEdit, TextEdit } from "std-widgets.slint";
|
|
|
|
export component EditPlaylistModal inherits Rectangle {
|
|
visible: EditPlaylistState.open;
|
|
|
|
if EditPlaylistState.open: Rectangle {
|
|
background: #000000bf;
|
|
TouchArea {
|
|
mouse-cursor: default;
|
|
clicked => {
|
|
EditPlaylistActions.close();
|
|
}
|
|
}
|
|
Rectangle {
|
|
width: Math.min(root.width - 80px, 420px);
|
|
height: panel.preferred-height;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
border-radius: Radius.md;
|
|
background: Theme.surface-card;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
drop-shadow-blur: 32px;
|
|
drop-shadow-color: #00000080;
|
|
TouchArea { }
|
|
|
|
panel := VerticalLayout {
|
|
padding: 20px;
|
|
spacing: 16px;
|
|
|
|
HorizontalLayout {
|
|
Text {
|
|
text: @tr("Edit playlist");
|
|
color: Theme.text-primary;
|
|
font-size: Typography.heading;
|
|
font-weight: Typography.semibold;
|
|
horizontal-stretch: 1;
|
|
vertical-alignment: center;
|
|
}
|
|
close-x := TouchArea {
|
|
width: 28px;
|
|
height: 28px;
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
EditPlaylistActions.close();
|
|
}
|
|
QbzIcon {
|
|
source: @image-url("../assets/icons/x.svg");
|
|
width: 17px;
|
|
height: 17px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted;
|
|
}
|
|
}
|
|
}
|
|
|
|
name-input := LineEdit {
|
|
placeholder-text: @tr("Playlist name");
|
|
text <=> EditPlaylistState.name;
|
|
accepted => {
|
|
EditPlaylistActions.save();
|
|
}
|
|
}
|
|
|
|
Text {
|
|
text: @tr("Description");
|
|
color: Theme.text-muted;
|
|
font-size: Typography.legal;
|
|
}
|
|
desc-input := TextEdit {
|
|
height: 90px;
|
|
wrap: word-wrap;
|
|
text <=> EditPlaylistState.description;
|
|
}
|
|
|
|
HorizontalLayout {
|
|
spacing: 10px;
|
|
// Delete (destructive, left).
|
|
Rectangle {
|
|
width: del-label.preferred-width + 28px;
|
|
height: 36px;
|
|
border-radius: Radius.sm;
|
|
background: del-ta.has-hover ? #ef444433 : transparent;
|
|
border-width: 1px;
|
|
border-color: #ef4444;
|
|
del-label := Text {
|
|
text: @tr("Delete");
|
|
color: #ef4444;
|
|
font-size: Typography.body;
|
|
font-weight: Typography.medium;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
}
|
|
del-ta := TouchArea {
|
|
mouse-cursor: EditPlaylistState.busy ? default : pointer;
|
|
clicked => {
|
|
if (!EditPlaylistState.busy) {
|
|
EditPlaylistActions.delete();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Spacer.
|
|
Rectangle { horizontal-stretch: 1; }
|
|
// Save (right).
|
|
Rectangle {
|
|
width: save-label.preferred-width + 36px;
|
|
height: 36px;
|
|
border-radius: Radius.sm;
|
|
opacity: (EditPlaylistState.name != "" && !EditPlaylistState.busy) ? 1.0 : 0.5;
|
|
background: save-ta.has-hover ? #ffffffd6 : Theme.accent;
|
|
save-label := Text {
|
|
text: @tr("Save");
|
|
color: #ffffff;
|
|
font-size: Typography.body;
|
|
font-weight: Typography.semibold;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
}
|
|
save-ta := TouchArea {
|
|
mouse-cursor: (EditPlaylistState.name != "" && !EditPlaylistState.busy)
|
|
? pointer : default;
|
|
clicked => {
|
|
if (EditPlaylistState.name != "" && !EditPlaylistState.busy) {
|
|
EditPlaylistActions.save();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|