Sayonara Player
GUI_Controls.h
1 /* GUI_Controls.h */
2 
3 /* Copyright (C) 2011-2017 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 
22 
23 #ifndef GUI_CONTROLS_H
24 #define GUI_CONTROLS_H
25 
26 #include <QWidget>
27 
28 #include "Components/PlayManager/PlayState.h"
29 
30 #include "Utils/Pimpl.h"
31 #include "Utils/MetaData/RadioMode.h"
32 
33 #include "GUI/Utils/Shortcuts/ShortcutWidget.h"
34 #include "GUI/Utils/Widgets/Widget.h"
35 #include "GUI/InfoDialog/InfoDialogContainer.h"
36 #include "GUI/Utils/Icons.h"
37 
38 UI_FWD(GUI_Controls)
39 
40 class MetaData;
41 class MetaDataList;
42 
43 class GUI_Controls :
44  public Gui::Widget,
45  public ShortcutWidget,
46  public InfoDialogContainer
47 {
48  Q_OBJECT
49  PIMPL(GUI_Controls)
50  UI_CLASS(GUI_Controls)
51 
52 private:
53  QIcon icon(Gui::Icons::IconName name);
54 
55  void played();
56  void paused();
57  void stopped();
58 
59  void check_record_button_visible();
60 
61  void set_cover_location(const MetaData &md);
62  void set_standard_cover();
63  void set_radio_mode(RadioMode radio);
64 
65  void setup_volume_button(int percent);
66  void increase_volume();
67  void decrease_volume();
68 
69  void set_cur_pos_label(int val);
70  void set_total_time_label(int64_t total_time);
71  void set_info_labels(const MetaData &md);
72  void refresh_info_labels();
73 
74  void setup_shortcuts();
75  void setup_connections();
76 
77 
78 protected:
79  void resizeEvent(QResizeEvent* e) override;
80  void showEvent(QShowEvent* e) override;
81  void contextMenuEvent(QContextMenuEvent* e) override;
82 
83 public:
84  explicit GUI_Controls(QWidget *parent = 0);
85  ~GUI_Controls();
86 
87  QString get_shortcut_text(const QString &shortcut_identifier) const override;
88  void language_changed() override;
89  void skin_changed() override;
90 
91  void file_info_changed();
92  void sr_active_changed();
93 
94 public slots:
95  void change_volume_by_tick(int val);
96 
97 private slots:
98  void playstate_changed(PlayState state);
99 
100  void play_clicked();
101  void stop_clicked();
102 
103  void prev_clicked();
104  void next_clicked();
105 
106  void rec_clicked(bool b);
107  void rec_changed(bool b);
108 
109  void buffering(int progress);
110 
111  void cur_pos_changed(uint64_t pos_ms);
112  void progress_moved(int val);
113  void progress_hovered(int val);
114 
115  void volume_slider_moved(int val);
116  void volume_changed(int val);
117 
118  void mute_button_clicked();
119  void mute_changed(bool muted);
120 
121  void track_changed(const MetaData& md);
122  void id3_tags_changed(const MetaDataList &v_md_old, const MetaDataList &v_md_new);
123  void md_changed(const MetaData &md);
124  void dur_changed(const MetaData &md);
125  void br_changed(const MetaData &md);
126 
127  // cover changed by engine
128  void force_cover(const QImage &img);
129 
130 
131  // InfoDialogContainer interface
132 protected:
133  MD::Interpretation metadata_interpretation() const override;
134  MetaDataList info_dialog_data() const override;
135 };
136 
137 #endif // GUI_CONTROLS_H
An interface used to abstract the usage of the info dialog. An implementing class has to return the i...
Definition: InfoDialogContainer.h:36
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...
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:48
RadioMode
The RadioMode enum.
Definition: RadioMode.h:30
The MetaDataList class.
Definition: MetaDataList.h:38
Definition: GUI_Controls.h:43
MD::Interpretation metadata_interpretation() const override
get the interpretation for the metadata. Maybe a list of metadata should be intrepeted as albums whil...
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: Widget.h:38
Interface that should be implemented when using configurable shortcuts.
Definition: ShortcutWidget.h:30