Merge branch 'worktree-agent-a716600088834a5e1'
Browse files at this commit3 changed files +108 -14
- crates/app/src/layout.rs +4 -0
- crates/app/src/tests/cards.rs +40 -0
- crates/app/src/ui/cards.rs +64 -14
crates/app/src/layout.rsmodified+4 -0
| @@ -80,6 +80,10 @@ pub(crate) const KEYS_ROW_H: f32 = HIT_MIN; | |||
| 80 | /// scrim showing either side of it. | 80 | /// scrim showing either side of it. |
| 81 | /// The export moment's height (the approved artboard's 200px): three rows, | 81 | /// The export moment's height (the approved artboard's 200px): three rows, |
| 82 | /// never a scroll -- the card it replaced grew a capped, scrolling list. | 82 | /// never a scroll -- the card it replaced grew a capped, scrolling list. |
| 83 | +/// Unchanged by the picture and sound readouts row 3 now carries (user | ||
| 84 | +/// 2026-09-09: "resolution and audio bitrate should be seen in export menu | ||
| 85 | +/// too"): measured at 1280 wide, the whole line still fits on one line, so | ||
| 86 | +/// the row wraps only below this editor's own 640px floor. | ||
| 83 | pub(crate) const EXPORT_MOMENT_H: f32 = 200.; | 87 | pub(crate) const EXPORT_MOMENT_H: f32 = 200.; |
| 84 | 88 | ||
| 85 | pub(crate) const EXPORT_W: f32 = 420.; | 89 | pub(crate) const EXPORT_W: f32 = 420.; |
crates/app/src/tests/cards.rsmodified+40 -0
| @@ -1089,6 +1089,46 @@ fn row_three_wears_the_encode_options_and_the_door_to_the_rest() { | |||
| 1089 | .expect("the segment atom"); | 1089 | .expect("the segment atom"); |
| 1090 | assert!(seg.contains("INK3()") && seg.contains("INK4()")); | 1090 | assert!(seg.contains("INK3()") && seg.contains("INK4()")); |
| 1091 | assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover"); | 1091 | assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover"); |
| 1092 | + // The readouts worth seeing: the project's picture size and rate, and | ||
| 1093 | + // a sound rate that is on the line whether or not it is pressable. | ||
| 1094 | + assert!( | ||
| 1095 | + body.contains("s.resolution()") && body.contains("fps_label(self.fps)"), | ||
| 1096 | + "row 3 says nothing about the picture the file will hold" | ||
| 1097 | + ); | ||
| 1098 | + assert!( | ||
| 1099 | + body.contains("format!(\"{word} {}\", self.audio_kbps)"), | ||
| 1100 | + "the sound segment no longer says the rate it is spent at" | ||
| 1101 | + ); | ||
| 1102 | + // The picture segment is a child, not a `has_video` maybe: hidden on the | ||
| 1103 | + // sound-only formats it left `c` pressing nothing and no way back. | ||
| 1104 | + let at = body.find("\"moment-picture\"").expect("the picture segment"); | ||
| 1105 | + assert!( | ||
| 1106 | + !body[at - 240..at].contains("has_video"), | ||
| 1107 | + "the picture segment is gated on has_video again -- the dead end" | ||
| 1108 | + ); | ||
| 1109 | + // Wrapped, never cut: the readouts made row 3 longer than 1280 wide. | ||
| 1110 | + assert!(body.contains(".flex_wrap()"), "row 3 truncates instead of wrapping"); | ||
| 1111 | +} | ||
| 1112 | + | ||
| 1113 | +/// The dead end the user hit: the cycle walked into the sound-only formats | ||
| 1114 | +/// and stopped there ("when selection reaches the audio clicking is disabled | ||
| 1115 | +/// and can't turn it back to video"). One cycle, and it wraps. | ||
| 1116 | +#[test] | ||
| 1117 | +fn the_picture_cycle_wraps_out_of_the_sound_only_formats() { | ||
| 1118 | + use crate::ui::settings_stance::{PICTURE_CYCLE, next_picture}; | ||
| 1119 | + // Nothing refused: every stop is the next one, and the last wraps to the | ||
| 1120 | + // first -- OGG, the tail of the list, back to MP4. | ||
| 1121 | + let mut at = PICTURE_CYCLE[0]; | ||
| 1122 | + for &want in PICTURE_CYCLE.iter().skip(1).chain(std::iter::once(&PICTURE_CYCLE[0])) { | ||
| 1123 | + at = next_picture(at, |_| false); | ||
| 1124 | + assert_eq!(at, want, "the cycle stopped walking"); | ||
| 1125 | + } | ||
| 1126 | + assert_eq!(at, PICTURE_CYCLE[0], "a full walk is a wrap, not a dead end"); | ||
| 1127 | + assert_eq!(next_picture(Format::Ogg, |_| false), Format::Mp4); | ||
| 1128 | + // A timeline with no picture refuses every video format, and the cycle | ||
| 1129 | + // still moves: the sound-only stops are what is left of it. | ||
| 1130 | + let sound_only = next_picture(Format::Ogg, |f| f.has_video()); | ||
| 1131 | + assert!(!sound_only.has_video() && sound_only != Format::Ogg); | ||
| 1092 | } | 1132 | } |
| 1093 | 1133 | ||
| 1094 | /// One chord per thing, said the same on both surfaces: the moment's segments | 1134 | /// One chord per thing, said the same on both surfaces: the moment's segments |
crates/app/src/ui/cards.rsmodified+64 -14
| @@ -388,11 +388,37 @@ impl Player { | |||
| 388 | // nobody is choosing wears no chord, the Settings row's own rule for | 388 | // nobody is choosing wears no chord, the Settings row's own rule for |
| 389 | // a codec with no rate to pick. | 389 | // a codec with no rate to pick. |
| 390 | let (codec, rated) = crate::ui::settings_stance::sound_codec(self.format); | 390 | let (codec, rated) = crate::ui::settings_stance::sound_codec(self.format); |
| 391 | - let sound_label = match audio.is_empty() { | 391 | + // The codec and the rate it is spent at, always -- the user asked to |
| 392 | - true => codec.to_string(), | 392 | + // *see* the sound rate here even where nothing on this surface picks |
| 393 | - false => audio.to_string(), | 393 | + // it ("resolution and audio bitrate should be seen in export menu |
| 394 | + // too even if they won't be changeable"). A copied stream carries | ||
| 395 | + // the source's own rate, which this surface cannot ask for, so it | ||
| 396 | + // says `copy` and nothing it would have to invent. | ||
| 397 | + let copied = audio.contains("copy"); | ||
| 398 | + let mute = audio.is_empty() || audio == "no sound to write"; | ||
| 399 | + // The engine's own first word where it has one ("Opus · SW encode" on | ||
| 400 | + // a Matroska mix it will take), the Settings row's word where it does | ||
| 401 | + // not -- the moment must not say AAC about a file that gets Opus. | ||
| 402 | + let word = match mute { | ||
| 403 | + true => codec, | ||
| 404 | + false => audio.split_whitespace().next().unwrap_or(codec), | ||
| 394 | }; | 405 | }; |
| 395 | - let sound_keyed = rated && !audio.contains("copy"); | 406 | + let sound_label = match (mute, copied, rated) { |
| 407 | + (true, ..) => codec.to_string(), | ||
| 408 | + (_, true, _) => format!("{word} copy"), | ||
| 409 | + (_, _, true) => format!("{word} {}", self.audio_kbps), | ||
| 410 | + _ => word.to_string(), | ||
| 411 | + }; | ||
| 412 | + let sound_keyed = rated && !copied && !mute; | ||
| 413 | + // The picture the file will hold, in the numbers Settings \u{b7} PROJECT | ||
| 414 | + // already shows: a readout here, since the canvas is the project's | ||
| 415 | + // and is set there. Greyed one step for a sound-only format -- the | ||
| 416 | + // export writes no picture, but the project still has one, and it is | ||
| 417 | + // meant to be seen rather than to disappear. | ||
| 418 | + let picture_readout = self.session.as_ref().map(|s| { | ||
| 419 | + let (w, h) = s.resolution(); | ||
| 420 | + format!("{w}\u{d7}{h} \u{b7} {}", fps_label(self.fps)) | ||
| 421 | + }); | ||
| 396 | // `auto` is a promise until the probe answers; once it has, the seat | 422 | // `auto` is a promise until the probe answers; once it has, the seat |
| 397 | // says what it resolved to rather than the word nobody picked. | 423 | // says what it resolved to rather than the word nobody picked. |
| 398 | let seat = self.encoder_seat(); | 424 | let seat = self.encoder_seat(); |
| @@ -614,19 +640,43 @@ impl Player { | |||
| 614 | .flex_1() | 640 | .flex_1() |
| 615 | .min_w(px(0.)) | 641 | .min_w(px(0.)) |
| 616 | .flex() | 642 | .flex() |
| 643 | + // Two lines rather than a truncated one: the readouts made | ||
| 644 | + // this line longer, and a number cut in half is worse than | ||
| 645 | + // a moment one line taller. Measured at 1280 wide it still | ||
| 646 | + // fits on one line -- this is the floor's guard, not the | ||
| 647 | + // usual case. | ||
| 648 | + .flex_wrap() | ||
| 617 | .items_baseline() | 649 | .items_baseline() |
| 618 | .gap(px(6.)) | 650 | .gap(px(6.)) |
| 619 | - .children(self.format.has_video().then(|| { | 651 | + // The project's own picture, read here and set in |
| 620 | - moment_segment( | 652 | + // Settings. INK4 is the faintest step this palette has, so |
| 621 | - "moment-picture", | 653 | + // a sound-only format greys it no further -- it stays |
| 622 | - crate::ui::settings_stance::picture_label(self.format), | 654 | + // said, which is what was asked for. |
| 623 | - "c", | 655 | + .children(picture_readout.map(|read| { |
| 624 | - cx.listener(|this, _: &ClickEvent, _, cx| { | 656 | + div() |
| 625 | - this.cycle_export_picture(); | 657 | + .flex_none() |
| 626 | - cx.notify(); | 658 | + .type_style(type_scale::mono( |
| 627 | - }), | 659 | + type_scale::CHORD_METADATA_MIN_PX, |
| 628 | - ) | 660 | + gpui::FontWeight::MEDIUM, |
| 661 | + )) | ||
| 662 | + .text_color(rgb(INK4())) | ||
| 663 | + .child(read) | ||
| 629 | })) | 664 | })) |
| 665 | + // Always a button, never hidden: the format cycle runs | ||
| 666 | + // through the sound-only files too, and this segment | ||
| 667 | + // disappearing on them left `c` with nothing to press and | ||
| 668 | + // no way back (user 2026-09-09: "when selection reaches | ||
| 669 | + // the audio clicking is disabled and can't turn it back to | ||
| 670 | + // video"). | ||
| 671 | + .child(moment_segment( | ||
| 672 | + "moment-picture", | ||
| 673 | + crate::ui::settings_stance::picture_label(self.format), | ||
| 674 | + "c", | ||
| 675 | + cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 676 | + this.cycle_export_picture(); | ||
| 677 | + cx.notify(); | ||
| 678 | + }), | ||
| 679 | + )) | ||
| 630 | .children(sound_keyed.then(|| { | 680 | .children(sound_keyed.then(|| { |
| 631 | moment_segment( | 681 | moment_segment( |
| 632 | "moment-sound", | 682 | "moment-sound", |