Moved the menu to a new structure.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/setting"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/menu"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/view"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/window"
|
||||
)
|
||||
@@ -40,6 +42,8 @@ func (c *controller) Start() {
|
||||
return
|
||||
}
|
||||
|
||||
c.app.GetSetting().ThemeInit()
|
||||
|
||||
if isDefault {
|
||||
languages := c.app.GetSetting().GetLanguages()
|
||||
content := view.StartWithoutSupportLang(languages, func(lang setting.Lang) {
|
||||
@@ -48,7 +52,7 @@ func (c *controller) Start() {
|
||||
c.startWithError(err)
|
||||
return
|
||||
}
|
||||
c.window.InitLayout()
|
||||
c.initLayout()
|
||||
c.verificareaFFmpeg()
|
||||
})
|
||||
c.window.SetContent(content)
|
||||
@@ -56,7 +60,7 @@ func (c *controller) Start() {
|
||||
return
|
||||
}
|
||||
|
||||
c.window.InitLayout()
|
||||
c.initLayout()
|
||||
c.verificareaFFmpeg()
|
||||
c.window.Show()
|
||||
}
|
||||
@@ -75,3 +79,17 @@ func (c *controller) initLanguage() (isDefault bool, err error) {
|
||||
err = setting.ChangeLang(lang)
|
||||
return isDefault, err
|
||||
}
|
||||
|
||||
func (c *controller) initLayout() {
|
||||
c.window.SetMainMenu(fyne.NewMainMenu(
|
||||
menu.MainMenuSettings(
|
||||
c.actionMainSettings,
|
||||
c.actionSettingConvertor,
|
||||
),
|
||||
menu.MainMenuHelp(
|
||||
c.actionAbout,
|
||||
c.actionHelpFFplay,
|
||||
),
|
||||
))
|
||||
c.window.InitLayout()
|
||||
}
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/view"
|
||||
)
|
||||
|
||||
@@ -34,3 +36,32 @@ func (c *controller) actionMainSettingsSave(setting *view.MainSettingForm) error
|
||||
c.convertor()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *controller) actionAbout() {
|
||||
ffmpegVersion := c.app.GetFFmpegService().GetFFmpegVersion()
|
||||
ffprobeVersion := c.app.GetFFmpegService().GetFFprobeVersion()
|
||||
ffplayVersion := c.app.GetFFmpegService().GetFFplayVersion()
|
||||
appVersion := c.app.FyneApp().Metadata().Version
|
||||
|
||||
window := c.app.FyneApp().NewWindow(lang.L("about"))
|
||||
window.Resize(fyne.Size{Width: 793, Height: 550})
|
||||
window.SetFixedSize(true)
|
||||
|
||||
content := view.About(appVersion, ffmpegVersion, ffprobeVersion, ffplayVersion)
|
||||
|
||||
window.SetContent(content)
|
||||
window.CenterOnScreen()
|
||||
window.Show()
|
||||
}
|
||||
|
||||
func (c *controller) actionHelpFFplay() {
|
||||
window := c.app.FyneApp().NewWindow(lang.L("helpFFplay"))
|
||||
window.Resize(fyne.Size{Width: 800, Height: 550})
|
||||
window.SetFixedSize(true)
|
||||
|
||||
content := view.HelpFFplay()
|
||||
|
||||
window.SetContent(content)
|
||||
window.CenterOnScreen()
|
||||
window.Show()
|
||||
}
|
||||
|
Reference in New Issue
Block a user