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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-18 09:59:34 -05:00
parent d7389a25bc
commit 2e3ccc0346

25
main.go
View File

@ -688,8 +688,9 @@ type appState struct {
compareFile2 *videoSource
inspectFile *videoSource
inspectInterlaceResult *interlace.DetectionResult
inspectInterlaceAnalyzing bool
autoCompare bool // Auto-load Compare module after conversion
inspectInterlaceAnalyzing bool
autoCompare bool // Auto-load Compare module after conversion
convertCommandPreviewShow bool // Show FFmpeg command preview in Convert module
// Merge state
mergeClips []mergeClip
@ -5064,7 +5065,14 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
state.queueBtn = queueBtn
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 coverDisplay *widget.Label
@ -6737,7 +6745,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
var commandPreviewRow *fyne.Container
buildCommandPreview := func() {
if src == nil {
if src == nil || !state.convertCommandPreviewShow {
if commandPreviewRow != nil {
commandPreviewRow.Hide()
}
@ -6790,6 +6798,13 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
}
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 {
commandPreviewWidget = ui.NewFFmpegCommandWidget(cmdStr, state.window)
commandLabel := widget.NewLabel("FFmpeg Command Preview:")
@ -6897,7 +6912,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
snippetRow,
widget.NewSeparator(),
}
if commandPreviewRow != nil {
if commandPreviewRow != nil && state.convertCommandPreviewShow {
footerSections = append(footerSections, commandPreviewRow)
}