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

Captures the Discman application global scope. More...

#include <application.h>

Collaboration diagram for Application:

Public Member Functions

 Application (int argc, char **argv)
 Application constructor.
 
 ~Application ()
 Application destructor.
 
void run ()
 Runs Discman.
 

Private Member Functions

void on_activate ()
 Called when _app is activated.
 
void on_insert (DriveManager::Drive drive)
 Called when a drive (disc or iPod/thumb drive) is inserted.
 
void on_eject (DriveManager::Drive drive)
 Called when a drive (disc or iPod/thumb drive) is removed.
 
void on_bluetooth_connected ()
 Called when the user connects to a Bluetooth device.
 
void on_bluetooth_done ()
 Called when the BluetoothComponent done button is clicked.
 
void on_track_progress (unsigned int track, unsigned int progress)
 Called when the CDRipper reports progress on a certain track.
 
void on_rip_done ()
 Called when the CDRipper reports it is done.
 
void on_album_art_done ()
 Called when the AlbumArtComponent done button is clicked.
 
void on_album_art_art (const std::string url)
 Called when album art is selected in the AlbumArtComponent.
 
void on_track_selected (unsigned int track)
 Called when a track is selected in the DiscComponent.
 
void on_button (const NowPlayingComponent::Button button)
 Called when a playback control button (prev/next, play/pause, stop) is clicked.
 
void on_album_art_button ()
 AlbumArtComponent done button handler.
 
void on_bluetooth_button ()
 Bluetooth button handler.
 
void on_shutdown_button ()
 Shutdown button handler.
 
bool on_timeout ()
 Called when the track monitoring timer reaches zero.
 
void eject (const DriveManager::Drive drive)
 Instructs the DriveManager to eject a drive.
 
void rip (unsigned int track)
 Instructs the CDRipper to begin ripping one specific track.
 
void query_discdb ()
 Queries DiscDB for the full information of the disc inserted.
 
Playback control button handlers

Individual handlers called by on_button().

void on_prev ()
 Previous button handler.
 
void on_playpause ()
 Play/pause button handler.
 
void on_stop ()
 Stop button handler.
 
void on_next ()
 Next button handler.
 
Playback control handlers

Delegates called by the control button handlers.

void play (unsigned int track)
 Play track handler (used for previous/next).
 
void play ()
 Play handler.
 
void pause ()
 Pause handler.
 
void stop ()
 Stop handler.
 

Private Attributes

int _argc
 The application argument count.
 
char ** _argv
 The application arguments.
 
Glib::RefPtr< Gtk::Builder > _builder
 The builder initialized with the Discman UI.
 
Glib::RefPtr< Gtk::Application > _app
 The underlying Gtk::Application.
 
Gtk::Window * _window
 Reference to the application window.
 
DriveManager _drive_manager
 Drive manager.
 
CDRipper_ripper
 CD ripper.
 
DiscDB::Disc _disc
 The Disc returned by DiscDB for the inserted CD.
 
AudioOutput< int16_t > * _audio_output
 The audio output.
 
unsigned int _track
 The current 1-based track being played.
 
std::string _album_art_url
 The URL of the currently displayed album art.
 
Glib::RefPtr< Gio::DBus::Proxy > _systemd_proxy
 The systemd D-Bus proxy, used for host shutdown.
 
sigc::connection _timer_connection
 A connection of a timer to the callback that periodically checks the current track state.
 
Gtk::Button * _shutdown_button
 Shutdown button.
 
Top-level widgets

The application maintains references to some top-level widgets.

Gtk::Stack * _stack
 Stack that switches between application screens.
 
Gtk::Box * _player_box
 Box holding the main application screen.
 
Gtk::Box * _bluetooth_box
 Box holding the Bluetooth device selection screen.
 
Gtk::Box * _album_art_box
 Box holding the album art selection screen.
 
Components

A component is responsible for managing interactions with a subset of the widgets available on a particular application screen.

DiscComponent_disc_component
 Handles the album labels, track listing and eject/rip buttons on the main application screen.
 
NowPlayingComponent_now_playing_component
 Handles the left-hand side of the main application screen showing album art and current track.
 
