2 * Copyright 2007 Alex Merry <alex.merry@kdemail.net>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <QSharedData>
30 * Interface for getting information from and controlling a
33 class Player
: public QSharedData
36 typedef KSharedPtr
<Player
> Ptr
;
38 Player(PlayerFactory
* factory
= 0);
41 * a pointer to the factory that created this player object
43 PlayerFactory
* factory() const;
45 * The name of this player
49 * Current state of the player
57 * Whether the player is running and accessible
59 virtual bool isRunning() = 0;
61 * Current state of the player
63 * Undefined if !running()
67 virtual State
state() = 0;
68 /** Artist for current track. May be empty */
69 virtual QString
artist();
70 /** Album for current track. May be empty */
71 virtual QString
album();
72 /** Title of current track. May be empty */
73 virtual QString
title();
75 * Track number of current track.
77 * Note that this is the track on a CD or in an album, not
78 * the playlist position
80 * 0 if no track defined, or unknown.
82 virtual int trackNumber();
83 /** Comment for current track. May be empty */
84 virtual QString
comment();
85 /** Genre of current track. May be empty */
86 virtual QString
genre();
88 * Length of current track in seconds.
94 * Position of current track in seconds.
96 * 0 if unknown, not defined if Stopped.
98 virtual int position();
102 * Value should be between 0 and 1
106 virtual float volume();
110 * Null (pm.isNull()) if none available
112 virtual QPixmap
artwork();
119 virtual bool canPlay();
122 * Pause the currently playing track
124 virtual bool canPause();
125 virtual void pause();
127 * Stop the currently playing track
129 * canStop() should usually be state() != Stopped if
130 * stop() is implemented
132 virtual bool canStop();
135 * Move to the previous track
137 virtual bool canGoPrevious();
138 virtual void previous();
140 * Move to the next track
142 virtual bool canGoNext();
148 * Must be between 0 and 1
150 virtual bool canSetVolume();
151 virtual void setVolume(qreal volume
);
154 * Set the position (in seconds)
156 * Should be <= length()
158 virtual bool canSeek();
159 virtual void seek(int time
);
162 void setName(const QString
& name
);
166 PlayerFactory
* m_factory
;