Plasma
player.h
Go to the documentation of this file.00001 /* 00002 * Copyright 2007 Alex Merry <alex.merry@kdemail.net> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License version 2 as 00006 * published by the Free Software Foundation 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 * GNU General Public License for more details 00012 * 00013 * You should have received a copy of the GNU Library General Public 00014 * License along with this program; if not, write to the 00015 * Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef PLAYER_H 00020 #define PLAYER_H 00021 00022 #include <QSharedData> 00023 #include <KSharedPtr> 00024 #include <QString> 00025 #include <QPixmap> 00026 00027 class PlayerFactory; 00028 00033 class Player : public QSharedData 00034 { 00035 public: 00036 typedef KSharedPtr<Player> Ptr; 00037 00038 Player(PlayerFactory* factory = 0); 00039 virtual ~Player(); 00043 PlayerFactory* factory() const; 00047 QString name() const; 00051 enum State { 00052 Playing, 00053 Paused, 00054 Stopped 00055 }; 00059 virtual bool isRunning() = 0; 00067 virtual State state() = 0; 00069 virtual QString artist(); 00071 virtual QString album(); 00073 virtual QString title(); 00082 virtual int trackNumber(); 00084 virtual QString comment(); 00086 virtual QString genre(); 00092 virtual int length(); 00098 virtual int position(); 00106 virtual float volume(); 00112 virtual QPixmap artwork(); 00113 00114 // Commands 00115 00119 virtual bool canPlay(); 00120 virtual void play(); 00124 virtual bool canPause(); 00125 virtual void pause(); 00132 virtual bool canStop(); 00133 virtual void stop(); 00137 virtual bool canGoPrevious(); 00138 virtual void previous(); 00142 virtual bool canGoNext(); 00143 virtual void next(); 00144 00150 virtual bool canSetVolume(); 00151 virtual void setVolume(qreal volume); 00152 00158 virtual bool canSeek(); 00159 virtual void seek(int time); 00160 00161 protected: 00162 void setName(const QString& name); 00163 00164 private: 00165 QString m_name; 00166 PlayerFactory* m_factory; 00167 }; 00168 00169 #endif // PLAYER_H