Prevent simultaneous conversions - enforce queue-only mode when queue is running

Implements mutual exclusion between 'Convert Now' and queue processing:

Behavior:
- If queue is running: 'Convert Now' button is DISABLED
- If user tries to click 'Convert Now' while queue runs: Shows info dialog
  with message and auto-adds video to queue instead
- Only one conversion method active at a time

This prevents:
- Multiple simultaneous FFmpeg processes competing for system resources
- Confusion about which conversion is running
- Queue and direct conversion interfering with each other

When queue is active:
- 'Convert Now' button: DISABLED (grey out)
- 'Add to Queue' button: ENABLED (highlighted)
- Clear UI signal: Only use queue mode for batch operations

Perfect for batch workflows where user loads multiple videos
and expects them all to process sequentially in the queue,
not spawn random direct conversions.
This commit is contained in:
Stu Leak 2025-11-29 20:36:13 -05:00
parent b3db00c533
commit 704ed38fcd

18
main.go
View File

@ -1892,6 +1892,19 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
}
convertBtn = widget.NewButton("CONVERT NOW", func() {
// Check if queue is already running
if state.jobQueue != nil && state.jobQueue.IsRunning() {
dialog.ShowInformation("Queue Active",
"The conversion queue is currently running. Click \"Add to Queue\" to add this video to the queue instead.",
state.window)
// Auto-add to queue instead
if err := state.addConvertToQueue(); err != nil {
dialog.ShowError(err, state.window)
} else {
dialog.ShowInformation("Queue", "Job added to queue!", state.window)
}
return
}
state.startConvert(statusLabel, convertBtn, cancelBtn, activity)
})
convertBtn.Importance = widget.HighImportance
@ -1903,6 +1916,11 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
cancelBtn.Enable()
addQueueBtn.Disable()
}
// Also disable if queue is running
if state.jobQueue != nil && state.jobQueue.IsRunning() {
convertBtn.Disable()
addQueueBtn.Enable()
}
actionInner := container.NewHBox(resetBtn, activity, statusLabel, layout.NewSpacer(), cancelBtn, addQueueBtn, convertBtn)
actionBar := ui.TintedBar(convertColor, actionInner)