21 _app = Gtk::Application::create(
"com.nirjacobson.discman");
25 _builder->add_from_resource(
"/ui/discman.glade");
60 Gio::DBus::BusType::SYSTEM,
61 "org.freedesktop.login1",
62 "/org/freedesktop/login1",
63 "org.freedesktop.login1.Manager");
128 DiscDB::Disc::Builder builder;
130 for (
unsigned int i = 0; i <
_drive_manager.disc_drive().tracks(); i++) {
131 builder.track(DiscDB::Track::Builder()
136 const DiscDB::Disc disc = builder
141 _disc = DiscDB::find(disc);
159 Glib::signal_timeout().connect([
this]() {
221 _systemd_proxy->call_sync(
"PowerOff", Glib::VariantContainerBase::create_tuple(Glib::Variant<bool>::create(
false)));
Handles the interactions with the album art selection screen.
static constexpr int ART_SIZE
The width and height of art displayed on the album art selection screen.
virtual std::vector< AlbumArt > album_art(const std::string &artist, const std::string &title, const int width, const int height)=0
Return all album art matching the criteria, at a specific width and height.
static void destroy()
Destroys the AlbumArtProvider.
static AlbumArtProvider * instance()
Factory method to return the album art provider. It may be called one or more times....
AudioOutput< int16_t > * _audio_output
The audio output.
void on_album_art_button()
AlbumArtComponent done button handler.
void on_shutdown_button()
Shutdown button handler.
void on_album_art_done()
Called when the AlbumArtComponent done button is clicked.
void on_bluetooth_button()
Bluetooth button handler.
Glib::RefPtr< Gio::DBus::Proxy > _systemd_proxy
The systemd D-Bus proxy, used for host shutdown.
Gtk::Stack * _stack
Stack that switches between application screens.
sigc::connection _timer_connection
A connection of a timer to the callback that periodically checks the current track state.
void on_track_progress(unsigned int track, unsigned int progress)
Called when the CDRipper reports progress on a certain track.
NowPlayingComponent * _now_playing_component
Handles the left-hand side of the main application screen showing album art and current track.
Gtk::Box * _player_box
Box holding the main application screen.
void on_rip_done()
Called when the CDRipper reports it is done.
void eject(const DriveManager::Drive drive)
Instructs the DriveManager to eject a drive.
void on_button(const NowPlayingComponent::Button button)
Called when a playback control button (prev/next, play/pause, stop) is clicked.
void on_eject(DriveManager::Drive drive)
Called when a drive (disc or iPod/thumb drive) is removed.
DiscComponent * _disc_component
Handles the album labels, track listing and eject/rip buttons on the main application screen.
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.
Gtk::Button * _shutdown_button
Shutdown button.
Gtk::Window * _window
Reference to the application window.
std::string _album_art_url
The URL of the currently displayed album art.
bool on_timeout()
Called when the track monitoring timer reaches zero.
DriveManager _drive_manager
Drive manager.
~Application()
Application destructor.
Application(int argc, char **argv)
Application constructor.
DiscDB::Disc _disc
The Disc returned by DiscDB for the inserted CD.
void on_track_selected(unsigned int track)
Called when a track is selected in the DiscComponent.
BluetoothComponent * _bluetooth_component
Handles the Bluetooth device selection screen.
void on_insert(DriveManager::Drive drive)
Called when a drive (disc or iPod/thumb drive) is inserted.
Gtk::Box * _bluetooth_box
Box holding the Bluetooth device selection screen.
void on_activate()
Called when _app is activated.
unsigned int _track
The current 1-based track being played.
Glib::RefPtr< Gtk::Application > _app
The underlying Gtk::Application.
Glib::RefPtr< Gtk::Builder > _builder
The builder initialized with the Discman UI.
void pause()
Pause handler.
char ** _argv
The application arguments.
int _argc
The application argument count.
void on_album_art_art(const std::string url)
Called when album art is selected in the AlbumArtComponent.
AlbumArtComponent * _album_art_component
Handles the album art selection screen.
void on_bluetooth_connected()
Called when the user connects to a Bluetooth device.
Gtk::Box * _album_art_box
Box holding the album art selection screen.
CDRipper * _ripper
CD ripper.
void on_bluetooth_done()
Called when the BluetoothComponent done button is clicked.
Abstracts PortAudio using a given audio sample data type.
Handles the interactions with the Bluetooth device selection screen.
static constexpr int BUFFER_SIZE_PLAYING
The audio buffer size when playing, in CD audio frames.
static constexpr int BUFFER_SIZE_RIPPING
The audio buffer size when ripping, in CD audio frames.
Rips CDs and individual tracks to M4A files.
Handles the interactions with the album labels, track listing and ipod/eject buttons.
Drive
The two drives supported.
Handles the interactions with the "now playing" side of the main screen.
Button
Playback control button identifiers.