2 * SomePlayer - An alternate music player for Maemo 5
3 * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
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.
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.
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.
24 #include "../someplayer.h"
26 #include "../trackmetainformation.h"
27 #include "../playlist.h"
28 #include <phonon/MediaObject>
29 #include <phonon/AudioOutput>
30 #include <phonon/Effect>
31 #include <phonon/Path>
37 using SomePlayer::DataObjects::Track;
38 using SomePlayer::DataObjects::TrackMetadata;
39 using SomePlayer::DataObjects::Playlist;
40 using SomePlayer::DataObjects::LastPlayed;
41 using SomePlayer::Storage::Config;
43 namespace SomePlayer {
46 enum PlayerState { PLAYER_STOPPED, PLAYER_PLAYING, PLAYER_PAUSED, PLAYER_LOADING, PLAYER_DONE, PLAYER_ERROR };
47 enum RepeatRule {REPEAT_NO, REPEAT_ALL, REPEAT_ONE};
49 class Player : public QObject
53 explicit Player(QObject *parent = 0);
55 bool random() {return _random;}
56 RepeatRule repeat() {return _repeat;}
57 Phonon::MediaObject* mediaObject() {return _player;}
58 bool equalizerEnabled() {return _equalizer_enabled;}
59 bool equalizerAvailable() {return _equalizer != NULL;}
61 void setAwaitingSeek(int pos) {_awaiting_seek = true; _awaiting_seek_pos = pos;}
63 void stateChanged (PlayerState);
64 void trackChanged (Track);
65 void tick (int, int); // played | all (seconds)
66 void trackDone(Track);
68 void saveLastPlayed(LastPlayed);
71 void setTrackId(int id);
72 void enqueue(int id); // refactor
80 void setPlaylist(Playlist);
84 void enableEqualizer();
85 void disableEqualizer();
86 void setEqualizerValue(int band, double value);
87 void equalizerValue(int band, double *);
91 PlayerState state() {return _state;}
93 QString albumart() {return _albumart;}
94 void setAlbumart(QString albumart) {_albumart = albumart;}
96 void _stateChanged(Phonon::State, Phonon::State);
99 Track _track; // current track
102 bool _equalizer_enabled;
103 QList<Track> _history;
106 Phonon::MediaObject *_player;
107 Phonon::AudioOutput *_output;
109 Phonon::Effect *_equalizer;
113 void _to_history(Track t);
114 void _truncate_history();
115 int _awaiting_seek_pos;