save selected sidebar tab
This commit is contained in:
@@ -59,6 +59,7 @@ type AppConfig struct {
|
||||
EnableOSMediaPlayerAPIs bool
|
||||
ShowSidebar bool
|
||||
SidebarWidthFraction float64
|
||||
SidebarTab string
|
||||
|
||||
FontNormalTTF string
|
||||
FontBoldTTF string
|
||||
|
||||
@@ -70,6 +70,9 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string,
|
||||
m.Controller = controller.New(app, appVersion, m.Window)
|
||||
m.BrowsingPane = browsing.NewBrowsingPane(app.PlaybackManager, m.Controller, func() { m.Router.NavigateTo(m.StartupPage()) })
|
||||
m.Sidebar = NewSidebar(m.Controller, m.App.PlaybackManager, m.App.ImageManager, m.App.LyricsManager)
|
||||
if m.App.Config.Application.SidebarTab == "Lyrics" {
|
||||
m.Sidebar.SetSelectedIndex(1)
|
||||
}
|
||||
m.ToastOverlay = NewToastOverlay()
|
||||
m.Router = browsing.NewRouter(app, m.Controller, m.BrowsingPane)
|
||||
goHomeFn := func() { m.Router.NavigateTo(m.StartupPage()) }
|
||||
@@ -533,6 +536,12 @@ func (m *MainWindow) SaveWindowSettings() {
|
||||
&m.App.Config.Application.WindowHeight)
|
||||
m.App.Config.Application.ShowSidebar = !m.Sidebar.Hidden
|
||||
m.App.Config.Application.SidebarWidthFraction = m.splitContainer.Offset
|
||||
switch m.Sidebar.SelectedIndex() {
|
||||
case 1:
|
||||
m.App.Config.Application.SidebarTab = "Lyrics"
|
||||
default:
|
||||
m.App.Config.Application.SidebarTab = "Play Queue"
|
||||
}
|
||||
}
|
||||
|
||||
// widget just so we can catch a tap event that doesn't land anywhere else
|
||||
|
||||
@@ -71,6 +71,14 @@ func NewSidebar(contr *controller.Controller, pm *backend.PlaybackManager, im *b
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Sidebar) SelectedIndex() int {
|
||||
return s.tabs.SelectedIndex()
|
||||
}
|
||||
|
||||
func (s *Sidebar) SetSelectedIndex(idx int) {
|
||||
s.tabs.SelectIndex(idx)
|
||||
}
|
||||
|
||||
func (s *Sidebar) SetQueueTracks(items []mediaprovider.MediaItem) {
|
||||
s.queueList.SetItems(items)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user