Clementine-audio-player-Mac.../src/player.h

75 lines
1.5 KiB
C
Raw Normal View History

2009-12-24 20:16:07 +01:00
#ifndef PLAYER_H
#define PLAYER_H
#include <QObject>
#include <QSettings>
2010-02-03 22:48:00 +01:00
#include <QFuture>
#include <QFutureWatcher>
2009-12-24 20:16:07 +01:00
#include "engine_fwd.h"
#include "playlistitem.h"
#include "song.h"
2009-12-24 20:16:07 +01:00
class Playlist;
class Settings;
2009-12-29 20:22:02 +01:00
class LastFMService;
2009-12-24 20:16:07 +01:00
class Player : public QObject {
Q_OBJECT
public:
2009-12-29 20:22:02 +01:00
Player(Playlist* playlist, LastFMService* lastfm, QObject* parent = 0);
2009-12-24 20:16:07 +01:00
2010-02-03 22:48:00 +01:00
void Init();
2009-12-24 20:16:07 +01:00
EngineBase* GetEngine() { return engine_; }
Engine::State GetState() const;
int GetVolume() const;
PlaylistItem::Options GetCurrentItemOptions() const { return current_item_options_; }
Song GetCurrentItem() const { return current_item_; }
2009-12-24 20:16:07 +01:00
public slots:
void ReloadSettings();
2009-12-24 20:16:07 +01:00
void PlayAt(int index);
void PlayPause();
void Next();
void NextItem();
2009-12-24 20:16:07 +01:00
void Previous();
void Stop();
void SetVolume(int value);
2010-01-15 18:12:47 +01:00
void Seek(int seconds);
2009-12-24 20:16:07 +01:00
void TrackEnded();
2009-12-26 22:35:45 +01:00
void StreamReady(const QUrl& original_url, const QUrl& media_url);
2009-12-24 20:16:07 +01:00
signals:
2010-02-03 22:48:00 +01:00
void InitFinished();
2009-12-24 20:16:07 +01:00
void Playing();
void Paused();
void Stopped();
2010-01-08 17:40:34 +01:00
void VolumeChanged(int volume);
2009-12-24 20:16:07 +01:00
void Error(const QString& message);
private slots:
2010-02-03 22:48:00 +01:00
void EngineInitFinished();
2009-12-24 20:16:07 +01:00
void EngineStateChanged(Engine::State);
2010-02-03 23:20:31 +01:00
void EngineMetadataReceived(const Engine::SimpleMetaBundle& bundle);
2009-12-24 20:16:07 +01:00
private:
Playlist* playlist_;
2009-12-29 20:22:02 +01:00
LastFMService* lastfm_;
2009-12-24 20:16:07 +01:00
QSettings settings_;
PlaylistItem::Options current_item_options_;
Song current_item_;
2009-12-24 20:16:07 +01:00
EngineBase* engine_;
2010-02-03 22:48:00 +01:00
QFuture<bool> init_engine_;
QFutureWatcher<bool>* init_engine_watcher_;
2009-12-24 20:16:07 +01:00
};
#endif // PLAYER_H