Refresh encoding controls on quality change
This commit is contained in:
parent
95d6fb1548
commit
4126f5565f
42
main.go
42
main.go
|
|
@ -2960,7 +2960,7 @@ func (s *appState) handleModuleDrop(moduleID string, items []fyne.URI) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect all video files (including from folders)
|
// Collect all video files (and audio files for audio module)
|
||||||
var videoPaths []string
|
var videoPaths []string
|
||||||
for _, uri := range items {
|
for _, uri := range items {
|
||||||
logging.Debug(logging.CatModule, "handleModuleDrop: processing uri scheme=%s path=%s", uri.Scheme(), uri.Path())
|
logging.Debug(logging.CatModule, "handleModuleDrop: processing uri scheme=%s path=%s", uri.Scheme(), uri.Path())
|
||||||
|
|
@ -2975,7 +2975,7 @@ func (s *appState) handleModuleDrop(moduleID string, items []fyne.URI) {
|
||||||
logging.Debug(logging.CatModule, "processing directory: %s", path)
|
logging.Debug(logging.CatModule, "processing directory: %s", path)
|
||||||
videos := s.findVideoFiles(path)
|
videos := s.findVideoFiles(path)
|
||||||
videoPaths = append(videoPaths, videos...)
|
videoPaths = append(videoPaths, videos...)
|
||||||
} else if s.isVideoFile(path) {
|
} else if s.isVideoFile(path) || (moduleID == "audio" && s.isAudioFile(path)) {
|
||||||
videoPaths = append(videoPaths, path)
|
videoPaths = append(videoPaths, path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3155,6 +3155,30 @@ func (s *appState) handleModuleDrop(moduleID string, items []fyne.URI) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If audio module, load audio/video file into audio slot
|
||||||
|
if moduleID == "audio" {
|
||||||
|
path := videoPaths[0]
|
||||||
|
go func() {
|
||||||
|
src, err := probeVideo(path)
|
||||||
|
if err != nil {
|
||||||
|
logging.Debug(logging.CatModule, "failed to load file for audio: %v", err)
|
||||||
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
|
dialog.ShowError(fmt.Errorf("failed to load file: %w", err), s.window)
|
||||||
|
}, false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update state and show module (with small delay to allow flash animation)
|
||||||
|
time.Sleep(350 * time.Millisecond)
|
||||||
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
|
s.audioFile = src
|
||||||
|
s.showModule(moduleID)
|
||||||
|
logging.Debug(logging.CatModule, "loaded file for audio module")
|
||||||
|
}, false)
|
||||||
|
}()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Single file or non-convert module: load first video and show module
|
// Single file or non-convert module: load first video and show module
|
||||||
path := videoPaths[0]
|
path := videoPaths[0]
|
||||||
logging.Debug(logging.CatModule, "drop on module %s path=%s - starting load", moduleID, path)
|
logging.Debug(logging.CatModule, "drop on module %s path=%s - starting load", moduleID, path)
|
||||||
|
|
@ -3183,6 +3207,17 @@ func (s *appState) isVideoFile(path string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *appState) isAudioFile(path string) bool {
|
||||||
|
ext := strings.ToLower(filepath.Ext(path))
|
||||||
|
audioExts := []string{".mp3", ".flac", ".aac", ".opus", ".m4a", ".wav", ".ogg", ".wma", ".alac", ".ape"}
|
||||||
|
for _, audioExt := range audioExts {
|
||||||
|
if ext == audioExt {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (s *appState) isSubtitleFile(path string) bool {
|
func (s *appState) isSubtitleFile(path string) bool {
|
||||||
ext := strings.ToLower(filepath.Ext(path))
|
ext := strings.ToLower(filepath.Ext(path))
|
||||||
subtitleExts := []string{".srt", ".vtt", ".ass", ".ssa"}
|
subtitleExts := []string{".srt", ".vtt", ".ass", ".ssa"}
|
||||||
|
|
@ -8538,6 +8573,9 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
buildCommandPreview()
|
buildCommandPreview()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
uiState.onQualityChange = append(uiState.onQualityChange, func(string) {
|
||||||
|
updateEncodingControls()
|
||||||
|
})
|
||||||
updateEncodingControls()
|
updateEncodingControls()
|
||||||
if updateQualityVisibility != nil {
|
if updateQualityVisibility != nil {
|
||||||
updateQualityVisibility()
|
updateQualityVisibility()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user