add some comments
This commit is contained in:
@@ -18,6 +18,9 @@ const (
|
|||||||
ReplayGainTrack = string(player.ReplayGainTrack)
|
ReplayGainTrack = string(player.ReplayGainTrack)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// A high-level Subsonic-aware playback backend.
|
||||||
|
// Manages loading tracks into the Player queue,
|
||||||
|
// sending callbacks on play time updates and track changes.
|
||||||
type PlaybackManager struct {
|
type PlaybackManager struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
cancelPollPos context.CancelFunc
|
cancelPollPos context.CancelFunc
|
||||||
|
|||||||
@@ -85,10 +85,12 @@ func (s *ServerManager) Logout() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets a callback that is invoked when a server is connected to.
|
||||||
func (s *ServerManager) OnServerConnected(cb func()) {
|
func (s *ServerManager) OnServerConnected(cb func()) {
|
||||||
s.onServerConnected = append(s.onServerConnected, cb)
|
s.onServerConnected = append(s.onServerConnected, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets a callback that is invoked when the user logs out of a server.
|
||||||
func (s *ServerManager) OnLogout(cb func()) {
|
func (s *ServerManager) OnLogout(cb func()) {
|
||||||
s.onLogout = append(s.onLogout, cb)
|
s.onLogout = append(s.onLogout, cb)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// A component to check for updates from the
|
||||||
|
// Github releases/latest URL.
|
||||||
type UpdateChecker struct {
|
type UpdateChecker struct {
|
||||||
OnUpdatedVersionFound func()
|
OnUpdatedVersionFound func()
|
||||||
|
|
||||||
@@ -26,6 +28,8 @@ func NewUpdateChecker(appVersionTag, latestReleaseURL string, lastCheckedTag *st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start automatically polling for updates in the background.
|
||||||
|
// Quits when the given ctx's Done channel returns a value.
|
||||||
func (u *UpdateChecker) Start(ctx context.Context, interval time.Duration) {
|
func (u *UpdateChecker) Start(ctx context.Context, interval time.Duration) {
|
||||||
go func() {
|
go func() {
|
||||||
u.checkForUpdate() // check once at startup
|
u.checkForUpdate() // check once at startup
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import (
|
|||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// The "aux" controls for playback, positioned to the right
|
||||||
|
// of the BottomPanel. Currently only volume control.
|
||||||
type AuxControls struct {
|
type AuxControls struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import (
|
|||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 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.
|
||||||
type ImagePlaceholder struct {
|
type ImagePlaceholder struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
container *fyne.Container
|
container *fyne.Container
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ var _ fyne.Tappable = (*ListRowBase)(nil)
|
|||||||
var _ fyne.Widget = (*ListRowBase)(nil)
|
var _ fyne.Widget = (*ListRowBase)(nil)
|
||||||
var _ fyne.Focusable = (*ListRowBase)(nil)
|
var _ fyne.Focusable = (*ListRowBase)(nil)
|
||||||
|
|
||||||
|
// Base type used for all list rows in widgets such as Tracklist, etc.
|
||||||
type ListRowBase struct {
|
type ListRowBase struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import (
|
|||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Shows the current album art, track name, artist name, and album name
|
||||||
|
// for the currently playing track. Placed into the left side of the BottomPanel.
|
||||||
type NowPlayingCard struct {
|
type NowPlayingCard struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import (
|
|||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// A widget.Entry that allows restrictions on the text
|
||||||
|
// that can be typed into it, based on a charAllowed callback.
|
||||||
type TextRestrictedEntry struct {
|
type TextRestrictedEntry struct {
|
||||||
widget.Entry
|
widget.Entry
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import (
|
|||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Lays out multiple buttons horizontally with no padding,
|
||||||
|
// and uses button.Importance to highlight exactly one which is "active".
|
||||||
|
// Similar to a segmented control in other UI toolkits.
|
||||||
type ToggleButtonGroup struct {
|
type ToggleButtonGroup struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import (
|
|||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Similar to widgets.ToggleButtonGroup, but using text.
|
||||||
|
// The "active" label is bolded non-interactive text,
|
||||||
|
// while all the others are hyperlinks.
|
||||||
type ToggleText struct {
|
type ToggleText struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user