FFmpeg UI improvement. Fix language change for Windows and Mac
This commit is contained in:
@@ -128,26 +128,27 @@ func Start(ctx context.Context, s *FyneScreen) {
|
||||
|
||||
s.Hotkeys = true
|
||||
tabs.OnSelected = func(t *container.TabItem) {
|
||||
s.TranscodeCheckBox.Enable()
|
||||
if err := utils.CheckFFmpeg(s.ffmpegPath); err != nil {
|
||||
s.TranscodeCheckBox.SetChecked(false)
|
||||
s.TranscodeCheckBox.Disable()
|
||||
s.SelectInternalSubs.Options = []string{}
|
||||
s.SelectInternalSubs.PlaceHolder = lang.L("No Embedded Subs")
|
||||
s.SelectInternalSubs.ClearSelected()
|
||||
s.SelectInternalSubs.Disable()
|
||||
}
|
||||
|
||||
if s.ffmpegPathChanged {
|
||||
furi, err := storage.ParseURI("file://" + s.mediafile)
|
||||
if err == nil {
|
||||
go selectMediaFile(s, furi)
|
||||
}
|
||||
s.ffmpegPathChanged = false
|
||||
}
|
||||
|
||||
if t.Text == "Go2TV" {
|
||||
s.Hotkeys = true
|
||||
s.TranscodeCheckBox.Enable()
|
||||
|
||||
if err := utils.CheckFFmpeg(s.ffmpegPath); err != nil {
|
||||
s.TranscodeCheckBox.SetChecked(false)
|
||||
s.TranscodeCheckBox.Disable()
|
||||
s.SelectInternalSubs.Options = []string{}
|
||||
s.SelectInternalSubs.PlaceHolder = lang.L("No Embedded Subs")
|
||||
s.SelectInternalSubs.ClearSelected()
|
||||
s.SelectInternalSubs.Disable()
|
||||
}
|
||||
|
||||
if s.ffmpegPathChanged {
|
||||
furi, err := storage.ParseURI("file://" + s.mediafile)
|
||||
if err == nil {
|
||||
go selectMediaFile(s, furi)
|
||||
}
|
||||
s.ffmpegPathChanged = false
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
s.Hotkeys = false
|
||||
@@ -244,16 +245,24 @@ func (p *FyneScreen) Fini() {
|
||||
}
|
||||
}
|
||||
|
||||
func InitFyneNewScreen(version string) *FyneScreen {
|
||||
func initFyneNewScreen(version string) *FyneScreen {
|
||||
go2tv := app.NewWithID("app.go2tv.go2tv")
|
||||
|
||||
// Hack. Ongoing discussion in https://github.com/fyne-io/fyne/issues/5333
|
||||
var content []byte
|
||||
switch go2tv.Preferences().String("Language") {
|
||||
case "中文(简体)":
|
||||
os.Setenv("LANG", "zh_CN.UTF-8")
|
||||
content, _ = translations.ReadFile("translations/zh.json")
|
||||
case "English":
|
||||
os.Setenv("LANG", "en_US.UTF-8")
|
||||
content, _ = translations.ReadFile("translations/en.json")
|
||||
}
|
||||
|
||||
if content != nil {
|
||||
name := lang.SystemLocale().LanguageString()
|
||||
lang.AddTranslations(fyne.NewStaticResource(name+".json", content))
|
||||
} else {
|
||||
lang.AddTranslationsFS(translations, "translations")
|
||||
}
|
||||
lang.AddTranslationsFS(translations, "translations")
|
||||
|
||||
go2tv.SetIcon(fyne.NewStaticResource("icon", go2TVIcon510))
|
||||
|
||||
|
@@ -121,8 +121,7 @@ func (p *FyneScreen) Fini() {
|
||||
}
|
||||
}
|
||||
|
||||
// InitFyneNewScreen .
|
||||
func InitFyneNewScreen(v string) *FyneScreen {
|
||||
func initFyneNewScreen(v string) *FyneScreen {
|
||||
go2tv := app.NewWithID("app.go2tv.go2tv")
|
||||
go2tv.Settings().SetTheme(go2tvTheme{"Dark"})
|
||||
|
||||
|
@@ -5,5 +5,5 @@ package gui
|
||||
|
||||
// NewFyneScreen .
|
||||
func NewFyneScreen(version string) *FyneScreen {
|
||||
return InitFyneNewScreen(version)
|
||||
return initFyneNewScreen(version)
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
// NewFyneScreen .
|
||||
func NewFyneScreen(version string) *FyneScreen {
|
||||
hideConsole()
|
||||
return InitFyneNewScreen(version)
|
||||
return initFyneNewScreen(version)
|
||||
}
|
||||
|
||||
func hideConsole() {
|
||||
|
@@ -4,6 +4,7 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
@@ -54,6 +55,22 @@ func settingsWindow(s *FyneScreen) fyne.CanvasObject {
|
||||
ffmpegText := widget.NewLabel("ffmpeg " + lang.L("Path"))
|
||||
ffmpegTextEntry := widget.NewEntry()
|
||||
|
||||
ffmpegFolderSelect := widget.NewButtonWithIcon("", theme.FolderOpenIcon(), func() {
|
||||
dialog.ShowFolderOpen(func(lu fyne.ListableURI, err error) {
|
||||
if err != nil {
|
||||
dialog.ShowError(err, w)
|
||||
return
|
||||
}
|
||||
if lu == nil {
|
||||
return
|
||||
}
|
||||
|
||||
p := filepath.ToSlash(lu.Path() + string(filepath.Separator) + "ffmpeg")
|
||||
ffmpegTextEntry.SetText(p)
|
||||
}, w)
|
||||
})
|
||||
ffmpegPathControls := container.New(layout.NewBorderLayout(nil, nil, nil, ffmpegFolderSelect), ffmpegFolderSelect, ffmpegTextEntry)
|
||||
|
||||
ffmpegTextEntry.Text = func() string {
|
||||
if fyne.CurrentApp().Preferences().String("ffmpeg") != "" {
|
||||
return fyne.CurrentApp().Preferences().String("ffmpeg")
|
||||
@@ -62,7 +79,7 @@ func settingsWindow(s *FyneScreen) fyne.CanvasObject {
|
||||
os := runtime.GOOS
|
||||
switch os {
|
||||
case "windows":
|
||||
return `C:\ffmpeg\bin\ffmpeg`
|
||||
return "C:/ffmpeg/bin/ffmpeg"
|
||||
case "linux":
|
||||
return "ffmpeg"
|
||||
case "darwin":
|
||||
@@ -73,6 +90,7 @@ func settingsWindow(s *FyneScreen) fyne.CanvasObject {
|
||||
|
||||
}()
|
||||
ffmpegTextEntry.Refresh()
|
||||
|
||||
s.ffmpegPath = ffmpegTextEntry.Text
|
||||
|
||||
ffmpegTextEntry.OnChanged = func(update string) {
|
||||
@@ -144,7 +162,7 @@ func settingsWindow(s *FyneScreen) fyne.CanvasObject {
|
||||
|
||||
dropdownTheme.Refresh()
|
||||
|
||||
return container.New(layout.NewFormLayout(), themeText, dropdownTheme, languageText, dropdownLanguage, gaplessText, gaplessdropdown, ffmpegText, ffmpegTextEntry, debugText, debugExport)
|
||||
return container.New(layout.NewFormLayout(), themeText, dropdownTheme, languageText, dropdownLanguage, gaplessText, gaplessdropdown, ffmpegText, ffmpegPathControls, debugText, debugExport)
|
||||
}
|
||||
|
||||
func saveDebugLogs(f fyne.URIWriteCloser, s *FyneScreen) {
|
||||
|
Reference in New Issue
Block a user