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