Sayonara Player
GUI_AbstractStream.h
1 /* GUI_AbstractStream.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 #ifndef GUI_ABSTRACT_STREAM_H_
22 #define GUI_ABSTRACT_STREAM_H_
23 
24 #include "Interfaces/PlayerPlugin/PlayerPluginBase.h"
25 #include "GUI/Utils/PreferenceAction.h"
26 #include "Utils/Pimpl.h"
27 
28 class QComboBox;
29 class QPushButton;
30 class QLineEdit;
31 class QLabel;
32 class MenuToolButton;
34 
36  public PreferenceAction
37 {
38  Q_OBJECT
39 
40 public:
41  StreamPreferenceAction(QWidget* parent);
43 
44  QString identifier() const override;
45 
46 protected:
47  QString display_name() const override;
48 };
49 
51  public PlayerPlugin::Base
52 {
53  Q_OBJECT
54 
55 public:
56  explicit GUI_AbstractStream(QWidget* parent=nullptr);
57  virtual ~GUI_AbstractStream();
58 
59 protected:
60  virtual void retranslate_ui() override;
61  virtual void play(QString url, QString station_name);
62 
63  virtual QString get_title_fallback_name() const=0;
64 
65  bool has_loading_bar() const override;
66 
67  template<typename T, typename UiType>
68  void setup_parent(T* subclass, UiType** uiptr)
69  {
70  PlayerPlugin::Base::setup_parent(subclass, uiptr);
71  GUI_AbstractStream::init_ui();
72  }
73 
74 protected slots:
75  void listen_clicked();
76  void combo_idx_changed(int idx);
77  void new_clicked();
78  void delete_clicked();
79  void save_clicked();
80  void rename_clicked();
81  void text_changed(const QString& str);
82  void too_many_urls_found(int n_urls, int n_max_urls);
83 
84  void stopped();
85  void error();
86  void data_available();
87  void _sl_skin_changed();
88 
89 
90 protected:
91  virtual QLineEdit* le_url()=0;
92  virtual QComboBox* combo_stream()=0;
93  virtual QPushButton* btn_play()=0;
94  virtual MenuToolButton* btn_menu()=0;
95  virtual QLabel* lab_listen()=0;
96  virtual AbstractStreamHandler* stream_handler() const=0;
97 
98 
99 private:
100  PIMPL(GUI_AbstractStream)
101 
102  void assign_ui_vars() override;
103 
104  void init_connections();
105  void setup_stations();
106 
107  void set_le_url(QLineEdit* le_url);
108  void set_combo_stream(QComboBox* le_combo_stream);
109  void set_btn_play(QPushButton* btn_play);
110  void set_btn_tool(MenuToolButton* btn_tool);
111  void set_lab_listen(QLabel* lab_listen);
112 
113  void set_searching(bool searching);
114 
115  virtual void init_ui() override;
116 };
117 
118 #endif // GUI_ABSTRACT_STREAM_H_
Definition: GUI_AbstractStream.h:50
Definition: PlayerPluginBase.h:39
Definition: GUI_AbstractStream.h:35
bool has_loading_bar() const override
indicates if the widget has a loading bar. If yes, there will be reserved some extra space at the bot...
Definition: PreferenceAction.h:30
This is the little button you often see near comboboxes It opens up a menu when clicked. The actions in the menu a configurable.
Definition: MenuTool.h:36
Used to interprete website data as streams. Some methods have to be overridden, to map their function...
Definition: AbstractStreamHandler.h:37