Phase 2B: Add Copy Command button to queue view for running/pending jobs

Added "Copy Command" button to queue view for running and pending jobs,
allowing users to copy the FFmpeg command to clipboard for manual execution.

Changes:
- internal/ui/queueview.go: Add onCopyCommand parameter and buttons
- main.go: Implement onCopyCommand handler in showQueue()

The handler retrieves the job, generates the FFmpeg command with
INPUT/OUTPUT placeholders using buildFFmpegCommandFromJob(), and copies
it to the clipboard with a confirmation dialog.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-17 19:25:38 -05:00
parent 9df622eb72
commit bccacf9ea2
2 changed files with 19 additions and 1 deletions

View File

@ -138,6 +138,7 @@ func BuildQueueView(
onClearAll func(),
onCopyError func(string),
onViewLog func(string),
onCopyCommand func(string),
titleColor, bgColor, textColor color.Color,
) (fyne.CanvasObject, *container.Scroll) {
// Header
@ -181,7 +182,7 @@ func BuildQueueView(
jobItems = append(jobItems, container.NewCenter(emptyMsg))
} else {
for _, job := range jobs {
jobItems = append(jobItems, buildJobItem(job, onPause, onResume, onCancel, onRemove, onMoveUp, onMoveDown, onCopyError, onViewLog, bgColor, textColor))
jobItems = append(jobItems, buildJobItem(job, onPause, onResume, onCancel, onRemove, onMoveUp, onMoveDown, onCopyError, onViewLog, onCopyCommand, bgColor, textColor))
}
}
@ -211,6 +212,7 @@ func buildJobItem(
onMoveDown func(string),
onCopyError func(string),
onViewLog func(string),
onCopyCommand func(string),
bgColor, textColor color.Color,
) fyne.CanvasObject {
// Status color
@ -261,6 +263,7 @@ func buildJobItem(
switch job.Status {
case queue.JobStatusRunning:
buttons = append(buttons,
widget.NewButton("Copy Command", func() { onCopyCommand(job.ID) }),
widget.NewButton("Pause", func() { onPause(job.ID) }),
widget.NewButton("Cancel", func() { onCancel(job.ID) }),
)
@ -271,6 +274,7 @@ func buildJobItem(
)
case queue.JobStatusPending:
buttons = append(buttons,
widget.NewButton("Copy Command", func() { onCopyCommand(job.ID) }),
widget.NewButton("Cancel", func() { onCancel(job.ID) }),
)
case queue.JobStatusCompleted, queue.JobStatusFailed, queue.JobStatusCancelled:

14
main.go
View File

@ -1340,6 +1340,20 @@ func (s *appState) refreshQueueView() {
text.Disable()
dialog.ShowCustom("Conversion Log", "Close", container.NewVScroll(text), s.window)
},
func(id string) { // onCopyCommand
job, err := s.jobQueue.Get(id)
if err != nil {
logging.Debug(logging.CatSystem, "copy command failed: %v", err)
return
}
cmdStr := buildFFmpegCommandFromJob(job)
if cmdStr == "" {
dialog.ShowInformation("No Command", "Unable to generate FFmpeg command for this job.", s.window)
return
}
s.window.Clipboard().SetContent(cmdStr)
dialog.ShowInformation("Copied", "FFmpeg command copied to clipboard", s.window)
},
utils.MustHex("#4CE870"), // titleColor
gridColor, // bgColor
textColor, // textColor