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