switch many tracklist columns to label, since not bolding anymore
This commit is contained in:
+32
-26
@@ -674,18 +674,18 @@ type TrackRow struct {
|
|||||||
isFavorite bool
|
isFavorite bool
|
||||||
playCount int
|
playCount int
|
||||||
|
|
||||||
num *widget.RichText
|
num *widget.Label
|
||||||
name *widget.RichText
|
name *widget.RichText // for bold support
|
||||||
artist *MultiHyperlink
|
artist *MultiHyperlink
|
||||||
album *widget.Hyperlink
|
album *widget.Hyperlink
|
||||||
dur *widget.RichText
|
dur *widget.Label
|
||||||
year *widget.RichText
|
year *widget.Label
|
||||||
favorite *fyne.Container
|
favorite *fyne.Container
|
||||||
rating *StarRating
|
rating *StarRating
|
||||||
bitrate *widget.RichText
|
bitrate *widget.Label
|
||||||
plays *widget.RichText
|
plays *widget.Label
|
||||||
size *widget.RichText
|
size *widget.Label
|
||||||
path *widget.RichText
|
path *widget.Label
|
||||||
|
|
||||||
OnTappedSecondary func(e *fyne.PointEvent, trackIdx int)
|
OnTappedSecondary func(e *fyne.PointEvent, trackIdx int)
|
||||||
|
|
||||||
@@ -695,25 +695,25 @@ type TrackRow struct {
|
|||||||
func NewTrackRow(tracklist *Tracklist, playingIcon fyne.CanvasObject) *TrackRow {
|
func NewTrackRow(tracklist *Tracklist, playingIcon fyne.CanvasObject) *TrackRow {
|
||||||
t := &TrackRow{tracklist: tracklist, playingIcon: playingIcon}
|
t := &TrackRow{tracklist: tracklist, playingIcon: playingIcon}
|
||||||
t.ExtendBaseWidget(t)
|
t.ExtendBaseWidget(t)
|
||||||
t.num = newTrailingAlignRichText()
|
t.num = newTrailingAlignLabel()
|
||||||
t.name = newTruncatingRichText()
|
t.name = newTruncatingRichText()
|
||||||
t.artist = NewMultiHyperlink()
|
t.artist = NewMultiHyperlink()
|
||||||
t.artist.OnTapped = tracklist.onArtistTapped
|
t.artist.OnTapped = tracklist.onArtistTapped
|
||||||
t.album = widget.NewHyperlink("", nil)
|
t.album = widget.NewHyperlink("", nil)
|
||||||
t.album.Wrapping = fyne.TextTruncate
|
t.album.Wrapping = fyne.TextTruncate
|
||||||
t.album.OnTapped = func() { tracklist.onAlbumTapped(t.albumID) }
|
t.album.OnTapped = func() { tracklist.onAlbumTapped(t.albumID) }
|
||||||
t.dur = newTrailingAlignRichText()
|
t.dur = newTrailingAlignLabel()
|
||||||
t.year = newTrailingAlignRichText()
|
t.year = newTrailingAlignLabel()
|
||||||
favorite := NewTappableIcon(myTheme.NotFavoriteIcon)
|
favorite := NewTappableIcon(myTheme.NotFavoriteIcon)
|
||||||
favorite.OnTapped = t.toggleFavorited
|
favorite.OnTapped = t.toggleFavorited
|
||||||
t.favorite = container.NewCenter(favorite)
|
t.favorite = container.NewCenter(favorite)
|
||||||
t.rating = NewStarRating()
|
t.rating = NewStarRating()
|
||||||
t.rating.StarSize = 16
|
t.rating.StarSize = 16
|
||||||
t.rating.OnRatingChanged = t.setTrackRating
|
t.rating.OnRatingChanged = t.setTrackRating
|
||||||
t.plays = newTrailingAlignRichText()
|
t.plays = newTrailingAlignLabel()
|
||||||
t.bitrate = newTrailingAlignRichText()
|
t.bitrate = newTrailingAlignLabel()
|
||||||
t.size = newTrailingAlignRichText()
|
t.size = newTrailingAlignLabel()
|
||||||
t.path = newTruncatingRichText()
|
t.path = newTruncatingLabel()
|
||||||
|
|
||||||
t.Content = container.New(tracklist.colLayout,
|
t.Content = container.New(tracklist.colLayout,
|
||||||
t.num, t.name, t.artist, t.album, t.dur, t.year, t.favorite, t.rating, t.plays, t.bitrate, t.size, t.path)
|
t.num, t.name, t.artist, t.album, t.dur, t.year, t.favorite, t.rating, t.plays, t.bitrate, t.size, t.path)
|
||||||
@@ -726,9 +726,15 @@ func newTruncatingRichText() *widget.RichText {
|
|||||||
return rt
|
return rt
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTrailingAlignRichText() *widget.RichText {
|
func newTruncatingLabel() *widget.Label {
|
||||||
rt := widget.NewRichTextWithText("")
|
rt := widget.NewLabel("")
|
||||||
rt.Segments[0].(*widget.TextSegment).Style.Alignment = fyne.TextAlignTrailing
|
rt.Wrapping = fyne.TextTruncate
|
||||||
|
return rt
|
||||||
|
}
|
||||||
|
|
||||||
|
func newTrailingAlignLabel() *widget.Label {
|
||||||
|
rt := widget.NewLabel("")
|
||||||
|
rt.Alignment = fyne.TextAlignTrailing
|
||||||
return rt
|
return rt
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -750,12 +756,12 @@ func (t *TrackRow) Update(tm *trackModel, rowNum int) {
|
|||||||
t.name.Segments[0].(*widget.TextSegment).Text = tr.Name
|
t.name.Segments[0].(*widget.TextSegment).Text = tr.Name
|
||||||
t.artist.BuildSegments(tr.ArtistNames, tr.ArtistIDs)
|
t.artist.BuildSegments(tr.ArtistNames, tr.ArtistIDs)
|
||||||
t.album.SetText(tr.Album)
|
t.album.SetText(tr.Album)
|
||||||
t.dur.Segments[0].(*widget.TextSegment).Text = util.SecondsToTimeString(float64(tr.Duration))
|
t.dur.Text = util.SecondsToTimeString(float64(tr.Duration))
|
||||||
t.year.Segments[0].(*widget.TextSegment).Text = strconv.Itoa(tr.Year)
|
t.year.Text = strconv.Itoa(tr.Year)
|
||||||
t.plays.Segments[0].(*widget.TextSegment).Text = strconv.Itoa(int(tr.PlayCount))
|
t.plays.Text = strconv.Itoa(int(tr.PlayCount))
|
||||||
t.bitrate.Segments[0].(*widget.TextSegment).Text = strconv.Itoa(tr.BitRate)
|
t.bitrate.Text = strconv.Itoa(tr.BitRate)
|
||||||
t.size.Segments[0].(*widget.TextSegment).Text = util.BytesToSizeString(tr.Size)
|
t.size.Text = util.BytesToSizeString(tr.Size)
|
||||||
t.path.Segments[0].(*widget.TextSegment).Text = tr.FilePath
|
t.path.Text = tr.FilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update track num if needed
|
// Update track num if needed
|
||||||
@@ -775,13 +781,13 @@ func (t *TrackRow) Update(tm *trackModel, rowNum int) {
|
|||||||
} else {
|
} else {
|
||||||
str = strconv.Itoa(rowNum)
|
str = strconv.Itoa(rowNum)
|
||||||
}
|
}
|
||||||
t.num.Segments[0].(*widget.TextSegment).Text = str
|
t.num.Text = str
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update play count if needed
|
// Update play count if needed
|
||||||
if tr.PlayCount != t.playCount {
|
if tr.PlayCount != t.playCount {
|
||||||
t.playCount = tr.PlayCount
|
t.playCount = tr.PlayCount
|
||||||
t.plays.Segments[0].(*widget.TextSegment).Text = strconv.Itoa(int(tr.PlayCount))
|
t.plays.Text = strconv.Itoa(int(tr.PlayCount))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render whether track is playing or not
|
// Render whether track is playing or not
|
||||||
|
|||||||
Reference in New Issue
Block a user