Make command preview collapsible and show actual file paths

Made the FFmpeg command preview less intrusive by adding a toggle button
and showing actual file paths instead of placeholders.

Changes:
- Added convertCommandPreviewShow state field to track preview visibility
- Added "Command Preview" toggle button next to "View Queue" button
- Command preview now hidden by default to save screen space
- Preview shows actual input/output file paths instead of INPUT/OUTPUT
- Cover art paths also shown with real file path when present

This makes the interface cleaner while providing more useful information
when the preview is needed.
This commit is contained in:
Stu Leak 2025-12-18 09:59:34 -05:00
parent c3dd340470
commit a9eb1cd843

25
main.go
View File

@ -688,8 +688,9 @@ type appState struct {
compareFile2 *videoSource compareFile2 *videoSource
inspectFile *videoSource inspectFile *videoSource
inspectInterlaceResult *interlace.DetectionResult inspectInterlaceResult *interlace.DetectionResult
inspectInterlaceAnalyzing bool inspectInterlaceAnalyzing bool
autoCompare bool // Auto-load Compare module after conversion autoCompare bool // Auto-load Compare module after conversion
convertCommandPreviewShow bool // Show FFmpeg command preview in Convert module
// Merge state // Merge state
mergeClips []mergeClip mergeClips []mergeClip
@ -5064,7 +5065,14 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
state.queueBtn = queueBtn state.queueBtn = queueBtn
state.updateQueueButtonLabel() state.updateQueueButtonLabel()
backBar := ui.TintedBar(convertColor, container.NewHBox(back, layout.NewSpacer(), navButtons, layout.NewSpacer(), queueBtn)) // Command Preview toggle button
cmdPreviewBtn := widget.NewButton("Command Preview", func() {
state.convertCommandPreviewShow = !state.convertCommandPreviewShow
state.showModule("convert")
})
cmdPreviewBtn.Importance = widget.LowImportance
backBar := ui.TintedBar(convertColor, container.NewHBox(back, layout.NewSpacer(), navButtons, layout.NewSpacer(), cmdPreviewBtn, queueBtn))
var updateCover func(string) var updateCover func(string)
var coverDisplay *widget.Label var coverDisplay *widget.Label
@ -6737,7 +6745,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
var commandPreviewRow *fyne.Container var commandPreviewRow *fyne.Container
buildCommandPreview := func() { buildCommandPreview := func() {
if src == nil { if src == nil || !state.convertCommandPreviewShow {
if commandPreviewRow != nil { if commandPreviewRow != nil {
commandPreviewRow.Hide() commandPreviewRow.Hide()
} }
@ -6790,6 +6798,13 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
} }
cmdStr := buildFFmpegCommandFromJob(job) cmdStr := buildFFmpegCommandFromJob(job)
// Replace INPUT and OUTPUT placeholders with actual file paths for preview
inputPath := src.Path
outputPath := state.convert.OutputFile()
cmdStr = strings.ReplaceAll(cmdStr, "INPUT", inputPath)
cmdStr = strings.ReplaceAll(cmdStr, "OUTPUT", outputPath)
cmdStr = strings.ReplaceAll(cmdStr, "[COVER_ART]", state.convert.CoverArtPath)
if commandPreviewWidget == nil { if commandPreviewWidget == nil {
commandPreviewWidget = ui.NewFFmpegCommandWidget(cmdStr, state.window) commandPreviewWidget = ui.NewFFmpegCommandWidget(cmdStr, state.window)
commandLabel := widget.NewLabel("FFmpeg Command Preview:") commandLabel := widget.NewLabel("FFmpeg Command Preview:")
@ -6897,7 +6912,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
snippetRow, snippetRow,
widget.NewSeparator(), widget.NewSeparator(),
} }
if commandPreviewRow != nil { if commandPreviewRow != nil && state.convertCommandPreviewShow {
footerSections = append(footerSections, commandPreviewRow) footerSections = append(footerSections, commandPreviewRow)
} }