Better stringification of play times longer than 1 hr

This commit is contained in:
Drew Weymouth
2024-06-13 18:28:38 -07:00
parent 768c3851ea
commit 169b914abf
6 changed files with 71 additions and 10 deletions
+5 -5
View File
@@ -115,15 +115,15 @@ func NewPlayerControls() *PlayerControls {
pc.slider = NewTrackPosSlider()
pc.slider.Disable()
pc.curTimeLabel = NewLabelMinSize(util.SecondsToTimeString(0), 55)
pc.curTimeLabel = NewLabelMinSize(util.SecondsToMMSS(0), 55)
pc.curTimeLabel.Alignment = fyne.TextAlignTrailing
pc.totalTimeLabel = NewLabelMinSize(util.SecondsToTimeString(0), 55)
pc.totalTimeLabel = NewLabelMinSize(util.SecondsToMMSS(0), 55)
pc.totalTimeLabel.Alignment = fyne.TextAlignTrailing
pc.slider.OnChanged = func(f float64) {
if pc.slider.IsDragging() {
time := f * pc.totalTime
pc.curTimeLabel.SetText(util.SecondsToTimeString(time))
pc.curTimeLabel.SetText(util.SecondsToMMSS(time))
}
}
@@ -178,7 +178,7 @@ func (pc *PlayerControls) UpdatePlayTime(curTime, totalTime float64) {
}
updated := false
tt := util.SecondsToTimeString(totalTime)
tt := util.SecondsToMMSS(totalTime)
if tt != pc.totalTimeLabel.Text {
pc.totalTimeLabel.SetText(tt)
updated = true
@@ -189,7 +189,7 @@ func (pc *PlayerControls) UpdatePlayTime(curTime, totalTime float64) {
pc.slider.Disable()
}
if !pc.slider.IsDragging() {
ct := util.SecondsToTimeString(curTime)
ct := util.SecondsToMMSS(curTime)
if ct != pc.curTimeLabel.Text {
pc.curTimeLabel.SetText(ct)
updated = true