playlist GUI
This commit is contained in:
@@ -701,6 +701,110 @@ func main() {
|
||||
drawFeedsSections()
|
||||
}
|
||||
|
||||
if playlistRuntime != nil &&
|
||||
cimgui.CollapsingHeaderTreeNodeFlagsV("Playlist", collapsingHeaderFlags) {
|
||||
playlistSnapshot, hasPlaylistSnapshot :=
|
||||
playlistRuntime.Controller.Snapshot()
|
||||
|
||||
cimgui.TextWrapped(fmt.Sprintf("File: %s", args.PlaylistPath))
|
||||
cimgui.Text(fmt.Sprintf("Entries: %d", len(configuredPlaylist.Entries)))
|
||||
if configuredPlaylist.Loop {
|
||||
cimgui.Text("End behavior: loop")
|
||||
} else {
|
||||
cimgui.Text("End behavior: stop")
|
||||
}
|
||||
|
||||
preview := "No entry selected"
|
||||
if hasPlaylistSnapshot && playlistSnapshot.State.HasSelection {
|
||||
preview = playlistEntryDisplayName(
|
||||
playlistSnapshot.Entry,
|
||||
playlistSnapshot.State.CurrentIndex,
|
||||
)
|
||||
}
|
||||
if cimgui.BeginCombo("Entry##playlist", preview) {
|
||||
for index, entry := range configuredPlaylist.Entries {
|
||||
selected := hasPlaylistSnapshot &&
|
||||
playlistSnapshot.State.HasSelection &&
|
||||
playlistSnapshot.State.CurrentIndex == index
|
||||
label := fmt.Sprintf(
|
||||
"%s##playlist-entry-%d",
|
||||
playlistEntryDisplayName(entry, index),
|
||||
index,
|
||||
)
|
||||
if cimgui.SelectableBoolV(
|
||||
label,
|
||||
selected,
|
||||
cimgui.SelectableFlagsNone,
|
||||
cimgui.Vec2{},
|
||||
) && !playlistRuntime.Select(index) {
|
||||
log.Print("playlist command queue is full")
|
||||
}
|
||||
if selected {
|
||||
cimgui.SetItemDefaultFocus()
|
||||
}
|
||||
}
|
||||
cimgui.EndCombo()
|
||||
}
|
||||
|
||||
if cimgui.Button("Previous##playlist") && !playlistRuntime.Previous() {
|
||||
log.Print("playlist command queue is full")
|
||||
}
|
||||
cimgui.SameLine()
|
||||
if cimgui.Button("Next##playlist") && !playlistRuntime.Next() {
|
||||
log.Print("playlist command queue is full")
|
||||
}
|
||||
|
||||
if hasPlaylistSnapshot && playlistSnapshot.State.HasSelection {
|
||||
entry := playlistSnapshot.Entry
|
||||
cimgui.SeparatorText("Current entry")
|
||||
cimgui.Text(fmt.Sprintf(
|
||||
"%d of %d: %s",
|
||||
playlistSnapshot.State.CurrentIndex+1,
|
||||
len(configuredPlaylist.Entries),
|
||||
playlistEntryDisplayName(entry, playlistSnapshot.State.CurrentIndex),
|
||||
))
|
||||
if entry.Video.IsConfigured() {
|
||||
cimgui.TextWrapped(fmt.Sprintf(
|
||||
"Video: %s (%s)",
|
||||
entry.Video.UUID,
|
||||
entry.Video.Domain,
|
||||
))
|
||||
}
|
||||
if entry.Audio.IsConfigured() {
|
||||
cimgui.TextWrapped(fmt.Sprintf(
|
||||
"Audio: %s (%s)",
|
||||
entry.Audio.UUID,
|
||||
entry.Audio.Domain,
|
||||
))
|
||||
}
|
||||
if entry.SyncRequested {
|
||||
cimgui.Text("Synchronization: requested")
|
||||
} else {
|
||||
cimgui.Text("Synchronization: independent")
|
||||
}
|
||||
|
||||
switch {
|
||||
case entry.Duration == 0:
|
||||
cimgui.Text("Timing: manual advance")
|
||||
case playlistSnapshot.Timing.Started:
|
||||
fraction, remaining := playlistTimingProgress(
|
||||
playlistSnapshot.Timing,
|
||||
time.Now(),
|
||||
)
|
||||
cimgui.Text(fmt.Sprintf("Duration: %s", entry.Duration))
|
||||
cimgui.ProgressBarV(
|
||||
fraction,
|
||||
cimgui.Vec2{X: -1, Y: 0},
|
||||
remaining.Round(time.Second).String(),
|
||||
)
|
||||
case playlistSnapshot.Timing.Expired:
|
||||
cimgui.Text("Timing: finished")
|
||||
default:
|
||||
cimgui.Text("Timing: waiting for playback")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drawHotkeysSection := func() {
|
||||
cimgui.Text("F1 - show/hide stats")
|
||||
cimgui.Text("F2 - show/hide settings")
|
||||
|
||||
Reference in New Issue
Block a user