Sayonara Player
GUI_ControlsBase.h
1 /* GUI_ControlsBase.h */
2 
3 /* Copyright (C) 2011-2019 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef GUI_CONTROLSBASE_H
22 #define GUI_CONTROLSBASE_H
23 
24 #include "Components/PlayManager/PlayState.h"
25 
26 #include "Gui/InfoDialog/InfoDialogContainer.h"
27 #include "Gui/Utils/Widgets/Widget.h"
28 #include "Gui/Utils/Icons.h"
29 
30 #include "Utils/MetaData/RadioMode.h"
31 #include "Utils/Pimpl.h"
32 
33 class QLabel;
34 class QSlider;
35 class QPushButton;
36 
37 namespace Gui
38 {
39  class CoverButton;
40  class SearchSlider;
41  class ProgressBar;
42  class RatingEditor;
43 }
44 
46  public Gui::Widget,
47  public InfoDialogContainer
48 {
49  Q_OBJECT
50  PIMPL(GUI_ControlsBase)
51 
52 public:
53  GUI_ControlsBase(QWidget* parent=nullptr);
54  virtual ~GUI_ControlsBase();
55  virtual void init();
56 
57  virtual QLabel* lab_sayonara() const=0;
58  virtual QLabel* lab_title() const=0;
59  virtual QLabel* lab_version() const=0;
60  virtual QLabel* lab_album() const=0;
61  virtual QLabel* lab_artist() const=0;
62  virtual QLabel* lab_writtenby() const=0;
63  virtual QLabel* lab_bitrate() const=0;
64  virtual QLabel* lab_filesize() const=0;
65  virtual QLabel* lab_copyright() const=0;
66  virtual QLabel* lab_current_time() const=0;
67  virtual QLabel* lab_max_time() const=0;
68  virtual Gui::RatingEditor* lab_rating() const;
69  virtual QWidget* widget_details() const=0;
70 
71  virtual Gui::SearchSlider* sli_progress() const=0;
72  virtual Gui::SearchSlider* sli_volume() const=0;
73  virtual QPushButton* btn_mute() const=0;
74  virtual QPushButton* btn_play() const=0;
75  virtual QPushButton* btn_rec() const=0;
76  virtual QPushButton* btn_bwd() const=0;
77  virtual QPushButton* btn_fwd() const=0;
78  virtual QPushButton* btn_stop() const=0;
79  virtual Gui::CoverButton* btn_cover() const=0;
80 
81  virtual QSize button_size() const final;
82  virtual bool is_extern_resize_allowed() const=0;
83 
84 private:
85  QIcon icon(Gui::Icons::IconName name);
86 
87  void played();
88  void paused();
89  void stopped();
90 
91  void set_cover_location(const MetaData& md);
92  void set_standard_cover();
93 
94  void set_radio_mode(RadioMode radio);
95  void check_record_button_visible();
96 
97  void setup_volume_button(int percent);
98  void increase_volume();
99  void decrease_volume();
100 
101  void refresh_current_position(int val);
102  void set_total_time_label(MilliSeconds total_time);
103 
104  void setup_shortcuts();
105  void setup_connections();
106 
107 
108 public slots:
109  void change_volume_by_tick(int val);
110 
111 private slots:
112  void playstate_changed(PlayState state);
113 
114  void rec_changed(bool b);
115 
116  void buffering(int progress);
117 
118  void cur_pos_changed(MilliSeconds pos_ms);
119  void progress_moved(int val);
120  void progress_hovered(int val);
121  void volume_changed(int val);
122 
123  void mute_changed(bool muted);
124 
125  void track_changed(const MetaData& md);
126  void id3_tags_changed();
127 
128  void refresh_labels(const MetaData& md);
129  void refresh_current_track();
130 
131  // cover changed by engine
132  void cover_changed(const QByteArray& data, const QString& mimedata);
133  void cover_click_rejected();
134 
135  void sr_active_changed();
136 
137 protected:
138 
139  MD::Interpretation metadata_interpretation() const override;
140  MetaDataList info_dialog_data() const override;
141 
142  void resizeEvent(QResizeEvent* e) override;
143  void showEvent(QShowEvent* e) override;
144  void contextMenuEvent(QContextMenuEvent* e) override;
145  void skin_changed() override;
146 };
147 
148 #endif // GUI_CONTROLSBASE_H
Definition: GUI_ControlsBase.h:45
MD::Interpretation metadata_interpretation() const override
get the interpretation for the metadata. Maybe a list of metadata should be intrepeted as albums whil...
An interface used to abstract the usage of the info dialog. An implementing class has to return the i...
Definition: InfoDialogContainer.h:61
Definition: AbstractLibrary.h:36
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:44
MetaDataList info_dialog_data() const override
get the metadata that should be used for the info dialog So for lists, the selected tracks are used h...
RadioMode
The RadioMode enum.
Definition: RadioMode.h:30
The MetaDataList class.
Definition: MetaDataList.h:37
The CoverButton class.
Definition: CoverButton.h:63
A slider as it is used by the progress bar You can also set a different value by calling set_bufferin...
Definition: SearchSlider.h:39
IconName
The IconName enum.
Definition: Icons.h:57
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: Widget.h:37
This class is used for the actual editing of a RatingLabel While the RatingLabel class is used in pai...
Definition: RatingLabel.h:96