X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fplayer%2Fplayer.h;h=ab26c9dc2a193ac644f6a8ad7723e7d034034be9;hb=3b5ba650989f08b43bd23ab371824b94765ef3be;hp=625aa63e2912c887d5e6734e8dfc5170a5c30361;hpb=68e7e55646f7caf47dd678a5f2f51644ddacd751;p=someplayer diff --git a/src/player/player.h b/src/player/player.h index 625aa63..ab26c9d 100644 --- a/src/player/player.h +++ b/src/player/player.h @@ -1,3 +1,22 @@ +/* + * SomePlayer - An alternate music player for Maemo 5 + * Copyright (C) 2010 Nikolay (somebody) Tischenko + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef PLAYER_H #define PLAYER_H @@ -8,7 +27,8 @@ #include "../playlist.h" #include #include -#include +#include +#include #include #include @@ -17,35 +37,43 @@ using SomePlayer::DataObjects::Track; using SomePlayer::DataObjects::TrackMetadata; using SomePlayer::DataObjects::Playlist; +using SomePlayer::DataObjects::LastPlayed; using SomePlayer::Storage::Config; namespace SomePlayer { namespace Playback { enum PlayerState { PLAYER_STOPPED, PLAYER_PLAYING, PLAYER_PAUSED, PLAYER_LOADING, PLAYER_DONE, PLAYER_ERROR }; + enum RepeatRule {REPEAT_NO, REPEAT_ALL, REPEAT_ONE}; class Player : public QObject { Q_OBJECT public: explicit Player(QObject *parent = 0); - + ~Player(); bool random() {return _random;} - bool repeat() {return _repeat;} - int volume() {return (int)(_output->volume()*100 + 0.5);} + RepeatRule repeat() {return _repeat;} Phonon::MediaObject* mediaObject() {return _player;} - + bool equalizerEnabled() {return _equalizer_enabled;} + bool equalizerAvailable() {return _equalizer != NULL;} + Track current(); + void setAwaitingSeek(int pos) {_awaiting_seek = true; _awaiting_seek_pos = pos;} signals: void stateChanged (PlayerState); void trackChanged (Track); void tick (int, int); // played | all (seconds) void trackDone(Track); + void startPlaylist(); + void saveLastPlayed(LastPlayed); public slots: void setTrackId(int id); - void enqueue(int id); + void enqueue(int id); // refactor void toggle(); void play(); + void pause(); + void playIfPaused(); void stop(); void next(); void prev(); @@ -53,26 +81,40 @@ namespace SomePlayer { void toggleRandom(); void toggleRepeat(); void seek(int); - void setVolume(int); + void enableEqualizer(); + void disableEqualizer(); + void setEqualizerValue(int band, double value); + void equalizerValue(int band, double *); + QString artist(); + QString album(); + QString title(); + PlayerState state() {return _state;} + QString stateText(); + QString albumart() {return _albumart;} + void setAlbumart(QString albumart) {_albumart = albumart;} private slots: void _stateChanged(Phonon::State, Phonon::State); void _tick(qint64); private: - int _current; - Track _track; // current track (workaround) + Track _track; // current track bool _random; - bool _repeat; - QStack _history; - QQueue _queue; - QStack _prev_history; + RepeatRule _repeat; + bool _equalizer_enabled; + QList _history; + QList _queue; Playlist _playlist; Phonon::MediaObject *_player; Phonon::AudioOutput *_output; + Phonon::Path _path; + Phonon::Effect *_equalizer; PlayerState _state; Config _config; - void _set_source(); - + void _to_history(Track t); + void _truncate_history(); + int _awaiting_seek_pos; + bool _awaiting_seek; + QString _albumart; }; }; };