The panel improvised its own title + free-form paragraph + ghost buttons,
breaking the established Settings structure. Rebuilt it like Audio/Playback/
Appearance: a GroupHeader ("OFFLINE CACHE") + SettingRow rows (label +
description + a SecondaryButton control on the right) — Manage offline cache /
Cache folder / Clear offline cache. No panel-level title (the left sub-nav
names the section). Keeps the layout consistent for the offline settings we'll
add here later.
cc
86 lines
2.7 KiB
Plaintext
86 lines
2.7 KiB
Plaintext
// Settings > Offline Playback (cache half). Same structure as the other
|
|
// settings panels (GroupHeader + SettingRow + a secondary button control) so
|
|
// the section stays consistent as more offline settings land. Launches the
|
|
// Offline Cache Manager + offers open-folder / clear-all. The Local-Library
|
|
// rows (show-in-library, repair) arrive with the Local Library port.
|
|
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { Typography } from "../foundation/typography.slint";
|
|
import { Radius } from "../foundation/radius.slint";
|
|
import { OfflineManagerActions } from "../state.slint";
|
|
import { SettingRow } from "SettingRow.slint";
|
|
|
|
component GroupHeader inherits Text {
|
|
color: Theme.text-muted;
|
|
font-size: 11px;
|
|
letter-spacing: 1.5px;
|
|
font-weight: Typography.semibold;
|
|
}
|
|
|
|
// Matches AudioSettings/AppearanceSettings' SecondaryButton.
|
|
component SecondaryButton inherits Rectangle {
|
|
in property <string> label;
|
|
in property <bool> danger: false;
|
|
callback clicked();
|
|
width: 160px;
|
|
height: 34px;
|
|
border-radius: Radius.sm;
|
|
border-width: 1px;
|
|
border-color: root.danger ? #e0564f : Theme.border-subtle;
|
|
background: ta.has-hover ? Theme.surface-hover : Theme.surface-elevated;
|
|
Text {
|
|
width: 100%;
|
|
height: 100%;
|
|
text: root.label;
|
|
color: root.danger ? #e0564f : Theme.text-secondary;
|
|
font-size: Typography.body;
|
|
font-weight: Typography.medium;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
}
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
root.clicked();
|
|
}
|
|
}
|
|
}
|
|
|
|
export component OfflineSettings inherits VerticalLayout {
|
|
spacing: 4px;
|
|
|
|
GroupHeader { text: @tr("OFFLINE CACHE"); }
|
|
|
|
SettingRow {
|
|
label: @tr("Manage offline cache");
|
|
description: @tr("Browse and manage your downloaded tracks and albums.");
|
|
SecondaryButton {
|
|
label: @tr("Open manager");
|
|
clicked => {
|
|
OfflineManagerActions.open();
|
|
}
|
|
}
|
|
}
|
|
SettingRow {
|
|
label: @tr("Cache folder");
|
|
description: @tr("Open the folder where offline tracks are stored on disk.");
|
|
SecondaryButton {
|
|
label: @tr("Open folder");
|
|
clicked => {
|
|
OfflineManagerActions.open-folder();
|
|
}
|
|
}
|
|
}
|
|
SettingRow {
|
|
label: @tr("Clear offline cache");
|
|
description: @tr("Remove every downloaded track. This cannot be undone.");
|
|
SecondaryButton {
|
|
label: @tr("Clear all");
|
|
danger: true;
|
|
clicked => {
|
|
OfflineManagerActions.clear-all();
|
|
}
|
|
}
|
|
}
|
|
}
|