widgets

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package widgets contains all widgets that are used in jellycli. Window is the root widget and controls access to interfaces.Player, interfaces.Queue and interfaces.Items.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlbumCover

type AlbumCover struct {
	*cview.TextView
	// contains filtered or unexported fields
}

AlbumCover is a simple cover for album, it shows album name, year and possible artists

func NewAlbumCover

func NewAlbumCover(index int, album *models.Album) *AlbumCover

func (*AlbumCover) SetRect

func (a *AlbumCover) SetRect(x, y, w, h int)

func (*AlbumCover) SetSelected

func (a *AlbumCover) SetSelected(selected twidgets.Selection)

type AlbumList added in v0.2.0

type AlbumList struct {
	// contains filtered or unexported fields
}

ArtisView as a view that contains

func NewAlbumList added in v0.2.0

func NewAlbumList(selectAlbum func(album *models.Album), context contextOperator,
	queryFunc func(opts *interfaces.QueryOpts), filterFunc openFilterFunc) *AlbumList

NewAlbumList constructs new albumList view

func (*AlbumList) Clear added in v0.2.0

func (a *AlbumList) Clear()

func (*AlbumList) EnableFilter added in v0.8.0

func (a *AlbumList) EnableFilter(enabled bool)

func (*AlbumList) EnablePaging added in v0.2.0

func (a *AlbumList) EnablePaging(enabled bool)

EnablePaging enables paging and shows page on banner

func (*AlbumList) EnableSimilar added in v0.4.0

func (a *AlbumList) EnableSimilar(enabled bool)

func (*AlbumList) EnableSorting added in v0.8.0

func (a *AlbumList) EnableSorting(enabled bool)

func (AlbumList) InputHandler added in v0.2.0

func (i AlbumList) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*AlbumList) SetAlbums added in v0.2.0

func (a *AlbumList) SetAlbums(albums []*models.Album)

SetPlaylist sets albums

func (*AlbumList) SetLabel added in v0.7.0

func (a *AlbumList) SetLabel(label string)

func (*AlbumList) SetPage added in v0.2.0

func (a *AlbumList) SetPage(paging interfaces.Paging)

func (*AlbumList) SetText added in v0.2.0

func (a *AlbumList) SetText(text string)

type AlbumView

type AlbumView struct {
	// contains filtered or unexported fields
}

AlbumView shows user a header (album name, info, buttons) and list of songs

func NewAlbumview

func NewAlbumview(playSong func(song *models.Song),
	playSongs func(songs []*models.Song), operator contextOperator) *AlbumView

NewAlbumView initializes new album view

func (AlbumView) InputHandler

func (i AlbumView) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*AlbumView) SetAlbum

func (a *AlbumView) SetAlbum(album *models.Album, songs []*models.Song)

func (*AlbumView) SetArtist added in v0.5.0

func (a *AlbumView) SetArtist(artist *models.Artist)

type ArtistAlbumList added in v0.8.0

type ArtistAlbumList struct {
	*AlbumList
	// contains filtered or unexported fields
}

func NewArtistAlbumList added in v0.8.0

func NewArtistAlbumList(selectAlbum func(album *models.Album), context contextOperator,
	queryFunc func(opts *interfaces.QueryOpts), filterFunc openFilterFunc) *ArtistAlbumList

func (ArtistAlbumList) InputHandler added in v0.8.0

func (i ArtistAlbumList) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*ArtistAlbumList) SetAlbums added in v0.8.0

func (a *ArtistAlbumList) SetAlbums(albums []*models.Album)

SetPlaylist sets albums

func (*ArtistAlbumList) SetArtist added in v0.8.0

func (a *ArtistAlbumList) SetArtist(artist *models.Artist)

SetPlaylists sets albumList cover

type ArtistCover

type ArtistCover struct {
	*cview.TextView
	// contains filtered or unexported fields
}

func (*ArtistCover) SetSelected

