Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2008-2012 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 00028 class QmmpUiSettings; 00029 00030 00034 class MediaPlayer : public QObject 00035 { 00036 Q_OBJECT 00037 public: 00042 MediaPlayer(QObject *parent = 0); 00046 ~MediaPlayer(); 00050 static MediaPlayer* instance(); 00054 PlayListManager *playListManager(); 00058 bool isRepeatable() const; 00062 bool isNoPlaylistAdvance() const; 00063 00064 public slots: 00068 void play(qint64 offset = -1); 00072 void stop(); 00076 void next(); 00080 void previous(); 00085 void setRepeatable(bool enable); 00091 void setNoPlaylistAdvance(bool enable); 00092 00093 signals: 00098 void repeatableChanged(bool enabled); 00104 void noPlaylistAdvanceChanged(bool enabled); 00105 00106 private slots: 00107 void playNext(); 00108 void updateNextUrl(); 00109 void processState(Qmmp::State state); 00110 void updateMetaData(); 00111 00112 private: 00113 QmmpUiSettings *m_settings; 00114 PlayListManager *m_pl_manager; 00115 SoundCore *m_core; 00116 static MediaPlayer* m_instance; 00117 bool m_repeat; 00118 bool m_noPlaylistAdvance; 00119 int m_skips; 00120 QString m_nextUrl; 00121 }; 00122 00123 #endif