Sayonara Player
RemoteControl.h
1 /* RemoteControl.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 REMOTECONTROL_H
22 #define REMOTECONTROL_H
23 
24 #include "Components/PlayManager/PlayState.h"
25 #include "Utils/Playlist/PlaylistFwd.h"
26 
27 #include <QObject>
28 
29 #include "Utils/Pimpl.h"
30 
73  public QObject
74 {
75  Q_OBJECT
76  PIMPL(RemoteControl)
77 
78 public:
79  explicit RemoteControl(QObject *parent=nullptr);
80  virtual ~RemoteControl();
81 
82  bool is_connected() const;
83 
84 private slots:
85  void new_connection();
86  void socket_disconnected();
87  void new_request();
88 
89  void pos_changed_ms(MilliSeconds pos);
90  void track_changed(const MetaData& md);
91  void volume_changed(int vol);
92  void playstate_changed(PlayState playstate);
93  void playlist_changed(PlaylistConstPtr pl);
94 
95  void _sl_active_changed();
96  void _sl_port_changed();
97  void _sl_broadcast_changed();
98 
99 
100 private:
101 
102  void init();
103 
104  void set_volume(int vol);
105  void seek_rel(int pos_percent);
106  void seek_rel_ms(int pos_ms);
107  void change_track(int idx);
108 
109  void show_api();
110  void request_state();
111 
112  int extract_parameter_int(const QByteArray& arr, int cmd_len);
113 
114  void write_playstate();
115  void write_broadcast_info();
116  void write_cur_track();
117  void write_volume();
118  void write_cur_pos();
119  void write_playlist();
120 
121  void write_cover();
122  void write_cover(const MetaData& md);
123 
124  void write(const QByteArray& arr);
125 
126  void active_changed();
127 };
128 
129 #endif // REMOTECONTROL_H
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:44
Remote control allows to control Sayonara from an external application via network. Various commands are implemented. Sayonara also delivers information about state changes,The current implemented commands are: .
Definition: RemoteControl.h:72
std::shared_ptr< const Playlist::Base > PlaylistConstPtr
PlaylistConstPtr read only Playlist Pointer.
Definition: PlaylistFwd.h:45