Discman
Loading...
Searching...
No Matches
NowPlayingComponent Class Reference

Handles the interactions with the "now playing" side of the main screen. More...

#include <now_playing_component.h>

Inheritance diagram for NowPlayingComponent:
Collaboration diagram for NowPlayingComponent:

Public Types

enum  State {
  Disabled , Cleared , Playing , Paused ,
  Stopped
}
 The component has several states it can be put into. More...
 
enum  Button { Previous , PlayPause , Stop , Next }
 Playback control button identifiers. More...
 
typedef sigc::signal< void(const Button)> sig_button
 "Playback button clicked" signal type.
 
typedef sigc::signal< void(void)> sig_album_art
 "Album art clicked" signal type.
 

Public Member Functions

 NowPlayingComponent (Glib::RefPtr< Gtk::Builder > builder)
 NowPlayingComponent constructor.
 
 ~NowPlayingComponent ()
 NowPlayingComponent destructor.
 
void set_track (const DiscDB::Disc &disc, unsigned int track, const bool first, const bool last)
 Sets the information for the track currently playing.
 
void set_state (const State state)
 Sets the state of the component.
 
State get_state () const
 Returns the state of the component.
 
void set_seconds (const float seconds)
 Sets the elapsed seconds.
 
void set_album (const std::string &url)
 Sets the album art image.
 
sig_button signal_button ()
 Getter for _signal_button.
 
sig_album_art signal_album_art ()
 Getter for _signal_album_art.
 

Private Member Functions

void on_prev_button_clicked ()
 Called when the previous track button is clicked.
 
void on_playpause_button_clicked ()
 Called when the play/pause button is clicked.
 
void on_stop_button_clicked ()
 Called when the stop button is clicked.
 
void on_next_button_clicked ()
 Called when the next track button is clicked.
 
void on_album_art_button_clicked ()
 Called when the album art button is clicked.
 

Private Attributes

State _state
 State of the component.
 
Gtk::Button * _album_art_button
 Button that shows the album art.
 
Gtk::Image * _album_art_image
 Album art image.
 
Gtk::Label * _track_title_label
 Track title label.
 
Gtk::Label * _track_artist_label
 Track artist label.
 
Gtk::Scale * _seek_scale
 Display for elapsed time.
 
Gtk::Button * _prev_button
 Previous track button.
 
Gtk::Button * _play_pause_button
 Play/pause button.
 
Gtk::Button * _stop_button
 Stop button.
 
Gtk::Button * _next_button
 Next track button.
 
Gtk::Image * _play_pause_image
 The current image displayed on the play/pause button. It will either be a "play" icon or a "pause" icon.
 
sig_button _signal_button
 Emitted when a playback control button is clicked.
 
sig_album_art _signal_album_art
 Emitted when the album art button is clicked.
 

Additional Inherited Members

- Protected Member Functions inherited from Component
 Component ()
 
virtual ~Component ()=0
 

Detailed Description

Handles the interactions with the "now playing" side of the main screen.

Definition at line 26 of file now_playing_component.h.

Member Typedef Documentation

◆ sig_album_art

typedef sigc::signal<void(void)> NowPlayingComponent::sig_album_art

"Album art clicked" signal type.

Definition at line 51 of file now_playing_component.h.

◆ sig_button

typedef sigc::signal<void(const Button)> NowPlayingComponent::sig_button

"Playback button clicked" signal type.

Definition at line 48 of file now_playing_component.h.

Member Enumeration Documentation

◆ Button

Playback control button identifiers.

Enumerator
Previous 
PlayPause 
Stop 
Next 

Definition at line 40 of file now_playing_component.h.

◆ State

The component has several states it can be put into.

Enumerator
Disabled 
Cleared 
Playing 
Paused 
Stopped 

Definition at line 31 of file now_playing_component.h.

Constructor & Destructor Documentation

◆ NowPlayingComponent()

NowPlayingComponent::NowPlayingComponent ( Glib::RefPtr< Gtk::Builder > builder)

NowPlayingComponent constructor.

Parameters
[in]builderThe builder initialized with the widgets managed by this component.

Definition at line 9 of file now_playing_component.cc.

◆ ~NowPlayingComponent()

NowPlayingComponent::~NowPlayingComponent ( )

NowPlayingComponent destructor.

Definition at line 33 of file now_playing_component.cc.

Member Function Documentation

◆ get_state()

NowPlayingComponent::State NowPlayingComponent::get_state ( ) const

Returns the state of the component.

Returns
The state of the component.

Definition at line 73 of file now_playing_component.cc.

