Sayonara Player
RemoteControl.h
1/* RemoteControl.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (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 "Utils/Pimpl.h"
25#include "Utils/Playlist/PlaylistFwd.h"
26
27#include <QObject>
28
29class QPixmap;
30class PlayManager;
31namespace Playlist
32{
33 class Handler;
34}
35
92 public QObject
93{
94 Q_OBJECT
95 PIMPL(RemoteControl)
96
97 public:
98 RemoteControl(Playlist::Handler* playlistHandler, PlayManager* playManager, QObject* parent = nullptr);
99 ~RemoteControl() override;
100
101 bool isConnected() const;
102
103 private:
104 void init();
105
106 void setVolume(int volume);
107 void seekRelative(int posPercent);
108 void seekRelativeMs(int positionMs);
109 void seekAbsoluteMs(int positionMs);
110 void changeTrack(int trackIndex);
111
112 void showApi();
113 void requestState();
114
115 void writePlaystate();
116 void writeBroadcastInfo();
117 void writeCurrentTrack();
118 void writeVolume();
119 void writeCurrentPosition();
120 void writePlaylist();
121 void writeSayonaraIdAndName();
122
123 void searchCover();
124 void activeChanged();
125
126 private slots:
127 void newConnection();
128 void socketDisconnected();
129 void newRequest();
130
131 void currentPositionChangedMs(MilliSeconds positionMs);
132 void currentTrackChanged(const MetaData& track);
133 void volumeChanged(int volume);
134 void playstateChanged(PlayState playstate);
135 void activePlaylistChanged(int index);
136 void activePlaylistContentChanged(int index);
137
138 void coverFound(const QPixmap& pixmap);
139
140 void remoteActiveChanged();
141 void remotePortChanged();
142 void broadcastChanged();
143};
144
145#endif // REMOTECONTROL_H
The MetaData class.
Definition: MetaData.h:47
Global handler for current playback state (Singleton)
Definition: PlayManager.h:36
Global handler for playlists.
Definition: PlaylistHandler.h:56
Remote control allows to control Sayonara from an external application via network....
Definition: RemoteControl.h:93