I made sure that the current folder was saved.
This commit is contained in:
parent
3dc59344cb
commit
ee0a305972
@ -6,11 +6,13 @@ import (
|
|||||||
"fyne.io/fyne/v2/canvas"
|
"fyne.io/fyne/v2/canvas"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/dialog"
|
"fyne.io/fyne/v2/dialog"
|
||||||
|
"fyne.io/fyne/v2/storage"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/helper"
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/helper"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/localizer"
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/localizer"
|
||||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ViewContract interface {
|
type ViewContract interface {
|
||||||
@ -78,14 +80,14 @@ func (v View) Main(
|
|||||||
Widget: fileVideoForConversion,
|
Widget: fileVideoForConversion,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Widget: fileVideoForConversionMessage,
|
Widget: container.NewHScroll(fileVideoForConversionMessage),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Text: v.localizerService.GetMessage(&i18n.LocalizeConfig{MessageID: "buttonForSelectedDirTitle"}),
|
Text: v.localizerService.GetMessage(&i18n.LocalizeConfig{MessageID: "buttonForSelectedDirTitle"}),
|
||||||
Widget: buttonForSelectedDir,
|
Widget: buttonForSelectedDir,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Widget: buttonForSelectedDirMessage,
|
Widget: container.NewHScroll(buttonForSelectedDirMessage),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Widget: checkboxOverwriteOutputFiles,
|
Widget: checkboxOverwriteOutputFiles,
|
||||||
@ -147,6 +149,8 @@ func (v View) getButtonFileVideoForConversion(form *widget.Form, progress *widge
|
|||||||
MessageID: "choose",
|
MessageID: "choose",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var locationURI fyne.ListableURI
|
||||||
|
|
||||||
button := widget.NewButton(buttonTitle, func() {
|
button := widget.NewButton(buttonTitle, func() {
|
||||||
fileDialog := dialog.NewFileOpen(
|
fileDialog := dialog.NewFileOpen(
|
||||||
func(r fyne.URIReadCloser, err error) {
|
func(r fyne.URIReadCloser, err error) {
|
||||||
@ -170,9 +174,15 @@ func (v View) getButtonFileVideoForConversion(form *widget.Form, progress *widge
|
|||||||
progress.Value = 0
|
progress.Value = 0
|
||||||
progress.Refresh()
|
progress.Refresh()
|
||||||
conversionMessage.Text = ""
|
conversionMessage.Text = ""
|
||||||
|
|
||||||
|
listableURI := storage.NewFileURI(filepath.Dir(r.URI().Path()))
|
||||||
|
locationURI, err = storage.ListerForURI(listableURI)
|
||||||
}, v.w)
|
}, v.w)
|
||||||
helper.FileDialogResize(fileDialog, v.w)
|
helper.FileDialogResize(fileDialog, v.w)
|
||||||
fileDialog.Show()
|
fileDialog.Show()
|
||||||
|
if locationURI != nil {
|
||||||
|
fileDialog.SetLocation(locationURI)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return button, fileVideoForConversionMessage, fileInput
|
return button, fileVideoForConversionMessage, fileInput
|
||||||
@ -190,6 +200,8 @@ func (v View) getButtonForSelectingDirectoryForSaving() (button *widget.Button,
|
|||||||
MessageID: "choose",
|
MessageID: "choose",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var locationURI fyne.ListableURI
|
||||||
|
|
||||||
button = widget.NewButton(buttonTitle, func() {
|
button = widget.NewButton(buttonTitle, func() {
|
||||||
fileDialog := dialog.NewFolderOpen(
|
fileDialog := dialog.NewFolderOpen(
|
||||||
func(r fyne.ListableURI, err error) {
|
func(r fyne.ListableURI, err error) {
|
||||||
@ -206,9 +218,14 @@ func (v View) getButtonForSelectingDirectoryForSaving() (button *widget.Button,
|
|||||||
|
|
||||||
buttonMessage.Text = r.Path()
|
buttonMessage.Text = r.Path()
|
||||||
setStringSuccessStyle(buttonMessage)
|
setStringSuccessStyle(buttonMessage)
|
||||||
|
locationURI, _ = storage.ListerForURI(r)
|
||||||
|
|
||||||
}, v.w)
|
}, v.w)
|
||||||
helper.FileDialogResize(fileDialog, v.w)
|
helper.FileDialogResize(fileDialog, v.w)
|
||||||
fileDialog.Show()
|
fileDialog.Show()
|
||||||
|
if locationURI != nil {
|
||||||
|
fileDialog.SetLocation(locationURI)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -5,11 +5,13 @@ import (
|
|||||||
"fyne.io/fyne/v2/canvas"
|
"fyne.io/fyne/v2/canvas"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/dialog"
|
"fyne.io/fyne/v2/dialog"
|
||||||
|
"fyne.io/fyne/v2/storage"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/helper"
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/helper"
|
||||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
"image/color"
|
"image/color"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (v View) SelectFFPath(
|
func (v View) SelectFFPath(
|
||||||
@ -47,7 +49,7 @@ func (v View) SelectFFPath(
|
|||||||
Widget: buttonFFmpeg,
|
Widget: buttonFFmpeg,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Widget: buttonFFmpegMessage,
|
Widget: container.NewHScroll(buttonFFmpegMessage),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Text: v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
Text: v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||||
@ -56,7 +58,7 @@ func (v View) SelectFFPath(
|
|||||||
Widget: buttonFFprobe,
|
Widget: buttonFFprobe,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Widget: buttonFFprobeMessage,
|
Widget: container.NewHScroll(buttonFFprobeMessage),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Widget: errorMessage,
|
Widget: errorMessage,
|
||||||
@ -99,6 +101,12 @@ func (v View) getButtonSelectFile(path string) (filePath *string, button *widget
|
|||||||
MessageID: "choose",
|
MessageID: "choose",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var locationURI fyne.ListableURI
|
||||||
|
if len(path) > 0 {
|
||||||
|
listableURI := storage.NewFileURI(filepath.Dir(path))
|
||||||
|
locationURI, _ = storage.ListerForURI(listableURI)
|
||||||
|
}
|
||||||
|
|
||||||
button = widget.NewButton(buttonTitle, func() {
|
button = widget.NewButton(buttonTitle, func() {
|
||||||
fileDialog := dialog.NewFileOpen(
|
fileDialog := dialog.NewFileOpen(
|
||||||
func(r fyne.URIReadCloser, err error) {
|
func(r fyne.URIReadCloser, err error) {
|
||||||
@ -115,9 +123,15 @@ func (v View) getButtonSelectFile(path string) (filePath *string, button *widget
|
|||||||
|
|
||||||
buttonMessage.Text = r.URI().Path()
|
buttonMessage.Text = r.URI().Path()
|
||||||
setStringSuccessStyle(buttonMessage)
|
setStringSuccessStyle(buttonMessage)
|
||||||
|
|
||||||
|
listableURI := storage.NewFileURI(filepath.Dir(r.URI().Path()))
|
||||||
|
locationURI, _ = storage.ListerForURI(listableURI)
|
||||||
}, v.w)
|
}, v.w)
|
||||||
helper.FileDialogResize(fileDialog, v.w)
|
helper.FileDialogResize(fileDialog, v.w)
|
||||||
fileDialog.Show()
|
fileDialog.Show()
|
||||||
|
if locationURI != nil {
|
||||||
|
fileDialog.SetLocation(locationURI)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user