save shuffle state in config

This commit is contained in:
Siiiiinth
2026-02-01 14:21:57 +01:00
parent 7302e4ebbd
commit e05542844a
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
@@ -259,6 +260,7 @@ func DefaultConfig(appVersionTag string) *Config {
},
Playback: PlaybackConfig{
Autoplay: false,
Shuffle: false,
RepeatMode: "None",
UseWaveformSeekbar: true,
},
-4
View File
@@ -355,10 +355,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
@@ -368,8 +368,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.
@@ -639,6 +639,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
@@ -101,7 +101,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() {