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 "Helper/Singleton.h"
27 #include "Helper/Pimpl.h"
28 #include "Helper/Settings/SayonaraClass.h"
29 
30 
31 class MetaData;
32 
37 class PlayManager :
38  public QObject,
39  protected SayonaraClass
40 {
41  Q_OBJECT
42 
43  SINGLETON_QOBJECT(PlayManager)
44  PIMPL(PlayManager)
45 
46 signals:
47 
52  void sig_www_track_finished(const MetaData& old_md);
53 
58 
62  void sig_next();
63 
67  void sig_previous();
68 
72  void sig_stopped();
73 
78  void sig_seeked_rel(double percent);
79 
84  void sig_seeked_rel_ms(qint64 ms);
85 
90  void sig_seeked_abs_ms(quint64 ms);
91 
96  void sig_position_changed_ms(quint64 ms);
97 
102  void sig_track_changed(const MetaData& md);
103 
108  void sig_track_idx_changed(int idx);
109 
114  void sig_playlist_changed(int len);
115 
120  void sig_duration_changed(quint64 ms);
121 
125  void sig_playlist_finished();
126 
133  void sig_record(bool b);
134 
139  void sig_buffer(int b);
140 
145  void sig_volume_changed(int vol);
146 
147 
152  void sig_mute_changed(bool b);
153 
154  void sig_md_changed(const MetaData& md);
155 
156 
157  void sig_duration_changed(qint64 ms);
158 
159 
160 public slots:
164  void play();
165 
169  void play_pause();
170 
174  void pause();
175 
179  void previous();
180 
184  void next();
185 
189  void stop();
190 
197  void record(bool b);
198 
203  void seek_rel(double percent);
204 
209  void seek_abs_ms(quint64 ms);
210 
215  void seek_rel_ms(qint64 ms);
216 
223  void set_position_ms(quint64 ms);
224 
229  void change_track(const MetaData& md, int playlist_idx);
230 
231 
235  void set_track_ready();
236 
241  void buffering(int progress);
242 
246  void volume_up();
247 
251  void volume_down();
252 
257  void set_volume(int vol);
258 
263  void set_mute(bool b);
264 
265 
266  void change_metadata(const MetaData& md);
267 
268 
269  void change_duration(qint64 ms);
270 
271 public:
276  PlayState get_play_state() const;
277 
282  quint64 get_cur_position_ms() const;
283 
288  quint64 get_init_position_ms() const;
289 
294  quint64 get_duration_ms() const;
295 
300  MetaData get_cur_track() const;
301 
306  int get_volume() const;
307 
308 
313  bool get_mute() const;
314 };
315 
316 #endif
317 
quint64 get_duration_ms() const
get duration of track
void set_mute(bool b)
mute/unmute
void volume_down()
decrease volume by 5
bool get_mute() const
query mute status
void play()
Start playing if there&#39;s a track.
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
void sig_previous()
previous track was triggered
void sig_playlist_changed(int len)
playlist has changed
The MetaData class.
Definition: MetaData.h:55
quint64 get_cur_position_ms() const
get current position in milliseconds
void set_position_ms(quint64 ms)
set current position of track This method does not seek. Just tells the playmanager where the current...
void sig_seeked_rel_ms(qint64 ms)
relative seeking was triggered
quint64 get_init_position_ms() const
get position in milliseconds where track will start
void sig_track_idx_changed(int idx)
track has changed
void seek_rel_ms(qint64 ms)
seek_rel_ms
void change_track(const MetaData &md, int playlist_idx)
change current track
void sig_position_changed_ms(quint64 ms)
position in 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 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:37
void record(bool b)
request recording (see also sig_record(bool b))
void sig_record(bool b)
recording is requested
void sig_playlist_finished()
playlist has finished
void sig_stopped()
stop was triggered
PlayState get_play_state() const
get current play state
void sig_seeked_abs_ms(quint64 ms)
absolute seeking was triggered
int get_volume() const
get current volume
void sig_seeked_rel(double percent)
relative seeking was triggered
void set_volume(int vol)
set volume
void buffering(int progress)
notifiy, that track is in buffering state currently
void next()
change to next track
void sig_playstate_changed(PlayState)
emitted, when PlayState was changed
void set_track_ready()
notify, that track is ready for playback
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 seek_abs_ms(quint64 ms)
seek absolute
void previous()
change to previous track
void sig_duration_changed(quint64 ms)
duration of track has changed
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
PlayState
The PlayState enum.
Definition: PlayState.h:30
MetaData get_cur_track() const
get current track