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 
34 class PlayManager :
35  public QObject,
36  public SayonaraClass
37 {
38  Q_OBJECT
39 
40  SINGLETON_QOBJECT(PlayManager)
41  PIMPL(PlayManager)
42 
43 signals:
44 
49  void sig_www_track_finished(const MetaData& old_md);
50 
55 
59  void sig_next();
60 
65  void sig_wake_up();
66 
70  void sig_previous();
71 
75  void sig_stopped();
76 
81  void sig_seeked_rel(double percent);
82 
87  void sig_seeked_rel_ms(MilliSeconds ms);
88 
93  void sig_seeked_abs_ms(MilliSeconds ms);
94 
99  void sig_position_changed_ms(MilliSeconds ms);
100 
105  void sig_track_changed(const MetaData& md);
106 
111  void sig_track_idx_changed(int idx);
112 
117  void sig_playlist_changed(int len);
118 
123  void sig_duration_changed(MilliSeconds ms);
124 
128  void sig_playlist_finished();
129 
136  void sig_record(bool b);
137 
142  void sig_buffer(int b);
143 
148  void sig_volume_changed(int vol);
149 
150 
155  void sig_mute_changed(bool b);
156 
157  void sig_md_changed(const MetaData& md);
158 
159  void sig_error(const QString& message);
160 
161 
162 public slots:
166  void play();
167 
171  void wake_up();
172 
176  void play_pause();
177 
181  void pause();
182 
186  void previous();
187 
191  void next();
192 
196  void stop();
197 
204  void record(bool b);
205 
210  void seek_rel(double percent);
211 
216  void seek_abs_ms(MilliSeconds ms);
217 
222  void seek_rel_ms(MilliSeconds ms);
223 
230  void set_position_ms(MilliSeconds ms);
231 
236  void change_track(const MetaData& md, int track_idx);
237 
238 
242  void set_track_ready();
243 
248  void buffering(int progress);
249 
253  void volume_up();
254 
258  void volume_down();
259 
264  void set_volume(int vol);
265 
270  void set_muted(bool b);
271 
275  void toggle_mute();
276 
282  void change_metadata(const MetaData& md);
283 
290  void change_duration(MilliSeconds ms);
291 
296  void error(const QString& message);
297 
298 public:
303  PlayState playstate() const;
304 
309  MilliSeconds current_position_ms() const;
310 
315  MilliSeconds initial_position_ms() const;
316 
321  MilliSeconds duration_ms() const;
322 
327  const MetaData& current_track() const;
328 
333  int volume() const;
334 
335 
340  bool is_muted() const;
341 
342 
346  void shutdown();
347 };
348 
350 
351 #endif
352 
353 
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.
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: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:34
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