201b4585f4ed85187c7d4f0afb5c3ec435a93fe9
[someplayer] / src / player / player.h
1 #ifndef PLAYER_H
2 #define PLAYER_H
3
4 #include <QObject>
5 #include "../someplayer.h"
6 #include "../track.h"
7 #include <phonon/MediaObject>
8 #include <phonon/AudioOutput>
9
10 // represents player
11
12 using SomePlayer::DataObjects::Track;
13
14 namespace SomePlayer {
15         namespace Playback {
16
17                 enum PlayerState { PLAYER_STOPPED, PLAYER_PLAYING, PLAYER_PAUSED, PLAYER_LOADING, PLAYER_DONE };
18
19                 class Player : public QObject
20                 {
21                         Q_OBJECT
22                 public:
23                         explicit Player(QObject *parent = 0);
24
25                 signals:
26                         void stateChanged (PlayerState);
27                         void tick (int, int); // played | all (seconds)
28
29                 public slots:
30                         void setTrack(Track&);
31                         void play();
32                         void pause();
33                         void stop();
34                 private slots:
35                         void _stateChanged(Phonon::State, Phonon::State);
36                         void _tick(qint64);
37                 private:
38                         Track _current_track;
39                         Phonon::MediaObject *_player;
40                         void _create_player();
41                 };
42         };
43 };
44
45 #endif // PLAYER_H