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.
This commit is contained in:
parent
0b0a123d83
commit
d29f485106
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user