Compare commits
No commits in common. "16b32e0167fb1afd9672e72f09d2d5a44c3163d9" and "cf2a0933b4d3b619dcc835f0f240a85afd4ae1ce" have entirely different histories.
16b32e0167
...
cf2a0933b4
@ -11,7 +11,6 @@ import (
|
|||||||
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel/encoder"
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel/encoder"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/setting"
|
|
||||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
"image/color"
|
"image/color"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -41,13 +40,13 @@ type HandleConvertSetting struct {
|
|||||||
Encoder encoder2.EncoderContract
|
Encoder encoder2.EncoderContract
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConversion(app kernel.AppContract, formats encoder.ConvertorFormatsContract, runConvert func(setting HandleConvertSetting), settingDirectoryForSaving setting.DirectoryForSavingContract) *Conversion {
|
func NewConversion(app kernel.AppContract, formats encoder.ConvertorFormatsContract, runConvert func(setting HandleConvertSetting)) *Conversion {
|
||||||
conversionMessage := canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
conversionMessage := canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
||||||
conversionMessage.TextSize = 16
|
conversionMessage.TextSize = 16
|
||||||
conversionMessage.TextStyle = fyne.TextStyle{Bold: true}
|
conversionMessage.TextStyle = fyne.TextStyle{Bold: true}
|
||||||
|
|
||||||
fileForConversion := newFileForConversion(app)
|
fileForConversion := newFileForConversion(app)
|
||||||
directoryForSaving := newDirectoryForSaving(app, settingDirectoryForSaving)
|
directoryForSaving := newDirectoryForSaving(app)
|
||||||
overwriteOutputFiles := newOverwriteOutputFiles(app)
|
overwriteOutputFiles := newOverwriteOutputFiles(app)
|
||||||
selectEncoder := newSelectEncoder(app, formats)
|
selectEncoder := newSelectEncoder(app, formats)
|
||||||
|
|
||||||
@ -248,7 +247,7 @@ type directoryForSaving struct {
|
|||||||
path string
|
path string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDirectoryForSaving(app kernel.AppContract, settingDirectoryForSaving setting.DirectoryForSavingContract) *directoryForSaving {
|
func newDirectoryForSaving(app kernel.AppContract) *directoryForSaving {
|
||||||
directoryForSaving := &directoryForSaving{
|
directoryForSaving := &directoryForSaving{
|
||||||
path: "",
|
path: "",
|
||||||
}
|
}
|
||||||
@ -263,13 +262,6 @@ func newDirectoryForSaving(app kernel.AppContract, settingDirectoryForSaving set
|
|||||||
|
|
||||||
var locationURI fyne.ListableURI
|
var locationURI fyne.ListableURI
|
||||||
|
|
||||||
location, err := getDirectoryForSaving(settingDirectoryForSaving)
|
|
||||||
if err == nil {
|
|
||||||
directoryForSaving.path = location.Path()
|
|
||||||
directoryForSaving.message.Text = location.Path()
|
|
||||||
setStringSuccessStyle(directoryForSaving.message)
|
|
||||||
}
|
|
||||||
|
|
||||||
directoryForSaving.button = widget.NewButton(buttonTitle, func() {
|
directoryForSaving.button = widget.NewButton(buttonTitle, func() {
|
||||||
app.GetWindow().NewFolderOpen(func(r fyne.ListableURI, err error) {
|
app.GetWindow().NewFolderOpen(func(r fyne.ListableURI, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -285,11 +277,7 @@ func newDirectoryForSaving(app kernel.AppContract, settingDirectoryForSaving set
|
|||||||
|
|
||||||
directoryForSaving.message.Text = r.Path()
|
directoryForSaving.message.Text = r.Path()
|
||||||
setStringSuccessStyle(directoryForSaving.message)
|
setStringSuccessStyle(directoryForSaving.message)
|
||||||
locationURI, err = storage.ListerForURI(r)
|
locationURI, _ = storage.ListerForURI(r)
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
_, _ = settingDirectoryForSaving.SaveDirectoryForSaving(locationURI.Path())
|
|
||||||
}
|
|
||||||
|
|
||||||
}, locationURI)
|
}, locationURI)
|
||||||
})
|
})
|
||||||
@ -297,24 +285,6 @@ func newDirectoryForSaving(app kernel.AppContract, settingDirectoryForSaving set
|
|||||||
return directoryForSaving
|
return directoryForSaving
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDirectoryForSaving(settingDirectoryForSaving setting.DirectoryForSavingContract) (fyne.ListableURI, error) {
|
|
||||||
path, err := settingDirectoryForSaving.GetDirectoryForSaving()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(path) > 0 {
|
|
||||||
path = "file://" + path
|
|
||||||
}
|
|
||||||
|
|
||||||
uri, err := storage.ParseURI(path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return storage.ListerForURI(uri)
|
|
||||||
}
|
|
||||||
|
|
||||||
type overwriteOutputFiles struct {
|
type overwriteOutputFiles struct {
|
||||||
checkbox *widget.Check
|
checkbox *widget.Check
|
||||||
isChecked bool
|
isChecked bool
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
error2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/error"
|
error2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/error"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/helper"
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/helper"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/setting"
|
|
||||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,11 +18,10 @@ type ConvertorHandlerContract interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ConvertorHandler struct {
|
type ConvertorHandler struct {
|
||||||
app kernel.AppContract
|
app kernel.AppContract
|
||||||
convertorView convertor.ViewContract
|
convertorView convertor.ViewContract
|
||||||
errorView error2.ViewContract
|
errorView error2.ViewContract
|
||||||
convertorRepository convertor.RepositoryContract
|
convertorRepository convertor.RepositoryContract
|
||||||
settingDirectoryForSaving setting.DirectoryForSavingContract
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConvertorHandler(
|
func NewConvertorHandler(
|
||||||
@ -31,14 +29,12 @@ func NewConvertorHandler(
|
|||||||
convertorView convertor.ViewContract,
|
convertorView convertor.ViewContract,
|
||||||
errorView error2.ViewContract,
|
errorView error2.ViewContract,
|
||||||
convertorRepository convertor.RepositoryContract,
|
convertorRepository convertor.RepositoryContract,
|
||||||
settingDirectoryForSaving setting.DirectoryForSavingContract,
|
|
||||||
) *ConvertorHandler {
|
) *ConvertorHandler {
|
||||||
return &ConvertorHandler{
|
return &ConvertorHandler{
|
||||||
app: app,
|
app: app,
|
||||||
convertorView: convertorView,
|
convertorView: convertorView,
|
||||||
errorView: errorView,
|
errorView: errorView,
|
||||||
convertorRepository: convertorRepository,
|
convertorRepository: convertorRepository,
|
||||||
settingDirectoryForSaving: settingDirectoryForSaving,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +45,7 @@ func (h ConvertorHandler) MainConvertor() {
|
|||||||
h.errorView.PanicError(err)
|
h.errorView.PanicError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
conversion := view.NewConversion(h.app, formats, h.runConvert, h.settingDirectoryForSaving)
|
conversion := view.NewConversion(h.app, formats, h.runConvert)
|
||||||
h.convertorView.Main(conversion)
|
h.convertorView.Main(conversion)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ package handler
|
|||||||
import (
|
import (
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
"errors"
|
"errors"
|
||||||
"fyne.io/fyne/v2"
|
|
||||||
"fyne.io/fyne/v2/canvas"
|
"fyne.io/fyne/v2/canvas"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||||
|
4
main.go
4
main.go
@ -73,8 +73,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
settingRepository := setting.NewRepository(db)
|
settingRepository := setting.NewRepository(db)
|
||||||
settingDirectoryForSaving := setting.NewSettingDirectoryForSaving(settingRepository)
|
|
||||||
|
|
||||||
convertorRepository := convertor.NewRepository(settingRepository)
|
convertorRepository := convertor.NewRepository(settingRepository)
|
||||||
pathFFmpeg, err := convertorRepository.GetPathFfmpeg()
|
pathFFmpeg, err := convertorRepository.GetPathFfmpeg()
|
||||||
if err != nil && errors.Is(err, dberror.ErrRecordNotFound) == false {
|
if err != nil && errors.Is(err, dberror.ErrRecordNotFound) == false {
|
||||||
@ -97,7 +95,7 @@ func main() {
|
|||||||
|
|
||||||
localizerView := localizer.NewView(application)
|
localizerView := localizer.NewView(application)
|
||||||
convertorView := convertor.NewView(application)
|
convertorView := convertor.NewView(application)
|
||||||
convertorHandler := handler.NewConvertorHandler(application, convertorView, errorView, convertorRepository, settingDirectoryForSaving)
|
convertorHandler := handler.NewConvertorHandler(application, convertorView, errorView, convertorRepository)
|
||||||
|
|
||||||
localizerRepository := localizer.NewRepository(settingRepository)
|
localizerRepository := localizer.NewRepository(settingRepository)
|
||||||
menuView := menu.NewView(application)
|
menuView := menu.NewView(application)
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
package setting
|
|
||||||
|
|
||||||
type DirectoryForSavingContract interface {
|
|
||||||
GetDirectoryForSaving() (string, error)
|
|
||||||
SaveDirectoryForSaving(path string) (Setting, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type DirectoryForSaving struct {
|
|
||||||
settingRepository RepositoryContract
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSettingDirectoryForSaving(settingRepository RepositoryContract) *DirectoryForSaving {
|
|
||||||
return &DirectoryForSaving{settingRepository: settingRepository}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (setting DirectoryForSaving) GetDirectoryForSaving() (string, error) {
|
|
||||||
return setting.settingRepository.GetValue("directoryForSaving")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (setting DirectoryForSaving) SaveDirectoryForSaving(path string) (Setting, error) {
|
|
||||||
return setting.settingRepository.CreateOrUpdate("directoryForSaving", path)
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user