more places to disable ratings for Jellyfin
This commit is contained in:
@@ -94,6 +94,8 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string,
|
|||||||
app.ServerManager.OnServerConnected(func() {
|
app.ServerManager.OnServerConnected(func() {
|
||||||
m.BrowsingPane.EnableNavigationButtons()
|
m.BrowsingPane.EnableNavigationButtons()
|
||||||
m.Router.NavigateTo(m.StartupPage())
|
m.Router.NavigateTo(m.StartupPage())
|
||||||
|
_, canRate := m.App.ServerManager.Server.(mediaprovider.SupportsRating)
|
||||||
|
m.BottomPanel.NowPlaying.DisableRating = !canRate
|
||||||
// check if launching new version, else if found available update on startup
|
// check if launching new version, else if found available update on startup
|
||||||
if l := app.Config.Application.LastLaunchedVersion; app.VersionTag() != l {
|
if l := app.Config.Application.LastLaunchedVersion; app.VersionTag() != l {
|
||||||
if !app.IsFirstLaunch() {
|
if !app.IsFirstLaunch() {
|
||||||
|
|||||||
@@ -17,11 +17,14 @@ import (
|
|||||||
type NowPlayingCard struct {
|
type NowPlayingCard struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
|
DisableRating bool
|
||||||
|
|
||||||
trackName *widget.Hyperlink
|
trackName *widget.Hyperlink
|
||||||
artistName *MultiHyperlink
|
artistName *MultiHyperlink
|
||||||
albumName *widget.Hyperlink
|
albumName *widget.Hyperlink
|
||||||
cover *TappableImage
|
cover *TappableImage
|
||||||
menu *widget.PopUpMenu
|
menu *widget.PopUpMenu
|
||||||
|
ratingMenu *fyne.MenuItem
|
||||||
|
|
||||||
OnTrackNameTapped func()
|
OnTrackNameTapped func()
|
||||||
OnArtistNameTapped func(artistID string)
|
OnArtistNameTapped func(artistID string)
|
||||||
@@ -125,13 +128,14 @@ func (n *NowPlayingCard) Update(track string, artists, artistIDs []string, album
|
|||||||
|
|
||||||
func (n *NowPlayingCard) showMenu(e *fyne.PointEvent) {
|
func (n *NowPlayingCard) showMenu(e *fyne.PointEvent) {
|
||||||
if n.menu == nil {
|
if n.menu == nil {
|
||||||
ratingMenu := util.NewRatingSubmenu(n.onSetRating)
|
n.ratingMenu = util.NewRatingSubmenu(n.onSetRating)
|
||||||
m := fyne.NewMenu("",
|
m := fyne.NewMenu("",
|
||||||
fyne.NewMenuItem("Set favorite", func() { n.onSetFavorite(true) }),
|
fyne.NewMenuItem("Set favorite", func() { n.onSetFavorite(true) }),
|
||||||
fyne.NewMenuItem("Unset favorite", func() { n.onSetFavorite(false) }),
|
fyne.NewMenuItem("Unset favorite", func() { n.onSetFavorite(false) }),
|
||||||
ratingMenu,
|
n.ratingMenu,
|
||||||
fyne.NewMenuItem("Add to playlist...", func() { n.onAddToPlaylist() }))
|
fyne.NewMenuItem("Add to playlist...", func() { n.onAddToPlaylist() }))
|
||||||
n.menu = widget.NewPopUpMenu(m, fyne.CurrentApp().Driver().CanvasForObject(n))
|
n.menu = widget.NewPopUpMenu(m, fyne.CurrentApp().Driver().CanvasForObject(n))
|
||||||
}
|
}
|
||||||
|
n.ratingMenu.Disabled = n.DisableRating
|
||||||
n.menu.ShowAtPosition(e.AbsolutePosition)
|
n.menu.ShowAtPosition(e.AbsolutePosition)
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-8
@@ -99,12 +99,13 @@ type Tracklist struct {
|
|||||||
tracks []*trackModel
|
tracks []*trackModel
|
||||||
tracksOrigOrder []*trackModel
|
tracksOrigOrder []*trackModel
|
||||||
|
|
||||||
nowPlayingID string
|
nowPlayingID string
|
||||||
colLayout *layouts.ColumnsLayout
|
colLayout *layouts.ColumnsLayout
|
||||||
hdr *ListHeader
|
hdr *ListHeader
|
||||||
list *DisabledList
|
list *DisabledList
|
||||||
ctxMenu *fyne.Menu
|
ctxMenu *fyne.Menu
|
||||||
container *fyne.Container
|
ratingSubmenu *fyne.MenuItem
|
||||||
|
container *fyne.Container
|
||||||
}
|
}
|
||||||
|
|
||||||
type trackModel struct {
|
type trackModel struct {
|
||||||
@@ -565,15 +566,16 @@ func (t *Tracklist) onShowContextMenu(e *fyne.PointEvent, trackIdx int) {
|
|||||||
fyne.NewMenuItem("Unset favorite", func() {
|
fyne.NewMenuItem("Unset favorite", func() {
|
||||||
t.onSetFavorites(t.selectedTracks(), false, true)
|
t.onSetFavorites(t.selectedTracks(), false, true)
|
||||||
}))
|
}))
|
||||||
ratingMenu := util.NewRatingSubmenu(func(rating int) {
|
t.ratingSubmenu = util.NewRatingSubmenu(func(rating int) {
|
||||||
t.onSetRatings(t.selectedTracks(), rating, true)
|
t.onSetRatings(t.selectedTracks(), rating, true)
|
||||||
})
|
})
|
||||||
t.ctxMenu.Items = append(t.ctxMenu.Items, ratingMenu)
|
t.ctxMenu.Items = append(t.ctxMenu.Items, t.ratingSubmenu)
|
||||||
if len(t.Options.AuxiliaryMenuItems) > 0 {
|
if len(t.Options.AuxiliaryMenuItems) > 0 {
|
||||||
t.ctxMenu.Items = append(t.ctxMenu.Items, fyne.NewMenuItemSeparator())
|
t.ctxMenu.Items = append(t.ctxMenu.Items, fyne.NewMenuItemSeparator())
|
||||||
t.ctxMenu.Items = append(t.ctxMenu.Items, t.Options.AuxiliaryMenuItems...)
|
t.ctxMenu.Items = append(t.ctxMenu.Items, t.Options.AuxiliaryMenuItems...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
t.ratingSubmenu.Disabled = t.Options.DisableRating
|
||||||
widget.ShowPopUpMenuAtPosition(t.ctxMenu, fyne.CurrentApp().Driver().CanvasForObject(t), e.AbsolutePosition)
|
widget.ShowPopUpMenuAtPosition(t.ctxMenu, fyne.CurrentApp().Driver().CanvasForObject(t), e.AbsolutePosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user