Merge remote-tracking branch 'origin/main' into worktree-agent-ab575acff76734cee
Browse files at this commit9 changed files +277 -55
- crates/app/src/export_ui.rs +20 -22
- crates/app/src/player/cards.rs +2 -2
- crates/app/src/player/export.rs +15 -6
- crates/app/src/tests/cards.rs +90 -1
- crates/app/src/tests/layout.rs +1 -1
- crates/app/src/tests/media.rs +7 -11
- crates/app/src/tests/mod.rs +1 -1
- crates/app/src/ui/cards.rs +140 -10
- crates/app/src/ui/settings_stance.rs +1 -1
crates/app/src/export_ui.rsmodified+20 -22
| @@ -663,6 +663,21 @@ pub(crate) fn export_settings( | |||
| 663 | } | 663 | } |
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | +/// The same settings with the budget taken out -- what the seat probe is asked | ||
| 667 | +/// and keyed on ([`crate::Player::cache_export_seat`]). A bitrate does not | ||
| 668 | +/// decide whether this machine has a VA-API seat or whether the picture's | ||
| 669 | +/// packets can be copied; leaving it in the key meant every wheel notch on the | ||
| 670 | +/// budget row invalidated the answer and opened a real VA-API encoder to ask it | ||
| 671 | +/// again -- measured at ten opens for ten notches, 5-32 ms of GPU work each, | ||
| 672 | +/// against the player's own decoder, which is the "freezes a little" this row | ||
| 673 | +/// was reported for. | ||
| 674 | +pub(crate) fn probe_settings(format: Format, audio_kbps: u32, seat: EncoderSeat) -> ExportSettings { | ||
| 675 | + ExportSettings { | ||
| 676 | + bitrate: None, | ||
| 677 | + ..export_settings(0, format, audio_kbps, seat) | ||
| 678 | + } | ||
| 679 | +} | ||
| 680 | + | ||
| 666 | /// The budget's bounds, the engine's own (`engine::export`'s `MIN_BITRATE` | 681 | /// The budget's bounds, the engine's own (`engine::export`'s `MIN_BITRATE` |
| 667 | /// and `MAX_EXPLICIT_BITRATE`): a number outside them would be written as a | 682 | /// and `MAX_EXPLICIT_BITRATE`): a number outside them would be written as a |
| 668 | /// different one, so the lever and the field clamp to exactly these. | 683 | /// different one, so the lever and the field clamp to exactly these. |
| @@ -724,32 +739,15 @@ pub(crate) fn parse_budget(text: &str, seconds: f64, audio_bps: u64) -> Option<u | |||
| 724 | /// The faintest line on the moment: what the export resolved to on its own -- | 739 | /// The faintest line on the moment: what the export resolved to on its own -- |
| 725 | /// the codec, the sound, whether it is the whole film or the marked span, and | 740 | /// the codec, the sound, whether it is the whole film or the marked span, and |
| 726 | /// which seat writes the picture. A readout, never a control: everything in it | 741 | /// which seat writes the picture. A readout, never a control: everything in it |
| 727 | -/// is set in Settings now. | 742 | +/// The span an export writes, in the words row 3 says it in: the marked |
| 728 | -pub(crate) fn plan_line( | 743 | +/// range where there is one, the whole timeline otherwise -- and "sound only" |
| 729 | - format: Format, | 744 | +/// for a file that carries no picture at all. |
| 730 | - audio: &str, | 745 | +pub(crate) fn range_word(marks: Option<&str>, has_video: bool) -> String { |
| 731 | - marks: Option<&str>, | 746 | + match (marks, has_video) { |
| 732 | - hardware: bool, | ||
| 733 | -) -> String { | ||
| 734 | - let mut parts: Vec<String> = Vec::new(); | ||
| 735 | - if format.has_video() { | ||
| 736 | - parts.push(format_label(format).to_string()); | ||
| 737 | - } | ||
| 738 | - if !audio.is_empty() { | ||
| 739 | - parts.push(audio.to_string()); | ||
| 740 | - } | ||
| 741 | - parts.push(match (marks, format.has_video()) { | ||
| 742 | (Some(marks), _) => format!("marks {marks}"), | 747 | (Some(marks), _) => format!("marks {marks}"), |
| 743 | (None, true) => "whole film".to_string(), | 748 | (None, true) => "whole film".to_string(), |
| 744 | (None, false) => "sound only".to_string(), | 749 | (None, false) => "sound only".to_string(), |
| 745 | - }); | ||
| 746 | - if format.has_video() { | ||
| 747 | - parts.push(match hardware { | ||
| 748 | - true => "GPU".to_string(), | ||
| 749 | - false => "SW".to_string(), | ||
| 750 | - }); | ||
| 751 | } | 750 | } |
| 752 | - parts.join(" · ") | ||
| 753 | } | 751 | } |
| 754 | 752 | ||
| 755 | /// A clip's share of the lane. A timeline with no length reads as one full-width | 753 | /// A clip's share of the lane. A timeline with no length reads as one full-width |
crates/app/src/player/cards.rsmodified+2 -2
| @@ -1824,7 +1824,7 @@ impl Player { | |||
| 1824 | return true; | 1824 | return true; |
| 1825 | } | 1825 | } |
| 1826 | // The settings page's EXPORT rows: `c` steps the file, `b` the rate | 1826 | // The settings page's EXPORT rows: `c` steps the file, `b` the rate |
| 1827 | - // its sound is coded at and `e` the encoder seat. Card-local like the | 1827 | + // its sound is coded at and `g` the encoder seat. Card-local like the |
| 1828 | // colour and transform branches above -- and only these three, so | 1828 | // colour and transform branches above -- and only these three, so |
| 1829 | // escape still closes the page and every other key falls through to | 1829 | // escape still closes the page and every other key falls through to |
| 1830 | // the room. | 1830 | // the room. |
| @@ -1832,7 +1832,7 @@ impl Player { | |||
| 1832 | match key { | 1832 | match key { |
| 1833 | "c" => self.cycle_export_picture(), | 1833 | "c" => self.cycle_export_picture(), |
| 1834 | "b" => self.cycle_audio_kbps(), | 1834 | "b" => self.cycle_audio_kbps(), |
| 1835 | - "e" => self.cycle_encoder(cx), | 1835 | + "g" => self.cycle_encoder(cx), |
| 1836 | _ => return false, | 1836 | _ => return false, |
| 1837 | } | 1837 | } |
| 1838 | return true; | 1838 | return true; |
crates/app/src/player/export.rsmodified+15 -6
| @@ -351,12 +351,7 @@ impl Player { | |||
| 351 | let Some(session) = &self.session else { | 351 | let Some(session) = &self.session else { |
| 352 | return; | 352 | return; |
| 353 | }; | 353 | }; |
| 354 | - let settings = export_settings( | 354 | + let settings = probe_settings(self.format, self.audio_kbps, self.encoder_seat()); |
| 355 | - self.budget_bps(), | ||
| 356 | - self.format, | ||
| 357 | - self.audio_kbps, | ||
| 358 | - self.encoder_seat(), | ||
| 359 | - ); | ||
| 360 | if !self.export_open { | 355 | if !self.export_open { |
| 361 | return; | 356 | return; |
| 362 | } | 357 | } |
| @@ -648,6 +643,20 @@ impl Player { | |||
| 648 | "d" => self.pick_destination(cx), | 643 | "d" => self.pick_destination(cx), |
| 649 | "n" => self.edit_budget(), | 644 | "n" => self.edit_budget(), |
| 650 | "e" | "enter" => self.start_export(cx), | 645 | "e" | "enter" => self.start_export(cx), |
| 646 | + // The encode options, on the moment that spends them (user | ||
| 647 | + // 2026-09-09: "couldn't find how to change encode options") -- | ||
| 648 | + // the Settings room's own `c`/`b`/`g` setters, so the two | ||
| 649 | + // surfaces can never say different things. `g` and not `e` | ||
| 650 | + // because `e` is this moment's Export, and a ghost wears no | ||
| 651 | + // shifted letter (DESIGN §4). | ||
| 652 | + "c" => self.cycle_export_picture(), | ||
| 653 | + "b" => self.cycle_audio_kbps(), | ||
| 654 | + "g" => self.cycle_encoder(cx), | ||
| 655 | + // corner-cut: the settings door answers a bare `,` as well as the | ||
| 656 | + // room's `^,` it wears, because `param_card_key` is handed shift | ||
| 657 | + // only -- ceiling: no modifier reaches a card's keys. Upgrade: | ||
| 658 | + // thread `Modifiers` through `ui::stance`'s handler. | ||
| 659 | + "," => self.open_settings(cx), | ||
| 651 | "up" | "right" | "+" | "=" => self.nudge_budget(1, shift), | 660 | "up" | "right" | "+" | "=" => self.nudge_budget(1, shift), |
| 652 | "down" | "left" | "-" => self.nudge_budget(-1, shift), | 661 | "down" | "left" | "-" => self.nudge_budget(-1, shift), |
| 653 | _ => {} | 662 | _ => {} |
crates/app/src/tests/cards.rsmodified+90 -1
| @@ -1047,11 +1047,71 @@ fn a_chord_the_export_moment_answers_never_reaches_the_room() { | |||
| 1047 | assert!(typing.contains("self.budget_edit = None"), "esc leaves the field"); | 1047 | assert!(typing.contains("self.budget_edit = None"), "esc leaves the field"); |
| 1048 | assert!(closed.contains("self.close_card()"), "then esc closes the moment"); | 1048 | assert!(closed.contains("self.close_card()"), "then esc closes the moment"); |
| 1049 | // Its chords, all of them consumed here rather than by the keymap. | 1049 | // Its chords, all of them consumed here rather than by the keymap. |
| 1050 | - for chord in ["\"d\"", "\"n\"", "\"e\"", "\"enter\"", "\"up\"", "\"down\""] { | 1050 | + for chord in [ |
| 1051 | + "\"d\"", "\"n\"", "\"e\"", "\"enter\"", "\"up\"", "\"down\"", "\"c\"", "\"b\"", "\"g\"", | ||
| 1052 | + "\",\"", | ||
| 1053 | + ] { | ||
| 1051 | assert!(closed.contains(chord), "{chord} is not the moment's own"); | 1054 | assert!(closed.contains(chord), "{chord} is not the moment's own"); |
| 1052 | } | 1055 | } |
| 1053 | } | 1056 | } |
| 1054 | 1057 | ||
| 1058 | +/// The user could not find the encode options from the moment that spends | ||
| 1059 | +/// them ("simplifying doesn't mean getting rid of advanced settings"): row 3 | ||
| 1060 | +/// now *is* the options -- three ghost segments carrying the Settings room's | ||
| 1061 | +/// own setters, plus the door to the rest of that room. | ||
| 1062 | +#[test] | ||
| 1063 | +fn row_three_wears_the_encode_options_and_the_door_to_the_rest() { | ||
| 1064 | + let cards = src_text("ui/cards.rs"); | ||
| 1065 | + let start = cards.find("fn export_card(").expect("the moment"); | ||
| 1066 | + let body = &cards[start..start + cards[start..].find("\n /// ").unwrap_or(cards.len() - start)]; | ||
| 1067 | + // A segment is the setter it names, not a readout of it. | ||
| 1068 | + for (id, chord, setter) in [ | ||
| 1069 | + ("moment-picture", "\"c\"", "cycle_export_picture"), | ||
| 1070 | + ("moment-sound", "\"b\"", "cycle_audio_kbps"), | ||
| 1071 | + ("moment-encoder", "\"g\"", "cycle_encoder"), | ||
| 1072 | + ] { | ||
| 1073 | + assert!(body.contains(id), "row 3 lost its {id} segment"); | ||
| 1074 | + assert!(body.contains(chord), "the {id} segment wears no chord"); | ||
| 1075 | + assert!(body.contains(setter), "the {id} segment changes nothing"); | ||
| 1076 | + } | ||
| 1077 | + // The door, wearing the room's own chord rather than a hand-typed one. | ||
| 1078 | + assert!(body.contains("moment-settings"), "row 3 has no settings door"); | ||
| 1079 | + assert!( | ||
| 1080 | + body.contains("self.keymap.chord(ActionId::Settings)"), | ||
| 1081 | + "the door's chord is not read from the keymap" | ||
| 1082 | + ); | ||
| 1083 | + assert!(body.contains("open_settings"), "the door opens nothing"); | ||
| 1084 | + // Quiet, and a control: ink3 with the chord in ink4 (DESIGN §4), never | ||
| 1085 | + // the ink4 line the plan used to be. | ||
| 1086 | + let seg = cards | ||
| 1087 | + .find("fn moment_segment(") | ||
| 1088 | + .map(|at| &cards[at..at + 1200]) | ||
| 1089 | + .expect("the segment atom"); | ||
| 1090 | + assert!(seg.contains("INK3()") && seg.contains("INK4()")); | ||
| 1091 | + assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover"); | ||
| 1092 | +} | ||
| 1093 | + | ||
| 1094 | +/// One chord per thing, said the same on both surfaces: the moment's segments | ||
| 1095 | +/// and the Settings room's EXPORT rows drive the same setters, so a chord that | ||
| 1096 | +/// drifted on one of them would teach the user a key the other refuses. | ||
| 1097 | +#[test] | ||
| 1098 | +fn the_moment_and_the_settings_room_wear_the_same_export_chords() { | ||
| 1099 | + let settings = src_text("ui/settings_stance.rs"); | ||
| 1100 | + let moment = src_text("ui/cards.rs"); | ||
| 1101 | + let player = src_text("player/cards.rs"); | ||
| 1102 | + let handler = fn_body("export_moment_key"); | ||
| 1103 | + for chord in ["\"c\"", "\"b\"", "\"g\""] { | ||
| 1104 | + assert!(settings.contains(chord), "the EXPORT rows lost {chord}"); | ||
| 1105 | + assert!(moment.contains(chord), "row 3 lost {chord}"); | ||
| 1106 | + assert!(handler.contains(chord), "the moment answers no {chord}"); | ||
| 1107 | + assert!(player.contains(chord), "the settings page answers no {chord}"); | ||
| 1108 | + } | ||
| 1109 | + // `e` stays the Export press: the encoder seat took `g` rather than a | ||
| 1110 | + // shifted letter, which no ghost wears. | ||
| 1111 | + assert!(handler.contains("\"e\" | \"enter\" => self.start_export")); | ||
| 1112 | + assert!(!settings.contains("\n \"e\","), "the Encoder row took `e` back"); | ||
| 1113 | +} | ||
| 1114 | + | ||
| 1055 | /// The Sound row: what it offers, and that the pick travels to the engine | 1115 | /// The Sound row: what it offers, and that the pick travels to the engine |
| 1056 | /// for a *video* export as much as for an MP3 -- both files carry sound, so | 1116 | /// for a *video* export as much as for an MP3 -- both files carry sound, so |
| 1057 | /// a row that only reached the audio formats would be half a control. | 1117 | /// a row that only reached the audio formats would be half a control. |
| @@ -2006,3 +2066,32 @@ fn toggle_proxy_wakes_the_asked_phase_it_stops() { | |||
| 2006 | "a stop asked during Asked no longer sets the flag the header read polls" | 2066 | "a stop asked during Asked no longer sets the flag the header read polls" |
| 2007 | ); | 2067 | ); |
| 2008 | } | 2068 | } |
| 2069 | + | ||
| 2070 | +/// A wheel notch on the budget must not re-ask the seat probe. The probe opens | ||
| 2071 | +/// a real VA-API encoder (ten opens for ten notches before this, 5-32 ms of GPU | ||
| 2072 | +/// work each, against the player's own decoder) and its answer -- GPU seat or | ||
| 2073 | +/// software, copy or encode -- does not depend on the bitrate at all. So the | ||
| 2074 | +/// settings it is keyed on carry no budget, and the budget still reaches the | ||
| 2075 | +/// export itself, which is the one place it changes a file. | ||
| 2076 | +#[test] | ||
| 2077 | +fn the_seat_probe_is_not_keyed_on_the_budget() { | ||
| 2078 | + let seat = EncoderSeat::default(); | ||
| 2079 | + let asked = crate::probe_settings(Format::Mp4, DEFAULT_AUDIO_KBPS, seat); | ||
| 2080 | + assert_eq!(asked.bitrate, None, "no budget is in the probe's question"); | ||
| 2081 | + // What still *is* a new question: the format the file is written in. | ||
| 2082 | + assert_ne!( | ||
| 2083 | + asked, | ||
| 2084 | + crate::probe_settings(Format::Av1, DEFAULT_AUDIO_KBPS, seat), | ||
| 2085 | + "a format change must re-probe" | ||
| 2086 | + ); | ||
| 2087 | + let cache = fn_body("cache_export_seat"); | ||
| 2088 | + assert!( | ||
| 2089 | + cache.contains("probe_settings(") && !cache.contains("budget_bps()"), | ||
| 2090 | + "the seat cache is keyed on the budget again" | ||
| 2091 | + ); | ||
| 2092 | + // ...and the number the wheel moves is still what the export is given. | ||
| 2093 | + assert!( | ||
| 2094 | + fn_body("start_export").contains("self.budget_bps()"), | ||
| 2095 | + "the export no longer writes at the budget on the row" | ||
| 2096 | + ); | ||
| 2097 | +} | ||
crates/app/src/tests/layout.rsmodified+1 -1
| @@ -3345,7 +3345,7 @@ fn the_export_section_is_four_rows_and_no_fifth() { | |||
| 3345 | ); | 3345 | ); |
| 3346 | // Every row wears its chord (DESIGN §4): three keyed rows plus the | 3346 | // Every row wears its chord (DESIGN §4): three keyed rows plus the |
| 3347 | // range's own marks, which are keymap actions. | 3347 | // range's own marks, which are keymap actions. |
| 3348 | - for chord in ["\"c\"", "\"b\"", "\"e\"", "ActionId::SetIn"] { | 3348 | + for chord in ["\"c\"", "\"b\"", "\"g\"", "ActionId::SetIn"] { |
| 3349 | assert!(body.contains(chord), "an EXPORT row lost its chord {chord}"); | 3349 | assert!(body.contains(chord), "an EXPORT row lost its chord {chord}"); |
| 3350 | } | 3350 | } |
| 3351 | } | 3351 | } |
crates/app/src/tests/media.rsmodified+7 -11
| @@ -690,18 +690,14 @@ fn the_budget_row_states_the_size_before_it_is_written() { | |||
| 690 | assert_eq!(rate_label(6_000_000), "6.0"); | 690 | assert_eq!(rate_label(6_000_000), "6.0"); |
| 691 | assert_eq!(rate_label(6_500_000), "6.5"); | 691 | assert_eq!(rate_label(6_500_000), "6.5"); |
| 692 | assert_eq!(rate_label(BPS_MIN), "1.0"); | 692 | assert_eq!(rate_label(BPS_MIN), "1.0"); |
| 693 | - // The faintest line: what resolved, never a control -- and it says the | 693 | + // Row 3's range readout: the marked span where there is one, and a |
| 694 | - // marked span where there is one rather than "whole film". | 694 | + // sound-only file names no film to take a range from. |
| 695 | - let line = plan_line(Format::Mp4, "AAC 256 kbps", None, true); | 695 | + assert_eq!(range_word(None, true), "whole film"); |
| 696 | - assert_eq!(line, "H.264 · AAC 256 kbps · whole film · GPU"); | 696 | + assert_eq!(range_word(None, false), "sound only"); |
| 697 | - assert!(plan_line(Format::Mp4, "AAC", None, false).ends_with("SW")); | 697 | + assert_eq!( |
| 698 | - assert!( | 698 | + range_word(Some("00:00:04:00\u{2013}00:00:12:00"), true), |
| 699 | - plan_line(Format::Mp4, "AAC", Some("00:00:04:00–00:00:12:00"), true) | 699 | + "marks 00:00:04:00\u{2013}00:00:12:00" |
| 700 | - .contains("marks 00:00:04:00–00:00:12:00") | ||
| 701 | ); | 700 | ); |
| 702 | - // A sound-only export names no picture codec and no seat to write it on. | ||
| 703 | - let sound = plan_line(Format::Flac, "FLAC", None, true); | ||
| 704 | - assert_eq!(sound, "FLAC · sound only"); | ||
| 705 | } | 701 | } |
| 706 | 702 | ||
| 707 | /// Which cue is on screen when: the whole of what the overlay decides, and | 703 | /// Which cue is on screen when: the whole of what the overlay decides, and |
crates/app/src/tests/mod.rsmodified+1 -1
| @@ -27,7 +27,7 @@ use super::{ | |||
| 27 | export_settings, format_refusal, fps_choices, fps_label, frac_along, frac_down, | 27 | export_settings, format_refusal, fps_choices, fps_label, frac_along, frac_down, |
| 28 | frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, keys_rows, lanes_h, | 28 | frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, keys_rows, lanes_h, |
| 29 | marked, menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play, | 29 | marked, menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play, |
| 30 | - notice_tone, panel_h, parse_budget, plan_line, project_path, proxies_to_start, push_notice, px_below, retarget, | 30 | + notice_tone, panel_h, parse_budget, project_path, range_word, proxies_to_start, push_notice, px_below, retarget, |
| 31 | row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, size_label, | 31 | row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, size_label, |
| 32 | rate_label, snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, sub_pick_after_removal, | 32 | rate_label, snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, sub_pick_after_removal, |
| 33 | subtitle_plan, timecode, timeline_fixed_h, tip_may_paint, | 33 | subtitle_plan, timecode, timeline_fixed_h, tip_may_paint, |
crates/app/src/ui/cards.rsmodified+140 -10
| @@ -215,6 +215,45 @@ fn dark_step_glyph( | |||
| 215 | .child(dark_row_value(if plus { "+" } else { "−" })) | 215 | .child(dark_row_value(if plus { "+" } else { "−" })) |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | +/// One segment of the export moment's plan line (row 3): the thing it says | ||
| 219 | +/// *is* the button that changes it, so `H.264 \u{b7} MP4` is pressed to walk the | ||
| 220 | +/// files and wears `c` beside it exactly as the Settings row does (user | ||
| 221 | +/// 2026-09-09: "couldn't find how to change encode options, simplifying | ||
| 222 | +/// doesn't mean getting rid of advanced settings"). A ghost (DESIGN \u{a7}4) at a | ||
| 223 | +/// readout's size: `ink3` at rest so the line stays as quiet as the one it | ||
| 224 | +/// replaced, `ink2` and one fill step on hover, the chord in `ink4` beside it. | ||
| 225 | +fn moment_segment( | ||
| 226 | + id: &'static str, | ||
| 227 | + text: impl Into<SharedString>, | ||
| 228 | + chord: impl Into<SharedString>, | ||
| 229 | + on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, | ||
| 230 | +) -> impl IntoElement { | ||
| 231 | + let text: SharedString = text.into(); | ||
| 232 | + let hitmap = hitmap::enabled().then(|| { | ||
| 233 | + let label = text.clone(); | ||
| 234 | + hitmap::dynamic(move || (format!("card.{id}"), label.to_string()), true) | ||
| 235 | + }); | ||
| 236 | + div() | ||
| 237 | + .id(id) | ||
| 238 | + .flex_none() | ||
| 239 | + .flex() | ||
| 240 | + .items_baseline() | ||
| 241 | + .gap(px(5.)) | ||
| 242 | + .px(px(4.)) | ||
| 243 | + .rounded(px(3.)) | ||
| 244 | + .cursor_pointer() | ||
| 245 | + .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK2()))) | ||
| 246 | + .on_click(on_click) | ||
| 247 | + .children(hitmap.flatten()) | ||
| 248 | + .type_style(type_scale::mono( | ||
| 249 | + type_scale::CHORD_METADATA_MIN_PX, | ||
| 250 | + gpui::FontWeight::MEDIUM, | ||
| 251 | + )) | ||
| 252 | + .text_color(rgb(INK3())) | ||
| 253 | + .child(text) | ||
| 254 | + .child(div().flex_none().text_color(rgb(INK4())).child(chord.into())) | ||
| 255 | +} | ||
| 256 | + | ||
| 218 | fn dark_ghost_button( | 257 | fn dark_ghost_button( |
| 219 | id: impl Into<gpui::ElementId>, | 258 | id: impl Into<gpui::ElementId>, |
| 220 | text: impl Into<SharedString>, | 259 | text: impl Into<SharedString>, |
| @@ -330,7 +369,33 @@ impl Player { | |||
| 330 | timecode(f64::from(end) / self.fps, self.fps), | 369 | timecode(f64::from(end) / self.fps, self.fps), |
| 331 | ) | 370 | ) |
| 332 | }); | 371 | }); |
| 333 | - let plan = plan_line(self.format, audio, marks.as_deref(), hardware); | 372 | + // Row 3's segments are the Settings room's own EXPORT rows worn as |
| 373 | + // ghosts on the line that used to only *report* them -- the same | ||
| 374 | + // setters, so both surfaces can never disagree. | ||
| 375 | + // What the engine says the sound *will* be ("AAC 256 kbps", or "AAC | ||
| 376 | + // copy" where the source's own stream is carried through): a rate | ||
| 377 | + // nobody is choosing wears no chord, the Settings row's own rule for | ||
| 378 | + // a codec with no rate to pick. | ||
| 379 | + let (codec, rated) = crate::ui::settings_stance::sound_codec(self.format); | ||
| 380 | + let sound_label = match audio.is_empty() { | ||
| 381 | + true => codec.to_string(), | ||
| 382 | + false => audio.to_string(), | ||
| 383 | + }; | ||
| 384 | + let sound_keyed = rated && !audio.contains("copy"); | ||
| 385 | + // `auto` is a promise until the probe answers; once it has, the seat | ||
| 386 | + // says what it resolved to rather than the word nobody picked. | ||
| 387 | + let seat = self.encoder_seat(); | ||
| 388 | + let seat_label = match seat { | ||
| 389 | + EncoderSeat::Auto => format!( | ||
| 390 | + "auto \u{2192} {}", | ||
| 391 | + match hardware { | ||
| 392 | + true => "GPU", | ||
| 393 | + false => "SW", | ||
| 394 | + } | ||
| 395 | + ), | ||
| 396 | + _ => crate::ui::settings_stance::encoder_word(seat).to_string(), | ||
| 397 | + }; | ||
| 398 | + let range = range_word(marks.as_deref(), self.format.has_video()); | ||
| 334 | // The refusal the button used to carry, said before it is pressed and | 399 | // The refusal the button used to carry, said before it is pressed and |
| 335 | // in the readout's own place: a few words and the chord that fixes it, | 400 | // in the readout's own place: a few words and the chord that fixes it, |
| 336 | // never the sentence the old card wrapped over three lines. | 401 | // never the sentence the old card wrapped over three lines. |
| @@ -537,17 +602,82 @@ impl Player { | |||
| 537 | div() | 602 | div() |
| 538 | .flex_1() | 603 | .flex_1() |
| 539 | .min_w(px(0.)) | 604 | .min_w(px(0.)) |
| 540 | - .truncate() | 605 | + .flex() |
| 541 | - .type_style(type_scale::mono( | 606 | + .items_baseline() |
| 542 | - type_scale::CHORD_METADATA_MIN_PX, | 607 | + .gap(px(6.)) |
| 543 | - gpui::FontWeight::MEDIUM, | 608 | + .children(self.format.has_video().then(|| { |
| 544 | - )) | 609 | + moment_segment( |
| 545 | - .text_color(rgb(match blocked.is_some() { | 610 | + "moment-picture", |
| 546 | - true => STATUS_WARNING(), | 611 | + crate::ui::settings_stance::picture_label(self.format), |
| 547 | - false => INK4(), | 612 | + "c", |
| 613 | + cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 614 | + this.cycle_export_picture(); | ||
| 615 | + cx.notify(); | ||
| 616 | + }), | ||
| 617 | + ) | ||
| 618 | + })) | ||
| 619 | + .children(sound_keyed.then(|| { | ||
| 620 | + moment_segment( | ||
| 621 | + "moment-sound", | ||
| 622 | + sound_label.clone(), | ||
| 623 | + "b", | ||
| 624 | + cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 625 | + this.cycle_audio_kbps(); | ||
| 626 | + cx.notify(); | ||
| 627 | + }), | ||
| 628 | + ) | ||
| 629 | + })) | ||
| 630 | + // A codec with no rate to pick is a readout, not a button | ||
| 631 | + // that would do nothing when pressed -- the Settings row's | ||
| 632 | + // own rule. | ||
| 633 | + .children((!sound_keyed).then(|| { | ||
| 634 | + div() | ||
| 635 | + .flex_none() | ||
| 636 | + .type_style(type_scale::mono( | ||
| 637 | + type_scale::CHORD_METADATA_MIN_PX, | ||
| 638 | + gpui::FontWeight::MEDIUM, | ||
| 639 | + )) | ||
| 640 | + .text_color(rgb(INK4())) | ||
| 641 | + .child(sound_label.clone()) | ||
| 548 | })) | 642 | })) |
| 549 | - .child(blocked.clone().unwrap_or(plan)), | 643 | + .children(self.format.has_video().then(|| { |
| 644 | + moment_segment( | ||
| 645 | + "moment-encoder", | ||
| 646 | + seat_label.clone(), | ||
| 647 | + "g", | ||
| 648 | + cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 649 | + this.cycle_encoder(cx); | ||
| 650 | + }), | ||
| 651 | + ) | ||
| 652 | + })) | ||
| 653 | + // The range is set on the timeline with the marks | ||
| 654 | + // themselves, so here it is what the file will hold -- | ||
| 655 | + // or, where the press would be refused, the refusal in | ||
| 656 | + // its place (DESIGN \u{a7}8: said before it is pressed). | ||
| 657 | + .child( | ||
| 658 | + div() | ||
| 659 | + .flex_1() | ||
| 660 | + .min_w(px(0.)) | ||
| 661 | + .truncate() | ||
| 662 | + .type_style(type_scale::mono( | ||
| 663 | + type_scale::CHORD_METADATA_MIN_PX, | ||
| 664 | + gpui::FontWeight::MEDIUM, | ||
| 665 | + )) | ||
| 666 | + .text_color(rgb(match blocked.is_some() { | ||
| 667 | + true => STATUS_WARNING(), | ||
| 668 | + false => INK4(), | ||
| 669 | + })) | ||
| 670 | + .child(blocked.clone().unwrap_or(range)), | ||
| 671 | + ), | ||
| 550 | ) | 672 | ) |
| 673 | + // The door to everything else this file could be written as: the | ||
| 674 | + // room's own settings chord, on the moment that needed it. | ||
| 675 | + .child(moment_segment( | ||
| 676 | + "moment-settings", | ||
| 677 | + "settings", | ||
| 678 | + self.keymap.chord(ActionId::Settings), | ||
| 679 | + cx.listener(|this, _: &ClickEvent, _, cx| this.open_settings(cx)), | ||
| 680 | + )) | ||
| 551 | .child( | 681 | .child( |
| 552 | div() | 682 | div() |
| 553 | .id("export-confirm") | 683 | .id("export-confirm") |
crates/app/src/ui/settings_stance.rsmodified+1 -1
| @@ -634,7 +634,7 @@ fn export_section(player: &Player, cx: &mut Context<Player>) -> impl IntoElement | |||
| 634 | "Encoder", | 634 | "Encoder", |
| 635 | encoder_word(seat), | 635 | encoder_word(seat), |
| 636 | "which encoder writes the picture: the GPU where this machine has a seat, or the CPU", | 636 | "which encoder writes the picture: the GPU where this machine has a seat, or the CPU", |
| 637 | - "e", | 637 | + "g", |
| 638 | av1_gpu.then(|| (AV1_GPU_NOTICE.into(), NOTICE_LOOK())), | 638 | av1_gpu.then(|| (AV1_GPU_NOTICE.into(), NOTICE_LOOK())), |
| 639 | player, | 639 | player, |
| 640 | cx.listener(|this, _: &ClickEvent, _, cx| { | 640 | cx.listener(|this, _: &ClickEvent, _, cx| { |