ui: restore visible caption Off and compact settings controls
This commit is contained in:
+27
-10
@@ -1328,8 +1328,7 @@ private struct CaptionSelector: NSViewRepresentable {
|
||||
imageScaling = .scaleProportionallyUpOrDown
|
||||
(cell as? NSPopUpButtonCell)?.arrowPosition = .noArrow
|
||||
let symbol = NSImage(systemSymbolName: "captions.bubble", accessibilityDescription: "Subtitles")?
|
||||
.withSymbolConfiguration(.init(pointSize: 22, weight: .regular))
|
||||
symbol?.size = NSSize(width: 24, height: 24)
|
||||
.withSymbolConfiguration(.init(pointSize: 17, weight: .regular))
|
||||
captionItem.image = symbol
|
||||
contentTintColor = SunsetPalette.text
|
||||
toolTip = "Subtitles"
|
||||
@@ -1349,6 +1348,10 @@ private struct CaptionSelector: NSViewRepresentable {
|
||||
displayedSelection = model.selectedSubtitle
|
||||
let tracks = NSMenu()
|
||||
tracks.autoenablesItems = false
|
||||
// AppKit reserves the first pull-down item for the button title.
|
||||
let title = NSMenuItem(title: "Subtitles", action: nil, keyEquivalent: "")
|
||||
title.isHidden = true
|
||||
tracks.addItem(title)
|
||||
func add(_ label: String, index: Int?) {
|
||||
let item = NSMenuItem(title: label, action: #selector(selectTrack(_:)), keyEquivalent: "")
|
||||
item.target = self
|
||||
@@ -1522,7 +1525,7 @@ private struct PlayerContent: View {
|
||||
.frame(height: 24)
|
||||
.background(PlayerGlass(cornerRadius: 8).clipShape(RoundedRectangle(cornerRadius: 8)).allowsHitTesting(false))
|
||||
Spacer(minLength: 12)
|
||||
titleControls(compact: false)
|
||||
titleControls
|
||||
}
|
||||
.padding(.leading, model.isFullScreen ? 16 : 86)
|
||||
.padding(.trailing, 12)
|
||||
@@ -1534,7 +1537,7 @@ private struct PlayerContent: View {
|
||||
.accessibilityHidden(!model.controlsVisible)
|
||||
}
|
||||
|
||||
private func titleControls(compact: Bool) -> some View {
|
||||
private var titleControls: some View {
|
||||
HStack(spacing: 4) {
|
||||
iconButton(model.isOnTop ? "pin.fill" : "pin",
|
||||
model.isOnTop ? "Stop Keeping Window on Top" : "Keep Window on Top", action: model.toggleOnTop)
|
||||
@@ -1544,9 +1547,9 @@ private struct PlayerContent: View {
|
||||
actionsMenu
|
||||
}
|
||||
.padding(.horizontal, 8)
|
||||
.frame(height: compact ? 28 : 24)
|
||||
.background(PlayerGlass(cornerRadius: compact ? 10 : 8)
|
||||
.clipShape(RoundedRectangle(cornerRadius: compact ? 10 : 8)).allowsHitTesting(false))
|
||||
.frame(height: 24)
|
||||
.background(PlayerGlass(cornerRadius: 8)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 8)).allowsHitTesting(false))
|
||||
}
|
||||
|
||||
private var captionsMenu: some View {
|
||||
@@ -1562,6 +1565,21 @@ private struct PlayerContent: View {
|
||||
Divider()
|
||||
PlayerQualityMenu(model: model)
|
||||
Divider()
|
||||
if model.isCompact {
|
||||
Menu("Subtitles") {
|
||||
Button("Off") { model.selectSubtitle(nil) }
|
||||
ForEach(model.subtitleTracks.indices, id: \.self) { index in
|
||||
Button {
|
||||
model.selectSubtitle(index)
|
||||
} label: {
|
||||
Label(model.subtitleTracks[index].label + " (" + model.subtitleTracks[index].language + ")",
|
||||
systemImage: model.selectedSubtitle == index ? "checkmark" : "text.bubble")
|
||||
}
|
||||
}
|
||||
}
|
||||
.disabled(model.subtitleTracks.isEmpty)
|
||||
Divider()
|
||||
}
|
||||
PlayerActionButton(model: model, action: model.bufferInfoAction,
|
||||
title: model.showsBufferInfo ? "Hide Buffer Info" : "Show Buffer Info")
|
||||
Divider()
|
||||
@@ -1590,7 +1608,7 @@ private struct PlayerContent: View {
|
||||
.disabled(!model.canTogglePlayback)
|
||||
iconButton("pip.exit", "Exit Compact Mode", action: model.toggleCompact)
|
||||
.disabled(!model.canToggleCompact)
|
||||
captionsMenu
|
||||
actionsMenu
|
||||
}
|
||||
if showsBufferReadout { bufferReadout }
|
||||
}
|
||||
@@ -1720,7 +1738,7 @@ private struct PlayerContent: View {
|
||||
.font(.system(size: max(16, min(28, geometry.size.width / 32)), weight: .semibold))
|
||||
.foregroundStyle(.white)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(8)
|
||||
.padding(12)
|
||||
.background(PlayerGlass().clipShape(RoundedRectangle(cornerRadius: 12)).allowsHitTesting(false))
|
||||
.padding(.horizontal, 24)
|
||||
.padding(.bottom, model.controlsVisible ? 110 : 24)
|
||||
@@ -1873,7 +1891,6 @@ private struct PlayerContent: View {
|
||||
.background(PlayerGlass(cornerRadius: 10).clipShape(RoundedRectangle(cornerRadius: 10)).allowsHitTesting(false))
|
||||
.allowsHitTesting(false)
|
||||
Spacer(minLength: 0)
|
||||
titleControls(compact: true)
|
||||
}
|
||||
.padding(8)
|
||||
.foregroundStyle(Color(SunsetPalette.text))
|
||||
|
||||
Reference in New Issue
Block a user