Avoid player view rebuild when already active
This commit is contained in:
parent
ee08618142
commit
fc1e91bda6
51
main.go
51
main.go
|
|
@ -266,19 +266,7 @@ func (s *appState) queueProgressCounts() (completed, total int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *appState) updateQueueButtonLabel() {
|
func (s *appState) updateQueueButtonLabel() {
|
||||||
if s.queueBtn == nil {
|
// Queue UI hidden in player-only mode.
|
||||||
return
|
|
||||||
}
|
|
||||||
completed, total := s.queueProgressCounts()
|
|
||||||
// Include active direct conversion in totals
|
|
||||||
if s.convertBusy {
|
|
||||||
total++
|
|
||||||
}
|
|
||||||
label := "View Queue"
|
|
||||||
if total > 0 {
|
|
||||||
label = fmt.Sprintf("View Queue %d/%d", completed, total)
|
|
||||||
}
|
|
||||||
s.queueBtn.SetText(label)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type playerSurface struct {
|
type playerSurface struct {
|
||||||
|
|
@ -431,6 +419,16 @@ func (s *appState) showMainMenu() {
|
||||||
s.showPlayerView()
|
s.showPlayerView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *appState) onClose() {
|
||||||
|
s.stopPreview()
|
||||||
|
s.stopPlayer()
|
||||||
|
s.stopCompareSessions()
|
||||||
|
if s.jobQueue != nil {
|
||||||
|
s.jobQueue.Stop()
|
||||||
|
}
|
||||||
|
logging.Close()
|
||||||
|
}
|
||||||
|
|
||||||
// showCompareView renders a simple side-by-side player for the first two loaded videos.
|
// showCompareView renders a simple side-by-side player for the first two loaded videos.
|
||||||
func (s *appState) showCompareView() {
|
func (s *appState) showCompareView() {
|
||||||
s.stopPreview()
|
s.stopPreview()
|
||||||
|
|
@ -579,6 +577,10 @@ func (s *appState) buildComparePane(src *videoSource, onStop func(), setSess fun
|
||||||
// showPlayerView renders the player-focused UI with a lightweight playlist.
|
// showPlayerView renders the player-focused UI with a lightweight playlist.
|
||||||
func (s *appState) showPlayerView() {
|
func (s *appState) showPlayerView() {
|
||||||
fmt.Printf("🎬 showPlayerView called\n")
|
fmt.Printf("🎬 showPlayerView called\n")
|
||||||
|
if s.active == "player" && s.playSess != nil {
|
||||||
|
fmt.Printf("📺 already in player view; skipping rebuild\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
s.stopPreview()
|
s.stopPreview()
|
||||||
s.stopPlayer()
|
s.stopPlayer()
|
||||||
s.stopCompareSessions()
|
s.stopCompareSessions()
|
||||||
|
|
@ -1987,6 +1989,10 @@ func runGUI() {
|
||||||
a.Settings().SetTheme(&ui.MonoTheme{})
|
a.Settings().SetTheme(&ui.MonoTheme{})
|
||||||
logging.Debug(logging.CatUI, "created fyne app: %#v", a)
|
logging.Debug(logging.CatUI, "created fyne app: %#v", a)
|
||||||
w := a.NewWindow("VT Player")
|
w := a.NewWindow("VT Player")
|
||||||
|
w.SetOnClosed(func() {
|
||||||
|
state.onClose()
|
||||||
|
a.Quit()
|
||||||
|
})
|
||||||
if icon := utils.LoadAppIcon(); icon != nil {
|
if icon := utils.LoadAppIcon(); icon != nil {
|
||||||
a.SetIcon(icon)
|
a.SetIcon(icon)
|
||||||
w.SetIcon(icon)
|
w.SetIcon(icon)
|
||||||
|
|
@ -2048,7 +2054,7 @@ func runGUI() {
|
||||||
// Initialize conversion stats bar
|
// Initialize conversion stats bar
|
||||||
state.statsBar = ui.NewConversionStatsBar(func() {
|
state.statsBar = ui.NewConversionStatsBar(func() {
|
||||||
// Clicking the stats bar opens the queue view
|
// Clicking the stats bar opens the queue view
|
||||||
state.showQueue()
|
// Queue hidden in player-only mode
|
||||||
})
|
})
|
||||||
|
|
||||||
// Initialize job queue
|
// Initialize job queue
|
||||||
|
|
@ -2061,9 +2067,6 @@ func runGUI() {
|
||||||
app.Driver().DoFromGoroutine(func() {
|
app.Driver().DoFromGoroutine(func() {
|
||||||
state.updateStatsBar()
|
state.updateStatsBar()
|
||||||
state.updateQueueButtonLabel()
|
state.updateQueueButtonLabel()
|
||||||
if state.active == "queue" {
|
|
||||||
state.refreshQueueView()
|
|
||||||
}
|
|
||||||
}, false)
|
}, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -2100,19 +2103,7 @@ func runGUI() {
|
||||||
fmt.Printf("✅ showMainMenu completed\n")
|
fmt.Printf("✅ showMainMenu completed\n")
|
||||||
logging.Debug(logging.CatUI, "main menu rendered with %d modules", len(modulesList))
|
logging.Debug(logging.CatUI, "main menu rendered with %d modules", len(modulesList))
|
||||||
|
|
||||||
// Start stats bar update loop on a timer
|
// Stats update loop disabled in player-only mode to avoid view churn.
|
||||||
go func() {
|
|
||||||
ticker := time.NewTicker(500 * time.Millisecond)
|
|
||||||
defer ticker.Stop()
|
|
||||||
for range ticker.C {
|
|
||||||
app := fyne.CurrentApp()
|
|
||||||
if app != nil && app.Driver() != nil {
|
|
||||||
app.Driver().DoFromGoroutine(func() {
|
|
||||||
state.updateStatsBar()
|
|
||||||
}, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
w.ShowAndRun()
|
w.ShowAndRun()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user