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() {
|
||||
m.BrowsingPane.EnableNavigationButtons()
|
||||
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
|
||||
if l := app.Config.Application.LastLaunchedVersion; app.VersionTag() != l {
|
||||
if !app.IsFirstLaunch() {
|
||||
|
||||
@@ -17,11 +17,14 @@ import (
|
||||
type NowPlayingCard struct {
|
||||
widget.BaseWidget
|
||||
|
||||
DisableRating bool
|
||||
|
||||
trackName *widget.Hyperlink
|
||||
artistName *MultiHyperlink
|
||||
albumName *widget.Hyperlink
|
||||
cover *TappableImage
|
||||
menu *widget.PopUpMenu
|
||||
ratingMenu *fyne.MenuItem
|
||||
|
||||
OnTrackNameTapped func()
|
||||
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) {
|
||||
if n.menu == nil {
|
||||
ratingMenu := util.NewRatingSubmenu(n.onSetRating)
|
||||
n.ratingMenu = util.NewRatingSubmenu(n.onSetRating)
|
||||
m := fyne.NewMenu("",
|
||||
fyne.NewMenuItem("Set favorite", func() { n.onSetFavorite(true) }),
|
||||
fyne.NewMenuItem("Unset favorite", func() { n.onSetFavorite(false) }),
|
||||
ratingMenu,
|
||||
n.ratingMenu,
|
||||
fyne.NewMenuItem("Add to playlist...", func() { n.onAddToPlaylist() }))
|
||||
n.menu = widget.NewPopUpMenu(m, fyne.CurrentApp().Driver().CanvasForObject(n))
|
||||
}
|
||||
n.ratingMenu.Disabled = n.DisableRating
|
||||
n.menu.ShowAtPosition(e.AbsolutePosition)
|
||||
}
|
||||
|
||||
+10
-8
@@ -99,12 +99,13 @@ type Tracklist struct {
|
||||
tracks []*trackModel
|
||||
tracksOrigOrder []*trackModel
|
||||
|
||||
nowPlayingID string
|
||||
colLayout *layouts.ColumnsLayout
|
||||
hdr *ListHeader
|
||||
list *DisabledList
|
||||
ctxMenu *fyne.Menu
|
||||
container *fyne.Container
|
||||
nowPlayingID string
|
||||
colLayout *layouts.ColumnsLayout
|
||||
hdr *ListHeader
|
||||
list *DisabledList
|
||||
ctxMenu *fyne.Menu
|
||||
ratingSubmenu *fyne.MenuItem
|
||||
container *fyne.Container
|
||||
}
|
||||
|
||||
type trackModel struct {
|
||||
@@ -565,15 +566,16 @@ func (t *Tracklist) onShowContextMenu(e *fyne.PointEvent, trackIdx int) {
|
||||
fyne.NewMenuItem("Unset favorite", func() {
|
||||
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.ctxMenu.Items = append(t.ctxMenu.Items, ratingMenu)
|
||||
t.ctxMenu.Items = append(t.ctxMenu.Items, t.ratingSubmenu)
|
||||
if len(t.Options.AuxiliaryMenuItems) > 0 {
|
||||
t.ctxMenu.Items = append(t.ctxMenu.Items, fyne.NewMenuItemSeparator())
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user