add icons to gear menu
This commit is contained in:
@@ -140,14 +140,16 @@ func (b *BrowsingPane) ClearHistory() {
|
||||
b.updateHistoryButtons()
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) AddSettingsMenuItem(label string, action func()) {
|
||||
b.settingsMenu.Items = append(b.settingsMenu.Items,
|
||||
fyne.NewMenuItem(label, action))
|
||||
func (b *BrowsingPane) AddSettingsMenuItem(label string, icon fyne.Resource, action func()) {
|
||||
item := fyne.NewMenuItem(label, action)
|
||||
item.Icon = icon
|
||||
b.settingsMenu.Items = append(b.settingsMenu.Items, item)
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) AddSettingsSubmenu(label string, menu *fyne.Menu) {
|
||||
func (b *BrowsingPane) AddSettingsSubmenu(label string, icon fyne.Resource, menu *fyne.Menu) {
|
||||
item := fyne.NewMenuItem(label, nil)
|
||||
item.ChildMenu = menu
|
||||
item.Icon = icon
|
||||
b.settingsMenu.Items = append(b.settingsMenu.Items, item)
|
||||
}
|
||||
|
||||
|
||||
+20
-19
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/dweymouth/supersonic/ui/controller"
|
||||
"github.com/dweymouth/supersonic/ui/dialogs"
|
||||
"github.com/dweymouth/supersonic/ui/shortcuts"
|
||||
"github.com/dweymouth/supersonic/ui/theme"
|
||||
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||
"github.com/dweymouth/supersonic/ui/util"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/driver/desktop"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
@@ -37,7 +38,7 @@ type MainWindow struct {
|
||||
BottomPanel *BottomPanel
|
||||
ToastOverlay *ToastOverlay
|
||||
|
||||
theme *theme.MyTheme
|
||||
theme *myTheme.MyTheme
|
||||
haveSystemTray bool
|
||||
alreadyConnected bool // tracks if we have already connected to a server before
|
||||
content *mainWindowContent
|
||||
@@ -50,9 +51,9 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string,
|
||||
m := MainWindow{
|
||||
App: app,
|
||||
Window: fyneApp.NewWindow(displayAppName),
|
||||
theme: theme.NewMyTheme(&app.Config.Theme, app.ThemesDir()),
|
||||
theme: myTheme.NewMyTheme(&app.Config.Theme, app.ThemesDir()),
|
||||
}
|
||||
fynetooltip.SetToolTipTextSizeName(theme.SizeNameSubText)
|
||||
fynetooltip.SetToolTipTextSizeName(myTheme.SizeNameSubText)
|
||||
|
||||
m.theme.NormalFont = app.Config.Application.FontNormalTTF
|
||||
m.theme.BoldFont = app.Config.Application.FontBoldTTF
|
||||
@@ -99,16 +100,16 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string,
|
||||
m.BrowsingPane.ClearHistory()
|
||||
m.Controller.PromptForLoginAndConnect()
|
||||
})
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Log Out"), func() { app.ServerManager.Logout(true) })
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Switch Servers"), func() { app.ServerManager.Logout(false) })
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Rescan Library"), func() { app.ServerManager.Server.RescanLibrary() })
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Log Out"), theme.LogoutIcon(), func() { app.ServerManager.Logout(true) })
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Switch Servers"), theme.LoginIcon(), func() { app.ServerManager.Logout(false) })
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Rescan Library"), theme.ViewRefreshIcon(), func() { app.ServerManager.Server.RescanLibrary() })
|
||||
m.BrowsingPane.AddSettingsMenuSeparator()
|
||||
m.BrowsingPane.AddSettingsSubmenu(lang.L("Visualizations"),
|
||||
m.BrowsingPane.AddSettingsSubmenu(lang.L("Visualizations"), myTheme.VisualizationIcon,
|
||||
fyne.NewMenu("", []*fyne.MenuItem{
|
||||
fyne.NewMenuItem(lang.L("Peak Meter"), m.Controller.ShowPeakMeter),
|
||||
}...))
|
||||
m.BrowsingPane.AddSettingsMenuSeparator()
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Check for Updates"), func() {
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Check for Updates"), theme.DownloadIcon(), func() {
|
||||
go func() {
|
||||
if t := app.UpdateChecker.CheckLatestVersionTag(); t != "" && t != app.VersionTag() {
|
||||
fyne.Do(func() { m.ShowNewVersionDialog(displayAppName, t) })
|
||||
@@ -121,8 +122,8 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string,
|
||||
}
|
||||
}()
|
||||
})
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Settings")+"...", m.showSettingsDialog)
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("About")+"...", m.Controller.ShowAboutDialog)
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Settings")+"...", theme.SettingsIcon(), m.showSettingsDialog)
|
||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("About")+"...", theme.InfoIcon(), m.Controller.ShowAboutDialog)
|
||||
m.addNavigationButtons()
|
||||
m.BrowsingPane.DisableNavigationButtons()
|
||||
m.addShortcuts()
|
||||
@@ -333,28 +334,28 @@ func (m *MainWindow) ShowWhatsNewDialog() {
|
||||
}
|
||||
|
||||
func (m *MainWindow) addNavigationButtons() {
|
||||
m.BrowsingPane.AddNavigationButton(theme.NowPlayingIcon, controller.NowPlaying, func() {
|
||||
m.BrowsingPane.AddNavigationButton(myTheme.NowPlayingIcon, controller.NowPlaying, func() {
|
||||
m.Router.NavigateTo(controller.NowPlayingRoute())
|
||||
})
|
||||
m.BrowsingPane.AddNavigationButton(theme.FavoriteIcon, controller.Favorites, func() {
|
||||
m.BrowsingPane.AddNavigationButton(myTheme.FavoriteIcon, controller.Favorites, func() {
|
||||
m.Router.NavigateTo(controller.FavoritesRoute())
|
||||
})
|
||||
m.BrowsingPane.AddNavigationButton(theme.AlbumIcon, controller.Albums, func() {
|
||||
m.BrowsingPane.AddNavigationButton(myTheme.AlbumIcon, controller.Albums, func() {
|
||||
m.Router.NavigateTo(controller.AlbumsRoute())
|
||||
})
|
||||
m.BrowsingPane.AddNavigationButton(theme.ArtistIcon, controller.Artists, func() {
|
||||
m.BrowsingPane.AddNavigationButton(myTheme.ArtistIcon, controller.Artists, func() {
|
||||
m.Router.NavigateTo(controller.ArtistsRoute())
|
||||
})
|
||||
m.BrowsingPane.AddNavigationButton(theme.GenreIcon, controller.Genres, func() {
|
||||
m.BrowsingPane.AddNavigationButton(myTheme.GenreIcon, controller.Genres, func() {
|
||||
m.Router.NavigateTo(controller.GenresRoute())
|
||||
})
|
||||
m.BrowsingPane.AddNavigationButton(theme.PlaylistIcon, controller.Playlists, func() {
|
||||
m.BrowsingPane.AddNavigationButton(myTheme.PlaylistIcon, controller.Playlists, func() {
|
||||
m.Router.NavigateTo(controller.PlaylistsRoute())
|
||||
})
|
||||
m.BrowsingPane.AddNavigationButton(theme.TracksIcon, controller.Tracks, func() {
|
||||
m.BrowsingPane.AddNavigationButton(myTheme.TracksIcon, controller.Tracks, func() {
|
||||
m.Router.NavigateTo(controller.TracksRoute())
|
||||
})
|
||||
m.radioBtn = m.BrowsingPane.AddNavigationButton(theme.RadioIcon, controller.Radios, func() {
|
||||
m.radioBtn = m.BrowsingPane.AddNavigationButton(myTheme.RadioIcon, controller.Radios, func() {
|
||||
m.Router.NavigateTo(controller.RadiosRoute())
|
||||
})
|
||||
}
|
||||
|
||||
+20
-19
@@ -42,25 +42,26 @@ var (
|
||||
GridViewHoveredIconColor color.Color = color.White
|
||||
GridViewIconColor color.Color = darkenColor(color.White, 0.2)
|
||||
|
||||
AlbumIcon fyne.Resource = theme.NewThemedResource(res.ResDiscSvg)
|
||||
ArtistIcon fyne.Resource = theme.NewThemedResource(res.ResPeopleSvg)
|
||||
AutoplayIcon fyne.Resource = theme.NewThemedResource(res.ResInfinitySvg)
|
||||
CastIcon fyne.Resource = theme.NewThemedResource(res.ResCastSvg)
|
||||
RadioIcon fyne.Resource = theme.NewThemedResource(res.ResBroadcastSvg)
|
||||
FavoriteIcon fyne.Resource = theme.NewThemedResource(res.ResHeartFilledSvg)
|
||||
NotFavoriteIcon fyne.Resource = theme.NewThemedResource(res.ResHeartOutlineSvg)
|
||||
NowPlayingIcon fyne.Resource = theme.NewThemedResource(res.ResHeadphonesSvg)
|
||||
PlaylistIcon fyne.Resource = theme.NewThemedResource(res.ResPlaylistSvg)
|
||||
PlayNextIcon fyne.Resource = theme.NewThemedResource(res.ResPlaylistAddNextSvg)
|
||||
PlayQueueIcon fyne.Resource = theme.NewThemedResource(res.ResPlayqueueSvg)
|
||||
ShareIcon fyne.Resource = theme.NewThemedResource(res.ResShareSvg)
|
||||
ShuffleIcon fyne.Resource = theme.NewThemedResource(res.ResShuffleSvg)
|
||||
TracksIcon fyne.Resource = theme.NewThemedResource(res.ResMusicnotesSvg)
|
||||
GenreIcon fyne.Resource = theme.NewThemedResource(res.ResTheatermasksSvg)
|
||||
FilterIcon fyne.Resource = theme.NewThemedResource(res.ResFilterSvg)
|
||||
RepeatIcon fyne.Resource = theme.NewThemedResource(res.ResRepeatSvg)
|
||||
RepeatOneIcon fyne.Resource = theme.NewThemedResource(res.ResRepeatoneSvg)
|
||||
SortIcon fyne.Resource = theme.NewThemedResource(res.ResUpdownarrowSvg)
|
||||
AlbumIcon fyne.Resource = theme.NewThemedResource(res.ResDiscSvg)
|
||||
ArtistIcon fyne.Resource = theme.NewThemedResource(res.ResPeopleSvg)
|
||||
AutoplayIcon fyne.Resource = theme.NewThemedResource(res.ResInfinitySvg)
|
||||
CastIcon fyne.Resource = theme.NewThemedResource(res.ResCastSvg)
|
||||
RadioIcon fyne.Resource = theme.NewThemedResource(res.ResBroadcastSvg)
|
||||
FavoriteIcon fyne.Resource = theme.NewThemedResource(res.ResHeartFilledSvg)
|
||||
NotFavoriteIcon fyne.Resource = theme.NewThemedResource(res.ResHeartOutlineSvg)
|
||||
NowPlayingIcon fyne.Resource = theme.NewThemedResource(res.ResHeadphonesSvg)
|
||||
PlaylistIcon fyne.Resource = theme.NewThemedResource(res.ResPlaylistSvg)
|
||||
PlayNextIcon fyne.Resource = theme.NewThemedResource(res.ResPlaylistAddNextSvg)
|
||||
PlayQueueIcon fyne.Resource = theme.NewThemedResource(res.ResPlayqueueSvg)
|
||||
ShareIcon fyne.Resource = theme.NewThemedResource(res.ResShareSvg)
|
||||
ShuffleIcon fyne.Resource = theme.NewThemedResource(res.ResShuffleSvg)
|
||||
TracksIcon fyne.Resource = theme.NewThemedResource(res.ResMusicnotesSvg)
|
||||
GenreIcon fyne.Resource = theme.NewThemedResource(res.ResTheatermasksSvg)
|
||||
FilterIcon fyne.Resource = theme.NewThemedResource(res.ResFilterSvg)
|
||||
RepeatIcon fyne.Resource = theme.NewThemedResource(res.ResRepeatSvg)
|
||||
RepeatOneIcon fyne.Resource = theme.NewThemedResource(res.ResRepeatoneSvg)
|
||||
SortIcon fyne.Resource = theme.NewThemedResource(res.ResUpdownarrowSvg)
|
||||
VisualizationIcon fyne.Resource = theme.NewThemedResource(res.ResOscilloscopeSvg)
|
||||
)
|
||||
|
||||
type AppearanceMode string
|
||||
|
||||
Reference in New Issue
Block a user