◆ on_album_art_button_clicked()

void NowPlayingComponent::on_album_art_button_clicked ( )
private

Called when the album art button is clicked.

Definition at line 114 of file now_playing_component.cc.

◆ on_next_button_clicked()

void NowPlayingComponent::on_next_button_clicked ( )
private

Called when the next track button is clicked.

Definition at line 110 of file now_playing_component.cc.

◆ on_playpause_button_clicked()

void NowPlayingComponent::on_playpause_button_clicked ( )
private

Called when the play/pause button is clicked.

Definition at line 102 of file now_playing_component.cc.

◆ on_prev_button_clicked()

void NowPlayingComponent::on_prev_button_clicked ( )
private

Called when the previous track button is clicked.

Definition at line 98 of file now_playing_component.cc.

◆ on_stop_button_clicked()

void NowPlayingComponent::on_stop_button_clicked ( )
private

Called when the stop button is clicked.

Definition at line 106 of file now_playing_component.cc.

◆ set_album()

void NowPlayingComponent::set_album ( const std::string & url)

Sets the album art image.

Parameters
[in]urlThe URL of the album art image.

Definition at line 81 of file now_playing_component.cc.

◆ set_seconds()

void NowPlayingComponent::set_seconds ( const float seconds)

Sets the elapsed seconds.

Parameters
[in]secondsFractional elapsed seconds .

Definition at line 77 of file now_playing_component.cc.

◆ set_state()

void NowPlayingComponent::set_state ( const State state)

Sets the state of the component.

Parameters
[in]stateThe new state to enter.

Definition at line 55 of file now_playing_component.cc.

◆ set_track()

void NowPlayingComponent::set_track ( const DiscDB::Disc & disc,
unsigned int track,
const bool first,
const bool last )

Sets the information for the track currently playing.

Parameters
discAll of the album information.
track1-based index of the track.
firstWhether the track is the first on the disc.
lastWhether the track is the last on the disc.

Definition at line 45 of file now_playing_component.cc.

◆ signal_album_art()

NowPlayingComponent::sig_album_art NowPlayingComponent::signal_album_art ( )

Getter for _signal_album_art.

Definition at line 94 of file now_playing_component.cc.

◆ signal_button()

NowPlayingComponent::sig_button NowPlayingComponent::signal_button ( )

Getter for _signal_button.

Definition at line 90 of file now_playing_component.cc.

Member Data Documentation

◆ _album_art_button

Gtk::Button* NowPlayingComponent::_album_art_button
private

Button that shows the album art.

Definition at line 89 of file now_playing_component.h.

◆ _album_art_image

Gtk::Image* NowPlayingComponent::_album_art_image
private

Album art image.

Definition at line 90 of file now_playing_component.h.

◆ _next_button

Gtk::Button* NowPlayingComponent::_next_button
private

Next track button.

Definition at line 97 of file now_playing_component.h.

◆ _play_pause_button

Gtk::Button* NowPlayingComponent::_play_pause_button
private

Play/pause button.

Definition at line 95 of file now_playing_component.h.

◆ _play_pause_image

Gtk::Image* NowPlayingComponent::_play_pause_image
private

The current image displayed on the play/pause button. It will either be a "play" icon or a "pause" icon.

Definition at line 101 of file now_playing_component.h.

◆ _prev_button

Gtk::Button* NowPlayingComponent::_prev_button
private

Previous track button.

Definition at line 94 of file now_playing_component.h.

◆ _seek_scale

Gtk::Scale* NowPlayingComponent::_seek_scale
private

Display for elapsed time.

Definition at line 93 of file now_playing_component.h.

◆ _signal_album_art

sig_album_art NowPlayingComponent::_signal_album_art
private

Emitted when the album art button is clicked.

Definition at line 104 of file now_playing_component.h.

◆ _signal_button

sig_button NowPlayingComponent::_signal_button
private

Emitted when a playback control button is clicked.

Definition at line 103 of file now_playing_component.h.

◆ _state

State NowPlayingComponent::_state
private

State of the component.

Definition at line 87 of file now_playing_component.h.

◆ _stop_button

Gtk::Button* NowPlayingComponent::_stop_button
private

Stop button.

Definition at line 96 of file now_playing_component.h.

◆ _track_artist_label

Gtk::Label* NowPlayingComponent::_track_artist_label
private

Track artist label.

Definition at line 92 of file now_playing_component.h.

◆ _track_title_label

Gtk::Label* NowPlayingComponent::_track_title_label
private

Track title label.

Definition at line 91 of file now_playing_component.h.


The documentation for this class was generated from the following files: