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