Skip to content

Commit

Permalink
rebase to Fyne 2.5 prerelease and onboard to new CustomPaddedLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed May 24, 2024
1 parent 9308aa1 commit 883c1f7
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 86 deletions.
24 changes: 13 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,51 @@ module github.com/dweymouth/supersonic
go 1.21.1

require (
fyne.io/fyne/v2 v2.4.5
fyne.io/fyne/v2 v2.5.0
github.com/20after4/configdir v0.1.1
github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1
github.com/dweymouth/fyne-lyrics v0.0.0-20240519002116-250ccc6f4a5f
github.com/dweymouth/go-jellyfin v0.0.0-20240517151952-5ceca61cb645
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee
github.com/dweymouth/go-subsonic v0.0.0-20240417012336-798603e9f3a3
github.com/fsnotify/fsnotify v1.6.0
github.com/fsnotify/fsnotify v1.7.0
github.com/godbus/dbus/v5 v5.1.0
github.com/google/uuid v1.3.0
github.com/pelletier/go-toml/v2 v2.0.8
github.com/quarckster/go-mpris-server v1.0.3
github.com/zalando/go-keyring v0.2.1
golang.org/x/net v0.17.0
golang.org/x/net v0.24.0
golang.org/x/text v0.14.0
)

require (
fyne.io/systray v1.10.1-0.20231115130155-104f5ef7839e // indirect
fyne.io/systray v1.10.1-0.20231230205326-d160fd363db9 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/danieljoos/wincred v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fredbi/uri v1.0.0 // indirect
github.com/fredbi/uri v1.1.0 // indirect
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect
github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 // indirect
github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a // indirect
github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240306074159-ea2d69986ecb // indirect
github.com/go-text/render v0.1.0 // indirect
github.com/go-text/typesetting v0.1.0 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/jeandeaual/go-locale v0.0.0-20240204043739-672d8d016d9a // indirect
github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect
github.com/nicksnyder/go-i18n/v2 v2.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rymdport/portal v0.2.2 // indirect
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tevino/abool v1.2.0 // indirect
github.com/yuin/goldmark v1.5.5 // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect
golang.org/x/sys v0.19.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect
)

replace fyne.io/fyne/v2 v2.4.5 => github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20240418162613-9e56d7882130
replace fyne.io/fyne/v2 v2.5.0 => github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20240524232840-7926e6e17c8c
111 changes: 98 additions & 13 deletions go.sum

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions ui/browsing/albumpage.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
Expand Down Expand Up @@ -104,8 +105,8 @@ func newAlbumPage(
a.contr.ConnectTracklistActionsWithReplayGainAlbum(a.tracklist)

a.container = container.NewBorder(
container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadTop: 15, PadBottom: 10}, a.header),
nil, nil, nil, container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadBottom: 15}, a.tracklist))
container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, TopPadding: 15, BottomPadding: 10}, a.header),
nil, nil, nil, container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, BottomPadding: 15}, a.tracklist))

