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:
parent
9df622eb72
commit
bccacf9ea2
|
|
@ -138,6 +138,7 @@ func BuildQueueView(
|
||||||
onClearAll func(),
|
onClearAll func(),
|
||||||
onCopyError func(string),
|
onCopyError func(string),
|
||||||
onViewLog func(string),
|
onViewLog func(string),
|
||||||
|
onCopyCommand func(string),
|
||||||
titleColor, bgColor, textColor color.Color,
|
titleColor, bgColor, textColor color.Color,
|
||||||
) (fyne.CanvasObject, *container.Scroll) {
|
) (fyne.CanvasObject, *container.Scroll) {
|
||||||
// Header
|
// Header
|
||||||
|
|
@ -181,7 +182,7 @@ func BuildQueueView(
|
||||||
jobItems = append(jobItems, container.NewCenter(emptyMsg))
|
jobItems = append(jobItems, container.NewCenter(emptyMsg))
|
||||||
} else {
|
} else {
|
||||||
for _, job := range jobs {
|
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),
|
onMoveDown func(string),
|
||||||
onCopyError func(string),
|
onCopyError func(string),
|
||||||
onViewLog func(string),
|
onViewLog func(string),
|
||||||
|
onCopyCommand func(string),
|
||||||
bgColor, textColor color.Color,
|
bgColor, textColor color.Color,
|
||||||
) fyne.CanvasObject {
|
) fyne.CanvasObject {
|
||||||
// Status color
|
// Status color
|
||||||
|
|
@ -261,6 +263,7 @@ func buildJobItem(
|
||||||
switch job.Status {
|
switch job.Status {
|
||||||
case queue.JobStatusRunning:
|
case queue.JobStatusRunning:
|
||||||
buttons = append(buttons,
|
buttons = append(buttons,
|
||||||
|
widget.NewButton("Copy Command", func() { onCopyCommand(job.ID) }),
|
||||||
widget.NewButton("Pause", func() { onPause(job.ID) }),
|
widget.NewButton("Pause", func() { onPause(job.ID) }),
|
||||||
widget.NewButton("Cancel", func() { onCancel(job.ID) }),
|
widget.NewButton("Cancel", func() { onCancel(job.ID) }),
|
||||||
)
|
)
|
||||||
|
|
@ -271,6 +274,7 @@ func buildJobItem(
|
||||||
)
|
)
|
||||||
case queue.JobStatusPending:
|
case queue.JobStatusPending:
|
||||||
buttons = append(buttons,
|
buttons = append(buttons,
|
||||||
|
widget.NewButton("Copy Command", func() { onCopyCommand(job.ID) }),
|
||||||
widget.NewButton("Cancel", func() { onCancel(job.ID) }),
|
widget.NewButton("Cancel", func() { onCancel(job.ID) }),
|
||||||
)
|
)
|
||||||
case queue.JobStatusCompleted, queue.JobStatusFailed, queue.JobStatusCancelled:
|
case queue.JobStatusCompleted, queue.JobStatusFailed, queue.JobStatusCancelled:
|
||||||
|
|
|
||||||
14
main.go
14
main.go
|
|
@ -1340,6 +1340,20 @@ func (s *appState) refreshQueueView() {
|
||||||
text.Disable()
|
text.Disable()
|
||||||
dialog.ShowCustom("Conversion Log", "Close", container.NewVScroll(text), s.window)
|
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
|
utils.MustHex("#4CE870"), // titleColor
|
||||||
gridColor, // bgColor
|
gridColor, // bgColor
|
||||||
textColor, // textColor
|
textColor, // textColor
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user