ui

package
v0.0.0-...-6257981 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2013 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

The ui package is responsible for the user interface of Juke. It's objective is to abstract and de-couple the main program's logic from the user interface.

Index

Constants

View Source
const (
	PREV_BUTTON uint8 = iota
	PLAY_PAUSE_BUTTON
	STOP_BUTTON
	NEXT_BUTTON
)

Playback control constant indexes:

View Source
const (
	SHUFFLE_BUTTON uint8 = iota
	REPEAT_BUTTON
)

Left-side control constant indexes:

View Source
const (
	VOLUME_BUTTON uint8 = iota
	CONNECTION_BUTTON
)

Right-side control constant indexes:

View Source
const (
	NOT_CONNECTED_WINDOW_TITLE string = "Not Connected [Juke]"
	NOT_CONNECTED_SONG_LABEL   string = "<span size=\"x-large\" font_weight=\"bold\">Stopped</span>\nNot connected."
	STOPPED_WINDOW_TITLE       string = "Stopped [Juke]"
	STOPPED_SONG_LABEL         string = "<span size=\"x-large\" font_weight=\"bold\">Stopped</span>\nConnected."
	STOPPED_OR_DC_PROGRESS     string = "0:00 / 0:00"
)

Constant referances for set program states:

View Source
const (
	ICON              string = "/usr/share/pixmaps/juke/juke.png"
	NO_COVER_ARTWORK  string = "/usr/share/pixmaps/juke/no_cover.png"
	CUR_PL_ALBUM_SIZE int    = 20
)

Constant pixmap paths:

View Source
const (
	CUR_PL_COL_ID int = iota
	CUR_PL_COL_ARTPATH
	CUR_PL_COL_ARTBUF
	CUR_PL_COL_NAME
	CUR_PL_COL_ARTIST
	CUR_PL_COL_ALBUM
	NUM_PL_COLS
)
View Source
const ROW_BUFFER_SIZE = 50

Variables

This section is empty.

Functions

func AddManyRowstoCurrentPlaylist

func AddManyRowstoCurrentPlaylist(rows []*CurrentPLRow)

AddManyRowstoCurrentPlaylist adds mulitple rows at once. It is designed to be more efficient than adding one row at a time.

func AddRowtoCurrentPlaylist

func AddRowtoCurrentPlaylist(row *CurrentPLRow)

AddRowtoCurrentPlaylist adds a row to the current playlist view.

func BoldRowById

func BoldRowById(rowId int)

BoldRowById makes a row in the current playlist by the ID of the song. Only one row can be bold at a time.

func BoldRowByReference

func BoldRowByReference(row *CurrentPLRow)

BoldRowByReference makes a row in the current playlist bold. Only one row can be bold at a time.

func ClearCurrentPlaylist

func ClearCurrentPlaylist()

ClearCurrentPlaylist clears the current playlist view.

func ConnectionClick

func ConnectionClick(f func() error)

ConnectionClick will bind to the "click" event on the connection button.

func CurrentClearSongs

func CurrentClearSongs(f func() error)

CurrentClearSongs will bind the "click" event on the clear playlist button in the current playlist menu.

func CurrentColumnClick

func CurrentColumnClick(f func(chan *CurrentPLRow) error)

CurrentColumnClick will bind to the "column click" event in the current playlist.

func CurrentRemoveSongs

func CurrentRemoveSongs(f func(chan *CurrentPLRow) error)

CurrentRemoveSongs will bind to the "click" event on the remove songs button in the current playlist menu.

func CurrentRowDoubleClick

func CurrentRowDoubleClick(f func(*CurrentPLRow) error)

CurrentRowDoubleClick will bind to the "double-click" event on a row in the current playlist.

func InitInterface

func InitInterface()

InitInterface inits the GUI toolkit and builds most of the base interface.

func Lock

func Lock()

Lock grabs the ui lock.

func MainLoop

func MainLoop()

MainLoop runs the GUI toolkit's main loop.

func NextClick

func NextClick(f func() error)

NextClick will bind to the "release" event on the next button.

func OnExit

func OnExit(f func() error)

OnExit will bind additional functions to the ui "exit" event.

func PlayPauseClick

func PlayPauseClick(f func() error)

PlayPauseClick will bind to the "release" event on the play/pause button.

func PreviousClick

func PreviousClick(f func() error)

PreviousClick will bind to the "release" event on the previous button.

func ProgressBarClick

func ProgressBarClick(f func(int, int) error)

ProgressBarClick will bind to the "click" event on the progress bar.

func RemoveManyRowsfromCurrentPlaylist

func RemoveManyRowsfromCurrentPlaylist(rowsList *list.List)

RemoveManyRowsfromCurrentPlaylist removes mulitple rows at once. It is designed to be more efficient than removing one row at a time.

func RemoveRowfromCurrentPlaylist

func RemoveRowfromCurrentPlaylist(row *CurrentPLRow)

RemoveRowfromCurrentPlaylist adds a row to the current playlist view.

func SetCurrentAlbumArt

func SetCurrentAlbumArt(path string)

SetCurrentAlbumArt sets the current album artwork to the image specified by path.

func SetCurrentSong

func SetCurrentSong(songName, artist, album string)

SetCurrentSong changes the window title and current song labeling to reflect the parameters of song name, artist name, and album name.

func SetCurrentSongNotConnected

func SetCurrentSongNotConnected()

SetCurrentSongNotConnected changes the window title and current song labeling to reflect and unconnected client.

func SetCurrentSongStopped

func SetCurrentSongStopped()

SetCurrentSongStopped changes the window title and current song labeling to reflect a stopped but still connected client.

func SetPlayPause

func SetPlayPause(pause bool)

SetPlayPause changes the image on the play button based on the boolean argument. True will display a pause image, while false will display a play image.

func SetProgressBarTime

func SetProgressBarTime(at, total int)

SetProgressBarTime takes song progress and updates the progress bar to reflect that both textually and visually.

func SetProgressBarTimeStoppedOrDisconnected

func SetProgressBarTimeStoppedOrDisconnected()

SetProgressBarTimeStoppedOrDisconnected sets the progress bar to reflect that the client is stopped or is disconnected.

func StopClick

func StopClick(f func() error)

StopClick will bind to the "release" event on the stop button.

func Unlock

func Unlock()

Unlock releases any ui locks.

Types

type CurrentPLRow

type CurrentPLRow struct {
	ID          int
	ArtworkPath string
	Name        string
	Artist      string
	Album       string
	Bold        bool
	// contains filtered or unexported fields
}

CurrentPLRow is an abstraction for other modules to work with visible rows in the current playlist.

Jump to

Keyboard shortcuts

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