Sayonara Player
PlayManager.h
1 /* PlayManager.h */
2 
3 /* Copyright (C) 2011-2019 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 
33 class PlayManager :
34  public QObject
35 {
36  Q_OBJECT
37 
38  SINGLETON_QOBJECT(PlayManager)
39  PIMPL(PlayManager)
40 
41 signals:
42 
47  void sig_www_track_finished(const MetaData& old_md);
48 
53 
57  void sig_next();
58 
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_duration_changed(MilliSeconds ms);
116 
120  void sig_playlist_finished();
121 
128  void sig_record(bool b);
129 
134  void sig_buffer(int b);
135 
140  void sig_volume_changed(int vol);
141 
142 
147  void sig_mute_changed(bool b);
148 
149  void sig_md_changed(const MetaData& md);
150 
151  void sig_error(const QString& message);
152 
153 
154 public slots:
158  void play();
159 
163  void wake_up();
164 
168  void play_pause();
169 
173  void pause();
174 
178  void previous();
179 
183  void next();
184 
188  void stop();
189 
196  void record(bool b);
197 
202  void seek_rel(double percent);
203 
208  void seek_abs_ms(MilliSeconds ms);
209 
214  void seek_rel_ms(MilliSeconds ms);
215 
222  void set_position_ms(MilliSeconds ms);
223 
228  void change_track(const MetaData& md, int track_idx);
229 
230 
234  void set_track_ready();
235 
240  void buffering(int progress);
241 
245  void volume_up();
246 
250  void volume_down();
251 
256  void set_volume(int vol);
257 
262  void set_muted(bool b);
263 
267  void toggle_mute();
268 
274  void change_metadata(const MetaData& md);
275 
282  void change_duration(MilliSeconds ms);
283 
288  void error(const QString& message);
289 
290 public:
295  PlayState playstate() const;
296 
301  MilliSeconds current_position_ms() const;
302 
307  MilliSeconds initial_position_ms() const;
308 
313  MilliSeconds duration_ms() const;
314 
319  const MetaData& current_track() const;
320 
325  int volume() const;
326 
327 
332  bool is_muted() const;
333 
334 
338  void shutdown();
339 };
340 
342 
343 #endif
344 
345 
void volume_down()
decrease volume by 5
void sig_duration_changed(MilliSeconds ms)
duration of track has changed
void sig_wake_up()
This signal is sent when the playstate changed from stopped to play.
void shutdown()
Shutdown the computer.
MilliSeconds initial_position_ms() const
get position in milliseconds where track will start
void play()
Start playing if there&#39;s a track.
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
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:44
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 change_metadata(const MetaData &md)
Change the current MetaData object. This may happen if the current track is edited while playing...
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:33
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 error(const QString &message)
Some playback error occured.
void sig_seeked_rel(double percent)
relative seeking was triggered
void change_duration(MilliSeconds ms)
Change the duration. This is usually called when the Engine sends a duration changed signal...
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
void toggle_mute()
If already muted, then unmute. If unmuted, then mute it.
int volume() const
get current volume
bool is_muted() const
query mute status