Sayonara Player
PlayManager.h
1 /* PlayManager.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef PLAY_MANAGER_H
22 #define PLAY_MANAGER_H
23 
24 #include <QObject>
25 #include "PlayState.h"
26 #include "Utils/Singleton.h"
27 #include "Utils/Pimpl.h"
28 #include "Utils/Settings/SayonaraClass.h"
29 
30 class MetaData;
31 
36 class PlayManager :
37  public QObject,
38  public SayonaraClass
39 {
40  Q_OBJECT
41 
42  SINGLETON_QOBJECT(PlayManager)
43  PIMPL(PlayManager)
44 
45 signals:
46 
51  void sig_www_track_finished(const MetaData& old_md);
52 
57 
61  void sig_next();
62 
63  void sig_wake_up();
64 
68  void sig_previous();
69 
73  void sig_stopped();
74 
79  void sig_seeked_rel(double percent);
80 
85  void sig_seeked_rel_ms(MilliSeconds ms);
86 
91  void sig_seeked_abs_ms(MilliSeconds ms);
92 
97  void sig_position_changed_ms(MilliSeconds ms);
98 
103  void sig_track_changed(const MetaData& md);
104 
109  void sig_track_idx_changed(int idx);
110 
115  void sig_playlist_changed(int len);
116 
121  void sig_duration_changed(MilliSeconds ms);
122 
126  void sig_playlist_finished();
127 
134  void sig_record(bool b);
135 
140  void sig_buffer(int b);
141 
146  void sig_volume_changed(int vol);
147 
148 
153  void sig_mute_changed(bool b);
154 
155  void sig_md_changed(const MetaData& md);
156 
157  void sig_error(const QString& message);
158 
159 
160 public slots:
164  void play();
165 
169  void wake_up();
170 
174  void play_pause();
175 
179  void pause();
180 
184  void previous();
185 
189  void next();
190 
194  void stop();
195 
202  void record(bool b);
203 
208  void seek_rel(double percent);
209 
214  void seek_abs_ms(MilliSeconds ms);
215 
220  void seek_rel_ms(MilliSeconds ms);
221 
228  void set_position_ms(MilliSeconds ms);
229 
234  void change_track(const MetaData& md, int track_idx);
235 
236 
240  void set_track_ready();
241 
246  void buffering(int progress);
247 
251  void volume_up();
252 
256  void volume_down();
257 
262  void set_volume(int vol);
263 
268  void set_muted(bool b);
269 
270  void toggle_mute();
271 
272 
273  void change_metadata(const MetaData& md);
274 
275 
276  void change_duration(MilliSeconds ms);
277 
278  void error(const QString& message);
279 
280 public:
285  PlayState playstate() const;
286 
291  MilliSeconds current_position_ms() const;
292 
297  MilliSeconds initial_position_ms() const;
298 
303  MilliSeconds duration_ms() const;
304 
309  const MetaData& current_track() const;
310 
315  int volume() const;
316 
317 
322  bool is_muted() const;
323 
324 
325  void shutdown();
326 };
327 
329 
330 #endif
331 
332 
void volume_down()
decrease volume by 5
void sig_duration_changed(MilliSeconds ms)
duration of track has changed
MilliSeconds initial_position_ms() const
get position in milliseconds where track will start
void play()
Start playing if there's a track.
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
void sig_seeked_rel_ms(MilliSeconds ms)
relative seeking was triggered
void sig_seeked_abs_ms(MilliSeconds ms)
absolute seeking was triggered
void sig_previous()
previous track was triggered
void sig_playlist_changed(int len)
playlist has changed
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:48
MilliSeconds current_position_ms() const
get current position in milliseconds
void sig_track_idx_changed(int idx)
track has changed
void sig_volume_changed(int vol)
emitted when volume has changed
void sig_buffer(int b)
emitted when currently in buffering state
void set_muted(bool b)
mute/unmute
void sig_next()
next track was triggered
void sig_track_changed(const MetaData &md)
track has changed
Global handler for current playback state (Singleton)
Definition: PlayManager.h:36
void record(bool b)
request recording (see also sig_record(bool b))
void sig_record(bool b)
recording is requested
void set_position_ms(MilliSeconds ms)
set current position of track This method does not seek. Just tells the playmanager where the current...
void sig_playlist_finished()
playlist has finished
PlayState playstate() const
get current play state
void sig_stopped()
stop was triggered
void wake_up()
Emit wake up signal after stopping state.
void sig_seeked_rel(double percent)
relative seeking was triggered
void set_volume(int vol)
set volume
void sig_position_changed_ms(MilliSeconds ms)
position in track has changed
void buffering(int progress)
notifiy, that track is in buffering state currently
void seek_abs_ms(MilliSeconds ms)
seek absolute
void next()
change to next track
void sig_playstate_changed(PlayState)
emitted, when PlayState was changed
const MetaData & current_track() const
get current track
void set_track_ready()
notify, that track is ready for playback
void seek_rel_ms(MilliSeconds ms)
seek_rel_ms
void seek_rel(double percent)
seek relative
void volume_up()
increase volume by 5
void play_pause()
toggle play/pause
void pause()
pause track, if currently playing
void previous()
change to previous track
MilliSeconds duration_ms() const
get duration of track
void sig_mute_changed(bool b)
emitted when mute state has changed
void sig_www_track_finished(const MetaData &old_md)
emitted when a streamed track has finished
void stop()
stop playback
void change_track(const MetaData &md, int track_idx)
change current track
int volume() const
get current volume
bool is_muted() const
query mute status