Auto-start queue when adding jobs from Convert module

Implements automatic queue processing when jobs are added from the Convert
module via the 'Add to Queue' button:

Features:
- IsRunning() method added to queue package to check processing status
- 'Add to Queue' button now auto-starts queue if not already running
- Eliminates need to manually open Queue view and click 'Start Queue'
- Seamless workflow: Add video → Queue → Auto-starts conversion

Before:
1. Load video
2. Click 'Add to Queue'
3. Click 'View Queue'
4. Click 'Start Queue'

After:
1. Load video
2. Click 'Add to Queue' (auto-starts!)
3. Load next video
4. Click 'Add to Queue' (already running)

Perfect for batch operations where user loads multiple videos and expects
them to start encoding immediately.
This commit is contained in:
Stu Leak 2025-11-29 20:31:52 -05:00
parent f306cf32e6
commit b3db00c533
2 changed files with 12 additions and 0 deletions

View File

@ -283,6 +283,13 @@ func (q *Queue) Stop() {
q.running = false
}
// IsRunning returns true if the queue is currently processing jobs
func (q *Queue) IsRunning() bool {
q.mu.RLock()
defer q.mu.RUnlock()
return q.running
}
// PauseAll pauses any running job and stops processing
func (q *Queue) PauseAll() {
q.mu.Lock()

View File

@ -1880,6 +1880,11 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
dialog.ShowError(err, state.window)
} else {
dialog.ShowInformation("Queue", "Job added to queue!", state.window)
// Auto-start queue if not already running
if state.jobQueue != nil && !state.jobQueue.IsRunning() {
state.jobQueue.Start()
logging.Debug(logging.CatUI, "queue auto-started after adding job")
}
}
})
if src == nil {