Sayonara Player
GUI_ControlsBase.h
1/* GUI_ControlsBase.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_CONTROLSBASE_H
22#define GUI_CONTROLSBASE_H
23
24#include "Interfaces/Engine/CoverDataReceiver.h"
25
26#include "Gui/InfoDialog/InfoDialogContainer.h"
27#include "Gui/Utils/Widgets/Widget.h"
28#include "Gui/Utils/Icons.h"
29
30#include "Utils/MetaData/RadioMode.h"
31#include "Utils/Pimpl.h"
32
33class QLabel;
34class QSlider;
35class QPushButton;
36
38class PlayManager;
39
40namespace Gui
41{
42 class CoverButton;
43 class SearchSlider;
44 class ProgressBar;
45 class RatingEditor;
46}
47
49 public Gui::Widget,
52{
53 Q_OBJECT
54 PIMPL(GUI_ControlsBase)
55
56 public:
57 GUI_ControlsBase(PlayManager* playManager, CoverDataProvider* coverProvider, QWidget* parent = nullptr);
58 ~GUI_ControlsBase() override;
59 virtual void init();
60
61 [[nodiscard]] virtual QLabel* labSayonara() const = 0;
62 [[nodiscard]] virtual QLabel* labTitle() const = 0;
63 [[nodiscard]] virtual QLabel* labVersion() const = 0;
64 [[nodiscard]] virtual QLabel* labAlbum() const = 0;
65 [[nodiscard]] virtual QLabel* labArtist() const = 0;
66 [[nodiscard]] virtual QLabel* labWrittenBy() const = 0;
67 [[nodiscard]] virtual QLabel* labBitrate() const = 0;
68 [[nodiscard]] virtual QLabel* labFilesize() const = 0;
69 [[nodiscard]] virtual QLabel* labCopyright() const = 0;
70 [[nodiscard]] virtual QLabel* labCurrentTime() const = 0;
71 [[nodiscard]] virtual QLabel* labMaxTime() const = 0;
72 [[nodiscard]] virtual Gui::RatingEditor* labRating() const;
73 [[nodiscard]] virtual QWidget* widgetDetails() const = 0;
74
75 [[nodiscard]] virtual Gui::SearchSlider* sliProgress() const = 0;
76 [[nodiscard]] virtual Gui::SearchSlider* sliVolume() const = 0;
77 [[nodiscard]] virtual QPushButton* btnMute() const = 0;
78 [[nodiscard]] virtual QPushButton* btnPlay() const = 0;
79 [[nodiscard]] virtual QPushButton* btnRecord() const = 0;
80 [[nodiscard]] virtual QPushButton* btnPrevious() const = 0;
81 [[nodiscard]] virtual QPushButton* btnNext() const = 0;
82 [[nodiscard]] virtual QPushButton* btnStop() const = 0;
83 [[nodiscard]] virtual Gui::CoverButton* btnCover() const = 0;
84
85 [[nodiscard]] virtual bool isExternResizeAllowed() const = 0;
86
87 private:
88 QIcon icon(Gui::Icons::IconName name);
89
90 void played();
91 void paused();
92 void stopped();
93
94 void setCoverLocation(const MetaData& md);
95 void setStandardCover();
96
97 void setRadioMode(RadioMode radio);
98 void checkRecordButtonVisible();
99
100 void setupVolumeButton(int percent);
101 void increaseVolume();
102 void decreaseVolume();
103
104 void refreshCurrentPosition(int val);
105 void setTotalTimeLabel(MilliSeconds totalTimeMs);
106
107 void setupShortcuts();
108 void setupConnections();
109
110 public slots:
111 void changeVolumeByDelta(int val);
112 void setCoverData(const QByteArray& coverData, const QString& mimeType) override;
113
114 private slots:
115 void playstateChanged(PlayState state);
116
117 void recordChanged(bool b);
118
119 void buffering(int progress);
120
121 void currentPositionChanged(MilliSeconds posMs);
122 void progressMoved(int val);
123 void progressHovered(int val);
124
125 void volumeChanged(int val);
126 void muteChanged(bool muted);
127
128 void currentTrackChanged(const MetaData& track);
129 void metadataChanged();
130
131 void refreshLabels(const MetaData& md);
132 void refreshCurrentTrack();
133
134 // cover changed by engine
135 void coverClickRejected();
136
137 void streamRecorderActiveChanged();
138
139 protected:
140 [[nodiscard]] bool isActive() const override;
141 [[nodiscard]] MD::Interpretation metadataInterpretation() const override;
142 [[nodiscard]] MetaDataList infoDialogData() const override;
143 QWidget* getParentWidget() override;
144
145 void resizeEvent(QResizeEvent* e) override;
146 void showEvent(QShowEvent* e) override;
147 void contextMenuEvent(QContextMenuEvent* e) override;
148 void skinChanged() override;
149};
150
151#endif // GUI_CONTROLSBASE_H
Definition: CoverDataProvider.h:28
Definition: CoverDataReceiver.h:27
Definition: GUI_ControlsBase.h:52
MetaDataList infoDialogData() const override
get the metadata that should be used for the info dialog So for lists, the selected tracks are used h...
MD::Interpretation metadataInterpretation() const override
get the interpretation for the metadata. Maybe a list of metadata should be intrepeted as albums whil...
The CoverButton class.
Definition: CoverButton.h:40
This class is used for the actual editing of a RatingLabel While the RatingLabel class is used in pai...
Definition: RatingLabel.h:97
Definition: SearchSlider.h:35
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() \nT...
Definition: Widget.h:39
An interface used to abstract the usage of the info dialog. An implementing class has to return the i...
Definition: InfoDialogContainer.h:64
The MetaDataList class.
Definition: MetaDataList.h:39
The MetaData class.
Definition: MetaData.h:47
Global handler for current playback state (Singleton)
Definition: PlayManager.h:36
IconName
The IconName enum.
Definition: Icons.h:59
RadioMode
The RadioMode enum.
Definition: RadioMode.h:29