Sayonara Player
Loading...
Searching...
No Matches
AbstractStationPlugin.h
1/* GUI_AbstractStream.h */
2
3/* Copyright (C) 2011-2024 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_ConfigureStation.h"
26#include "Gui/Utils/PreferenceAction.h"
27#include "Utils/Pimpl.h"
28#include "Utils/Streams/Station.h"
29
31class PlaylistCreator;
32class QComboBox;
33class QPushButton;
34
35namespace Gui
36{
37 class MenuToolButton;
38
40 public PreferenceAction
41 {
42 Q_OBJECT
43
44 public:
45 explicit StreamPreferenceAction(QWidget* parent);
46 ~StreamPreferenceAction() override;
47
48 [[nodiscard]] QString identifier() const override;
49
50 protected:
51 [[nodiscard]] QString displayName() const override;
52 };
53
56 {
57 Q_OBJECT
59
60 public:
61 AbstractStationPlugin(PlaylistCreator* playlistCreator, AbstractStationHandler* stationHandler,
62 QWidget* parent = nullptr);
63 ~AbstractStationPlugin() override;
64
65 protected:
66 [[nodiscard]] virtual QComboBox* comboStream() = 0;
67 [[nodiscard]] virtual QPushButton* btnPlay() = 0;
68 [[nodiscard]] virtual MenuToolButton* btnMenu() = 0;
69 [[nodiscard]] virtual QString titleFallbackName() const = 0;
70 [[nodiscard]] virtual GUI_ConfigureStation* createConfigDialog() = 0;
71
72 void initUi() override;
73 void assignUiVariables() override;
74 void skinChanged() override;
75 void retranslate() override;
76 [[nodiscard]] bool hasLoadingBar() const override;
77
78 void addStream(const StationPtr& station, bool temporary);
79
80 private slots:
81 void listenClicked();
82 void currentIndexChanged(int index);
83 void newClicked();
84 void saveClicked();
85 void editClicked();
86 void deleteClicked();
87 void urlCountExceeded(int urlCount, int maxUrlCount);
88 void errorReceived();
89
90 private: // NOLINT(readability-redundant-access-specifiers)
91 void showConfigDialog(const QString& name, const StationPtr& station,
92 GUI_ConfigureStation::Mode mode,
93 std::function<bool(GUI_ConfigureStation*)>&& callback);
94 void saveStation(const StationPtr& station);
95 void initConnections();
96 void setupStations();
97 void restorePreviousIndex(const QString& name);
98 void stopSearching();
99 [[nodiscard]] QString currentName() const;
100 [[nodiscard]] QString currentUrl() const;
101 void setSearching(bool b);
102
103 virtual void play(const QString& stationName);
104
105 };
106}
107
108#endif // GUI_ABSTRACT_STREAM_H_
Definition AbstractStationHandler.h:35
Definition GUI_ConfigureStation.h:33
Definition AbstractStationPlugin.h:56
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
Definition AbstractStationPlugin.h:41
Definition PlayerPluginBase.h:40
virtual QString name() const =0
must be overwritten
Definition PlaylistInterface.h:57