diff --git a/crates/rundown-converter/src/gui.rs b/crates/rundown-converter/src/gui.rs index 8a4335e..49e0fd0 100644 --- a/crates/rundown-converter/src/gui.rs +++ b/crates/rundown-converter/src/gui.rs @@ -589,6 +589,11 @@ impl App { "Treat rows without a timing as notes", ) .on_hover_text("Attach rows without a timing to the preceding event. Applied before automatic warning exclusions, so notes are retained where possible."); + ui.horizontal(|ui| { + ui.label("Default break name"); + ui.add(egui::TextEdit::singleline(&mut profile.default_break_name).hint_text("Break")) + .on_hover_text("Names unnamed gaps and events created from them. Source names and individual event titles take precedence. Leave empty to keep automatic names."); + }); ui.small("Applied on analysis / recheck. Export requires a consistent schedule."); if before != serde_json::to_string(&profile).unwrap() { self.profile = serde_json::to_string_pretty(&profile).unwrap(); diff --git a/crates/rundown-converter/src/gui/review.rs b/crates/rundown-converter/src/gui/review.rs index 0f83db2..16b0b42 100644 --- a/crates/rundown-converter/src/gui/review.rs +++ b/crates/rundown-converter/src/gui/review.rs @@ -787,6 +787,7 @@ fn schedule_settings_changed(current: &Profile, analyzed: &Profile) -> bool { || current.durations != analyzed.durations || current.gap_resolutions != analyzed.gap_resolutions || current.gap_options != analyzed.gap_options + || current.default_break_name != analyzed.default_break_name } fn preview_row_settings_changed(row: &PreviewRow, current: &Profile, analyzed: &Profile) -> bool { @@ -799,6 +800,7 @@ fn preview_row_settings_changed(row: &PreviewRow, current: &Profile, analyzed: & let gap_changed = row.gap_key.as_ref().is_some_and(|key| { current.gap_resolutions.get(key) != analyzed.gap_resolutions.get(key) || current.gap_options.get(key) != analyzed.gap_options.get(key) + || current.default_break_name != analyzed.default_break_name }); let part_changed = row.split_part.is_some_and(|part| { current @@ -1245,7 +1247,12 @@ impl App { let mut options = profile.gap_options.get(key).cloned().unwrap_or_default(); if action == "create_event" { ui.label("Event title"); - ui.add(egui::TextEdit::singleline(&mut options.title).hint_text("Gap name, or Break")); + let hint = if profile.default_break_name.trim().is_empty() { + "Gap name, or Break".to_owned() + } else { + format!("Gap name, or {}", profile.default_break_name.trim()) + }; + ui.add(egui::TextEdit::singleline(&mut options.title).hint_text(hint)); } ui.checkbox(&mut options.distribute, "Distribute across neighbours"); if options.distribute { diff --git a/crates/rundown-converter/src/model.rs b/crates/rundown-converter/src/model.rs index cecca3f..291deae 100644 --- a/crates/rundown-converter/src/model.rs +++ b/crates/rundown-converter/src/model.rs @@ -148,6 +148,8 @@ pub struct Profile { /// Exact gap key -> keep, extend_previous, add_to_next, or create_event. pub gap_resolutions: BTreeMap, pub gap_options: BTreeMap, + /// Fallback name for unnamed breaks; source and individual names take precedence. + pub default_break_name: String, } impl Profile { pub fn margin_ms(&self) -> Option { diff --git a/crates/rundown-converter/src/pipeline.rs b/crates/rundown-converter/src/pipeline.rs index 276146e..d90e247 100644 --- a/crates/rundown-converter/src/pipeline.rs +++ b/crates/rundown-converter/src/pipeline.rs @@ -836,7 +836,12 @@ fn resolve_gaps(rundown: &mut Rundown, profile: &Profile) -> Vec { }, ) }); - for gap in gaps { + for mut gap in gaps { + if !profile.default_break_name.trim().is_empty() + && (gap.title.trim().is_empty() || gap.title.starts_with("Unallocated")) + { + gap.title = profile.default_break_name.trim().into(); + } let key = gap.key(); let action = profile .gap_resolutions diff --git a/crates/rundown-converter/tests/conversion.rs b/crates/rundown-converter/tests/conversion.rs index 6a427fd..1d7338b 100644 --- a/crates/rundown-converter/tests/conversion.rs +++ b/crates/rundown-converter/tests/conversion.rs @@ -2002,6 +2002,41 @@ fn gap_distribution_preserves_block_bounds_and_exports_generated_timers() { ); assert_eq!(e.title, "Break"); assert_eq!(r.entries.len(), 5); + profile.default_break_name = " Pause ".into(); + let saved = serde_json::to_string(&profile).unwrap(); + let profile_roundtrip: Profile = serde_json::from_str(&saved).unwrap(); + let renamed = analyze(&t, &profile_roundtrip).rundown.unwrap(); + assert_eq!( + renamed + .entries + .iter() + .find(|e| e.gap_origin.is_some()) + .unwrap() + .title, + "Pause" + ); + profile.gap_options.insert( + gap.key(), + GapOptions { + title: "Coffee".into(), + ..Default::default() + }, + ); + let overridden = analyze(&t, &profile).rundown.unwrap(); + assert_eq!( + overridden + .entries + .iter() + .find(|e| e.gap_origin.is_some()) + .unwrap() + .title, + "Coffee" + ); + profile.gap_resolutions.clear(); + let retained = analyze(&t, &profile).rundown.unwrap(); + assert_eq!(retained.gaps[0].title, "Pause"); + assert_eq!(retained.gaps[0].key(), gap.key()); + assert_eq!( serde_json::to_value(analyze(&t, &Profile::default()).rundown.unwrap()).unwrap(), serde_json::to_value(baseline).unwrap() diff --git a/docs/rundown-converter.md b/docs/rundown-converter.md index e704f49..9477331 100644 --- a/docs/rundown-converter.md +++ b/docs/rundown-converter.md @@ -545,3 +545,8 @@ table structure, cell formats and representative time values when redacted. Private originals stay out of Git; regression fixtures are synthetic. See [all tools](../README.md) and [repository development](development.md). + +In Setup → General options, **Default break name** names unnamed gaps and the +events created from them. Source break names and individual event titles take +precedence. Leave it empty to retain automatic names. Apply & recheck after +changing it; the setting is saved with resolution profiles.