Версия 1.0.0 #11
@ -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()
|
||||
}
|
||||
|
29
internal/gui/menu/main.go
Normal file
29
internal/gui/menu/main.go
Normal file
@ -0,0 +1,29 @@
|
||||
package menu
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
)
|
||||
|
||||
func MainMenuSettings(
|
||||
actionMainSettings func(),
|
||||
actionFFPathSelection func(),
|
||||
) *fyne.Menu {
|
||||
quit := fyne.NewMenuItem(lang.L("exit"), nil)
|
||||
quit.IsQuit = true
|
||||
|
||||
settingsSelection := fyne.NewMenuItem(lang.L("settings"), actionMainSettings)
|
||||
ffPathSelection := fyne.NewMenuItem(lang.L("changeFFPath"), actionFFPathSelection)
|
||||
|
||||
return fyne.NewMenu(lang.L("settings"), settingsSelection, ffPathSelection, quit)
|
||||
}
|
||||
|
||||
func MainMenuHelp(
|
||||
actionAbout func(),
|
||||
actionHelpFFplay func(),
|
||||
) *fyne.Menu {
|
||||
about := fyne.NewMenuItem(lang.L("about"), actionAbout)
|
||||
helpFFplay := fyne.NewMenuItem(lang.L("helpFFplay"), actionHelpFFplay)
|
||||
|
||||
return fyne.NewMenu(lang.L("help"), helpFFplay, about)
|
||||
}
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
type WindowContract interface {
|
||||
SetContent(content fyne.CanvasObject)
|
||||
SetMainMenu(menu *fyne.MainMenu)
|
||||
Show()
|
||||
InitLayout()
|
||||
NewFileOpen(callback func(fyne.URIReadCloser, error), location fyne.ListableURI) *dialog.FileDialog
|
||||
@ -42,6 +43,12 @@ func NewMainWindow(
|
||||
}
|
||||
}
|
||||
|
||||
func (w *mainWindow) SetMainMenu(menu *fyne.MainMenu) {
|
||||
fyne.Do(func() {
|
||||
w.fyneWindow.SetMainMenu(menu)
|
||||
})
|
||||
}
|
||||
|
||||
func (w *mainWindow) InitLayout() {
|
||||
fyne.Do(func() {
|
||||
w.layout = NewLayout(w.progressBarService, w.itemsToConvert, w.queueLayout)
|
||||
|
Loading…
x
Reference in New Issue
Block a user