68 lines
1.6 KiB
Go
68 lines
1.6 KiB
Go
package controller
|
|
|
|
import (
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/lang"
|
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/view"
|
|
)
|
|
|
|
func (c *controller) actionSettingConvertor() {
|
|
c.settingConvertor(true)
|
|
}
|
|
|
|
func (c *controller) actionMainSettings() {
|
|
currentLang, _ := c.app.GetSetting().GetCurrentLangOrDefaultLang()
|
|
content := view.MainSettings(
|
|
currentLang,
|
|
c.app.GetSetting().GetLanguages(),
|
|
|
|
c.app.GetSetting().GetTheme(),
|
|
c.app.GetSetting().GetThemes(),
|
|
|
|
c.actionMainSettingsSave,
|
|
c.convertor,
|
|
)
|
|
c.window.SetContent(content)
|
|
}
|
|
|
|
func (c *controller) actionMainSettingsSave(setting *view.MainSettingForm) error {
|
|
err := c.app.GetSetting().SetLang(setting.Language)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
c.app.GetSetting().SetTheme(setting.ThemeInfo)
|
|
c.initLayout()
|
|
|
|
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()
|
|
}
|