diff --git a/res/bundled.go b/res/bundled.go index 590f9a0..154b27b 100644 --- a/res/bundled.go +++ b/res/bundled.go @@ -55,6 +55,11 @@ var ResMusicnotesSvg = &fyne.StaticResource{ StaticContent: []byte( "\n"), } +var ResOscilloscopeSvg = &fyne.StaticResource{ + StaticName: "oscilloscope.svg", + StaticContent: []byte( + "\n\r\n\n\r\n\r\n\r \n\r\n"), +} var ResPeopleSvg = &fyne.StaticResource{ StaticName: "people.svg", StaticContent: []byte( diff --git a/res/bundled_gen.sh b/res/bundled_gen.sh index 67c52fa..9470b62 100755 --- a/res/bundled_gen.sh +++ b/res/bundled_gen.sh @@ -10,6 +10,7 @@ fyne bundle -append -prefix Res icons/publicdomain/heart-filled.svg >> bundled.g fyne bundle -append -prefix Res icons/publicdomain/heart-outline.svg >> bundled.go fyne bundle -append -prefix Res icons/publicdomain/infinity.svg >> bundled.go fyne bundle -append -prefix Res icons/publicdomain/musicnotes.svg >> bundled.go +fyne bundle -append -prefix Res icons/publicdomain/oscilloscope.svg >> bundled.go fyne bundle -append -prefix Res icons/publicdomain/people.svg >> bundled.go fyne bundle -append -prefix Res icons/publicdomain/playlist.svg >> bundled.go fyne bundle -append -prefix Res icons/publicdomain/playqueue.svg >> bundled.go diff --git a/res/icons/publicdomain/oscilloscope.svg b/res/icons/publicdomain/oscilloscope.svg new file mode 100644 index 0000000..c7d5413 --- /dev/null +++ b/res/icons/publicdomain/oscilloscope.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ui/browsing/browsingpane.go b/ui/browsing/browsingpane.go index c004e1b..a1956c3 100644 --- a/ui/browsing/browsingpane.go +++ b/ui/browsing/browsingpane.go @@ -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) } diff --git a/ui/mainwindow.go b/ui/mainwindow.go index 293dad4..7c28181 100644 --- a/ui/mainwindow.go +++ b/ui/mainwindow.go @@ -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()) }) } diff --git a/ui/theme/theme.go b/ui/theme/theme.go index 9c1d517..3ff3f13 100644 --- a/ui/theme/theme.go +++ b/ui/theme/theme.go @@ -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