Miam-Player  0.8.0
A nice music player
remotecontrol.h
Go to the documentation of this file.
1 #ifndef REMOTECONTROL_H
2 #define REMOTECONTROL_H
3 
4 #include <abstractview.h>
5 
6 #include <QWebSocketServer>
7 #include <QUdpSocket>
8 
14 class RemoteControl : public QObject
15 {
16  Q_OBJECT
17  Q_ENUMS(Command)
18 
19 private:
20  AbstractView *_currentView;
21 
22  int _port;
23 
24  //QTcpServer *_tcpServer;
25  //QTcpSocket *_tcpSocket;
26  QWebSocketServer *_webSocketServer;
27  QWebSocket *_webSocket;
28 
29  QUdpSocket *_udpSocket;
30  QTimer *_timer;
31 
32 public:
33  enum Command : int { CMD_Playback = 0,
34  CMD_State = 1,
35  CMD_Track = 2,
38  CMD_Cover = 5,
43 
44  explicit RemoteControl(AbstractView *currentView, int port, QObject *parent = 0);
45 
46  virtual ~RemoteControl();
47 
48  void changeServerPort(int port);
49 
50  void startServer();
51 
52 private slots:
53  void decodeResponseFromClient(const QString &message);
54 
55  void initializeConnection();
56 
57  void mediaPlayerStatedChanged(QMediaPlayer::State state);
58 
59  void sendActivePlaylist(int index);
60 
61  void sendActivePlaylists() const;
62 
63  void sendAllPlaylists() const;
64 
65  void sendPosition(qint64 pos, qint64 duration);
66 
67  void sendTrackInfos(const QString &track);
68 
69  void sendVolume(qreal volume);
70 };
71 
72 #endif // REMOTECONTROL_H
Definition: remotecontrol.h:40
Definition: remotecontrol.h:38
Definition: remotecontrol.h:37
The RemoteControl class is a class which allows client-side applications (like App on SmartPhones) to...
Definition: remotecontrol.h:14
Definition: remotecontrol.h:34
void startServer()
Definition: remotecontrol.cpp:43
void changeServerPort(int port)
Definition: remotecontrol.cpp:36
Definition: remotecontrol.h:35
RemoteControl(AbstractView *currentView, int port, QObject *parent=0)
Definition: remotecontrol.cpp:18
Definition: remotecontrol.h:39
virtual ~RemoteControl()
Definition: remotecontrol.cpp:31
Command
Definition: remotecontrol.h:33
Definition: remotecontrol.h:33
The AbstractView class is the base class for all views in Miam-Player.
Definition: abstractview.h:22
Definition: remotecontrol.h:36
Definition: remotecontrol.h:41
Definition: remotecontrol.h:42