func (a *ArtistCover) SetSelected(s twidgets.Selection)

type ArtistList

type ArtistList struct {
	// contains filtered or unexported fields
}

func NewArtistList

func NewArtistList(selectFunc func(artist *models.Artist), queryFunc func(opts *interfaces.QueryOpts)) *ArtistList

func (*ArtistList) Clear

func (a *ArtistList) Clear()

func (*ArtistList) EnablePaging added in v0.2.0

func (a *ArtistList) EnablePaging(enabled bool)

EnablePaging enables paging and shows page on banner

func (ArtistList) InputHandler added in v0.8.0

func (i ArtistList) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*ArtistList) SetArtists added in v0.8.0

func (a *ArtistList) SetArtists(artists []*models.Artist)

func (*ArtistList) SetPage added in v0.2.0

func (a *ArtistList) SetPage(paging interfaces.Paging)

func (*ArtistList) SetText added in v0.2.0

func (a *ArtistList) SetText(text string)

type Genre added in v0.4.0

type Genre struct {
	*cview.TextView
	// contains filtered or unexported fields
}

func (*Genre) SetSelected added in v0.4.0

func (g *Genre) SetSelected(s twidgets.Selection)

type GenreList added in v0.4.0

type GenreList struct {
	// contains filtered or unexported fields
}

func NewGenreList added in v0.4.0

func NewGenreList() *GenreList

func (*GenreList) Clear added in v0.4.0

func (g *GenreList) Clear()

func (GenreList) InputHandler added in v0.8.0

func (i GenreList) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*GenreList) SetPage added in v0.4.0

func (g *GenreList) SetPage(paging interfaces.Paging)

type History added in v0.4.0

type History struct {
	*Queue
}

func NewHistory added in v0.4.0

func NewHistory() *History

func (*History) Clear added in v0.4.0

func (h *History) Clear()

Clear removes all songs

func (History) InputHandler added in v0.8.0

func (i History) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*History) SetSongs added in v0.4.0

func (h *History) SetSongs(songs []*models.Song)

SetSongs clears current songs and sets new ones

type MediaNavigation

type MediaNavigation struct {
	*cview.Table
	// contains filtered or unexported fields
}

MediaNavigation provides access to artists, albums, playlists

func NewMediaNavigation

func NewMediaNavigation(selectFunc func(selection MediaSelect)) *MediaNavigation

NewMediaNavigation constructs new mediaNavigation. SelectFunc is called every time user wants to access given resource. SelectFunc can be nil.

func (*MediaNavigation) InputHandler

func (m *MediaNavigation) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*MediaNavigation) MouseHandler added in v0.5.0

func (m *MediaNavigation) MouseHandler() func(action cview.MouseAction, event *tcell.EventMouse, setFocus func(p cview.Primitive)) (consumed bool, capture cview.Primitive)

MouseHandler returns the mouse handler for this primitive.

func (*MediaNavigation) SetCount

func (m *MediaNavigation) SetCount(id MediaSelect, count int)

type MediaSelect

type MediaSelect int
const (
	MediaLatestMusic MediaSelect = iota
	MediaRecent
	MediaArtists
	MediaAlbumArtists
	MediaAlbums
	MediaSongs
	MediaPlaylists
	MediaFavoriteArtists
	MediaFavoriteAlbums
	MediaGenres
)

type PageSelector added in v0.2.0

type PageSelector struct {
	*cview.Box
	Next       *button
	Previous   *button
	PageNum    int
	TotalPages int

	SelectFunc func(page int)
	// contains filtered or unexported fields
}

PageSelector shows current page and buttons for next and previous page. SelectFunc can be nil, in which case buttons do nothing.

func NewPageSelector added in v0.2.0

func NewPageSelector(selectPage func(int)) *PageSelector

func (*PageSelector) Draw added in v0.2.0

func (p *PageSelector) Draw(screen tcell.Screen)

func (*PageSelector) SetPage added in v0.2.0

