player.h
Go to the documentation of this file.00001 #ifndef PLAYER_H 00002 #define PLAYER_H 00003 00004 #include <qobject.h> 00005 #include <qtimer.h> 00006 #include <kurl.h> 00007 #include <noatun/playlist.h> 00008 00009 class Engine; 00010 class Playlist; 00011 class KLibrary; 00012 00022 class Player : public QObject 00023 { 00024 Q_OBJECT 00025 friend class Effects; 00026 friend class PlaylistItemData; 00027 friend class PlaylistNotifier; 00028 00029 public: 00041 enum LoopType { None=0, Song, Playlist, Random }; 00042 00043 public: 00044 Player(QObject *parent=0); 00045 ~Player(); 00046 00051 QString lengthString(int _position=-1); 00055 int loopStyle() const { return mLoopStyle; } 00060 int volume() const; 00064 int getTime() const { return position; } 00068 int getLength(); 00072 bool isPlaying(); 00076 bool isPaused(); 00080 bool isStopped(); 00081 00088 PlaylistItem current() const { return mCurrent;} // TODO: uninline 00089 00096 void openFile(const KURL &file, bool purge=true, bool autoplay=false); 00097 00104 void openFile(const KURL::List &files, bool purge=true, bool autoplay=false); 00105 00106 Engine *engine() const { return mEngine; } 00107 00108 public slots: 00112 void toggleListView(); 00118 void handleButtons(); 00122 void removeCurrent(); 00123 00127 void back(); 00131 void stop(); 00135 void play(); 00136 00140 void play(const PlaylistItem &item); 00144 void playpause(); 00148 void forward(bool allowLoop = true); 00149 00153 void skipTo(int msec); 00154 00158 void loop(); 00159 00163 void loop(int i); 00164 00165 void setVolume(int); 00166 00167 public slots: 00172 void playCurrent(); 00177 void newCurrent(); 00178 00179 private slots: 00180 void posTimeout(); 00181 void aboutToPlay(); 00182 00183 signals: 00188 void timeout(); 00189 00190 void stopped(); 00191 00192 void playing(); 00193 00194 void paused(); 00195 00200 void loopTypeChange(int t); 00201 00205 void playlistShown(); 00206 00210 void playlistHidden(); 00211 00216 void newSongLen(int mins, int sec); 00217 00221 void newSong(); 00222 00228 void changed(); 00229 00235 void aboutToOpen(PlaylistItem item); 00236 00237 void volumeChanged(int); 00238 00239 private: 00240 Engine *mEngine; 00241 QTimer filePos; 00242 int position; 00243 int mLoopStyle; 00244 bool firstTimeout; 00245 PlaylistItem mCurrent; // TODO eliminate 00246 QPtrList<PlaylistNotifier> mNotifiers; 00247 }; 00248 00249 00250 #endif 00251
