add interface to decouple MPV player from PlaybackManager
This commit is contained in:
+4
-4
@@ -162,13 +162,13 @@ func (m *MainWindow) SetupSystemTrayMenu(appName string, fyneApp fyne.App) {
|
||||
if desk, ok := fyneApp.(desktop.App); ok {
|
||||
menu := fyne.NewMenu(appName,
|
||||
fyne.NewMenuItem("Play/Pause", func() {
|
||||
_ = m.App.Player.PlayPause()
|
||||
_ = m.App.PlaybackManager.PlayPause()
|
||||
}),
|
||||
fyne.NewMenuItem("Previous", func() {
|
||||
_ = m.App.Player.SeekBackOrPrevious()
|
||||
_ = m.App.PlaybackManager.SeekBackOrPrevious()
|
||||
}),
|
||||
fyne.NewMenuItem("Next", func() {
|
||||
_ = m.App.Player.SeekNext()
|
||||
_ = m.App.PlaybackManager.SeekNext()
|
||||
}),
|
||||
fyne.NewMenuItemSeparator(),
|
||||
fyne.NewMenuItem("Volume +10%", func() {
|
||||
@@ -298,7 +298,7 @@ func (m *MainWindow) addShortcuts() {
|
||||
case fyne.KeyEscape:
|
||||
m.Controller.CloseEscapablePopUp()
|
||||
case fyne.KeySpace:
|
||||
m.App.Player.PlayPause()
|
||||
m.App.PlaybackManager.PlayPause()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
|
||||
"github.com/dweymouth/supersonic/backend"
|
||||
"github.com/dweymouth/supersonic/player"
|
||||
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||
"github.com/dweymouth/supersonic/ui/util"
|
||||
)
|
||||
@@ -67,15 +67,15 @@ func (a *AuxControls) OnChangeLoopMode(f func()) {
|
||||
a.loop.OnTapped = f
|
||||
}
|
||||
|
||||
func (a *AuxControls) SetLoopMode(mode backend.LoopMode) {
|
||||
func (a *AuxControls) SetLoopMode(mode player.LoopMode) {
|
||||
switch mode {
|
||||
case backend.LoopModeAll:
|
||||
case player.LoopAll:
|
||||
a.loop.Importance = widget.HighImportance
|
||||
a.loop.Icon = myTheme.RepeatIcon
|
||||
case backend.LoopModeOne:
|
||||
case player.LoopOne:
|
||||
a.loop.Importance = widget.HighImportance
|
||||
a.loop.Icon = myTheme.RepeatOneIcon
|
||||
case backend.LoopModeNone:
|
||||
case player.LoopNone:
|
||||
a.loop.Importance = widget.MediumImportance
|
||||
a.loop.Icon = myTheme.RepeatIcon
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user