Add FFplay help feature and keyboard shortcut guide
Introduced a new "Help FFplay" section in the help menu to provide information about FFplay player keyboard shortcuts and actions.
This commit is contained in:
147
menu/view.go
147
menu/view.go
@@ -4,6 +4,7 @@ import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
@@ -14,6 +15,7 @@ import (
|
||||
type ViewContract interface {
|
||||
About(ffmpegVersion string, ffprobeVersion string, ffplayVersion string)
|
||||
Gratitude()
|
||||
HelpFFplay()
|
||||
}
|
||||
|
||||
type View struct {
|
||||
@@ -144,6 +146,151 @@ func (v View) About(ffmpegVersion string, ffprobeVersion string, ffplayVersion s
|
||||
view.Show()
|
||||
}
|
||||
|
||||
func (v View) HelpFFplay() {
|
||||
view := v.app.GetAppFyne().NewWindow(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplay",
|
||||
}))
|
||||
view.Resize(fyne.Size{Width: 800, Height: 550})
|
||||
view.SetFixedSize(true)
|
||||
|
||||
data := [][]string{
|
||||
[]string{
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayKeys",
|
||||
}),
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayDescription",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"Q, ESC",
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayQuit",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"F, " + v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayDoubleClickLeftMouseButton",
|
||||
}),
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayToggleFullScreen",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"P, " +
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayKeySpace",
|
||||
}),
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayPause",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"M",
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayToggleMute",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"9, /",
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayDecreaseVolume",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"0, *",
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayIncreaseVolume",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayKeyLeft",
|
||||
}),
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplaySeekBackward10Seconds",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayKeyRight",
|
||||
}),
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplaySeekForward10Seconds",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayKeyDown",
|
||||
}),
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplaySeekBackward1Minute",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayKeyUp",
|
||||
}),
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplaySeekBForward1Minute",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"Page Down",
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplaySeekBackward10Minutes",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"Page Up",
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplaySeekBForward10Minutes",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"S, " + v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayKeyHoldS",
|
||||
}),
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayActivateFrameStepMode",
|
||||
}),
|
||||
},
|
||||
[]string{
|
||||
"W",
|
||||
v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplayCycleVideoFiltersOrShowModes",
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
list := widget.NewTable(
|
||||
func() (int, int) {
|
||||
return len(data), len(data[0])
|
||||
},
|
||||
func() fyne.CanvasObject {
|
||||
return widget.NewLabel("")
|
||||
},
|
||||
func(i widget.TableCellID, o fyne.CanvasObject) {
|
||||
if i.Row == 0 {
|
||||
o.(*widget.Label).TextStyle.Bold = true
|
||||
o.(*widget.Label).SizeName = theme.SizeNameSubHeadingText
|
||||
}
|
||||
if i.Col == 0 {
|
||||
o.(*widget.Label).TextStyle.Bold = true
|
||||
}
|
||||
o.(*widget.Label).SetText(data[i.Row][i.Col])
|
||||
})
|
||||
list.SetRowHeight(0, 40)
|
||||
list.SetColumnWidth(0, 200)
|
||||
list.SetColumnWidth(1, 585)
|
||||
list.SetRowHeight(2, 55)
|
||||
view.SetContent(
|
||||
container.NewScroll(list),
|
||||
)
|
||||
view.CenterOnScreen()
|
||||
view.Show()
|
||||
}
|
||||
|
||||
func (v View) getCopyright() *widget.RichText {
|
||||
return widget.NewRichTextFromMarkdown("Copyright (c) 2024 **[Leonid Nikitin (kor-elf)](https://git.kor-elf.net/kor-elf/)**.")
|
||||
}
|
||||
|
Reference in New Issue
Block a user