Drive macOS player control bars from presets

Render the macOS control bar button row and top bar from the active
preset's sections via a new MacOSControlsSectionRenderer, replacing the
hardcoded QuickTime-style rows in MacOSControlBar. Add a keepOnTop
button type and macOS-specific button availability lists, and adapt the
player controls settings editors (preset editor, section editor, button
configuration) for macOS.

Also apply the preset font style to the control bar time labels, and
update the built-in macOS Default preset order (queue before transport,
fullscreen at the end), bumping builtInPresetsVersion to 7.
This commit is contained in:
Arkadiusz Fal
2026-05-31 16:55:39 +02:00
parent fa6ad2235c
commit 05bbd449f8
18 changed files with 1348 additions and 404 deletions

View File

@@ -74,7 +74,10 @@ private struct PlayerControlsSettingsContent: View {
var body: some View {
Form {
// The phone-shaped preview and comments pill don't apply to the macOS player.
#if os(iOS)
PreviewSection(viewModel: viewModel, layout: previewLayout)
#endif
PresetSection(
viewModel: viewModel,
trackedPresetName: $trackedActivePresetName,
@@ -87,13 +90,16 @@ private struct PlayerControlsSettingsContent: View {
fontStyle: $fontStyle
)
LayoutSectionsSection(viewModel: viewModel)
CommentsPillSection(viewModel: viewModel)
#if os(iOS)
CommentsPillSection(viewModel: viewModel)
GesturesSectionsSection(viewModel: viewModel)
#endif
SystemControlsSection(viewModel: viewModel)
VolumeSection(viewModel: viewModel)
}
#if os(macOS)
.formStyle(.grouped)
#endif
.id(refreshID)
.alert(
String(localized: "settings.playerControls.error"),
@@ -237,6 +243,8 @@ private struct AppearanceSection: View {
var body: some View {
Section {
// The macOS bar draws its own glass capsule; the per-button style has no effect there.
#if os(iOS)
Picker(
String(localized: "settings.playerControls.style"),
selection: $style
@@ -250,6 +258,7 @@ private struct AppearanceSection: View {
guard newStyle != viewModel.currentLayout.globalSettings.style else { return }
viewModel.updateGlobalSettingsSync { $0.style = newStyle }
}
#endif
Picker(
String(localized: "settings.playerControls.buttonSize"),
@@ -312,10 +321,17 @@ private struct LayoutSectionsSection: View {
NavigationLink {
CenterControlsSettingsView(viewModel: viewModel)
} label: {
#if os(macOS)
Label(
String(localized: "settings.playerControls.seekDurations", defaultValue: "Seek Durations"),
systemImage: "arrow.trianglehead.clockwise"
)
#else
Label(
String(localized: "settings.playerControls.centerControls"),
systemImage: "play.circle"
)
#endif
}
.disabled(!viewModel.canEditActivePreset)
@@ -336,10 +352,17 @@ private struct LayoutSectionsSection: View {
)
} label: {
HStack {
#if os(macOS)
Label(
String(localized: "settings.playerControls.controlBarButtons", defaultValue: "Control Bar Buttons"),
systemImage: "rectangle.bottomthird.inset.filled"
)
#else
Label(
String(localized: "settings.playerControls.bottomButtons"),
systemImage: "rectangle.bottomthird.inset.filled"
)
#endif
Spacer()
Text("\(viewModel.currentLayout.bottomSection.buttons.count)")
.foregroundStyle(.secondary)
@@ -347,6 +370,8 @@ private struct LayoutSectionsSection: View {
}
.disabled(!viewModel.canEditActivePreset)
// The player pill only exists in the iOS player.
#if os(iOS)
NavigationLink {
PlayerPillEditorView(viewModel: viewModel)
} label: {
@@ -361,6 +386,7 @@ private struct LayoutSectionsSection: View {
}
}
.disabled(!viewModel.canEditActivePreset)
#endif
NavigationLink {
MiniPlayerEditorView(viewModel: viewModel)