diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index 7b93c97..4d74226 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -80,6 +80,10 @@ pub(crate) const KEYS_ROW_H: f32 = HIT_MIN; /// scrim showing either side of it. /// The export moment's height (the approved artboard's 200px): three rows, /// never a scroll -- the card it replaced grew a capped, scrolling list. +/// Unchanged by the picture and sound readouts row 3 now carries (user +/// 2026-09-09: "resolution and audio bitrate should be seen in export menu +/// too"): measured at 1280 wide, the whole line still fits on one line, so +/// the row wraps only below this editor's own 640px floor. pub(crate) const EXPORT_MOMENT_H: f32 = 200.; pub(crate) const EXPORT_W: f32 = 420.; diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index 2edac27..8978a98 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -1089,6 +1089,46 @@ fn row_three_wears_the_encode_options_and_the_door_to_the_rest() { .expect("the segment atom"); assert!(seg.contains("INK3()") && seg.contains("INK4()")); assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover"); + // The readouts worth seeing: the project's picture size and rate, and + // a sound rate that is on the line whether or not it is pressable. + assert!( + body.contains("s.resolution()") && body.contains("fps_label(self.fps)"), + "row 3 says nothing about the picture the file will hold" + ); + assert!( + body.contains("format!(\"{word} {}\", self.audio_kbps)"), + "the sound segment no longer says the rate it is spent at" + ); + // The picture segment is a child, not a `has_video` maybe: hidden on the + // sound-only formats it left `c` pressing nothing and no way back. + let at = body.find("\"moment-picture\"").expect("the picture segment"); + assert!( + !body[at - 240..at].contains("has_video"), + "the picture segment is gated on has_video again -- the dead end" + ); + // Wrapped, never cut: the readouts made row 3 longer than 1280 wide. + assert!(body.contains(".flex_wrap()"), "row 3 truncates instead of wrapping"); +} + +/// The dead end the user hit: the cycle walked into the sound-only formats +/// and stopped there ("when selection reaches the audio clicking is disabled +/// and can't turn it back to video"). One cycle, and it wraps. +#[test] +fn the_picture_cycle_wraps_out_of_the_sound_only_formats() { + use crate::ui::settings_stance::{PICTURE_CYCLE, next_picture}; + // Nothing refused: every stop is the next one, and the last wraps to the + // first -- OGG, the tail of the list, back to MP4. + let mut at = PICTURE_CYCLE[0]; + for &want in PICTURE_CYCLE.iter().skip(1).chain(std::iter::once(&PICTURE_CYCLE[0])) { + at = next_picture(at, |_| false); + assert_eq!(at, want, "the cycle stopped walking"); + } + assert_eq!(at, PICTURE_CYCLE[0], "a full walk is a wrap, not a dead end"); + assert_eq!(next_picture(Format::Ogg, |_| false), Format::Mp4); + // A timeline with no picture refuses every video format, and the cycle + // still moves: the sound-only stops are what is left of it. + let sound_only = next_picture(Format::Ogg, |f| f.has_video()); + assert!(!sound_only.has_video() && sound_only != Format::Ogg); } /// One chord per thing, said the same on both surfaces: the moment's segments diff --git a/crates/app/src/ui/cards.rs b/crates/app/src/ui/cards.rs index 5a32c5d..040bcd4 100644 --- a/crates/app/src/ui/cards.rs +++ b/crates/app/src/ui/cards.rs @@ -388,11 +388,37 @@ impl Player { // nobody is choosing wears no chord, the Settings row's own rule for // a codec with no rate to pick. let (codec, rated) = crate::ui::settings_stance::sound_codec(self.format); - let sound_label = match audio.is_empty() { - true => codec.to_string(), - false => audio.to_string(), + // The codec and the rate it is spent at, always -- the user asked to + // *see* the sound rate here even where nothing on this surface picks + // it ("resolution and audio bitrate should be seen in export menu + // too even if they won't be changeable"). A copied stream carries + // the source's own rate, which this surface cannot ask for, so it + // says `copy` and nothing it would have to invent. + let copied = audio.contains("copy"); + let mute = audio.is_empty() || audio == "no sound to write"; + // The engine's own first word where it has one ("Opus ยท SW encode" on + // a Matroska mix it will take), the Settings row's word where it does + // not -- the moment must not say AAC about a file that gets Opus. + let word = match mute { + true => codec, + false => audio.split_whitespace().next().unwrap_or(codec), }; - let sound_keyed = rated && !audio.contains("copy"); + let sound_label = match (mute, copied, rated) { + (true, ..) => codec.to_string(), + (_, true, _) => format!("{word} copy"), + (_, _, true) => format!("{word} {}", self.audio_kbps), + _ => word.to_string(), + }; + let sound_keyed = rated && !copied && !mute; + // The picture the file will hold, in the numbers Settings \u{b7} PROJECT + // already shows: a readout here, since the canvas is the project's + // and is set there. Greyed one step for a sound-only format -- the + // export writes no picture, but the project still has one, and it is + // meant to be seen rather than to disappear. + let picture_readout = self.session.as_ref().map(|s| { + let (w, h) = s.resolution(); + format!("{w}\u{d7}{h} \u{b7} {}", fps_label(self.fps)) + }); // `auto` is a promise until the probe answers; once it has, the seat // says what it resolved to rather than the word nobody picked. let seat = self.encoder_seat(); @@ -614,19 +640,43 @@ impl Player { .flex_1() .min_w(px(0.)) .flex() + // Two lines rather than a truncated one: the readouts made + // this line longer, and a number cut in half is worse than + // a moment one line taller. Measured at 1280 wide it still + // fits on one line -- this is the floor's guard, not the + // usual case. + .flex_wrap() .items_baseline() .gap(px(6.)) - .children(self.format.has_video().then(|| { - moment_segment( - "moment-picture", - crate::ui::settings_stance::picture_label(self.format), - "c", - cx.listener(|this, _: &ClickEvent, _, cx| { - this.cycle_export_picture(); - cx.notify(); - }), - ) + // The project's own picture, read here and set in + // Settings. INK4 is the faintest step this palette has, so + // a sound-only format greys it no further -- it stays + // said, which is what was asked for. + .children(picture_readout.map(|read| { + div() + .flex_none() + .type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK4())) + .child(read) })) + // Always a button, never hidden: the format cycle runs + // through the sound-only files too, and this segment + // disappearing on them left `c` with nothing to press and + // no way back (user 2026-09-09: "when selection reaches + // the audio clicking is disabled and can't turn it back to + // video"). + .child(moment_segment( + "moment-picture", + crate::ui::settings_stance::picture_label(self.format), + "c", + cx.listener(|this, _: &ClickEvent, _, cx| { + this.cycle_export_picture(); + cx.notify(); + }), + )) .children(sound_keyed.then(|| { moment_segment( "moment-sound",