Player factory
[someplayer] / src / player / abstractplayer.h
1 /*
2  * SomePlayer - An alternate music player for Maemo 5
3  * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef ABSTRACTPLAYER_H
21 #define ABSTRACTPLAYER_H
22
23 #include <QObject>
24 #include "../someplayer.h"
25 #include "../track.h"
26 #include "../trackmetainformation.h"
27 #include "../playlist.h"
28
29 using SomePlayer::DataObjects::Track;
30 using SomePlayer::DataObjects::Playlist;
31 using SomePlayer::DataObjects::LastPlayed;
32
33 namespace SomePlayer {
34         namespace Playback {
35
36                 enum PlayerState { PLAYER_STOPPED, PLAYER_PLAYING, PLAYER_PAUSED, PLAYER_LOADING, PLAYER_DONE, PLAYER_ERROR };
37                 enum RepeatRule {REPEAT_NO, REPEAT_ALL, REPEAT_ONE};
38
39                 class AbstractPlayer : public QObject
40                 {
41
42                         Q_OBJECT
43                 public:
44                         explicit AbstractPlayer(QObject *parent = 0);
45                         virtual bool random() = 0;
46                         virtual RepeatRule repeat() = 0;
47                         virtual bool equalizerEnabled() = 0;
48                         virtual bool equalizerAvailable() = 0;
49                         virtual Track current() = 0;
50                         virtual void setAwaitingSeek(int pos) = 0;
51
52                 signals:
53                         void stateChanged (PlayerState);
54                         void trackChanged (Track);
55                         void tick (int, int); // played | all (seconds)
56                         void trackDone(Track);
57                         void saveLastPlayed(LastPlayed);
58                         void startPlaylist();
59
60                 public slots:
61                         virtual void setTrackId(int id) = 0;
62                         virtual void enqueue(int id) = 0;
63                         virtual void toggle() = 0;
64                         virtual void play() = 0;
65                         virtual void pause() = 0;
66                         virtual void playIfPaused() = 0;
67                         virtual void stop() = 0;
68                         virtual void next() = 0;
69                         virtual void prev() = 0;
70                         virtual void setPlaylist(Playlist) = 0;
71                         virtual void toggleRandom() = 0;
72                         virtual void toggleRepeat() = 0;
73                         virtual void seek(int) = 0;
74                         virtual void enableEqualizer() = 0;
75                         virtual void disableEqualizer() = 0;
76                         virtual void setEqualizerValue(int band, double value) = 0;
77                         virtual void equalizerValue(int band, double *) = 0;
78                         virtual QString artist() = 0;
79                         virtual QString album() = 0;
80                         virtual QString title() = 0;
81                         virtual PlayerState state() = 0;
82                         virtual QString stateText() = 0;
83                         virtual QString albumart() = 0;
84                         virtual void setAlbumart(QString albumart) = 0;
85                 };
86         };
87 };
88
89 #endif // ABSTRACTPLAYER_H