Sayonara Player
GUI_AbstractStream.h
1 /* GUI_AbstractStream.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_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 private slots:
75  void edit_finished();
76  void new_finished();
77 
78 protected slots:
79  void listen_clicked();
80  void combo_idx_changed(int idx);
81 
82  void new_clicked();
83  void save_clicked();
84  void edit_clicked();
85  void delete_clicked();
86 
87  void too_many_urls_found(int n_urls, int n_max_urls);
88 
89  void stopped();
90  void error();
91  void data_available();
92  void _sl_skin_changed();
93 
94 
95 protected:
96  virtual QComboBox* combo_stream()=0;
97  virtual QPushButton* btn_play()=0;
98  virtual MenuToolButton* btn_menu()=0;
99  virtual AbstractStreamHandler* stream_handler() const=0;
100  virtual QString url() const;
101  QString current_station() const;
102  void add_stream(const QString& name, const QString& url, bool keep_old=true);
103 
104 private:
105  PIMPL(GUI_AbstractStream)
106 
107  void assign_ui_vars() override;
108 
109  void init_connections();
110  void setup_stations();
111 
112  void set_searching(bool searching);
113 
114  virtual void init_ui() override;
115 };
116 
117 #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:29
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