From bccacf9ea2c4de221129e08763375b0781c85db6 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Wed, 17 Dec 2025 19:25:38 -0500 Subject: [PATCH] Phase 2B: Add Copy Command button to queue view for running/pending jobs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- internal/ui/queueview.go | 6 +++++- main.go | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/internal/ui/queueview.go b/internal/ui/queueview.go index 917ea64..df3fd24 100644 --- a/internal/ui/queueview.go +++ b/internal/ui/queueview.go @@ -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: diff --git a/main.go b/main.go index 80400ce..07e410c 100644 --- a/main.go +++ b/main.go @@ -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