From 704ed38fcdd8bd62ade786481567f7bc30be5b27 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sat, 29 Nov 2025 20:36:13 -0500 Subject: [PATCH] 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. --- main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/main.go b/main.go index fd6421b..6a22718 100644 --- a/main.go +++ b/main.go @@ -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)