func (p *PageSelector) SetPage(n int)

SetPage sets current page

func (*PageSelector) SetRect added in v0.2.0

func (p *PageSelector) SetRect(x, y, width, height int)

func (*PageSelector) SetTotalPages added in v0.2.0

func (p *PageSelector) SetTotalPages(n int)

SetTotalPages sets number of pages

type PlaylistCover added in v0.2.0

type PlaylistCover struct {
	*cview.TextView
	// contains filtered or unexported fields
}

AlbumCover is a simple cover for album, it shows album name, year and possible artists

func NewPlaylistCover added in v0.2.0

func NewPlaylistCover(index int, playlist *models.Playlist) *PlaylistCover

func (*PlaylistCover) SetRect added in v0.2.0

func (a *PlaylistCover) SetRect(x, y, w, h int)

func (*PlaylistCover) SetSelected added in v0.2.0

func (a *PlaylistCover) SetSelected(selected twidgets.Selection)

type PlaylistView added in v0.2.0

type PlaylistView struct {
	// contains filtered or unexported fields
}

AlbumView shows user a header (album name, info, buttons) and list of songs

func NewPlaylistView added in v0.2.0

func NewPlaylistView(playSong func(song *models.Song), playSongs func(songs []*models.Song),
	operator contextOperator) *PlaylistView

NewAlbumView initializes new album view

func (PlaylistView) InputHandler added in v0.2.0

func (i PlaylistView) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*PlaylistView) SetPlaylist added in v0.2.0

func (p *PlaylistView) SetPlaylist(playlist *models.Playlist)

type Playlists added in v0.2.0

type Playlists struct {
	// contains filtered or unexported fields
}

Playlists shows playlists

func NewPlaylists added in v0.2.0

func NewPlaylists(selectPlaylist func(playlist *models.Playlist)) *Playlists

NewPlaylists constructs new playlist view

func (*Playlists) Clear added in v0.2.0

func (pl *Playlists) Clear()

func (*Playlists) InputHandler added in v0.2.0

func (pl *Playlists) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*Playlists) SetPlaylists added in v0.2.0

func (pl *Playlists) SetPlaylists(playlists []*models.Playlist)

SetPlaylist sets albums

type Previous added in v0.2.0

type Previous interface {
	cview.Primitive
	// Back gives last primitive
	Back() Previous
	// SetLast sets last primitive
	SetLast(p Previous)

	//SetBackCallback sets callback function that gets called when user clicks 'back'
	SetBackCallback(cb func(p Previous))
}

Previous can give last primitive

type ProgressBar

type ProgressBar interface {
	SetWidth(w int)
	SetMaximum(m int)
	Draw(val int) string
}

func NewProgressBar

func NewProgressBar(width int, maxValue int) ProgressBar

NewProgressBar creates new progress bar with given character width

type Queue added in v0.2.0

type Queue struct {
	// contains filtered or unexported fields
}

Queue shows a list of songs similar to album. A history view is queue with reverse order and some little tweaks.

func NewQueue added in v0.2.0

func NewQueue() *Queue

NewQueue initializes new album view

func (*Queue) AddSong added in v0.2.0

func (q *Queue) AddSong(song *models.Song, index int)

AddSong adds song to queue. If index is 0, add to beginning, if -1, add to end

func (*Queue) Clear added in v0.2.0

func (q *Queue) Clear()

Clear removes all songs

func (Queue) InputHandler added in v0.8.0

func (i Queue) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*Queue) SetSongs added in v0.2.0

func (q *Queue) SetSongs(songs []*models.Song)

SetSongs clears current songs and sets new ones

type SearchTopList added in v0.7.0

type SearchTopList struct {
	*twidgets.Banner
	// contains filtered or unexported fields
}

SearchTopList shows overall result of different keys, where user can click any key and see actual results.

func NewSearchTopList added in v0.7.0