go a.load()
return a
Expand Down
4 changes: 2 additions & 2 deletions ui/browsing/artistpage.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func newArtistPage(artistID string, cfg *backend.ArtistPageConfig, pool *util.Wi
layout.NewSpacer(),
)
a.container = container.NewBorder(
container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadTop: 15, PadBottom: 10}, a.header),
container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, TopPadding: 15, BottomPadding: 10}, a.header),
nil, nil, nil,
container.NewBorder(viewToggleRow, nil, nil, nil, layout.NewSpacer()))
go a.load()
Expand Down Expand Up @@ -248,7 +248,7 @@ func (a *ArtistPage) showTopTracks() {
tl.SetNowPlaying(a.nowPlayingID)
a.contr.ConnectTracklistActions(tl)
a.tracklistCtr = container.New(
&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadBottom: 10},
&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, BottomPadding: 10},
tl)
}
a.container.Objects[0].(*fyne.Container).Objects[0] = a.tracklistCtr
Expand Down
2 changes: 1 addition & 1 deletion ui/browsing/browsingpane.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func NewBrowsingPane(app *backend.App, contr *controller.Controller, onGoHome fu
b.navBtnsContainer = container.NewHBox()
b.navBtnsPageMap = map[controller.PageName]fyne.Resource{}
b.container = container.NewBorder(container.New(
&layouts.MaxPadLayout{PadLeft: -5, PadRight: -5},
&layout.CustomPaddedLayout{LeftPadding: -5, RightPadding: -5},
container.New(layouts.NewLeftMiddleRightLayout(0),
container.NewHBox(b.home, b.back, b.forward, b.reload), b.navBtnsContainer,
container.NewHBox(layout.NewSpacer(), quickSearchBtn, b.settingsBtn))),
Expand Down
3 changes: 1 addition & 2 deletions ui/browsing/favoritespage.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/dweymouth/supersonic/backend/mediaprovider"
"github.com/dweymouth/supersonic/sharedutil"
"github.com/dweymouth/supersonic/ui/controller"
"github.com/dweymouth/supersonic/ui/layouts"
myTheme "github.com/dweymouth/supersonic/ui/theme"
"github.com/dweymouth/supersonic/ui/util"
"github.com/dweymouth/supersonic/ui/widgets"
Expand Down Expand Up @@ -413,7 +412,7 @@ func (a *FavoritesPage) onShowFavoriteSongs() {
tracklist.SetNowPlaying(a.nowPlayingID)
a.contr.ConnectTracklistActions(tracklist)
a.tracklistCtr = container.New(
&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadTop: 5, PadBottom: 15},
&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, TopPadding: 5, BottomPadding: 15},
tracklist)
a.container.Objects[0] = a.tracklistCtr
a.Refresh()
Expand Down
4 changes: 2 additions & 2 deletions ui/browsing/genrespage.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ func (s *savedGenresPage) Restore() Page {

func (a *GenresPage) buildContainer() {
searchVbox := container.NewVBox(layout.NewSpacer(), a.searcher, layout.NewSpacer())
a.container = container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadTop: 5, PadBottom: 15},
a.container = container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, TopPadding: 5, BottomPadding: 15},
container.NewBorder(
container.New(&layouts.MaxPadLayout{PadLeft: -5},
container.New(&layout.CustomPaddedLayout{LeftPadding: -5},
container.NewHBox(a.titleDisp, layout.NewSpacer(), searchVbox)),
nil, nil, nil, a.list))
}
Expand Down
5 changes: 3 additions & 2 deletions ui/browsing/playlistpage.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
Expand Down Expand Up @@ -102,8 +103,8 @@ func newPlaylistPage(
a.contr.ConnectTracklistActions(a.tracklist)

a.container = container.NewBorder(
container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadTop: 15, PadBottom: 10}, a.header),
nil, nil, nil, container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadBottom: 15}, a.tracklist))
container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, TopPadding: 15, BottomPadding: 10}, a.header),
nil, nil, nil, container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, BottomPadding: 15}, a.tracklist))
go a.load()
return a
}
Expand Down
2 changes: 1 addition & 1 deletion ui/browsing/playlistspage.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func (s *savedPlaylistsPage) Restore() Page {

func (a *PlaylistsPage) buildContainer(initialView fyne.CanvasObject) {
searchVbox := container.NewVBox(layout.NewSpacer(), a.searcher, layout.NewSpacer())
a.container = container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadTop: 5, PadBottom: 15},
a.container = container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, TopPadding: 5, BottomPadding: 15},
container.NewBorder(
container.NewHBox(a.titleDisp, container.NewCenter(a.viewToggle), layout.NewSpacer(), searchVbox),
nil, nil, nil, initialView))
Expand Down
3 changes: 1 addition & 2 deletions ui/browsing/trackspage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"github.com/dweymouth/supersonic/backend/mediaprovider"
"github.com/dweymouth/supersonic/sharedutil"
"github.com/dweymouth/supersonic/ui/controller"
"github.com/dweymouth/supersonic/ui/layouts"
"github.com/dweymouth/supersonic/ui/theme"
"github.com/dweymouth/supersonic/ui/util"
"github.com/dweymouth/supersonic/ui/widgets"
Expand Down Expand Up @@ -80,7 +79,7 @@ func (t *TracksPage) createContainer() {
playRandomVbox := container.NewVBox(layout.NewSpacer(), t.playRandom, layout.NewSpacer())
searchVbox := container.NewVBox(layout.NewSpacer(), t.searcher, layout.NewSpacer())
topRow := container.NewHBox(t.title, playRandomVbox, layout.NewSpacer(), searchVbox)
t.container = container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15, PadTop: 5, PadBottom: 15},
t.container = container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15, TopPadding: 5, BottomPadding: 15},
container.NewBorder(topRow, nil, nil, nil, t.tracklist))
}

