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 virtual ~GUI_ControlsBase() override;
59 virtual void init();
60
61 virtual QLabel* labSayonara() const = 0;
62 virtual QLabel* labTitle() const = 0;
63 virtual QLabel* labVersion() const = 0;
64 virtual QLabel* labAlbum() const = 0;
65 virtual QLabel* labArtist() const = 0;
66 virtual QLabel* labWrittenBy() const = 0;
67 virtual QLabel* labBitrate() const = 0;
68 virtual QLabel* labFilesize() const = 0;
69 virtual QLabel* labCopyright() const = 0;
70 virtual QLabel* labCurrentTime() const = 0;
71 virtual QLabel* labMaxTime() const = 0;
72 virtual Gui::RatingEditor* labRating() const;
73 virtual QWidget* widgetDetails() const = 0;
74
75 virtual Gui::SearchSlider* sliProgress() const = 0;
76 virtual Gui::SearchSlider* sliVolume() const = 0;
77 virtual QPushButton* btnMute() const = 0;
78 virtual QPushButton* btnPlay() const = 0;
79 virtual QPushButton* btnRecord() const = 0;
80 virtual QPushButton* btnPrevious() const = 0;
81 virtual QPushButton* btnNext() const = 0;
82 virtual QPushButton* btnStop() const = 0;
83 virtual Gui::CoverButton* btnCover() const = 0;
84
85 virtual QSize buttonSize() const final;
86 virtual bool isExternResizeAllowed() const = 0;
87
88 private:
89 QIcon icon(Gui::Icons::IconName name);
90
91 void played();
92 void paused();
93 void stopped();
94
95 void setCoverLocation(const MetaData& md);
96 void setStandardCover();
97
98 void setRadioMode(RadioMode radio);
99 void checkRecordButtonVisible();
100
101 void setupVolumeButton(int percent);
102 void increaseVolume();
103 void decreaseVolume();
104
105 void refreshCurrentPosition(int val);
106 void setTotalTimeLabel(MilliSeconds totalTimeMs);
107
108 void setupShortcuts();
109 void setupConnections();
110
111 public slots:
112 void changeVolumeByDelta(int val);
113 void setCoverData(const QByteArray& coverData, const QString& mimeType) override;
114 bool isActive() const override;
115
116 private slots:
117 void playstateChanged(PlayState state);
118
119 void recordChanged(bool b);
120
121 void buffering(int progress);
122
123 void currentPositionChanged(MilliSeconds posMs);
124 void progressMoved(int val);
125 void progressHovered(int val);
126
127 void volumeChanged(int val);
128 void muteChanged(bool muted);
129
130 void currentTrackChanged(const MetaData& track);
131 void metadataChanged();
132
133 void refreshLabels(const MetaData& md);
134 void refreshCurrentTrack();
135
136 // cover changed by engine
137 void coverClickRejected();
138
139 void streamRecorderActiveChanged();
140
141 protected:
142 MD::Interpretation metadataInterpretation() const override;
143 MetaDataList infoDialogData() const override;
144 QWidget* getParentWidget() override;
145
146 void resizeEvent(QResizeEvent* e) override;
147 void showEvent(QShowEvent* e) override;
148 void contextMenuEvent(QContextMenuEvent* e) override;
149 void skinChanged() override;
150};
151
152#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
A slider as it is used by the progress bar You can also set a different value by calling set_bufferin...
Definition: SearchSlider.h:41
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:37
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