Noatun API Documentation

player.h

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         void slotUpdateStreamMeta(
00183                 const QString &streamName, const QString &streamGenre,
00184                 const QString &streamUrl, const QString &streamBitrate,
00185                 const QString &trackTitle, const QString &trackUrl
00186         );
00187 
00188 signals:
00193         void timeout();
00194 
00195         void stopped();
00196 
00197         void playing();
00198 
00199         void paused();
00200 
00205         void loopTypeChange(int t);
00206 
00210         void playlistShown();
00211 
00215         void playlistHidden();
00216 
00221         void newSongLen(int mins, int sec);
00222 
00226         void newSong();
00227 
00233         void changed();
00234 
00240         void aboutToOpen(PlaylistItem item);
00241 
00242         void volumeChanged(int);
00243 
00244 private:
00245         Engine *mEngine;
00246         QTimer filePos;
00247         int position;
00248         int mLoopStyle;
00249         bool firstTimeout;
00250         PlaylistItem mCurrent; // TODO eliminate
00251         QPtrList<PlaylistNotifier> mNotifiers;
00252 };
00253 
00254 
00255 #endif
00256 
KDE Logo
This file is part of the documentation for Noatun 2.6.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 23:49:45 2004 by doxygen 1.3.8-20040913 written by Dimitri van Heesch, © 1997-2003