00001 /*************************************************************************** 00002 * Copyright (C) 2008-2010 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef MEDIAPLAYER_H 00021 #define MEDIAPLAYER_H 00022 00023 #include <QObject> 00024 #include <qmmp/soundcore.h> 00025 #include "playlistmanager.h" 00026 00027 00031 class MediaPlayer : public QObject 00032 { 00033 Q_OBJECT 00034 public: 00039 MediaPlayer(QObject *parent = 0); 00043 ~MediaPlayer(); 00047 static MediaPlayer* instance(); 00051 PlayListManager *playListManager(); 00055 bool isRepeatable() const; 00059 bool isNoPlaylistAdvance() const; 00060 00061 public slots: 00065 void play(qint64 offset = -1); 00069 void stop(); 00073 void next(); 00077 void previous(); 00082 void setRepeatable(bool enable); 00088 void setNoPlaylistAdvance(bool enable); 00089 00090 signals: 00095 void repeatableChanged(bool enabled); 00101 void noPlaylistAdvanceChanged(bool enabled); 00102 00103 private slots: 00104 void playNext(); 00105 void updateNextUrl(); 00106 void processState(Qmmp::State state); 00107 void showMetaData(); 00108 00109 private: 00110 PlayListManager *m_pl_manager; 00111 SoundCore *m_core; 00112 static MediaPlayer* m_instance; 00113 bool m_repeat; 00114 bool m_noPlaylistAdvance; 00115 int m_skips; 00116 QString m_nextUrl; 00117 }; 00118 00119 #endif