Open thumbnail results in default viewer
This commit is contained in:
parent
b29fb661cf
commit
db0d12865c
17
main.go
17
main.go
|
|
@ -480,6 +480,23 @@ func openFolder(path string) error {
|
||||||
return cmd.Start()
|
return cmd.Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// openFile tries to open a file in the OS default viewer.
|
||||||
|
func openFile(path string) error {
|
||||||
|
if strings.TrimSpace(path) == "" {
|
||||||
|
return fmt.Errorf("path is empty")
|
||||||
|
}
|
||||||
|
var cmd *exec.Cmd
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "windows":
|
||||||
|
cmd = utils.CreateCommandRaw("explorer", path)
|
||||||
|
case "darwin":
|
||||||
|
cmd = utils.CreateCommandRaw("open", path)
|
||||||
|
default:
|
||||||
|
cmd = utils.CreateCommandRaw("xdg-open", path)
|
||||||
|
}
|
||||||
|
return cmd.Start()
|
||||||
|
}
|
||||||
|
|
||||||
func (s *appState) showAbout() {
|
func (s *appState) showAbout() {
|
||||||
version := fmt.Sprintf("VideoTools %s", appVersion)
|
version := fmt.Sprintf("VideoTools %s", appVersion)
|
||||||
dev := "Leak Technologies"
|
dev := "Leak Technologies"
|
||||||
|
|
|
||||||
|
|
@ -352,32 +352,30 @@ func buildThumbView(state *appState) fyne.CanvasObject {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// If contact sheet mode, try to show contact sheet image
|
// If contact sheet mode, try to open contact sheet image
|
||||||
if state.thumbContactSheet {
|
if state.thumbContactSheet {
|
||||||
contactSheetPath := filepath.Join(outputDir, fmt.Sprintf("%s_contact_sheet.jpg", videoBaseName))
|
contactSheetPath := filepath.Join(outputDir, fmt.Sprintf("%s_contact_sheet.jpg", videoBaseName))
|
||||||
if _, err := os.Stat(contactSheetPath); err == nil {
|
if _, err := os.Stat(contactSheetPath); err == nil {
|
||||||
// Show contact sheet in a dialog
|
if err := openFile(contactSheetPath); err != nil {
|
||||||
go func() {
|
dialog.ShowError(fmt.Errorf("failed to open contact sheet: %w", err), state.window)
|
||||||
img := canvas.NewImageFromFile(contactSheetPath)
|
}
|
||||||
img.FillMode = canvas.ImageFillContain
|
|
||||||
// Adaptive size for small screens - use scrollable dialog
|
|
||||||
// img.SetMinSize(fyne.NewSize(640, 480)) // Removed for flexible sizing
|
|
||||||
|
|
||||||
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
|
||||||
// Wrap in scroll container for large contact sheets
|
|
||||||
scroll := container.NewScroll(img)
|
|
||||||
d := dialog.NewCustom("Contact Sheet", "Close", scroll, state.window)
|
|
||||||
// Adaptive dialog size that fits on 1280x768 screens
|
|
||||||
d.Resize(fyne.NewSize(700, 600))
|
|
||||||
d.Show()
|
|
||||||
}, false)
|
|
||||||
}()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, open folder
|
// Otherwise, open first thumbnail
|
||||||
openFolder(outputDir)
|
firstThumb := filepath.Join(outputDir, "thumb_0001.jpg")
|
||||||
|
if _, err := os.Stat(firstThumb); err == nil {
|
||||||
|
if err := openFile(firstThumb); err != nil {
|
||||||
|
dialog.ShowError(fmt.Errorf("failed to open thumbnail: %w", err), state.window)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to opening the folder if no images found
|
||||||
|
if err := openFolder(outputDir); err != nil {
|
||||||
|
dialog.ShowError(fmt.Errorf("failed to open results folder: %w", err), state.window)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
viewResultsBtn.Importance = widget.MediumImportance
|
viewResultsBtn.Importance = widget.MediumImportance
|
||||||
if state.thumbFile == nil {
|
if state.thumbFile == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user