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