00001 #ifndef MUSICCOMMON_H_
00002 #define MUSICCOMMON_H_
00003
00004
00005 #include <QKeyEvent>
00006 #include <QObject>
00007
00008
00009 #include <audiooutput.h>
00010 #include <mythscreentype.h>
00011
00012
00013 #include "metadata.h"
00014 #include "playlist.h"
00015 #include "musicplayer.h"
00016
00017 class Output;
00018 class Decoder;
00019 class QTimer;
00020 class MythUIProgressBar;
00021 class MythUIImage;
00022 class MythUIText;
00023 class MythUIStateType;
00024 class MythUIButton;
00025 class MythUIVideo;
00026 class MythUIButton;
00027 class MythUICheckBox;
00028 class MythMenu;
00029
00030 enum MusicView
00031 {
00032 MV_PLAYLIST,
00033 MV_LYRICS,
00034 MV_PLAYLISTEDITORTREE,
00035 MV_PLAYLISTEDITORGALLERY,
00036 MV_VISUALIZER,
00037 MV_SEARCH,
00038 MV_ARTISTINFO,
00039 MV_ALBUMINFO,
00040 MV_TRACKINFO,
00041 MV_RADIO
00042 };
00043
00044 Q_DECLARE_METATYPE(MusicView);
00045
00046 class MPUBLIC MusicCommon : public MythScreenType
00047 {
00048 Q_OBJECT
00049
00050 protected:
00051
00052 MusicCommon(MythScreenStack *parent, const QString &name);
00053 ~MusicCommon(void);
00054
00055 bool CreateCommon(void);
00056
00057 void switchView(MusicView view);
00058
00059 virtual void customEvent(QEvent *event);
00060 bool keyPressEvent(QKeyEvent *e);
00061
00062 virtual void ShowMenu(void);
00063
00064
00065
00066 protected slots:
00067
00068 void play(void);
00069 void stop(void);
00070 void pause(void);
00071 void previous(void);
00072 void next(void);
00073 void seekforward(void);
00074 void seekback(void);
00075 void seek(int);
00076 void stopAll(void);
00077 void changeRating(bool increase);
00078
00079
00080
00081 void searchButtonList(void);
00082 MythMenu* createMainMenu(void);
00083 MythMenu* createViewMenu(void);
00084 MythMenu* createPlaylistMenu(void);
00085 MythMenu* createPlayerMenu(void);
00086 MythMenu* createQuickPlaylistsMenu(void);
00087 MythMenu* createRepeatMenu(void);
00088 MythMenu* createShuffleMenu(void);
00089 MythMenu* createVisualizerMenu(void);
00090 MythMenu* createPlaylistOptionsMenu(void);
00091
00092 void playlistItemClicked(MythUIButtonListItem *item);
00093 void playlistItemVisible(MythUIButtonListItem *item);
00094
00095 void fromCD(void);
00096 void allTracks(void);
00097 void byArtist(void);
00098 void byAlbum(void);
00099 void byGenre(void);
00100 void byYear(void);
00101 void byTitle(void);
00102 void doUpdatePlaylist(void);
00103
00104 protected:
00105 void showExitMenu(void);
00106 void showPlaylistOptionsMenu(bool addMainMenu = false);
00107
00108 QString getTimeString(int exTime, int maxTime);
00109 void updateProgressBar(void);
00110 void setTrackOnLCD(Metadata *mdata);
00111 void editTrackInfo(Metadata *mdata);
00112 void updateTrackInfo(Metadata *mdata);
00113 void showTrackInfo(Metadata *mdata);
00114 void updateUIPlaylist(void);
00115 void updatePlaylistStats(void);
00116 void updateUIPlayedList(void);
00117 void updateRepeatMode(void);
00118 void updateShuffleMode(bool updateUIList = false);
00119
00120 void changeVolume(bool up);
00121 void changeSpeed(bool up);
00122 void toggleMute(void);
00123 void toggleUpmix(void);
00124 void showVolume(void);
00125 void updateVolume(void);
00126 void showSpeed(bool show);
00127
00128 void startVisualizer(void);
00129 void stopVisualizer(void);
00130 void cycleVisualizer(void);
00131 void switchVisualizer(const QString &visual);
00132 void switchVisualizer(int visual);
00133
00134 void playFirstTrack();
00135 bool restorePosition(int trackID);
00136
00137 MusicView m_currentView;
00138
00139
00140 MainVisual *m_mainvisual;
00141 bool m_fullscreenBlank;
00142 bool m_cycleVisualizer;
00143 bool m_randomVisualizer;
00144
00145 QStringList m_visualModes;
00146 unsigned int m_currentVisual;
00147
00148 bool m_moveTrackMode;
00149 bool m_movingTrack;
00150
00151 bool m_controlVolume;
00152
00153 int m_currentTrack;
00154 int m_currentTime;
00155 int m_maxTime;
00156
00157 uint m_playlistTrackCount;
00158 uint m_playlistPlayedTime;
00159 uint m_playlistMaxTime;
00160
00161
00162 PlaylistOptions m_playlistOptions;
00163 QString m_whereClause;
00164
00165
00166 QList<int> m_songList;
00167
00168
00169 MythUIText *m_timeText;
00170 MythUIText *m_infoText;
00171 MythUIText *m_visualText;
00172 MythUIText *m_noTracksText;
00173
00174 MythUIStateType *m_shuffleState;
00175 MythUIStateType *m_repeatState;
00176
00177 MythUIStateType *m_movingTracksState;
00178
00179 MythUIStateType *m_ratingState;
00180
00181 MythUIProgressBar *m_trackProgress;
00182 MythUIText *m_trackProgressText;
00183 MythUIText *m_trackSpeedText;
00184 MythUIStateType *m_trackState;
00185
00186 MythUIStateType *m_muteState;
00187 MythUIText *m_volumeText;
00188
00189 MythUIProgressBar *m_playlistProgress;
00190
00191 MythUIButton *m_prevButton;
00192 MythUIButton *m_rewButton;
00193 MythUIButton *m_pauseButton;
00194 MythUIButton *m_playButton;
00195 MythUIButton *m_stopButton;
00196 MythUIButton *m_ffButton;
00197 MythUIButton *m_nextButton;
00198
00199 MythUIImage *m_coverartImage;
00200
00201 MythUIButtonList *m_currentPlaylist;
00202 MythUIButtonList *m_playedTracksList;
00203
00204 MythUIVideo *m_visualizerVideo;
00205 };
00206
00207 class MPUBLIC MythMusicVolumeDialog : public MythScreenType
00208 {
00209 Q_OBJECT
00210 public:
00211 MythMusicVolumeDialog(MythScreenStack *parent, const char *name);
00212 ~MythMusicVolumeDialog(void);
00213
00214 bool Create(void);
00215 bool keyPressEvent(QKeyEvent *event);
00216
00217 protected:
00218 void increaseVolume(void);
00219 void decreaseVolume(void);
00220 void toggleMute(void);
00221
00222 void updateDisplay(void);
00223
00224 QTimer *m_displayTimer;
00225 MythUIText *m_messageText;
00226 MythUIText *m_volText;
00227 MythUIStateType *m_muteState;
00228 MythUIProgressBar *m_volProgress;
00229 };
00230
00231 class MPUBLIC TrackInfoDialog : public MythScreenType
00232 {
00233 Q_OBJECT
00234 public:
00235 TrackInfoDialog(MythScreenStack *parent, Metadata *mdata, const char *name);
00236 ~TrackInfoDialog(void);
00237
00238 bool Create(void);
00239 bool keyPressEvent(QKeyEvent *event);
00240
00241 protected:
00242 Metadata *m_metadata;
00243 };
00244
00245 #endif