Sayonara Player
AbstractStationPlugin.h
1 /* GUI_AbstractStream.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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 "Gui/Plugins/PlayerPluginBase.h"
25 #include "Gui/Utils/PreferenceAction.h"
26 #include "Utils/Pimpl.h"
27 #include "Utils/Streams/Station.h"
28 
29 class PlaylistCreator;
30 
31 class QComboBox;
32 class QPushButton;
33 class QLineEdit;
34 class QLabel;
37 
38 namespace Gui
39 {
40  class MenuToolButton;
41 
46  public PreferenceAction
47  {
48  Q_OBJECT
49 
50  public:
51  StreamPreferenceAction(QWidget* parent);
52  virtual ~StreamPreferenceAction() override;
53 
54  QString identifier() const override;
55 
56  protected:
57  QString displayName() const override;
58  };
59 
61  public PlayerPlugin::Base
62  {
63  Q_OBJECT
65 
66  public:
67  explicit AbstractStationPlugin(PlaylistCreator* playlistCreator, QWidget* parent=nullptr);
68  virtual ~AbstractStationPlugin() override;
69 
70  protected:
71  virtual void retranslate() override;
72  virtual void play(const QString& station_name);
73 
74  bool hasLoadingBar() const override;
75 
76  template<typename T, typename UiType>
77  void setup_parent(T* subclass, UiType** uiptr)
78  {
79  PlayerPlugin::Base::setupParent(subclass, uiptr);
81  }
82 
83  protected slots:
84  void listenClicked();
85  void currentIndexChanged(int idx);
86 
87  void newClicked();
88  void saveClicked();
89  void editClicked();
90  void deleteClicked();
91 
92  void urlCountExceeded(int urlCount, int maxUrlCount);
93 
94  void stopped();
95  void error();
96  void dataAvailable();
97 
98  private slots:
99  void configFinished();
100 
101  protected:
102  virtual QComboBox* comboStream()=0;
103  virtual QPushButton* btnPlay()=0;
104  virtual MenuToolButton* btnMenu()=0;
105  virtual AbstractStationHandler* streamHandler() const=0;
106  virtual QString titleFallbackName() const=0;
107  virtual GUI_ConfigureStation* createConfigDialog()=0;
108 
109  virtual int addStream(const QString& name, const QString& url);
110 
111  virtual void initUi() override;
112  virtual void assignUiVariables() override;
113  virtual void skinChanged() override;
114 
115  private:
116  void initConnections();
117  void setupStations();
118  };
119 }
120 
121 #endif // GUI_ABSTRACT_STREAM_H_
Used to interprete website data as streams. Some methods have to be overridden, to map their function...
Definition: AbstractStationHandler.h:41
Definition: GUI_ConfigureStation.h:33
Definition: AbstractStationPlugin.h:62
virtual void initUi() override
GUI will be initialized on first show up. Please use this to make Sayonara starting fast.
bool hasLoadingBar() const override
indicates if the widget has a loading bar. If yes, there will be reserved some extra space at the bot...
This is the little button you often see near comboboxes It opens up a menu when clicked....
Definition: MenuToolButton.h:42
A PreferenceAction can be added to each widget supporting QActions. When triggering this action,...
Definition: PreferenceAction.h:40
Currently only a Radio Search Entry action.
Definition: AbstractStationPlugin.h:47
Definition: PlayerPluginBase.h:40
virtual QString name() const =0
must be overwritten
Definition: PlaylistInterface.h:56