Skip to content

Commit b055789

Browse files
committed
add setting to disable rounded image corners
1 parent 278ddde commit b055789

File tree

14 files changed

+26
-21
lines changed

14 files changed

+26
-21
lines changed

backend/config.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ type ReplayGainConfig struct {
145145
}
146146

147147
type ThemeConfig struct {
148-
ThemeFile string
149-
Appearance string
148+
ThemeFile string
149+
Appearance string
150+
UseRoundedImageCorners bool
150151
}
151152

152153
type TranscodingConfig struct {
@@ -279,7 +280,8 @@ func DefaultConfig(appVersionTag string) *Config {
279280
MaxBitRateKBPS: 160,
280281
},
281282
Theme: ThemeConfig{
282-
Appearance: "Dark",
283+
Appearance: "Dark",
284+
UseRoundedImageCorners: true,
283285
},
284286
PeakMeter: PeakMeterConfig{
285287
WindowWidth: 375,

ui/bottompanel.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"fyne.io/fyne/v2"
1313
"fyne.io/fyne/v2/container"
14-
"fyne.io/fyne/v2/theme"
1514
"fyne.io/fyne/v2/widget"
1615
)
1716

@@ -48,7 +47,6 @@ func NewBottomPanel(pm *backend.PlaybackManager, im *backend.ImageManager, contr
4847
pm.OnStopped(util.FyneDoFunc(func() { bp.Controls.SetPlaying(false) }))
4948

5049
bp.NowPlaying = widgets.NewNowPlayingCard()
51-
bp.NowPlaying.ImageCornerRadius = theme.InputRadiusSize()
5250
bp.NowPlaying.OnCoverTapped = func() {
5351
contr.NavigateTo(controller.NowPlayingRoute())
5452
}

ui/browsing/albumpage.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
231231
a.ExtendBaseWidget(a)
232232
a.cover = widgets.NewImagePlaceholder(myTheme.AlbumIcon, 225)
233233
a.cover.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
234-
a.cover.CornerRadius = theme.InputRadiusSize()
235234

236235
a.titleLabel = widget.NewRichTextWithText("")
237236
a.titleLabel.Truncation = fyne.TextTruncateEllipsis

ui/browsing/artistpage.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,6 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
503503
}
504504
a.artistImage = widgets.NewImagePlaceholder(myTheme.ArtistIcon, 225)
505505
a.artistImage.OnTapped = func(*fyne.PointEvent) { a.showPopUpCover() }
506-
a.artistImage.CornerRadius = theme.InputRadiusSize()
507506
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
508507
a.playBtn = widget.NewButtonWithIcon(lang.L("Play Discography"), theme.MediaPlayIcon(), func() {
509508
go a.artistPage.pm.PlayArtistDiscography(a.artistID, false /*shuffle*/)

ui/browsing/nowplayingpage.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ func NewNowPlayingPage(
107107
pm.OnStopped(doFmtStatus)
108108

109109
a.card = widgets.NewLargeNowPlayingCard()
110-
a.card.ImageCornerRadius = theme.InputRadiusSize()
111110
a.card.OnAlbumNameTapped = func() {
112111
contr.NavigateTo(controller.AlbumRoute(a.nowPlaying.Metadata().AlbumID))
113112
}

ui/browsing/playlistpage.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
328328

329329
a.image = widgets.NewImagePlaceholder(myTheme.PlaylistIcon, 225)
330330
a.image.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
331-
a.image.CornerRadius = theme.InputRadiusSize()
332331
a.titleLabel = util.NewTruncatingRichText()
333332
a.titleLabel.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
334333
SizeName: theme.SizeNameHeadingText,

ui/dialogs/settingsdialog.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,14 @@ func (s *SettingsDialog) createAppearanceTab(window fyne.Window) *container.TabI
570570
})
571571
useWaveformSeekbar.Checked = s.config.Playback.UseWaveformSeekbar
572572

573+
useRoundedImageCorners := widget.NewCheck(lang.L("Use rounded image corners"), func(b bool) {
574+
s.config.Theme.UseRoundedImageCorners = b
575+
if s.OnPageNeedsRefresh != nil {
576+
s.OnPageNeedsRefresh()
577+
}
578+
})
579+
useRoundedImageCorners.Checked = s.config.Theme.UseRoundedImageCorners
580+
573581
return container.NewTabItem(lang.L("Appearance"), container.NewVBox(
574582
util.NewHSpace(0), // insert a theme.Padding amount of space at top
575583
container.NewBorder(nil, nil, widget.NewLabel(lang.L("Theme")), /*left*/
@@ -582,6 +590,7 @@ func (s *SettingsDialog) createAppearanceTab(window fyne.Window) *container.TabI
582590
disableDPI,
583591
s.newSectionSeparator(),
584592
useWaveformSeekbar,
593+
useRoundedImageCorners,
585594
s.newSectionSeparator(),
586595
widget.NewRichText(&widget.TextSegment{Text: lang.L("Application font"), Style: util.BoldRichTextStyle}),
587596
container.New(layout.NewFormLayout(),

ui/theme/theme.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const (
3333
SizeNameSubText fyne.ThemeSizeName = "subText" // in between Text and Caption
3434
SizeNameSuffixText fyne.ThemeSizeName = "suffixText" // a tiny bit smaller than subText
3535

36+
SizeNameImageCornerRadius fyne.ThemeSizeName = "imageCornerRadius"
37+
3638
AnimationDurationShort = canvas.DurationShort
3739
AnimationDurationMedium = 225 * time.Millisecond
3840
AnimationDurationLong = canvas.DurationStandard
@@ -286,6 +288,11 @@ func (m *MyTheme) Size(name fyne.ThemeSizeName) float32 {
286288
return 12
287289
case theme.SizeNameScrollBar:
288290
return 14
291+
case SizeNameImageCornerRadius:
292+
if m.config.UseRoundedImageCorners {
293+
return theme.InputRadiusSize()
294+
}
295+
return 0
289296
default:
290297
return theme.DefaultTheme().Size(name)
291298
}

ui/widgets/gridview.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ func (g *GridView) createGridWrap() {
304304

305305
func (g *GridView) createNewItemCard() fyne.CanvasObject {
306306
card := NewGridViewItem(g.Placeholder)
307-
card.Cover.Im.CornerRadius = theme.InputRadiusSize()
308307
card.SetSize(backend.AppInstance().Config.GridView.CardSize)
309308
card.ItemIndex = -1
310309
card.ImgLoader = util.NewThumbnailLoader(g.imageFetcher, card.Cover.SetImage)

ui/widgets/imageplaceholder.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414
// A widget that can display an image or else
1515
// a placeholder with a rectangular border frame
1616
// and an icon positioned in the center of the frame.
17+
// The corner radius is taken from the app theme.
1718
type ImagePlaceholder struct {
1819
ScaleMode canvas.ImageScale
1920
PlaceholderIcon fyne.Resource
20-
CornerRadius float32
2121

2222
widget.BaseWidget
2323
content *fyne.Container
@@ -110,8 +110,8 @@ func (i *ImagePlaceholder) Refresh() {
110110
i.imageDisp.Hidden = !i.HaveImage()
111111
i.imageDisp.ScaleMode = i.ScaleMode
112112
i.iconImage.ScaleMode = i.ScaleMode
113-
i.imageDisp.CornerRadius = i.CornerRadius
114-
i.border.CornerRadius = i.CornerRadius
113+
i.imageDisp.CornerRadius = i.Theme().Size(myTheme.SizeNameImageCornerRadius)
114+
i.border.CornerRadius = i.imageDisp.CornerRadius
115115
i.BaseWidget.Refresh()
116116
}
117117

0 commit comments

Comments
 (0)