Compare commits

...

2 Commits

Author SHA1 Message Date
846986279c
Added icon. 2024-01-23 21:33:30 +06:00
adf9bc9c27
Code refactoring.
Added files with functions for various OS (//go:build windows, //go:build !windows).
2024-01-23 21:33:01 +06:00
10 changed files with 51 additions and 13 deletions

View File

@ -2,6 +2,7 @@ package convertor
import (
"errors"
"ffmpegGui/helper"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
@ -131,6 +132,7 @@ func (v View) getButtonFileVideoForConversion(form *widget.Form, progress *widge
progress.Refresh()
conversionMessage.Text = ""
}, v.w)
helper.FileDialogResize(fileDialog, v.w)
fileDialog.Show()
})
@ -162,6 +164,7 @@ func (v View) getButtonForSelectingDirectoryForSaving() (button *widget.Button,
buttonMessage.Text = r.Path()
setStringSuccessStyle(buttonMessage)
}, v.w)
helper.FileDialogResize(fileDialog, v.w)
fileDialog.Show()
})

View File

@ -9,7 +9,6 @@ import (
"fyne.io/fyne/v2/widget"
"io"
"regexp"
"runtime"
"strconv"
"strings"
)
@ -69,12 +68,7 @@ func (h ConvertorHandler) checkingFFPathUtilities() bool {
return true
}
var pathsToFF []convertor.FFPathUtilities
if runtime.GOOS == "windows" {
pathsToFF = []convertor.FFPathUtilities{{"ffmpeg\\bin\\ffmpeg.exe", "ffmpeg\\bin\\ffprobe.exe"}}
} else {
pathsToFF = []convertor.FFPathUtilities{{"ffmpeg/bin/ffmpeg", "ffmpeg/bin/ffprobe"}, {"ffmpeg", "ffprobe"}}
}
pathsToFF := getPathsToFF()
for _, item := range pathsToFF {
ffmpegChecking, _ := h.convertorService.ChangeFFmpegPath(item.FFmpeg)
if ffmpegChecking == false {

View File

@ -0,0 +1,10 @@
//go:build !windows
// +build !windows
package handler
import "ffmpegGui/convertor"
func getPathsToFF() []convertor.FFPathUtilities {
return []convertor.FFPathUtilities{{"ffmpeg/bin/ffmpeg", "ffmpeg/bin/ffprobe"}, {"ffmpeg", "ffprobe"}}
}

View File

@ -0,0 +1,8 @@
//go:build windows
// +build windows
package handler
func getPathsToFF() []convertor.FFPathUtilities {
return []convertor.FFPathUtilities{{"ffmpeg\\bin\\ffmpeg.exe", "ffmpeg\\bin\\ffprobe.exe"}}
}

View File

@ -1,10 +1,11 @@
package helper
import "runtime"
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/dialog"
)
func PathSeparator() string {
if runtime.GOOS == "windows" {
return "\\"
}
return "/"
func FileDialogResize(fileDialog *dialog.FileDialog, w fyne.Window) {
contentSize := w.Content().Size()
fileDialog.Resize(fyne.Size{Width: contentSize.Width - 50, Height: contentSize.Height - 50})
}

View File

@ -0,0 +1,8 @@
//go:build !windows
// +build !windows
package helper
func PathSeparator() string {
return "/"
}

View File

@ -0,0 +1,8 @@
//go:build windows
// +build windows
package helper
func PathSeparator() string {
return "\\"
}

BIN
src/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -19,6 +19,10 @@ import (
func main() {
a := app.New()
iconResource, err := fyne.LoadResourceFromPath("icon.png")
if err == nil {
a.SetIcon(iconResource)
}
w := a.NewWindow("GUI FFMpeg!")
w.Resize(fyne.Size{Width: 800, Height: 600})
w.CenterOnScreen()

View File

@ -1,6 +1,7 @@
package setting
import (
"ffmpegGui/helper"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
@ -81,6 +82,7 @@ func (v View) getButtonSelectFile() (filePath *string, button *widget.Button, bu
buttonMessage.Text = r.URI().Path()
setStringSuccessStyle(buttonMessage)
}, v.w)
helper.FileDialogResize(fileDialog, v.w)
fileDialog.Show()
})