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 protected:
54
55 MusicCommon(MythScreenStack *parent, MythScreenType *parentScreen,
56 const QString &name);
57 ~MusicCommon(void) override;
58
59 bool CreateCommon(void);
60
61 void switchView(MusicView view);
62
63 void customEvent(QEvent *event) override; // MythUIType
64 bool keyPressEvent(QKeyEvent *e) override; // MythScreenType
65
66 void ShowMenu(void) override; // MythScreenType
67
68 protected slots:
69 void viewExited(void);
70
71 static void play(void);
72 void stop(void);
73 static void pause(void);
74 void previous(void);
75 void next(void);
76 void seekforward(void);
77 void seekback(void);
78 void seek(std::chrono::seconds pos);
79 void stopAll(void);
80 static void changeRating(bool increase);
81
82 void searchButtonList(void);
83 MythMenu* createMainMenu(void);
84 MythMenu* createSubMenu(void);
85 MythMenu* createPlaylistMenu(void);
86 MythMenu* createPlayerMenu(void);
87 MythMenu* createQuickPlaylistsMenu(void);
88 MythMenu* createRepeatMenu(void);
89 MythMenu* createShuffleMenu(void);
90 MythMenu* createVisualizerMenu(void);
91 MythMenu* createPlaylistOptionsMenu(void);
92
93 void playlistItemClicked(MythUIButtonListItem *item);
94 static void playlistItemVisible(MythUIButtonListItem *item);
95
96 void fromCD(void);
97 void allTracks(void);
98 void byArtist(void);
99 void byAlbum(void);
100 void byGenre(void);
101 void byYear(void);
102 void byTitle(void);
103 void doUpdatePlaylist(void);
104
105 protected:
106 void showExitMenu(void);
107 void showPlaylistOptionsMenu(bool addMainMenu = false);
108
109 protected:
110 void init(bool startPlayback = true);
111 static QString getTimeString(std::chrono::seconds exTime, std::chrono::seconds maxTime);
112 void updateProgressBar(void);
113 static void setTrackOnLCD(MusicMetadata *mdata);
114 static void editTrackInfo(MusicMetadata *mdata);
115 void updateTrackInfo(MusicMetadata *mdata);
116 static void showTrackInfo(MusicMetadata *mdata);
117 void updateUIPlaylist(void);
118 void updatePlaylistStats(void);
119 void updateUIPlayedList(void); // for streaming
120 void updateRepeatMode(void);
121 void updateShuffleMode(bool updateUIList = false);
122
123 void changeVolume(bool up) const;
124 void changeSpeed(bool up);
125 void toggleMute(void) const;
126 static void toggleUpmix(void);
127 static void showVolume(void);
128 void updateVolume(void);
129 static void showSpeed(bool show);
130
131 void startVisualizer(void);
132 void stopVisualizer(void);
133 void cycleVisualizer(void);
134 void switchVisualizer(const QString &visual);
135 void switchVisualizer(int visual);
136
137 static void playFirstTrack();
138 bool restorePosition(int trackID);
139
140 MythScreenType *m_parentScreen {nullptr};
141 MusicView m_currentView {};
142
143 // visualiser stuff
144 MainVisual *m_mainvisual {nullptr};
145 bool m_fullscreenBlank {false};
146 bool m_cycleVisualizer {false};
147 bool m_randomVisualizer {false};
148
149 QStringList m_visualModes;
150 unsigned int m_currentVisual {0};
151
152 bool m_moveTrackMode {false};
153 bool m_movingTrack {false};
154
155 bool m_controlVolume {true};
156
157 int m_currentTrack {0};
158 std::chrono::seconds m_currentTime {0s};
159 std::chrono::seconds m_maxTime {0s};
160
161 uint m_playlistTrackCount {0};
162 std::chrono::seconds m_playlistPlayedTime {0s};
163 std::chrono::seconds m_playlistMaxTime {0s};
164
165 // for quick playlists
168
169 // for adding tracks from playlist editor
170 QList<int> m_songList;
171
172 // UI widgets
173 MythUIText *m_timeText {nullptr};
174 MythUIText *m_infoText {nullptr};
175 MythUIText *m_visualText {nullptr};
176 MythUIText *m_noTracksText {nullptr};
177
178 MythUIStateType *m_shuffleState {nullptr};
179 MythUIStateType *m_repeatState {nullptr};
180
181 MythUIStateType *m_movingTracksState {nullptr};
182
183 MythUIStateType *m_ratingState {nullptr};
184
185 MythUIProgressBar *m_trackProgress {nullptr};
186 MythUIText *m_trackProgressText {nullptr};
187 MythUIText *m_trackSpeedText {nullptr};
188 MythUIStateType *m_trackState {nullptr};
189
190 MythUIStateType *m_muteState {nullptr};
191 MythUIText *m_volumeText {nullptr};
192
193 MythUIProgressBar *m_playlistProgress {nullptr};
194
195 MythUIButton *m_prevButton {nullptr};
196 MythUIButton *m_rewButton {nullptr};
197 MythUIButton *m_pauseButton {nullptr};
198 MythUIButton *m_playButton {nullptr};
199 MythUIButton *m_stopButton {nullptr};
200 MythUIButton *m_ffButton {nullptr};
201 MythUIButton *m_nextButton {nullptr};
202
203 MythUIImage *m_coverartImage {nullptr};
204
205 MythUIButtonList *m_currentPlaylist {nullptr};
206 MythUIButtonList *m_playedTracksList {nullptr};
207
208 MythUIVideo *m_visualizerVideo {nullptr};
209};
210
212{
213 Q_OBJECT
214 public:
215 MythMusicVolumeDialog(MythScreenStack *parent, const char *name)
216 : MythScreenType(parent, name, false) {}
217 ~MythMusicVolumeDialog(void) override;
218
219 bool Create(void) override; // MythScreenType
220 bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
221
222 protected:
223 void increaseVolume(void);
224 void decreaseVolume(void);
225 void toggleMute(void);
226
227 void updateDisplay(void);
228
229 QTimer *m_displayTimer {nullptr};
230 MythUIText *m_messageText {nullptr};
231 MythUIText *m_volText {nullptr};
232 MythUIStateType *m_muteState {nullptr};
233 MythUIProgressBar *m_volProgress {nullptr};
234};
235
237{
238 Q_OBJECT
239 public:
240 TrackInfoDialog(MythScreenStack *parent, MusicMetadata *mdata, const char *name)
241 : MythScreenType(parent, name, false),
242 m_metadata(mdata) {}
243 ~TrackInfoDialog(void) override = default;
244
245 bool Create(void) override; // MythScreenType
246 bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
247
248 protected:
249 MusicMetadata *m_metadata {nullptr};
250};
251
252#endif
QStringList m_visualModes
Definition: musiccommon.h:149
QList< int > m_songList
Definition: musiccommon.h:170
QString m_whereClause
Definition: musiccommon.h:167
MythMusicVolumeDialog(MythScreenStack *parent, const char *name)
Definition: musiccommon.h:215
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
Video widget, displays raw image data.
Definition: mythuivideo.h:15
TrackInfoDialog(MythScreenStack *parent, MusicMetadata *mdata, const char *name)
Definition: musiccommon.h:240
~TrackInfoDialog(void) override=default
unsigned int uint
Definition: compat.h:68
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
@ PL_CURRENT
Definition: playlist.h:34
@ PL_REPLACE
Definition: playlist.h:24
static void show(uint8_t *buf, int length)
Definition: ringbuffer.cpp:341
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:89