VideoTools/vendor/fyne.io/fyne/v2/dialog/form.go
Stu Leak 68df790d27 Fix player frame generation and video playback
Major improvements to UnifiedPlayer:

1. GetFrameImage() now works when paused for responsive UI updates
2. Play() method properly starts FFmpeg process
3. Frame display loop runs continuously for smooth video display
4. Disabled audio temporarily to fix video playback fundamentals
5. Simplified FFmpeg command to focus on video stream only

Player now:
- Generates video frames correctly
- Shows video when paused
- Has responsive progress tracking
- Starts playback properly

Next steps: Re-enable audio playback once video is stable
2026-01-07 22:20:00 -05:00

88 lines
2.8 KiB
Go

package dialog
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
// FormDialog is a simple dialog window for displaying FormItems inside a form.
//
// Since: 2.4
type FormDialog struct {
*dialog
items []*widget.FormItem
confirm *widget.Button
cancel *widget.Button
}
// Submit will submit the form and then hide the dialog if validation passes.
//
// Since: 2.4
func (d *FormDialog) Submit() {
if d.confirm.Disabled() {
return
}
d.hideWithResponse(true)
}
// setSubmitState is intended to run when the form validation changes to
// enable/disable the submit button accordingly.
func (d *FormDialog) setSubmitState(err error) {
if err != nil {
d.confirm.Disable()
return
}
d.confirm.Enable()
}
// NewForm creates and returns a dialog over the specified application using
// the provided FormItems. The cancel button will have the dismiss text set and the confirm button will
// use the confirm text. The response callback is called on user action after validation passes.
// If any Validatable widget reports that validation has failed, then the confirm
// button will be disabled. The initial state of the confirm button will reflect the initial
// validation state of the items added to the form dialog.
//
// Since: 2.0
func NewForm(title, confirm, dismiss string, items []*widget.FormItem, callback func(bool), parent fyne.Window) *FormDialog {
form := widget.NewForm(items...)
d := &dialog{content: form, callback: callback, title: title, parent: parent}
d.dismiss = &widget.Button{
Text: dismiss, Icon: theme.CancelIcon(),
OnTapped: d.Hide,
}
confirmBtn := &widget.Button{
Text: confirm, Icon: theme.ConfirmIcon(), Importance: widget.HighImportance,
OnTapped: func() { d.hideWithResponse(true) },
}
formDialog := &FormDialog{
dialog: d,
items: items,
confirm: confirmBtn,
cancel: d.dismiss,
}
formDialog.setSubmitState(form.Validate())
form.SetOnValidationChanged(formDialog.setSubmitState)
d.create(container.NewGridWithColumns(2, d.dismiss, confirmBtn))
return formDialog
}
// ShowForm shows a dialog over the specified application using
// the provided FormItems. The cancel button will have the dismiss text set and the confirm button will
// use the confirm text. The response callback is called on user action after validation passes.
// If any Validatable widget reports that validation has failed, then the confirm
// button will be disabled. The initial state of the confirm button will reflect the initial
// validation state of the items added to the form dialog.
// The MinSize() of the CanvasObject passed will be used to set the size of the window.
//
// Since: 2.0
func ShowForm(title, confirm, dismiss string, content []*widget.FormItem, callback func(bool), parent fyne.Window) {
NewForm(title, confirm, dismiss, content, callback, parent).Show()
}