2024-01-14 16:31:07 +06:00
|
|
|
package convertor
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fyne.io/fyne/v2/canvas"
|
|
|
|
"fyne.io/fyne/v2/container"
|
|
|
|
"fyne.io/fyne/v2/widget"
|
2024-03-17 00:30:02 +05:00
|
|
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view"
|
2024-02-17 19:08:58 +06:00
|
|
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
2024-01-28 22:01:16 +06:00
|
|
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
2024-01-14 16:31:07 +06:00
|
|
|
"image/color"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ViewContract interface {
|
|
|
|
Main(
|
2024-03-17 00:30:02 +05:00
|
|
|
formConversion view.ConversionContract,
|
2024-01-14 16:31:07 +06:00
|
|
|
)
|
2024-01-31 21:02:12 +06:00
|
|
|
SelectFFPath(
|
2024-02-01 00:23:28 +06:00
|
|
|
ffmpegPath string,
|
|
|
|
ffprobePath string,
|
|
|
|
save func(ffmpegPath string, ffprobePath string) error,
|
|
|
|
cancel func(),
|
2024-02-04 20:16:15 +06:00
|
|
|
donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error,
|
2024-01-31 21:02:12 +06:00
|
|
|
)
|
2024-01-14 16:31:07 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
type View struct {
|
2024-02-17 19:08:58 +06:00
|
|
|
app kernel.AppContract
|
2024-01-14 16:31:07 +06:00
|
|
|
}
|
|
|
|
|
2024-02-17 19:08:58 +06:00
|
|
|
func NewView(app kernel.AppContract) *View {
|
2024-01-28 22:01:16 +06:00
|
|
|
return &View{
|
2024-02-17 19:08:58 +06:00
|
|
|
app: app,
|
2024-01-28 22:01:16 +06:00
|
|
|
}
|
2024-01-14 16:31:07 +06:00
|
|
|
}
|
|
|
|
|
2024-03-17 00:30:02 +05:00
|
|
|
func (v View) Main(formConversion view.ConversionContract) {
|
2024-02-17 19:08:58 +06:00
|
|
|
converterVideoFilesTitle := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
2024-01-28 22:01:16 +06:00
|
|
|
MessageID: "converterVideoFilesTitle",
|
|
|
|
})
|
2024-03-17 00:30:02 +05:00
|
|
|
v.app.GetWindow().SetContent(widget.NewCard(converterVideoFilesTitle, "", container.NewVScroll(formConversion.GetContent())))
|
|
|
|
formConversion.AfterViewContent()
|
2024-03-07 22:18:35 +05:00
|
|
|
}
|
|
|
|
|
2024-01-14 16:31:07 +06:00
|
|
|
func setStringErrorStyle(text *canvas.Text) {
|
2024-02-01 00:28:06 +06:00
|
|
|
text.Color = color.RGBA{R: 255, G: 0, B: 0, A: 255}
|
2024-01-14 16:31:07 +06:00
|
|
|
text.Refresh()
|
|
|
|
}
|
|
|
|
|
|
|
|
func setStringSuccessStyle(text *canvas.Text) {
|
2024-02-01 00:28:06 +06:00
|
|
|
text.Color = color.RGBA{R: 49, G: 127, B: 114, A: 255}
|
2024-01-14 16:31:07 +06:00
|
|
|
text.Refresh()
|
|
|
|
}
|