ui: restore visible caption Off and compact settings controls

This commit is contained in:
2026-10-12 23:40:37 +02:00
parent 2398370c23
commit e66f45d9ef
4 changed files with 60 additions and 13 deletions
+8
View File
@@ -203,6 +203,14 @@ def check_cli_instances(root, app, fixtures):
pid = next(pid for pid in states if pid not in previous)
states = input_request(pid, count + index + 1, lambda state: state["status"] == 2,
"resolved GUI pauses independently after decoded startup", action="pause")
states = input_request(pid, count + index + 1,
lambda state: state["selectedSubtitle"] == -1 and not state["subtitleText"],
"visible native Off item disables rendered captions", action="caption", label="Off")
states = input_request(pid, count + index + 1,
lambda state: state["selectedSubtitle"] == 0
and state["subtitleText"] == f"Independent subtitle {index}",
"visible native track item restores rendered captions",
action="caption", label=f"Track {index} (en)")
wait_report(report, [identity], lambda rows: any(
row["event"] == "progress" and row["completion_eligible"] for row in rows),
"resolved GUI owns v2 stable-identity reporting after CLI exit")
+22
View File
@@ -90,6 +90,14 @@ private enum CLIInstanceCheck {
}
}
static func captionSelector(in view: NSView) -> NSPopUpButton? {
if let selector = view as? NSPopUpButton, selector.toolTip == "Subtitles" { return selector }
for child in view.subviews {
if let selector = captionSelector(in: child) { return selector }
}
return nil
}
static func run(_ configuration: URL) {
let settings = try! JSONSerialization.jsonObject(with: Data(contentsOf: configuration)) as! [String: String]
let directory = URL(fileURLWithPath: settings["directory"]!, isDirectory: true)
@@ -139,6 +147,20 @@ private enum CLIInstanceCheck {
switch action {
case "youtube":
model.openYouTube(command["url"] as! String)
case "caption":
guard let view = window.contentView, let selector = captionSelector(in: view),
let cell = selector.cell as? NSPopUpButtonCell, let menu = selector.menu else {
fatalError("Native captions selector is missing")
}
cell.attachPopUp(withFrame: selector.bounds, in: selector)
menu.update()
let label = command["label"] as! String
guard let item = menu.items.first(where: { $0.title == label }) else {
fatalError("Requested native subtitle selection is missing")
}
precondition(!item.isHidden && item.isEnabled, "Subtitle selection must be visible and enabled")
cell.dismissPopUp()
precondition(selectMenuItem(label, in: menu), "Native subtitle selection must be actionable")
case "seek":
let position = command["position"] as! Double
precondition(model.seekRelative(position - model.state.position), "Native seek must be accepted")