BluetoothComponent_bluetooth_component
 Handles the Bluetooth device selection screen.
 
AlbumArtComponent_album_art_component
 Handles the album art selection screen.
 

Detailed Description

Captures the Discman application global scope.

Definition at line 39 of file application.h.

Constructor & Destructor Documentation

◆ Application()

Application::Application ( int argc,
char ** argv )

Application constructor.

Parameters
[in]argcArgument count.
[in]argvArguments.

Definition at line 9 of file application.cc.

◆ ~Application()

Application::~Application ( )

Application destructor.

Definition at line 66 of file application.cc.

Member Function Documentation

◆ eject()

void Application::eject ( const DriveManager::Drive drive)
private

Instructs the DriveManager to eject a drive.

Parameters
[in]driveThe drive to eject.

Definition at line 261 of file application.cc.

◆ on_activate()

void Application::on_activate ( )
private

Called when _app is activated.

Definition at line 144 of file application.cc.

◆ on_album_art_art()

void Application::on_album_art_art ( const std::string url)
private

Called when album art is selected in the AlbumArtComponent.

Definition at line 175 of file application.cc.

◆ on_album_art_button()

void Application::on_album_art_button ( )
private

AlbumArtComponent done button handler.

Definition at line 154 of file application.cc.

◆ on_album_art_done()

void Application::on_album_art_done ( )
private

Called when the AlbumArtComponent done button is clicked.

Definition at line 171 of file application.cc.

◆ on_bluetooth_button()

void Application::on_bluetooth_button ( )
private

Bluetooth button handler.

Definition at line 149 of file application.cc.

◆ on_bluetooth_connected()

void Application::on_bluetooth_connected ( )
private

Called when the user connects to a Bluetooth device.

Definition at line 158 of file application.cc.

◆ on_bluetooth_done()

void Application::on_bluetooth_done ( )
private

Called when the BluetoothComponent done button is clicked.

Definition at line 166 of file application.cc.

◆ on_button()

void Application::on_button ( const NowPlayingComponent::Button button)
private

Called when a playback control button (prev/next, play/pause, stop) is clicked.

Parameters
[in]buttonthe button clicked.

Definition at line 184 of file application.cc.

◆ on_eject()

void Application::on_eject ( DriveManager::Drive drive)
private

Called when a drive (disc or iPod/thumb drive) is removed.

Parameters
[in]driveThe drive removed (disc or iPod/thumb drive).

Definition at line 111 of file application.cc.

◆ on_insert()

void Application::on_insert ( DriveManager::Drive drive)
private

Called when a drive (disc or iPod/thumb drive) is inserted.

Parameters
[in]driveThe drive inserted (disc or iPod/thumb drive).

Definition at line 87 of file application.cc.

◆ on_next()

void Application::on_next ( )
private

Next button handler.

◆ on_playpause()

void Application::on_playpause ( )
private

Play/pause button handler.

◆ on_prev()

void Application::on_prev ( )
private

Previous button handler.

◆ on_rip_done()

void Application::on_rip_done ( )
private

Called when the CDRipper reports it is done.

Definition at line 300 of file application.cc.

◆ on_shutdown_button()

void Application::on_shutdown_button ( )
private

Shutdown button handler.

Definition at line 220 of file application.cc.

◆ on_stop()

void Application::on_stop ( )
private

Stop button handler.

◆ on_timeout()

bool Application::on_timeout ( )
private

Called when the track monitoring timer reaches zero.

Definition at line 205 of file application.cc.

◆ on_track_progress()

void Application::on_track_progress ( unsigned int track,
unsigned int progress )
private

Called when the CDRipper reports progress on a certain track.

Parameters
[in]trackthe 1-based index of the track.
[in]progressthe current percentage completion of the track.

Definition at line 296 of file application.cc.

◆ on_track_selected()

void Application::on_track_selected ( unsigned int track)
private

Called when a track is selected in the DiscComponent.

Parameters
[in]trackthe 1-based index of the track.

Definition at line 180 of file application.cc.

◆ pause()

void Application::pause ( )
private

Pause handler.

See also
on_playpause().

Definition at line 246 of file application.cc.

◆ play() [1/2]

