Discman
Loading...
Searching...
No Matches
disc_component.h
Go to the documentation of this file.
1
6
7#ifndef DISC_COMPONENT_H
8#define DISC_COMPONENT_H
9
10#include <glibmm.h>
11#include <pangomm/layout.h>
12#include <giomm/menu.h>
13#include <giomm/simpleactiongroup.h>
14#include <gtkmm/builder.h>
15#include <gtkmm/menubutton.h>
16#include <gtkmm/button.h>
17#include <gtkmm/label.h>
18#include <gtkmm/treeview.h>
19#include <gtkmm/treemodel.h>
20#include <gtkmm/liststore.h>
21#include <gtkmm/cellrendererprogress.h>
22#include <gtkmm/stack.h>
23#include <gtkmm/window.h>
24#include <sigc++/signal.h>
25#include <sstream>
26#include <iostream>
27#include <iomanip>
28
29#include <discdb/disc.h>
30
32#include "component.h"
33
35class DiscComponent : public Component {
36 public:
38 typedef sigc::signal<void(DriveManager::Drive)> sig_eject_requested;
39
41 typedef sigc::signal<void(unsigned int)> sig_track_selected;
42
44 typedef sigc::signal<void(unsigned int)> sig_rip_requested;
45
49 DiscComponent(DriveManager& drive_manager, Glib::RefPtr<Gtk::Builder> builder);
50
53
56 void set_disc(const DiscDB::Disc* const disc);
57
59 void clear_selection();
60
63 void set_selection(unsigned int track);
64
67 void show_progress(const bool show);
68
73 void update_track_progress(unsigned int track, unsigned int progress);
74
77 void show_ipod_button(const bool show);
78
81 void enable_ipod_button(const bool enable);
82
85 void enable_eject_button(const bool enable);
86
90 void show_double_eject_button(const bool show);
91
95
96 private:
97
99 class TracksListColumnRecord : public Gtk::TreeModel::ColumnRecord {
100 public:
102 this->add(this->number_column);
103 this->add(this->title_column);
104 this->add(this->progress_column);
105 this->add(this->length_column);
106 }
107
108 Gtk::TreeModelColumn<guint> number_column;
109 Gtk::TreeModelColumn<Glib::ustring> title_column;
110 Gtk::TreeModelColumn<int> progress_column;
111 Gtk::TreeModelColumn<Glib::ustring> length_column;
112 };
113
116
117 Gtk::Label* _album_label;
119
120 Gtk::Button* _eject_button;
122 Gtk::MenuButton* _double_eject_button;
123 Glib::RefPtr<Gio::Menu> _double_eject_button_menu;
124 Glib::RefPtr<Gio::SimpleActionGroup> _eject_action_group;
125
126 Gtk::Button* _ipod_button;
127 Gtk::TreeView* _tracks_tree_view;
128 Glib::RefPtr<Gtk::ListStore> _tracks_list_store;
129
133
136 void on_eject(const DriveManager::Drive drive);
139
142 void on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column*);
143};
144
145#endif // DISC_COMPONENT_H
Gtk::TreeModelColumn< Glib::ustring > title_column
Track title column.
Gtk::TreeModelColumn< Glib::ustring > length_column
Track length column.
Gtk::TreeModelColumn< int > progress_column
Track rip progress column.
Gtk::TreeModelColumn< guint > number_column
Track number column.
void enable_eject_button(const bool enable)
Enables or disables the normal eject button.
Gtk::Button * _eject_button
Normal eject button.
sig_track_selected signal_track_selected()
Getter for _signal_track_selected.
void set_disc(const DiscDB::Disc *const disc)
Sets the DiscDB::Disc containing all information about the inserted disc.
void show_ipod_button(const bool show)
Shows or hides the iPod button (rip button).
Gtk::Label * _album_label
Label displaying the album title.
sig_eject_requested signal_eject_requested()
Getter for _signal_eject_requested.
sig_rip_requested _signal_rip_requested
Emitted when the iPod (rip) button is clicked.
~DiscComponent()
DiscComponent destructor.
void enable_ipod_button(const bool enable)
Enables or disables the iPod button (rip button).
void show_progress(const bool show)
Shows or hides the rip progress column in the track listing.
Gtk::MenuButton * _double_eject_button
Eject button with disc/iPod selection.
sig_eject_requested _signal_eject_requested
Emitted when an eject button is used.
void on_eject_button_clicked()
Called when the normal eject button is clicked.
sigc::signal< void(unsigned int)> sig_track_selected
"Track selected" signal type.
void on_row_activated(const Gtk::TreeModel::Path &path, Gtk::TreeView::Column *)
Called when a track is double-clicked in the track list.
void on_ipod_button_clicked()
Called when the iPod (rip) button is clicked.
void on_eject(const DriveManager::Drive drive)
Called after successful ejection of a drive.
Gtk::TreeView * _tracks_tree_view
Shows the track list.
Gtk::Button * _ipod_button
Shown when the iPod is connected, enabled when ripping is possible.
Gtk::Stack * _eject_button_stack
Stack that switches between eject buttons.
void set_selection(unsigned int track)
Sets the selection in the track listing.
sigc::signal< void(unsigned int)> sig_rip_requested
"Rip requested" signal type.
DriveManager & _drive_manager
Used to eject the disc.
Glib::RefPtr< Gio::SimpleActionGroup > _eject_action_group
Action group for disc/iPod eject button menu.
sig_track_selected _signal_track_selected
Emitted when a track is double-clicked in the track list.
void clear_selection()
Clears the selection in the track listing.
Glib::RefPtr< Gio::Menu > _double_eject_button_menu
Disc/iPod eject button selection menu.
void update_track_progress(unsigned int track, unsigned int progress)
Updates the percentage completion in the track listing for a given track with a given percentage.
sig_rip_requested signal_rip_requested()
Getter for _signal_rip_requested.
DiscComponent(DriveManager &drive_manager, Glib::RefPtr< Gtk::Builder > builder)
DiscComponent constructor.
Gtk::Label * _album_artist_label
Label displaying the album artist.
sigc::signal< void(DriveManager::Drive)> sig_eject_requested
"Drive eject requested" signal type.
void show_double_eject_button(const bool show)
Switches between the normal eject button and the eject button with disc/iPod selection.
Glib::RefPtr< Gtk::ListStore > _tracks_list_store
Track list model.
Manages the state of the disc drive and any removable (iPod) drive.
Drive
The two drives supported.