From d29f48510692418bc32bab89ba41f6599bb6d569 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Tue, 30 Dec 2025 22:02:21 -0500 Subject: [PATCH] feat(author): Add Cancel Job button to Author module Added a "Cancel Job" button to the Author module top bar that: - Appears only when an Author job is currently running - Uses DangerImportance styling for clear visual indication - Cancels the running author job when clicked - Hides automatically when no author job is running This addresses the user's request for cancel buttons in every module where it's relevant. The button provides immediate job cancellation without needing to navigate to the queue view. --- author_module.go | 29 ++++++++++++++++++++++++++++- main.go | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/author_module.go b/author_module.go index e43d8f3..fb99ec8 100644 --- a/author_module.go +++ b/author_module.go @@ -161,7 +161,18 @@ func buildAuthorView(state *appState) fyne.CanvasObject { }) clearCompletedBtn.Importance = widget.LowImportance - topBar := ui.TintedBar(authorColor, container.NewHBox(backBtn, layout.NewSpacer(), clearCompletedBtn, queueBtn)) + cancelBtn := widget.NewButton("Cancel Job", func() { + if state.jobQueue != nil { + if job := state.jobQueue.CurrentRunning(); job != nil && job.Type == queue.JobTypeAuthor { + state.jobQueue.Cancel(job.ID) + } + } + }) + cancelBtn.Importance = widget.DangerImportance + state.authorCancelBtn = cancelBtn + state.updateAuthorCancelButton() + + topBar := ui.TintedBar(authorColor, container.NewHBox(backBtn, layout.NewSpacer(), cancelBtn, clearCompletedBtn, queueBtn)) bottomBar := moduleFooter(authorColor, layout.NewSpacer(), state.statsBar) tabs := container.NewAppTabs( @@ -1397,6 +1408,22 @@ func (s *appState) setAuthorProgress(percent float64) { } } +func (s *appState) updateAuthorCancelButton() { + if s.authorCancelBtn == nil { + return + } + if s.jobQueue == nil { + s.authorCancelBtn.Hide() + return + } + job := s.jobQueue.CurrentRunning() + if job != nil && job.Type == queue.JobTypeAuthor { + s.authorCancelBtn.Show() + } else { + s.authorCancelBtn.Hide() + } +} + func (s *appState) startAuthorGeneration(startNow bool) { if s.authorVideoTSPath != "" { title := authorOutputTitle(s) diff --git a/main.go b/main.go index a342b3a..d0b0c40 100644 --- a/main.go +++ b/main.go @@ -974,6 +974,7 @@ type appState struct { authorProgress float64 authorProgressBar *widget.ProgressBar authorStatusLabel *widget.Label + authorCancelBtn *widget.Button authorVideoTSPath string // Rip module state