Sayonara Player
StreamServer.h
1 /* StreamServer.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 STREAM_SERVER_H
22 #define STREAM_SERVER_H
23 
24 #include "StreamWriter.h"
25 #include "Utils/Pimpl.h"
26 
27 class QTcpSocket;
32 class StreamServer :
33  public QObject
34 {
35  Q_OBJECT
36  PIMPL(StreamServer)
37 
38  signals:
39  void sig_new_connection(const QString& ip);
40  void sig_connection_closed(const QString& ip);
41  void sig_listening(bool);
42 
43  public:
44  explicit StreamServer(QObject* parent=nullptr);
45  ~StreamServer();
46 
47  void active_changed();
48  void port_changed();
49 
50  public slots:
51  void dismiss(int idx);
52 
53  void disconnect(StreamWriterPtr sw);
54  void disconnect_all();
55 
56  bool listen();
57  void close();
58  void restart();
59 
60  private slots:
61  void accept_client(QTcpSocket* socket, const QString& ip);
62  void reject_client(QTcpSocket* socket, const QString& ip);
63 
64  void track_changed(const MetaData&);
65  void server_destroyed();
66 
67  void new_client_request();
68  void disconnected(StreamWriter* sw);
69  void new_connection(const QString& ip);
70 };
71 
72 #endif
StreamServer
The StreamServer class. This class is listening for new connections and holds and administrates curre...
Definition: StreamServer.h:32
MetaData
The MetaData class.
Definition: MetaData.h:44
StreamWriter
The StreamWriter class. This class is the interface between StreamDataSender and StreamServer....
Definition: StreamWriter.h:39