~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to src/core/player.h

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <boost/scoped_ptr.hpp>
25
25
 
26
26
#include "config.h"
27
 
#include "core/albumcoverloader.h"
28
27
#include "core/song.h"
 
28
#include "core/urlhandler.h"
 
29
#include "covers/albumcoverloader.h"
29
30
#include "engines/engine_fwd.h"
30
31
#include "playlist/playlistitem.h"
31
32
 
32
33
class LastFMService;
 
34
class MainWindow;
33
35
class PlaylistManagerInterface;
34
36
class Settings;
35
 
class MainWindow;
36
37
 
37
38
 
38
39
class PlayerInterface : public QObject {
49
50
  virtual PlaylistItemPtr GetItemAt(int pos) const = 0;
50
51
  virtual PlaylistManagerInterface* playlists() const = 0;
51
52
 
 
53
  virtual void RegisterUrlHandler(UrlHandler* handler) = 0;
 
54
  virtual void UnregisterUrlHandler(UrlHandler* handler) = 0;
 
55
 
52
56
public slots:
53
57
  virtual void ReloadSettings() = 0;
54
58
 
72
76
  // Moves the position of the currently playing song five seconds backwards.
73
77
  virtual void SeekBackward() = 0;
74
78
 
75
 
  virtual void HandleSpecialLoad(const PlaylistItem::SpecialLoadResult& result) = 0;
76
79
  virtual void CurrentMetadataChanged(const Song& metadata) = 0;
77
80
 
78
81
  virtual void Mute() = 0;
96
99
  // the URL of the song and a flag saying whether it was able to play the song.
97
100
  void SongChangeRequestProcessed(const QUrl& url, bool valid);
98
101
 
99
 
  void ForceShowOSD(Song);
 
102
  // The toggle parameter is true when user requests to toggle visibility for Pretty OSD
 
103
  void ForceShowOSD(Song, bool toogle);
100
104
};
101
105
 
102
106
class Player : public PlayerInterface {
103
107
  Q_OBJECT
104
108
 
105
109
public:
106
 
  Player(PlaylistManagerInterface* playlists, LastFMService* lastfm,
107
 
         QObject* parent = 0);
 
110
  Player(PlaylistManagerInterface* playlists, QObject* parent = 0);
108
111
  ~Player();
109
112
 
110
113
  void Init();
117
120
  PlaylistItemPtr GetItemAt(int pos) const;
118
121
  PlaylistManagerInterface* playlists() const { return playlists_; }
119
122
 
 
123
  void RegisterUrlHandler(UrlHandler* handler);
 
124
  void UnregisterUrlHandler(UrlHandler* handler);
 
125
 
120
126
public slots:
121
127
  void ReloadSettings();
122
128
 
131
137
  void SeekForward();
132
138
  void SeekBackward();
133
139
 
134
 
  void HandleSpecialLoad(const PlaylistItem::SpecialLoadResult& result);
135
140
  void CurrentMetadataChanged(const Song& metadata);
136
141
 
137
142
  void Mute();
139
144
  void Stop();
140
145
  void Play();
141
146
  void ShowOSD();
 
147
  void TogglePrettyOSD();
142
148
 
143
149
 private slots:
144
150
  void EngineStateChanged(Engine::State);
154
160
  void ValidSongRequested(const QUrl&);
155
161
  void InvalidSongRequested(const QUrl&);
156
162
 
 
163
  void UrlHandlerDestroyed(QObject* object);
 
164
  void HandleLoadResult(const UrlHandler::LoadResult& result);
 
165
 
 
166
 private:
 
167
  // Returns true if we were supposed to stop after this track.
 
168
  bool HandleStopAfter();
 
169
 
157
170
 private:
158
171
  PlaylistManagerInterface* playlists_;
159
172
  LastFMService* lastfm_;
165
178
  Engine::TrackChangeFlags stream_change_type_;
166
179
  Engine::State last_state_;
167
180
 
 
181
  QMap<QString, UrlHandler*> url_handlers_;
 
182
 
168
183
  QUrl loading_async_;
169
184
 
170
185
  int volume_before_mute_;