Expand Down
2 changes: 1 addition & 1 deletion ui/dialogs/albuminfodialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (a *AlbumInfoDialog) buildMainContainer(albumInfo *mediaprovider.AlbumInfo,
urlContainer := a.buildUrlContainer(albumInfo.LastFmUrl, albumInfo.MusicBrainzID)

return container.New(
&layouts.MaxPadLayout{PadLeft: 15, PadRight: 10, PadTop: 15, PadBottom: 10},
&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 10, TopPadding: 15, BottomPadding: 10},
container.NewVBox(
iconImage,
title,
Expand Down
5 changes: 2 additions & 3 deletions ui/dialogs/settingsdialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/dweymouth/supersonic/backend"
"github.com/dweymouth/supersonic/backend/player/mpv"
"github.com/dweymouth/supersonic/ui/layouts"
myTheme "github.com/dweymouth/supersonic/ui/theme"
"github.com/dweymouth/supersonic/ui/util"
"github.com/dweymouth/supersonic/ui/widgets"
Expand Down Expand Up @@ -385,7 +384,7 @@ func (s *SettingsDialog) createPlaybackTab(isLocalPlayer, isReplayGainPlayer boo

return container.NewTabItem("Playback", container.NewVBox(
disableTranscode,
container.New(&layouts.MaxPadLayout{PadTop: 5},
container.New(&layout.CustomPaddedLayout{TopPadding: 5},
container.New(layout.NewFormLayout(),
widget.NewLabel("Audio device"), container.NewBorder(nil, nil, nil, util.NewHSpace(70), deviceSelect),
layout.NewSpacer(), audioExclusive,
Expand Down Expand Up @@ -521,7 +520,7 @@ func (s *SettingsDialog) setRestartRequired() {
}

func (s *SettingsDialog) newSectionSeparator() fyne.CanvasObject {
return container.New(&layouts.MaxPadLayout{PadLeft: 15, PadRight: 15}, widget.NewSeparator())
return container.New(&layout.CustomPaddedLayout{LeftPadding: 15, RightPadding: 15}, widget.NewSeparator())
}

func (s *SettingsDialog) onReplayGainSettingsChanged() {
Expand Down
38 changes: 0 additions & 38 deletions ui/layouts/maxpadlayout.go

This file was deleted.

3 changes: 1 addition & 2 deletions ui/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/dweymouth/supersonic/backend/mediaprovider"
"github.com/dweymouth/supersonic/res"
"github.com/dweymouth/supersonic/sharedutil"
"github.com/dweymouth/supersonic/ui/layouts"
myTheme "github.com/dweymouth/supersonic/ui/theme"
"golang.org/x/net/html"
)
Expand Down Expand Up @@ -208,7 +207,7 @@ func AddHeaderBackground(obj fyne.CanvasObject) *fyne.Container {
bgrnd := myTheme.NewThemedRectangle(myTheme.ColorNamePageHeader)
bgrnd.CornerRadiusName = theme.SizeNameInputRadius
return container.NewStack(bgrnd,
container.New(&layouts.MaxPadLayout{PadLeft: 10, PadRight: 10, PadTop: 10, PadBottom: 10},
container.New(&layout.CustomPaddedLayout{LeftPadding: 10, RightPadding: 10, TopPadding: 10, BottomPadding: 10},
obj))
}

Expand Down
3 changes: 1 addition & 2 deletions ui/widgets/albumfilterbutton.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"fyne.io/fyne/v2/widget"
"github.com/dweymouth/supersonic/backend/mediaprovider"
"github.com/dweymouth/supersonic/sharedutil"
"github.com/dweymouth/supersonic/ui/layouts"
myTheme "github.com/dweymouth/supersonic/ui/theme"
"github.com/dweymouth/supersonic/ui/util"
)
Expand Down Expand Up @@ -309,7 +308,7 @@ func NewGenreFilterSubsection(onChanged func([]string), initialSelectedGenres []

filterRow := container.NewBorder(nil, nil, nil, container.NewHBox(g.allBtn, g.noneBtn), g.filterText)
g.container = container.NewBorder(g.genresTitleLine, nil, nil, nil,
container.New(&layouts.MaxPadLayout{PadLeft: 5, PadRight: 5},
container.New(&layout.CustomPaddedLayout{LeftPadding: 5, RightPadding: 5},
container.NewBorder(filterRow, nil, nil, nil, g.genreListView),
),
)
Expand Down
5 changes: 3 additions & 2 deletions ui/widgets/nowplayingcard.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/widget"
)

Expand Down Expand Up @@ -110,9 +111,9 @@ func (n *NowPlayingCard) onAddToPlaylist() {
}

func (n *NowPlayingCard) CreateRenderer() fyne.WidgetRenderer {
c := container.New(&layouts.MaxPadLayout{PadLeft: -4},
c := container.New(&layout.CustomPaddedLayout{LeftPadding: -4},
container.NewBorder(nil, nil, n.cover, nil,
container.New(&layouts.MaxPadLayout{PadTop: -2},
container.New(&layout.CustomPaddedLayout{TopPadding: -2},
container.New(&layouts.VboxCustomPadding{ExtraPad: -13}, n.trackName, n.artistName, n.albumName))),
)
return widget.NewSimpleRenderer(c)
Expand Down

0 comments on commit 883c1f7

Please sign in to comment.