MythTV master
musiccommon.h
Go to the documentation of this file.
1#ifndef MUSICCOMMON_H_
2#define MUSICCOMMON_H_
3
4// qt
5#include <QKeyEvent>
6#include <QObject>
7
8// mythtv
13
14// mythmusic
15#include "musicplayer.h"
16#include "playlist.h"
17
18class Output;
19class Decoder;
20class QTimer;
22class MythUIImage;
23class MythUIText;
24class MythUIStateType;
25class MythUIButton;
26class MythUIVideo;
27class MythUIButton;
28class MythUICheckBox;
29class MythMenu;
30
31enum MusicView : std::uint8_t
32{
45};
46
48
50{
51 Q_OBJECT
52
53 public:
54
55 bool keyPressEvent(QKeyEvent *e) override; // MythScreenType
56 void ShowMenu(void) override; // MythScreenType
57
58 protected:
59
60 MusicCommon(MythScreenStack *parent, MythScreenType *parentScreen,
61 const QString &name);
62 ~MusicCommon(void) override;
63
64 bool CreateCommon(void);
65
66 void switchView(MusicView view);
67
68 void customEvent(QEvent *event) override; // MythUIType
69
70 protected slots:
71 void viewExited(void);
72
73 static void play(void);
74 void stop(void);
75 static void pause(void);
76 void previous(void);
77 void next(void);
78 void seekforward(void);
79 void seekback(void);
80 void seek(std::chrono::seconds pos);
81 void stopAll(void);
82 static void changeRating(bool increase);
83
84 void searchButtonList(void);
85 MythMenu* createMainMenu(void);
86 MythMenu* createSubMenu(void);
87 MythMenu* createPlaylistMenu(void);
88 MythMenu* createPlayerMenu(void);
89 MythMenu* createQuickPlaylistsMenu(void);
90 MythMenu* createRepeatMenu(void);
91 MythMenu* createShuffleMenu(void);
92 MythMenu* createVisualizerMenu(void);
93 MythMenu* createPlaylistOptionsMenu(void);
94
95 void playlistItemClicked(MythUIButtonListItem *item);
96 static void playlistItemVisible(MythUIButtonListItem *item);
97
98 void fromCD(void);
99 void allTracks(void);
100 void byArtist(void);
101 void byAlbum(void);
102 void byGenre(void);
103 void byYear(void);
104 void byTitle(void);
105 void doUpdatePlaylist(void);
106
107 protected:
108 void showExitMenu(void);
109 void showPlaylistOptionsMenu(bool addMainMenu = false);
110
111 protected:
112 void init(bool startPlayback = true);
113 static QString getTimeString(std::chrono::seconds exTime, std::chrono::seconds maxTime);
114 void updateProgressBar(void);
115 static void setTrackOnLCD(MusicMetadata *mdata);
116 static void editTrackInfo(MusicMetadata *mdata);
117 void updateTrackInfo(MusicMetadata *mdata);
118 static void showTrackInfo(MusicMetadata *mdata);
119 void updateUIPlaylist(void);
120 void updatePlaylistStats(void);
121 void updateUIPlayedList(void); // for streaming
122 void updateRepeatMode(void);
123 void updateShuffleMode(bool updateUIList = false);
124
125 void changeVolume(bool up) const;
126 void changeSpeed(bool up);
127 void toggleMute(void) const;
128 static void toggleUpmix(void);
129 static void showVolume(void);
130 void updateVolume(void);
131 static void showSpeed(bool show);
132
133 void startVisualizer(void);
134 void stopVisualizer(void);
135 void cycleVisualizer(void);
136 void switchVisualizer(const QString &visual);
137 void switchVisualizer(int visual);
138
139 static void playFirstTrack();
140 bool restorePosition(int trackID);
141
142 MythScreenType *m_parentScreen {nullptr};
143 MusicView m_currentView {};
144
145 // visualiser stuff
146 MainVisual *m_mainvisual {nullptr};
147 bool m_fullscreenBlank {false};
148 bool m_cycleVisualizer {false};
149 bool m_randomVisualizer {false};
150
151 QStringList m_visualModes;
152 unsigned int m_currentVisual {0};
153
154 bool m_moveTrackMode {false};
155 bool m_movingTrack {false};
156
157 bool m_controlVolume {true};
158
159 int m_currentTrack {0};
160 std::chrono::seconds m_currentTime {0s};
161 std::chrono::seconds m_maxTime {0s};
162
163 uint m_playlistTrackCount {0};
164 std::chrono::seconds m_playlistPlayedTime {0s};
165 std::chrono::seconds m_playlistMaxTime {0s};
166
167 // for quick playlists
170
171 // for adding tracks from playlist editor
172 QList<int> m_songList;
173
174 // UI widgets
175 MythUIText *m_timeText {nullptr};
176 MythUIText *m_infoText {nullptr};
177 MythUIText *m_visualText {nullptr};
178 MythUIText *m_noTracksText {nullptr};
179
180 MythUIStateType *m_shuffleState {nullptr};
181 MythUIStateType *m_repeatState {nullptr};
182
183 MythUIStateType *m_movingTracksState {nullptr};
184
185 MythUIStateType *m_ratingState {nullptr};
186
187 MythUIProgressBar *m_trackProgress {nullptr};
188 MythUIText *m_trackProgressText {nullptr};
189 MythUIText *m_trackSpeedText {nullptr};
190 MythUIStateType *m_trackState {nullptr};
191
192 MythUIStateType *m_muteState {nullptr};
193 MythUIText *m_volumeText {nullptr};
194
195 MythUIProgressBar *m_playlistProgress {nullptr};
196
197 MythUIButton *m_prevButton {nullptr};
198 MythUIButton *m_rewButton {nullptr};
199 MythUIButton *m_pauseButton {nullptr};
200 MythUIButton *m_playButton {nullptr};
201 MythUIButton *m_stopButton {nullptr};
202 MythUIButton *m_ffButton {nullptr};
203 MythUIButton *m_nextButton {nullptr};
204
205 MythUIImage *m_coverartImage {nullptr};
206
207 MythUIButtonList *m_currentPlaylist {nullptr};
208 MythUIButtonList *m_playedTracksList {nullptr};
209
210 MythUIVideo *m_visualizerVideo {nullptr};
211};
212
214{
215 Q_OBJECT
216 public:
217 MythMusicVolumeDialog(MythScreenStack *parent, const char *name)
218 : MythScreenType(parent, name, false) {}
219 ~MythMusicVolumeDialog(void) override;
220
221 bool Create(void) override; // MythScreenType
222 bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
223
224 protected:
225 void increaseVolume(void);
226 void decreaseVolume(void);
227 void toggleMute(void);
228
229 void updateDisplay(void);
230
231 QTimer *m_displayTimer {nullptr};
232 MythUIText *m_messageText {nullptr};
233 MythUIText *m_volText {nullptr};
234 MythUIStateType *m_muteState {nullptr};
235 MythUIProgressBar *m_volProgress {nullptr};
236};
237
239{
240 Q_OBJECT
241 public:
242 TrackInfoDialog(MythScreenStack *parent, MusicMetadata *mdata, const char *name)
243 : MythScreenType(parent, name, false),
244 m_metadata(mdata) {}
245 ~TrackInfoDialog(void) override = default;
246
247 bool Create(void) override; // MythScreenType
248 bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
249
250 protected:
251 MusicMetadata *m_metadata {nullptr};
252};
253
254#endif
QStringList m_visualModes
Definition: musiccommon.h:151
QList< int > m_songList
Definition: musiccommon.h:172
PlaylistOptions m_playlistOptions
Definition: musiccommon.h:168
QString m_whereClause
Definition: musiccommon.h:169
MythMusicVolumeDialog(MythScreenStack *parent, const char *name)
Definition: musiccommon.h:217
Screen in which all other widgets are contained and rendered.
virtual void ShowMenu(void)
virtual bool Create(void)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
A single button widget.
Definition: mythuibutton.h:22
A checkbox widget supporting three check states - on,off,half and two conditions - selected and unsel...
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
Progress bar widget.
This widget is used for grouping other widgets for display when a particular named state is called.
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
void customEvent(QEvent *event) override
Definition: mythuitype.cpp:989
Video widget, displays raw image data.
Definition: mythuivideo.h:15
TrackInfoDialog(MythScreenStack *parent, MusicMetadata *mdata, const char *name)
Definition: musiccommon.h:242
~TrackInfoDialog(void) override=default
unsigned int uint
Definition: compat.h:60
Q_DECLARE_METATYPE(MusicView)
MusicView
Definition: musiccommon.h:32
@ MV_ARTISTINFO
Definition: musiccommon.h:39
@ MV_TRACKINFO
Definition: musiccommon.h:41
@ MV_SEARCH
Definition: musiccommon.h:38
@ MV_PLAYLIST
Definition: musiccommon.h:33
@ MV_LYRICS
Definition: musiccommon.h:34
@ MV_ALBUMINFO
Definition: musiccommon.h:40
@ MV_PLAYLISTEDITORTREE
Definition: musiccommon.h:35
@ MV_RADIO
Definition: musiccommon.h:42
@ MV_VISUALIZERINFO
Definition: musiccommon.h:44
@ MV_MINIPLAYER
Definition: musiccommon.h:43
@ MV_PLAYLISTEDITORGALLERY
Definition: musiccommon.h:36
@ MV_VISUALIZER
Definition: musiccommon.h:37
static void startPlayback(void)
#define MPLUGIN_PUBLIC
static void show(uint8_t *buf, int length)
Definition: ringbuffer.cpp:339
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:80