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