Enable drag-and-drop loading in filters and upscale
This commit is contained in:
parent
18d81cdbd4
commit
45c7b4f5c1
78
main.go
78
main.go
|
|
@ -7397,6 +7397,84 @@ func (s *appState) handleDrop(pos fyne.Position, items []fyne.URI) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If in filters module, handle single video file
|
||||||
|
if s.active == "filters" {
|
||||||
|
var videoPaths []string
|
||||||
|
for _, uri := range items {
|
||||||
|
if uri.Scheme() != "file" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
path := uri.Path()
|
||||||
|
if s.isVideoFile(path) {
|
||||||
|
videoPaths = append(videoPaths, path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(videoPaths) == 0 {
|
||||||
|
logging.Debug(logging.CatUI, "no valid video files in dropped items")
|
||||||
|
dialog.ShowInformation("Filters", "No video files found in dropped items.", s.window)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
src, err := probeVideo(videoPaths[0])
|
||||||
|
if err != nil {
|
||||||
|
logging.Debug(logging.CatModule, "failed to load video for filters: %v", err)
|
||||||
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
|
dialog.ShowError(fmt.Errorf("failed to load video: %w", err), s.window)
|
||||||
|
}, false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
|
s.filtersFile = src
|
||||||
|
s.showFiltersView()
|
||||||
|
logging.Debug(logging.CatModule, "loaded video into filters module")
|
||||||
|
}, false)
|
||||||
|
}()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// If in upscale module, handle single video file
|
||||||
|
if s.active == "upscale" {
|
||||||
|
var videoPaths []string
|
||||||
|
for _, uri := range items {
|
||||||
|
if uri.Scheme() != "file" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
path := uri.Path()
|
||||||
|
if s.isVideoFile(path) {
|
||||||
|
videoPaths = append(videoPaths, path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(videoPaths) == 0 {
|
||||||
|
logging.Debug(logging.CatUI, "no valid video files in dropped items")
|
||||||
|
dialog.ShowInformation("Upscale", "No video files found in dropped items.", s.window)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
src, err := probeVideo(videoPaths[0])
|
||||||
|
if err != nil {
|
||||||
|
logging.Debug(logging.CatModule, "failed to load video for upscale: %v", err)
|
||||||
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
|
dialog.ShowError(fmt.Errorf("failed to load video: %w", err), s.window)
|
||||||
|
}, false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
|
s.upscaleFile = src
|
||||||
|
s.showUpscaleView()
|
||||||
|
logging.Debug(logging.CatModule, "loaded video into upscale module")
|
||||||
|
}, false)
|
||||||
|
}()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// If in merge module, handle multiple video files
|
// If in merge module, handle multiple video files
|
||||||
if s.active == "merge" {
|
if s.active == "merge" {
|
||||||
// Collect all video files from the dropped items
|
// Collect all video files from the dropped items
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user