void Application::play ( )
private

Play handler.

See also
on_playpause().

Definition at line 236 of file application.cc.

◆ play() [2/2]

void Application::play ( unsigned int track)
private

Play track handler (used for previous/next).

See also
on_prev(), on_next().
Parameters
trackthe 1-base index of the track to play.

Definition at line 224 of file application.cc.

◆ query_discdb()

void Application::query_discdb ( )
private

Queries DiscDB for the full information of the disc inserted.

Definition at line 127 of file application.cc.

◆ rip()

void Application::rip ( unsigned int track)
private

Instructs the CDRipper to begin ripping one specific track.

Parameters
[in]trackThe 1-based index of the track.

Definition at line 271 of file application.cc.

◆ run()

void Application::run ( )

Runs Discman.

Definition at line 83 of file application.cc.

◆ stop()

void Application::stop ( )
private

Stop handler.

See also
on_stop().

Definition at line 252 of file application.cc.

Member Data Documentation

◆ _album_art_box

Gtk::Box* Application::_album_art_box
private

Box holding the album art selection screen.

Definition at line 79 of file application.h.

◆ _album_art_component

AlbumArtComponent* Application::_album_art_component
private

Handles the album art selection screen.

Definition at line 91 of file application.h.

◆ _album_art_url

std::string Application::_album_art_url
private

The URL of the currently displayed album art.

Definition at line 66 of file application.h.

◆ _app

Glib::RefPtr<Gtk::Application> Application::_app
private

The underlying Gtk::Application.

Definition at line 59 of file application.h.

◆ _argc

int Application::_argc
private

The application argument count.

Definition at line 55 of file application.h.

◆ _argv

char** Application::_argv
private

The application arguments.

Definition at line 56 of file application.h.

◆ _audio_output

AudioOutput<int16_t>* Application::_audio_output
private

The audio output.

Definition at line 64 of file application.h.

◆ _bluetooth_box

Gtk::Box* Application::_bluetooth_box
private

Box holding the Bluetooth device selection screen.

Definition at line 78 of file application.h.

◆ _bluetooth_component

BluetoothComponent* Application::_bluetooth_component
private

Handles the Bluetooth device selection screen.

Definition at line 90 of file application.h.

◆ _builder

Glib::RefPtr<Gtk::Builder> Application::_builder
private

The builder initialized with the Discman UI.

Definition at line 58 of file application.h.

◆ _disc

DiscDB::Disc Application::_disc
private

The Disc returned by DiscDB for the inserted CD.

Definition at line 63 of file application.h.

◆ _disc_component

DiscComponent* Application::_disc_component
private

Handles the album labels, track listing and eject/rip buttons on the main application screen.

Definition at line 88 of file application.h.

◆ _drive_manager

DriveManager Application::_drive_manager
private

Drive manager.

Definition at line 61 of file application.h.

◆ _now_playing_component

NowPlayingComponent* Application::_now_playing_component
private

Handles the left-hand side of the main application screen showing album art and current track.

Definition at line 89 of file application.h.

◆ _player_box

Gtk::Box* Application::_player_box
private

Box holding the main application screen.

Definition at line 77 of file application.h.

◆ _ripper

CDRipper* Application::_ripper
private

CD ripper.

Definition at line 62 of file application.h.

◆ _shutdown_button

Gtk::Button* Application::_shutdown_button
private

Shutdown button.

Definition at line 94 of file application.h.

◆ _stack

Gtk::Stack* Application::_stack
private

Stack that switches between application screens.

Definition at line 76 of file application.h.

◆ _systemd_proxy

Glib::RefPtr<Gio::DBus::Proxy> Application::_systemd_proxy
private

The systemd D-Bus proxy, used for host shutdown.

Definition at line 68 of file application.h.

◆ _timer_connection

sigc::connection Application::_timer_connection
private

A connection of a timer to the callback that periodically checks the current track state.

Definition at line 70 of file application.h.

◆ _track

unsigned int Application::_track
private

The current 1-based track being played.

Definition at line 65 of file application.h.

◆ _window

Gtk::Window* Application::_window
private

Reference to the application window.

Definition at line 60 of file application.h.


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