Merge branch 'main' into feature/shuffle
This commit is contained in:
@@ -43,6 +43,7 @@ type NowPlayingPage struct {
|
||||
curLyrics *mediaprovider.Lyrics
|
||||
curLyricsID string // id of track currently shown in lyrics
|
||||
curRelatedID string // id of track currrently used to populate related list
|
||||
curCoverArt string // id of cover art currently shown in background / card
|
||||
totalTime float64
|
||||
lastPlayPos float64
|
||||
queue []mediaprovider.MediaItem
|
||||
@@ -307,8 +308,12 @@ func (a *NowPlayingPage) OnSongChange(song mediaprovider.MediaItem, lastScrobble
|
||||
a.card.Update(song)
|
||||
if song == nil {
|
||||
a.card.SetCoverImage(nil)
|
||||
} else {
|
||||
a.imageLoadCancel = a.im.GetFullSizeCoverArtAsync(song.Metadata().CoverArtID, a.onImageLoaded)
|
||||
a.curCoverArt = ""
|
||||
} else if artID := song.Metadata().CoverArtID; artID != a.curCoverArt {
|
||||
a.imageLoadCancel = a.im.GetFullSizeCoverArtAsync(song.Metadata().CoverArtID, func(img image.Image, err error) {
|
||||
a.curCoverArt = artID
|
||||
a.onImageLoaded(img, err)
|
||||
})
|
||||
}
|
||||
|
||||
if a.tabs != nil && a.tabs.SelectedIndex() == 1 /*lyrics*/ {
|
||||
|
||||
@@ -239,6 +239,7 @@ type tracklistRowBase struct {
|
||||
|
||||
// must be injected by extending widget
|
||||
setColVisibility func(int, bool) bool
|
||||
layout func(fyne.Size)
|
||||
}
|
||||
|
||||
type TracklistRow interface {
|
||||
@@ -297,6 +298,9 @@ func NewExpandedTracklistRow(tracklist *Tracklist, im *backend.ImageManager, pla
|
||||
c.Hidden = vis
|
||||
return c.Hidden != wasHidden
|
||||
}
|
||||
t.layout = func(s fyne.Size) {
|
||||
container.Layout.Layout(container.Objects, s)
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
@@ -316,8 +320,9 @@ func NewCompactTracklistRow(tracklist *Tracklist, playingIcon fyne.CanvasObject)
|
||||
t.tracklistRowBase.create(tracklist)
|
||||
t.playingIcon = playingIcon
|
||||
|
||||
t.Content = container.New(tracklist.colLayout,
|
||||
container := container.New(tracklist.colLayout,
|
||||
t.num, t.name, t.artist, t.album, t.albumArtist, t.composer, t.genre, t.dur, t.year, t.favorite, t.rating, t.plays, t.lastPlayed, t.comment, t.bpm, t.bitrate, t.size, t.fileType, t.dateAdded, t.path)
|
||||
t.Content = container
|
||||
|
||||
colHiddenPtrMap := map[int]*bool{
|
||||
2: &t.artist.Hidden,
|
||||
@@ -348,6 +353,9 @@ func NewCompactTracklistRow(tracklist *Tracklist, playingIcon fyne.CanvasObject)
|
||||
*ptr = vis
|
||||
return vis != wasHidden
|
||||
}
|
||||
t.layout = func(s fyne.Size) {
|
||||
container.Layout.Layout(container.Objects, s)
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
@@ -409,11 +417,20 @@ func (t *tracklistRowBase) TrackID() string {
|
||||
return t.trackID
|
||||
}
|
||||
|
||||
func (t *tracklistRowBase) MinSize() fyne.Size {
|
||||
// because tracklist rows have variable column visibility,
|
||||
// we return a zero width here so that the tracklist
|
||||
// can size based on the header instead.
|
||||
s := t.BaseWidget.MinSize()
|
||||
return fyne.NewSize(0, s.Height)
|
||||
}
|
||||
|
||||
func (t *tracklistRowBase) Update(tm *util.TrackListModel, rowNum int, onUpdate func()) {
|
||||
// Show only columns configured to be visible
|
||||
for i := 2; i < len(t.tracklist.columns); i++ {
|
||||
t.setColVisibility(i, !t.tracklist.visibleColumns[i])
|
||||
}
|
||||
t.layout(t.Size())
|
||||
|
||||
// Ealy return if nothing else needs updating
|
||||
if !t.needsUpdate(tm, rowNum) {
|
||||
|
||||
Reference in New Issue
Block a user