add setting to disable rounded image corners

This commit is contained in:
Drew Weymouth
2025-11-15 10:36:07 -08:00
parent 679e9a9b1f
commit 2afef81a11
14 changed files with 26 additions and 21 deletions
+5 -3
View File
@@ -148,8 +148,9 @@ type ReplayGainConfig struct {
} }
type ThemeConfig struct { type ThemeConfig struct {
ThemeFile string ThemeFile string
Appearance string Appearance string
UseRoundedImageCorners bool
} }
type TranscodingConfig struct { type TranscodingConfig struct {
@@ -284,7 +285,8 @@ func DefaultConfig(appVersionTag string) *Config {
MaxBitRateKBPS: 160, MaxBitRateKBPS: 160,
}, },
Theme: ThemeConfig{ Theme: ThemeConfig{
Appearance: "Dark", Appearance: "Dark",
UseRoundedImageCorners: true,
}, },
PeakMeter: PeakMeterConfig{ PeakMeter: PeakMeterConfig{
WindowWidth: 375, WindowWidth: 375,
-2
View File
@@ -11,7 +11,6 @@ import (
"fyne.io/fyne/v2" "fyne.io/fyne/v2"
"fyne.io/fyne/v2/container" "fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget" "fyne.io/fyne/v2/widget"
) )
@@ -48,7 +47,6 @@ func NewBottomPanel(pm *backend.PlaybackManager, im *backend.ImageManager, contr
pm.OnStopped(util.FyneDoFunc(func() { bp.Controls.SetPlaying(false) })) pm.OnStopped(util.FyneDoFunc(func() { bp.Controls.SetPlaying(false) }))
bp.NowPlaying = widgets.NewNowPlayingCard() bp.NowPlaying = widgets.NewNowPlayingCard()
bp.NowPlaying.ImageCornerRadius = theme.InputRadiusSize()
bp.NowPlaying.OnCoverTapped = func() { bp.NowPlaying.OnCoverTapped = func() {
contr.NavigateTo(controller.NowPlayingRoute()) contr.NavigateTo(controller.NowPlayingRoute())
} }
-1
View File
@@ -231,7 +231,6 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
a.ExtendBaseWidget(a) a.ExtendBaseWidget(a)
a.cover = widgets.NewImagePlaceholder(myTheme.AlbumIcon, 225) a.cover = widgets.NewImagePlaceholder(myTheme.AlbumIcon, 225)
a.cover.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() } a.cover.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
a.cover.CornerRadius = theme.InputRadiusSize()
a.titleLabel = widget.NewRichTextWithText("") a.titleLabel = widget.NewRichTextWithText("")
a.titleLabel.Truncation = fyne.TextTruncateEllipsis a.titleLabel.Truncation = fyne.TextTruncateEllipsis
-1
View File
@@ -503,7 +503,6 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
} }
a.artistImage = widgets.NewImagePlaceholder(myTheme.ArtistIcon, 225) a.artistImage = widgets.NewImagePlaceholder(myTheme.ArtistIcon, 225)
a.artistImage.OnTapped = func(*fyne.PointEvent) { a.showPopUpCover() } a.artistImage.OnTapped = func(*fyne.PointEvent) { a.showPopUpCover() }
a.artistImage.CornerRadius = theme.InputRadiusSize()
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() }) a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
a.playBtn = widget.NewButtonWithIcon(lang.L("Play Discography"), theme.MediaPlayIcon(), func() { a.playBtn = widget.NewButtonWithIcon(lang.L("Play Discography"), theme.MediaPlayIcon(), func() {
go a.artistPage.pm.PlayArtistDiscography(a.artistID, false /*shuffle*/) go a.artistPage.pm.PlayArtistDiscography(a.artistID, false /*shuffle*/)
-1
View File
@@ -110,7 +110,6 @@ func NewNowPlayingPage(
pm.OnStopped(doFmtStatus) pm.OnStopped(doFmtStatus)
a.card = widgets.NewLargeNowPlayingCard() a.card = widgets.NewLargeNowPlayingCard()
a.card.ImageCornerRadius = theme.InputRadiusSize()
a.card.OnAlbumNameTapped = func() { a.card.OnAlbumNameTapped = func() {
contr.NavigateTo(controller.AlbumRoute(a.nowPlaying.Metadata().AlbumID)) contr.NavigateTo(controller.AlbumRoute(a.nowPlaying.Metadata().AlbumID))
} }
-1
View File
@@ -328,7 +328,6 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
a.image = widgets.NewImagePlaceholder(myTheme.PlaylistIcon, 225) a.image = widgets.NewImagePlaceholder(myTheme.PlaylistIcon, 225)
a.image.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() } a.image.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
a.image.CornerRadius = theme.InputRadiusSize()
a.titleLabel = util.NewTruncatingRichText() a.titleLabel = util.NewTruncatingRichText()
a.titleLabel.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{ a.titleLabel.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
SizeName: theme.SizeNameHeadingText, SizeName: theme.SizeNameHeadingText,
+9
View File
@@ -573,6 +573,14 @@ func (s *SettingsDialog) createAppearanceTab(window fyne.Window) *container.TabI
nowPlayingBackground := widget.NewCheckWithData(lang.L("Use blurred album cover for Now Playing page background"), binding.BindBool(&s.config.NowPlayingConfig.UseBackgroundImage)) nowPlayingBackground := widget.NewCheckWithData(lang.L("Use blurred album cover for Now Playing page background"), binding.BindBool(&s.config.NowPlayingConfig.UseBackgroundImage))
useRoundedImageCorners := widget.NewCheck(lang.L("Use rounded image corners"), func(b bool) {
s.config.Theme.UseRoundedImageCorners = b
if s.OnPageNeedsRefresh != nil {
s.OnPageNeedsRefresh()
}
})
useRoundedImageCorners.Checked = s.config.Theme.UseRoundedImageCorners
return container.NewTabItem(lang.L("Appearance"), container.NewVBox( return container.NewTabItem(lang.L("Appearance"), container.NewVBox(
util.NewHSpace(0), // insert a theme.Padding amount of space at top util.NewHSpace(0), // insert a theme.Padding amount of space at top
container.NewBorder(nil, nil, widget.NewLabel(lang.L("Theme")), /*left*/ container.NewBorder(nil, nil, widget.NewLabel(lang.L("Theme")), /*left*/
@@ -586,6 +594,7 @@ func (s *SettingsDialog) createAppearanceTab(window fyne.Window) *container.TabI
s.newSectionSeparator(), s.newSectionSeparator(),
useWaveformSeekbar, useWaveformSeekbar,
nowPlayingBackground, nowPlayingBackground,
useRoundedImageCorners,
s.newSectionSeparator(), s.newSectionSeparator(),
widget.NewRichText(&widget.TextSegment{Text: lang.L("Application font"), Style: util.BoldRichTextStyle}), widget.NewRichText(&widget.TextSegment{Text: lang.L("Application font"), Style: util.BoldRichTextStyle}),
container.New(layout.NewFormLayout(), container.New(layout.NewFormLayout(),
+7
View File
@@ -33,6 +33,8 @@ const (
SizeNameSubText fyne.ThemeSizeName = "subText" // in between Text and Caption SizeNameSubText fyne.ThemeSizeName = "subText" // in between Text and Caption
SizeNameSuffixText fyne.ThemeSizeName = "suffixText" // a tiny bit smaller than subText SizeNameSuffixText fyne.ThemeSizeName = "suffixText" // a tiny bit smaller than subText
SizeNameImageCornerRadius fyne.ThemeSizeName = "imageCornerRadius"
AnimationDurationShort = canvas.DurationShort AnimationDurationShort = canvas.DurationShort
AnimationDurationMedium = 225 * time.Millisecond AnimationDurationMedium = 225 * time.Millisecond
AnimationDurationLong = canvas.DurationStandard AnimationDurationLong = canvas.DurationStandard
@@ -286,6 +288,11 @@ func (m *MyTheme) Size(name fyne.ThemeSizeName) float32 {
return 12 return 12
case theme.SizeNameScrollBar: case theme.SizeNameScrollBar:
return 14 return 14
case SizeNameImageCornerRadius:
if m.config.UseRoundedImageCorners {
return theme.InputRadiusSize()
}
return 0
default: default:
return theme.DefaultTheme().Size(name) return theme.DefaultTheme().Size(name)
} }
-1
View File
@@ -304,7 +304,6 @@ func (g *GridView) createGridWrap() {
func (g *GridView) createNewItemCard() fyne.CanvasObject { func (g *GridView) createNewItemCard() fyne.CanvasObject {
card := NewGridViewItem(g.Placeholder) card := NewGridViewItem(g.Placeholder)
card.Cover.Im.CornerRadius = theme.InputRadiusSize()
card.SetSize(backend.AppInstance().Config.GridView.CardSize) card.SetSize(backend.AppInstance().Config.GridView.CardSize)
card.ItemIndex = -1 card.ItemIndex = -1
card.ImgLoader = util.NewThumbnailLoader(g.imageFetcher, card.Cover.SetImage) card.ImgLoader = util.NewThumbnailLoader(g.imageFetcher, card.Cover.SetImage)
+3 -3
View File
@@ -14,10 +14,10 @@ import (
// A widget that can display an image or else // A widget that can display an image or else
// a placeholder with a rectangular border frame // a placeholder with a rectangular border frame
// and an icon positioned in the center of the frame. // and an icon positioned in the center of the frame.
// The corner radius is taken from the app theme.
type ImagePlaceholder struct { type ImagePlaceholder struct {
ScaleMode canvas.ImageScale ScaleMode canvas.ImageScale
PlaceholderIcon fyne.Resource PlaceholderIcon fyne.Resource
CornerRadius float32
widget.BaseWidget widget.BaseWidget
content *fyne.Container content *fyne.Container
@@ -110,8 +110,8 @@ func (i *ImagePlaceholder) Refresh() {
i.imageDisp.Hidden = !i.HaveImage() i.imageDisp.Hidden = !i.HaveImage()
i.imageDisp.ScaleMode = i.ScaleMode i.imageDisp.ScaleMode = i.ScaleMode
i.iconImage.ScaleMode = i.ScaleMode i.iconImage.ScaleMode = i.ScaleMode
i.imageDisp.CornerRadius = i.CornerRadius i.imageDisp.CornerRadius = i.Theme().Size(myTheme.SizeNameImageCornerRadius)
i.border.CornerRadius = i.CornerRadius i.border.CornerRadius = i.imageDisp.CornerRadius
i.BaseWidget.Refresh() i.BaseWidget.Refresh()
} }
+1 -3
View File
@@ -19,8 +19,7 @@ import (
type LargeNowPlayingCard struct { type LargeNowPlayingCard struct {
CaptionedImage CaptionedImage
DisableRating bool DisableRating bool
ImageCornerRadius float32
isRadio bool isRadio bool
trackName *widget.RichText trackName *widget.RichText
@@ -164,6 +163,5 @@ func (n *LargeNowPlayingCard) Refresh() {
} else { } else {
n.rating.Enable() n.rating.Enable()
} }
n.cover.CornerRadius = n.ImageCornerRadius
n.BaseWidget.Refresh() n.BaseWidget.Refresh()
} }
+1 -3
View File
@@ -23,8 +23,7 @@ import (
type NowPlayingCard struct { type NowPlayingCard struct {
widget.BaseWidget widget.BaseWidget
DisableRating bool DisableRating bool
ImageCornerRadius float32
trackName *OptionHyperlink trackName *OptionHyperlink
artistName *MultiHyperlink artistName *MultiHyperlink
@@ -165,7 +164,6 @@ func (n *NowPlayingCard) Update(track mediaprovider.MediaItem) {
} }
func (n *NowPlayingCard) Refresh() { func (n *NowPlayingCard) Refresh() {
n.cover.CornerRadius = n.ImageCornerRadius
n.BaseWidget.Refresh() n.BaseWidget.Refresh()
} }
-1
View File
@@ -389,7 +389,6 @@ func NewPlayQueueListRow(playQueueList *PlayQueueList, im *backend.ImageManager,
p.ExtendBaseWidget(p) p.ExtendBaseWidget(p)
p.cover.ScaleMode = canvas.ImageScaleFastest p.cover.ScaleMode = canvas.ImageScaleFastest
p.cover.CornerRadius = theme.InputRadiusSize()
p.title.OnMouseIn = p.MouseIn p.title.OnMouseIn = p.MouseIn
p.title.OnMouseOut = p.MouseOut p.title.OnMouseOut = p.MouseOut
p.artist.OnTapped = playQueueList.onArtistTapped p.artist.OnTapped = playQueueList.onArtistTapped
-1
View File
@@ -274,7 +274,6 @@ func NewExpandedTracklistRow(tracklist *Tracklist, im *backend.ImageManager, pla
t.playingIcon = playingIcon t.playingIcon = playingIcon
t.img = NewImagePlaceholder(myTheme.TracksIcon, tracklistThumbnailSize) t.img = NewImagePlaceholder(myTheme.TracksIcon, tracklistThumbnailSize)
t.img.ScaleMode = canvas.ImageScaleFastest t.img.ScaleMode = canvas.ImageScaleFastest
t.img.CornerRadius = theme.InputRadiusSize()
t.imageLoader = util.NewThumbnailLoader(im, func(i image.Image) { t.imageLoader = util.NewThumbnailLoader(im, func(i image.Image) {
t.img.SetImage(i, false) t.img.SetImage(i, false)