refactor: Transportleiste als eigenes Panel (zweiter Node-Schnitt)

`PlaybackPanel` (src/whiteboard/view/playback_panel.gd) besitzt Play/Pause,
Reset, Zeitschieber, Zeitanzeige und Tempoauswahl und meldet nur Absichten:
`toggle_requested`, `reset_requested`, `seek_requested`,
`speed_requested`. Der Controller behält Uhr, Tempo und Audio und ruft
`set_state(time, duration, playing)`.

Anders als beim Export war kein Umhängen nötig: Die Widgets bleiben in der
Layout-Leiste, das Panel findet sie über unique_name_in_owner — ein Node ohne
Control-Basis kann in einem HBox keine Kinder sinnvoll aufnehmen.

- `_update_playback_ui` und `_update_play_button` sind zu
  `_sync_playback_ui()` verschmolzen.
- `_on_speed_selected`/`_on_timeline_changed` entfallen; das Tempo kommt als
  Wert aus dem Panel.
- Tests greifen über `controller.playback_panel.*` zu.

Controller: 8.245 -> 8.194 Zeilen. Suite grün.
This commit is contained in:
torsten 2026-11-13 14:43:21 +01:00
parent 27b7fd0907
commit a403270643
8 changed files with 166 additions and 96 deletions

View file

@ -32,8 +32,8 @@ func _run() -> void:
return
_check_approx(controller.get_playback_duration(), 0.0, "empty routine has no duration")
_check(controller.play_button.disabled, "play is disabled without segments")
_check(controller.playback_timeline.editable == false, "timeline is disabled without segments")
_check(controller.playback_panel.play_button.disabled, "play is disabled without segments")
_check(controller.playback_panel.timeline.editable == false, "timeline is disabled without segments")
var section_one := controller.get_active_section()
var forward := controller.add_segment(
@ -62,10 +62,10 @@ func _run() -> void:
controller._update_status()
_check_approx(controller.get_playback_duration(), 6.0, "duration sums all sections")
_check(not controller.play_button.disabled, "play is enabled with segments")
_check(controller.playback_timeline.editable, "timeline is enabled with segments")
_check(not controller.playback_panel.play_button.disabled, "play is enabled with segments")
_check(controller.playback_panel.timeline.editable, "timeline is enabled with segments")
_check_approx(
controller.playback_timeline.max_value,
controller.playback_panel.timeline.max_value,
6.0,
"timeline covers the whole routine"
)
@ -80,7 +80,7 @@ func _run() -> void:
"selecting a section moves the playback to its start"
)
_check_approx(
controller.playback_timeline.value,
controller.playback_panel.timeline.value,
4.0,
"timeline slider jumps to the section start"
)
@ -101,7 +101,7 @@ func _run() -> void:
"switching back moves the playback to the first section"
)
_check_approx(
controller.playback_timeline.value,
controller.playback_panel.timeline.value,
0.0,
"timeline slider returns to the first section"
)
@ -199,20 +199,20 @@ func _run() -> void:
"faded section banner has no alpha"
)
controller.play_button.pressed.emit()
controller.playback_panel.play_button.pressed.emit()
_check(controller.is_playing(), "play button starts playback")
controller.play_button.pressed.emit()
controller.playback_panel.play_button.pressed.emit()
_check(not controller.is_playing(), "play button pauses playback")
controller.play()
_check(controller.is_playing(), "play starts playback")
_check(controller.play_button.icon == PAUSE_ICON, "play button switches to pause")
_check(controller.playback_panel.play_button.icon == PAUSE_ICON, "play button switches to pause")
controller.advance_playback(0.5)
_check_approx(controller.get_playback_time(), 5.5, "playback advances by delta")
controller.advance_playback(1.0)
_check(not controller.is_playing(), "playback stops at the end")
_check_approx(controller.get_playback_time(), 6.0, "playback ends at the total duration")
_check(controller.play_button.icon == PLAY_ICON, "play button switches back after the end")
_check(controller.playback_panel.play_button.icon == PLAY_ICON, "play button switches back after the end")
controller.play()
_check_approx(
@ -223,21 +223,21 @@ func _run() -> void:
_check(controller.is_playing(), "restarted playback is running")
controller.pause()
_check(not controller.is_playing(), "pause stops playback")
controller.reset_playback_button.pressed.emit()
controller.playback_panel.reset_button.pressed.emit()
_check_approx(controller.get_playback_time(), 0.0, "reset returns to the start")
_check(
controller.rink_canvas.get_playback_section_id().is_empty(),
"reset clears the playback highlight"
)
controller.playback_timeline.value = 2.5
controller.playback_panel.timeline.value = 2.5
_check_approx(
controller.get_playback_time(),
2.5,
"timeline scrubbing seeks the playback"
)
controller.speed_option.item_selected.emit(4)
controller.playback_panel.speed_option.item_selected.emit(4)
_check_approx(controller.get_playback_speed(), 2.0, "speed option selects 2x")
controller.reset_playback()
controller.play()
@ -248,7 +248,7 @@ func _run() -> void:
"2x speed doubles the elapsed routine time"
)
controller.pause()
controller.speed_option.item_selected.emit(2)
controller.playback_panel.speed_option.item_selected.emit(2)
_check_approx(controller.get_playback_speed(), 1.0, "speed option returns to 1x")
# Element markers take their stand time from the element, not the geometry,
@ -656,13 +656,13 @@ func _run() -> void:
3.0,
"scrubbing moves the routine clock"
)
controller.speed_option.item_selected.emit(4)
controller.playback_panel.speed_option.item_selected.emit(4)
_check_approx(
controller.music_player.pitch_scale,
2.0,
"music follows the selected playback speed"
)
controller.speed_option.item_selected.emit(2)
controller.playback_panel.speed_option.item_selected.emit(2)
controller.reset_playback()
_check(not controller.music_player.playing, "reset stops the music")
_check_approx(

View file

@ -303,7 +303,7 @@ func _test_controller() -> void:
_check(not controller.sections_panel.visible, "section panel is hidden in 3D")
_check(not controller.timing_bar.visible, "timing bar is hidden in 3D")
_check(not controller.delete_segment_button.visible, "delete button is hidden in 3D")
_check(controller.play_button.visible, "playback bar stays visible in 3D")
_check(controller.playback_panel.play_button.visible, "playback bar stays visible in 3D")
var presentation := controller.get_presentation_3d()
_check(presentation != null, "controller owns a presentation")