From 50237f741aa966cbaff42fc916f945d29e5d7dd8 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sat, 13 Dec 2025 21:00:43 -0500 Subject: [PATCH] Add Generate Now and Add to Queue buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed thumbnail module to match convert module behavior with two action buttons: GENERATE NOW (High Importance): - Adds job to queue and starts it immediately - Runs right away if queue is idle - Queues for later if jobs are running - Shows "Thumbnail generation started!" message Add to Queue (Medium Importance): - Adds job to queue without starting - Allows queuing multiple jobs - Shows "Thumbnail job added to queue!" message Implementation: - Refactored job creation into createThumbJob() helper function - Both buttons use same job creation logic - Generate Now auto-starts queue if not running - Follows same pattern as convert module Benefits: - Immediate generation when queue is idle - Queue multiple jobs without starting - Consistent UX with convert module - Clear user feedback on action taken 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- main.go | 71 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/main.go b/main.go index 3d0c1ed..944485c 100644 --- a/main.go +++ b/main.go @@ -9662,18 +9662,8 @@ func buildThumbView(state *appState) fyne.CanvasObject { ) } - // Generate button - adds to queue - generateBtn := widget.NewButton("Add to Queue", func() { - if state.thumbFile == nil { - dialog.ShowInformation("No Video", "Please load a video file first.", state.window) - return - } - - if state.jobQueue == nil { - dialog.ShowInformation("Queue", "Queue not initialized.", state.window) - return - } - + // Helper function to create thumbnail job + createThumbJob := func() *queue.Job { // Create output directory in same folder as video videoDir := filepath.Dir(state.thumbFile.Path) videoBaseName := strings.TrimSuffix(filepath.Base(state.thumbFile.Path), filepath.Ext(state.thumbFile.Path)) @@ -9694,7 +9684,7 @@ func buildThumbView(state *appState) fyne.CanvasObject { description = fmt.Sprintf("%d individual thumbnails (%dpx width)", count, width) } - job := &queue.Job{ + return &queue.Job{ Type: queue.JobTypeThumb, Title: "Thumbnails: " + filepath.Base(state.thumbFile.Path), Description: description, @@ -9710,18 +9700,58 @@ func buildThumbView(state *appState) fyne.CanvasObject { "rows": float64(state.thumbRows), }, } + } - state.jobQueue.Add(job) - if !state.jobQueue.IsRunning() { - state.jobQueue.Start() + // Generate Now button - adds to queue and starts it + generateNowBtn := widget.NewButton("GENERATE NOW", func() { + if state.thumbFile == nil { + dialog.ShowInformation("No Video", "Please load a video file first.", state.window) + return } - dialog.ShowInformation("Thumbnails", "Thumbnail job added to queue.", state.window) + if state.jobQueue == nil { + dialog.ShowInformation("Queue", "Queue not initialized.", state.window) + return + } + + job := createThumbJob() + state.jobQueue.Add(job) + + // Start the queue if not already running + if !state.jobQueue.IsRunning() { + state.jobQueue.Start() + logging.Debug(logging.CatSystem, "started queue from Generate Now") + } + + dialog.ShowInformation("Thumbnails", "Thumbnail generation started! View progress in Job Queue.", state.window) }) - generateBtn.Importance = widget.HighImportance + generateNowBtn.Importance = widget.HighImportance if state.thumbFile == nil { - generateBtn.Disable() + generateNowBtn.Disable() + } + + // Add to Queue button + addQueueBtn := widget.NewButton("Add to Queue", func() { + if state.thumbFile == nil { + dialog.ShowInformation("No Video", "Please load a video file first.", state.window) + return + } + + if state.jobQueue == nil { + dialog.ShowInformation("Queue", "Queue not initialized.", state.window) + return + } + + job := createThumbJob() + state.jobQueue.Add(job) + + dialog.ShowInformation("Queue", "Thumbnail job added to queue!", state.window) + }) + addQueueBtn.Importance = widget.MediumImportance + + if state.thumbFile == nil { + addQueueBtn.Disable() } // View Queue button @@ -9782,7 +9812,8 @@ func buildThumbView(state *appState) fyne.CanvasObject { contactSheetCheck, settingsOptions, widget.NewSeparator(), - generateBtn, + generateNowBtn, + addQueueBtn, viewQueueBtn, viewResultsBtn, )