save shuffle state in config

This commit is contained in:
Siiiiinth
2026-02-15 09:29:20 -08:00
committed by Drew Weymouth
parent 1a5fed3add
commit cec32f68e3
5 changed files with 9 additions and 8 deletions
+2
View File
@@ -123,6 +123,7 @@ type NowPlayingPageConfig struct {
type PlaybackConfig struct {
Autoplay bool
Shuffle bool
RepeatMode string
SkipOneStarWhenShuffling bool
SkipKeywordWhenShuffling string
@@ -263,6 +264,7 @@ func DefaultConfig(appVersionTag string) *Config {
},
Playback: PlaybackConfig{
Autoplay: false,
Shuffle: false,
RepeatMode: "None",
UseWaveformSeekbar: false,
},
-4
View File
@@ -358,10 +358,6 @@ func (p *playbackEngine) SetShuffle(shuffle bool) {
p.invokeNoArgCallbacks(p.onQueueChange)
}
func (p *playbackEngine) GetShuffle() bool {
return p.shuffle
}
func (p *playbackEngine) PlaybackStatus() PlaybackStatus {
stat := p.pendingPlayerChangeStatus
if !p.pendingPlayerChange {
+4 -2
View File
@@ -373,8 +373,8 @@ func (p *PlaybackManager) LoadAlbum(albumID string, insertQueueMode InsertQueueM
return nil
}
func (p *PlaybackManager) GetShuffle() bool {
return p.engine.GetShuffle()
func (p *PlaybackManager) IsShuffle() bool {
return p.cfg.Shuffle
}
// Loads the specified playlist into the play queue.
@@ -644,6 +644,8 @@ func (p *PlaybackManager) SetAutoplay(autoplay bool) {
}
func (p *PlaybackManager) SetShuffle(shuffle bool) {
p.cfg.Shuffle = shuffle
fmt.Println("Setting shuffle in config")
p.engine.SetShuffle(shuffle)
}
+1 -1
View File
@@ -102,7 +102,7 @@ func NewBottomPanel(pm *backend.PlaybackManager, im *backend.ImageManager, contr
pm.SeekFraction(f)
})
bp.AuxControls = widgets.NewAuxControls(pm.Volume(), pm.GetLoopMode(), pm.IsAutoplay())
bp.AuxControls = widgets.NewAuxControls(pm.Volume(), pm.GetLoopMode(), pm.IsAutoplay(), pm.IsShuffle())
pm.OnLoopModeChange(func(lm backend.LoopMode) {
fyne.Do(func() { bp.AuxControls.SetLoopMode(lm) })
})
+2 -1
View File
@@ -34,7 +34,7 @@ type AuxControls struct {
container *fyne.Container
}
func NewAuxControls(initialVolume int, initialLoopMode backend.LoopMode, initialAutoplay bool) *AuxControls {
func NewAuxControls(initialVolume int, initialLoopMode backend.LoopMode, initialAutoplay bool, initialShuffle bool) *AuxControls {
a := &AuxControls{
VolumeControl: NewVolumeControl(initialVolume),
shuffle: NewIconButton(myTheme.ShuffleIcon, nil),
@@ -44,6 +44,7 @@ func NewAuxControls(initialVolume int, initialLoopMode backend.LoopMode, initial
showQueue: NewIconButton(myTheme.PlayQueueIcon, nil),
}
a.shuffle.Highlighted = initialShuffle
a.shuffle.IconSize = IconButtonSizeSmaller
a.shuffle.SetToolTip(lang.L("Shuffle"))
a.shuffle.OnTapped = func() {