00001 #ifndef PLAYBACKBOX_H_
00002 #define PLAYBACKBOX_H_
00003
00004
00005 #include <qtimer.h>
00006 #include <qmutex.h>
00007 #include <qvaluevector.h>
00008
00009
00010 #include <mythtv/mythwidgets.h>
00011 #include <mythtv/dialogbox.h>
00012 #include <mythtv/audiooutput.h>
00013
00014
00015 #include "mainvisual.h"
00016 #include "metadata.h"
00017 #include "playlist.h"
00018 #include "editmetadata.h"
00019 #include "databasebox.h"
00020 #include "musicplayer.h"
00021
00022 class Output;
00023 class Decoder;
00024
00025 class PlaybackBoxMusic : public MythThemedDialog
00026 {
00027 Q_OBJECT
00028
00029 public:
00030
00031 typedef QValueVector<int> IntVector;
00032
00033 PlaybackBoxMusic(MythMainWindow *parent, QString window_name,
00034 QString theme_filename,
00035 const QString &cd_device, const char *name = 0);
00036
00037 ~PlaybackBoxMusic(void);
00038
00039 void customEvent(QCustomEvent *);
00040 void keyPressEvent(QKeyEvent *e);
00041 void constructPlaylistTree();
00042
00043 bool onMediaEvent(MythMediaDevice *pDev);
00044
00045 public slots:
00046
00047 void play();
00048 void stop();
00049 void pause();
00050 void previous();
00051 void next();
00052 void seekforward();
00053 void seekback();
00054 void seek(int);
00055 void stopAll();
00056 void setShuffleMode(MusicPlayer::ShuffleMode mode);
00057 void toggleShuffle();
00058 void increaseRating();
00059 void decreaseRating();
00060 void setRepeatMode(MusicPlayer::RepeatMode mode);
00061 void toggleRepeat();
00062 void editPlaylist();
00063 void nextAuto();
00064 void showEditMetadataDialog();
00065 void checkForPlaylists();
00066 void handleTreeListSignals(int, IntVector*);
00067 void visEnable();
00068 void bannerDisable();
00069 void changeVolume(bool up_or_down);
00070 void changeSpeed(bool up_or_down);
00071 void toggleMute();
00072 void resetTimer();
00073 void hideVolume(){showVolume(false);}
00074 void showVolume(bool on_or_off);
00075 void showSpeed(bool on_or_off);
00076 void showProgressBar();
00077 void wipeTrackInfo();
00078 void toggleFullBlankVisualizer();
00079 void end();
00080 void resetScrollCount();
00081 void showAlbumArtImage(Metadata *mdata);
00082 void wipeAlbumArt();
00083
00084 void handlePush(QString buttonname);
00085
00086 void occasionallyCheckCD();
00087
00088
00089 void showMenu();
00090 void closePlaylistPopup();
00091 void allTracks();
00092 void byArtist();
00093 void byAlbum();
00094 void byGenre();
00095 void byYear();
00096 void byTitle();
00097 void fromCD();
00098 void showSmartPlaylistDialog();
00099 void showSearchDialog();
00100 bool getInsertPLOptions(InsertPLOption &insertOption,
00101 PlayPLOption &playOption, bool &bRemoveDups);
00102
00103 signals:
00104
00105 void dummy();
00106
00107 private:
00108
00109 void wireUpTheme();
00110 void updatePlaylistFromQuickPlaylist(QString whereClause);
00111 void updatePlaylistFromSmartPlaylist();
00112 void doUpdatePlaylist(QString whereClause);
00113 void CycleVisualizer(void);
00114 void updatePlaylistFromCD(void);
00115 void setTrackOnLCD(Metadata *mdata);
00116 void updateTrackInfo(Metadata *mdata);
00117 void postUpdate();
00118 void playFirstTrack();
00119 void bannerEnable(QString text, int millis);
00120 void bannerEnable(Metadata *mdata, bool fullScreen = false);
00121 void bannerToggle(Metadata *mdata);
00122 void savePosition(uint position);
00123 void restorePosition(const QString &position);
00124 void pushButton(UIPushButtonType *button);
00125 QString getTimeString(int exTime, int maxTime);
00126
00127 QString playfile;
00128 QString statusString;
00129 QString curSmartPlaylistCategory;
00130 QString curSmartPlaylistName;
00131
00132 bool listAsShuffled;
00133 int outputBufferSize;
00134 int currentTime, maxTime;
00135 int scrollCount;
00136 bool scrollingDown;
00137
00138 Metadata *curMeta;
00139
00140 unsigned int resumemode;
00141
00142 bool menufilters;
00143
00144 ReadCDThread *cd_reader_thread;
00145 QTimer *cd_watcher;
00146 bool cd_checking_flag;
00147 bool scan_for_cd;
00148 QString m_CDdevice;
00149
00150 MainVisual *mainvisual;
00151
00152 bool fullscreen_blank;
00153 QStringList visual_modes;
00154 unsigned int current_visual;
00155 int visual_mode_delay;
00156 QTimer *visual_mode_timer;
00157 QTimer *lcd_update_timer;
00158 QTimer *speed_scroll_timer;
00159 int visualizer_status;
00160
00161 bool showrating;
00162 bool vis_is_big;
00163 bool tree_is_done;
00164 bool first_playlist_check;
00165
00166 QTimer *waiting_for_playlists_timer;
00167 QTimer *volume_display_timer;
00168
00169 bool cycle_visualizer;
00170 bool random_visualizer;
00171 bool show_album_art;
00172 bool show_whole_tree;
00173 bool keyboard_accelerators;
00174 bool volume_control;
00175
00176 MythPopupBox *playlist_popup;
00177
00178
00179
00180
00181
00182 UIManagedTreeListType *music_tree_list;
00183
00184 UITextType *title_text;
00185 UITextType *artist_text;
00186 UITextType *album_text;
00187 UITextType *time_text;
00188 UITextType *info_text;
00189 UITextType *current_visualization_text;
00190
00191 UITextType *shuffle_state_text;
00192 UITextType *repeat_state_text;
00193
00194 UIRepeatedImageType *ratings_image;
00195 UIBlackHoleType *visual_blackhole;
00196
00197 UIStatusBarType *volume_status;
00198 UIStatusBarType *progress_bar;
00199 UITextType *speed_status;
00200
00201 UIPushButtonType *prev_button;
00202 UIPushButtonType *rew_button;
00203 UIPushButtonType *pause_button;
00204 UIPushButtonType *play_button;
00205 UIPushButtonType *stop_button;
00206 UIPushButtonType *ff_button;
00207 UIPushButtonType *next_button;
00208
00209 UIPushButtonType *m_pushedButton;
00210
00211 UIImageType *albumart_image;
00212
00213 UITextButtonType *shuffle_button;
00214 UITextButtonType *repeat_button;
00215 UITextButtonType *pledit_button;
00216 UITextButtonType *vis_button;
00217
00218 MythProgressDialog *progress;
00219 enum { kProgressNone, kProgressMusic } progress_type;
00220 };
00221
00222
00223 #endif