Add Generate Now and Add to Queue buttons
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 <noreply@anthropic.com>
This commit is contained in:
parent
56141be0d4
commit
50237f741a
71
main.go
71
main.go
|
|
@ -9662,18 +9662,8 @@ func buildThumbView(state *appState) fyne.CanvasObject {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate button - adds to queue
|
// Helper function to create thumbnail job
|
||||||
generateBtn := widget.NewButton("Add to Queue", func() {
|
createThumbJob := func() *queue.Job {
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create output directory in same folder as video
|
// Create output directory in same folder as video
|
||||||
videoDir := filepath.Dir(state.thumbFile.Path)
|
videoDir := filepath.Dir(state.thumbFile.Path)
|
||||||
videoBaseName := strings.TrimSuffix(filepath.Base(state.thumbFile.Path), filepath.Ext(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)
|
description = fmt.Sprintf("%d individual thumbnails (%dpx width)", count, width)
|
||||||
}
|
}
|
||||||
|
|
||||||
job := &queue.Job{
|
return &queue.Job{
|
||||||
Type: queue.JobTypeThumb,
|
Type: queue.JobTypeThumb,
|
||||||
Title: "Thumbnails: " + filepath.Base(state.thumbFile.Path),
|
Title: "Thumbnails: " + filepath.Base(state.thumbFile.Path),
|
||||||
Description: description,
|
Description: description,
|
||||||
|
|
@ -9710,18 +9700,58 @@ func buildThumbView(state *appState) fyne.CanvasObject {
|
||||||
"rows": float64(state.thumbRows),
|
"rows": float64(state.thumbRows),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
state.jobQueue.Add(job)
|
// Generate Now button - adds to queue and starts it
|
||||||
if !state.jobQueue.IsRunning() {
|
generateNowBtn := widget.NewButton("GENERATE NOW", func() {
|
||||||
state.jobQueue.Start()
|
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 {
|
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
|
// View Queue button
|
||||||
|
|
@ -9782,7 +9812,8 @@ func buildThumbView(state *appState) fyne.CanvasObject {
|
||||||
contactSheetCheck,
|
contactSheetCheck,
|
||||||
settingsOptions,
|
settingsOptions,
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
generateBtn,
|
generateNowBtn,
|
||||||
|
addQueueBtn,
|
||||||
viewQueueBtn,
|
viewQueueBtn,
|
||||||
viewResultsBtn,
|
viewResultsBtn,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user