Documentation
¶
Index ¶
- Variables
- func AudioPanelView() *tview.TextView
- func EpisodeMenu() *tview.List
- func FeedMenu() *tview.List
- func MainFlex() *tview.Flex
- func TopRow() *tview.Flex
- type APViewController
- type BeforeDraw
- type Control
- type Controller
- type Controllers
- type EpisodeMenuController
- type FeedsMenuController
- type LastPlayer
- type PanelStateAwareController
- type PanelStateAwareReceiverController
- type ReceiverController
- type RootController
- type Views
Constants ¶
This section is empty.
Variables ¶
var FocusLeft = func(event *tcell.EventKey) bool {
return event.Key() == tcell.KeyLeft
}
var FocusRight = func(event *tcell.EventKey) bool {
return event.Key() == tcell.KeyRight
}
var SelectItem = func(event *tcell.EventKey) bool {
return event.Key() == tcell.KeyEnter
}
Functions ¶
func AudioPanelView ¶
func EpisodeMenu ¶
Types ¶
type APViewController ¶
type APViewController struct { PanelStateAwareReceiverController // contains filtered or unexported fields }
APViewController manages the updating of the tview.TextView that shows the current playing episode
func NewAPViewController ¶
func NewAPViewController(lastPlayer *LastPlayer) *APViewController
NewAPViewController initialises the APViewController and provides an interface for dependency injection
func (*APViewController) InputHandler ¶
func (a *APViewController) InputHandler(event *tcell.EventKey) *tcell.EventKey
InputHandler is used here to rerender the view with the updated player state on capture of the 'Play/Pause' control input
func (*APViewController) OnUpdate ¶
func (a *APViewController) OnUpdate()
OnUpdate implements the audiopanel.PlayerStateSubscriber interface
func (*APViewController) Receive ¶
func (a *APViewController) Receive(state domain.State)
Receive updates the internal tracking of the currently playing episode, if it has changed then the view is re-rendered
func (*APViewController) RenderState ¶
func (a *APViewController) RenderState(state audiopanel.PlayerState)
RenderState updates the TextView that the APViewController controls
type BeforeDraw ¶
type BeforeDraw func(_ tcell.Screen) bool
type Control ¶
type Control func(event *tcell.EventKey) bool
Control is the abstraction of a keymapping
type Controller ¶
type Controller interface {
InputHandler(event *tcell.EventKey) *tcell.EventKey
}
Controller is the interface for views that are expressed In terms of tview.Primitive implementations. Implementations of this interface must pass their InputHandler method into tview.Primitive.SetInputCapture on initialisation or any controls they define will be ignored
type Controllers ¶
type Controllers struct { FeedMenu *FeedsMenuController EpisodeMenu *EpisodeMenuController RootController *RootController APViewController *APViewController }
Controllers is the declaration of the full set of controllers that must be supplied to the app on Build
type EpisodeMenuController ¶
type EpisodeMenuController struct { ReceiverController // contains filtered or unexported fields }
EpisodeMenuController Handles input captured from and updates to be displayed in the episode menu
func NewEpisodeMenuController ¶
func NewEpisodeMenuController(lastPlayer *LastPlayer) *EpisodeMenuController
NewEpisodeMenuController Initialises the EpisodeMenuController
func (*EpisodeMenuController) InputHandler ¶
func (e *EpisodeMenuController) InputHandler(event *tcell.EventKey) *tcell.EventKey
InputHandler implements the user input side of the controller interface
func (*EpisodeMenuController) Receive ¶
func (e *EpisodeMenuController) Receive(state domain.State)
Receive is looking out for changes to the feed index
type FeedsMenuController ¶
type FeedsMenuController struct { Controller // contains filtered or unexported fields }
FeedsMenuController manages the feeds menu, it synchronises the current feed with the feed selection in the ui
func NewFeedsController ¶
func NewFeedsController(application *LastPlayer) *FeedsMenuController
NewFeedsController initialises the FeedsMenuController
func (*FeedsMenuController) InputHandler ¶
func (f *FeedsMenuController) InputHandler(event *tcell.EventKey) *tcell.EventKey
InputHandler invokes selectFeed on capturing a tcell.KeyEnter keypress
type LastPlayer ¶
type LastPlayer struct { *tview.Application Controllers Controllers Views Views FocusRing []tview.Primitive State *domain.State AudioPanel *audiopanel.AudioPanel Config app.Config LogFile *os.File // contains filtered or unexported fields }
LastPlayer extends the tview.Application with our custom functionality
func Build ¶
func Build() *LastPlayer
Build and returns the LastPlayer, implement any additions to the user interface adding new primitives to the lastPlayer hierarchy in this function
func (*LastPlayer) GetLogger ¶
func (lp *LastPlayer) GetLogger(prefix string) *log.Logger
GetLogger can be used to get a log.Logger with the prefix as passed. This can be accessed inside controllers etc.
func (*LastPlayer) Run ¶
func (lp *LastPlayer) Run() error
Run overrides the tview.Application Run method and includes a deferred close of the logfile
type PanelStateAwareController ¶
type PanelStateAwareController interface { Controller audiopanel.PlayerStateSubscriber }
PanelStateAwareController is an interface that extends a Controller by requiring an implementation of OnUpdate which is periodically called with the audio panel state
type PanelStateAwareReceiverController ¶
type PanelStateAwareReceiverController interface { Controller domain.Receiver audiopanel.PlayerStateSubscriber }
PanelStateAwareReceiverController is an interface that combines the functionality of both PanelStateAwareController and ReceiverController
type ReceiverController ¶
type ReceiverController interface { Controller domain.Receiver }
ReceiverController is an interface that gives the controller the capability to be notified if the global state changes
type RootController ¶
type RootController struct { Controller // contains filtered or unexported fields }
RootController handles global controls
func NewRootController ¶
func NewRootController(lastPlayer *LastPlayer) *RootController
NewRootController initialises the RootController
func (*RootController) InputHandler ¶
func (r *RootController) InputHandler(event *tcell.EventKey) *tcell.EventKey
InputHandler implements the global controls. In some cases the events need to propagate through the hierarchy