Sayonara Player
Loading...
Searching...
No Matches
GUI_ControlsBase.h
1/* GUI_ControlsBase.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_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
48class GUI_ControlsBase :
49 public Gui::Widget,
50 public InfoDialogContainer,
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 Gui::SearchSlider* sliProgress() const = 0;
74 [[nodiscard]] virtual Gui::SearchSlider* sliVolume() const = 0;
75 [[nodiscard]] virtual QPushButton* btnMute() const = 0;
76 [[nodiscard]] virtual QPushButton* btnPlay() const = 0;
77 [[nodiscard]] virtual QPushButton* btnRecord() const = 0;
78 [[nodiscard]] virtual QPushButton* btnPrevious() const = 0;
79 [[nodiscard]] virtual QPushButton* btnNext() const = 0;
80 [[nodiscard]] virtual QPushButton* btnStop() const = 0;
81 [[nodiscard]] virtual Gui::CoverButton* btnCover() const = 0;
82
83 [[nodiscard]] virtual bool isExternResizeAllowed() const = 0;
84
85 private:
86 void played();
87 void paused();
88 void stopped();
89
90 void setCoverLocation(const MetaData& track);
91 void setStandardCover();
92
93 void setRadioMode(RadioMode radio);
94 void checkRecordButtonVisible();
95
96 void setupVolumeButton(int percent);
97 void increaseVolume();
98 void decreaseVolume();
99
100 void refreshCurrentPosition(int val);
101 void setTotalTimeLabel(MilliSeconds totalTimeMs);
102
103 void setupShortcuts();
104 void setupConnections();
105
106 void showTrackInfo(bool b);
107
108 public slots:
109 void changeVolumeByDelta(int val);
110 void setCoverData(const QByteArray& coverData, const QString& mimeType) override;
111
112 private slots:
113 void playstateChanged(PlayState state);
114
115 void recordChanged(bool b);
116
117 void buffering(int progress);
118
119 void currentPositionChanged(MilliSeconds posMs);
120 void progressMoved(int val);
121 void progressHovered(int val);
122
123 void volumeChanged(int val);
124 void muteChanged(bool muted);
125
126 void currentTrackChanged(const MetaData& track);
127 void metadataChanged();
128
129 void refreshLabels(const MetaData& track);
130 void refreshCurrentTrack();
131
132 // cover changed by engine
133 void coverClickRejected();
134
135 void streamRecorderActiveChanged();
136
137 protected:
138 [[nodiscard]] bool isActive() const override;
139 [[nodiscard]] MD::Interpretation metadataInterpretation() const override;
140 [[nodiscard]] MetaDataList infoDialogData() const override;
141 QWidget* getParentWidget() override;
142
143 virtual void showTrackInfoPage(bool b) = 0;
144 void resizeEvent(QResizeEvent* e) override;
145 void showEvent(QShowEvent* e) override;
146 void contextMenuEvent(QContextMenuEvent* e) override;
147 void skinChanged() override;
148};
149
150#endif // GUI_CONTROLSBASE_H
Definition CoverDataProvider.h:28
Definition CoverDataReceiver.h:27
The CoverButton class.
Definition CoverButton.h:40
Create a new Progress bar indicating progress of its parent widget Set the position....
Definition ProgressBar.h:41
Definition RatingLabel.h:69
Definition SearchSlider.h:35
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() \nT...
Definition Widget.h:39
Definition MetaDataList.h:34
Definition MetaData.h:43
Definition PlayManager.h:34
RadioMode
The RadioMode enum.
Definition RadioMode.h:32