func NewSearchTopList(searchFunc func(string), selectMediaFunc func(itemType models.ItemType, items []models.Item, query string)) *SearchTopList

func (SearchTopList) Back added in v0.7.0

func (p SearchTopList) Back() Previous

func (*SearchTopList) Clear added in v0.7.0

func (s *SearchTopList) Clear()

func (*SearchTopList) ClearResults added in v0.7.0

func (s *SearchTopList) ClearResults()

func (*SearchTopList) ResultsReady added in v0.7.0

func (s *SearchTopList) ResultsReady()

ResultsReady sets results layout

func (SearchTopList) SetBackCallback added in v0.7.0

func (p SearchTopList) SetBackCallback(cb func(p Previous))

func (SearchTopList) SetLast added in v0.7.0

func (p SearchTopList) SetLast(primitive Previous)

func (*SearchTopList) SetRect added in v0.7.0

func (s *SearchTopList) SetRect(x, y, w, h int)

type SongList added in v0.2.0

type SongList struct {
	// contains filtered or unexported fields
}

SongList shows a list of songs and optional paging

func NewSongList added in v0.2.0

func NewSongList(playSong func(song *models.Song), playSongs func(songs []*models.Song),
	operator contextOperator) *SongList

NewSongList initializes new song list

func (SongList) InputHandler added in v0.2.0

func (i SongList) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*SongList) SetSongs added in v0.2.0

func (s *SongList) SetSongs(songs []*models.Song, page interfaces.Paging)

type Status

type Status struct {
	// contains filtered or unexported fields
}

func (*Status) Blur

func (s *Status) Blur()

func (*Status) Draw

func (s *Status) Draw(screen tcell.Screen)

func (*Status) DrawButtons

func (s *Status) DrawButtons()

func (*Status) Focus

func (s *Status) Focus(delegate func(p cview.Primitive))

func (*Status) GetFocusable

func (s *Status) GetFocusable() cview.Focusable

func (*Status) GetRect

func (s *Status) GetRect() (int, int, int, int)

func (*Status) InputHandler

func (s *Status) InputHandler() func(event *tcell.EventKey, setFocus func(p cview.Primitive))

func (*Status) MouseHandler added in v0.5.0

func (s *Status) MouseHandler() func(action cview.MouseAction, event *tcell.EventMouse, setFocus func(p cview.Primitive)) (consumed bool, capture cview.Primitive)

func (*Status) SetRect

func (s *Status) SetRect(x, y, width, height int)

func (*Status) UpdateState

func (s *Status) UpdateState(state interfaces.AudioStatus, song *models.SongInfo)

func (*Status) WriteStatus

func (s *Status) WriteStatus(screen tcell.Screen, x, y int)

type Window

type Window struct {
	// contains filtered or unexported fields
}

func (*Window) AddSongToPlaylist added in v0.5.0

func (w *Window) AddSongToPlaylist(song *models.Song) error

func (*Window) InitBrowser

func (w *Window) InitBrowser(items []models.Item)

func (*Window) InstantMix added in v0.5.0

func (w *Window) InstantMix(item models.Item)

func (*Window) OpenInBrowser added in v0.5.0

func (w *Window) OpenInBrowser(item models.Item)

func (*Window) Run

func (w *Window) Run() error

func (*Window) Stop

func (w *Window) Stop()

func (*Window) ViewAlbumArtist added in v0.5.0

func (w *Window) ViewAlbumArtist(album *models.Album)

func (*Window) ViewArtist added in v0.5.0

func (w *Window) ViewArtist(artist *models.Artist)

func (*Window) ViewSongAlbum added in v0.5.0

func (w *Window) ViewSongAlbum(song *models.Song)

func (*Window) ViewSongArtist added in v0.5.0

func (w *Window) ViewSongArtist(song *models.Song)

Directories

Path Synopsis
Package modal contains modal views that are drawn on top of existing layout.
Package modal contains modal views that are drawn on top of existing layout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL