Clementine-audio-player-Mac.../src/networkremote/networkremote.h

54 lines
1.3 KiB
C
Raw Permalink Normal View History

2012-12-31 23:37:39 +01:00
#ifndef NETWORKREMOTE_H
#define NETWORKREMOTE_H
#include <memory>
2012-12-31 23:37:39 +01:00
#include <QTcpServer>
#include <QTcpSocket>
#include "core/player.h"
#include "core/application.h"
2013-01-03 21:40:47 +01:00
#include "incomingdataparser.h"
#include "outgoingdatacreator.h"
#include "remoteclient.h"
class NetworkRemote : public QObject {
Q_OBJECT
public:
2012-12-31 23:37:39 +01:00
static const char* kSettingsGroup;
static const quint16 kDefaultServerPort;
static const char* kTranscoderSettingPostfix;
2012-12-31 23:37:39 +01:00
explicit NetworkRemote(Application* app, QObject* parent = nullptr);
2012-12-31 23:37:39 +01:00
~NetworkRemote();
public slots:
2012-12-31 23:37:39 +01:00
void SetupServer();
void StartServer();
void ReloadSettings();
void AcceptConnection();
2013-12-22 15:16:42 +01:00
void EnableKittens(bool aww);
void SendKitten(quint64 id, const QImage& kitten);
2012-12-31 23:37:39 +01:00
private:
std::unique_ptr<QTcpServer> server_;
std::unique_ptr<QTcpServer> server_ipv6_;
std::unique_ptr<IncomingDataParser> incoming_data_parser_;
std::unique_ptr<OutgoingDataCreator> outgoing_data_creator_;
quint16 port_;
2012-12-31 23:37:39 +01:00
bool use_remote_;
bool only_non_public_ip_;
bool signals_connected_;
2012-12-31 23:37:39 +01:00
Application* app_;
QList<RemoteClient*> clients_;
2012-12-31 23:37:39 +01:00
void StopServer();
void ReadSettings();
void CreateRemoteClient(QTcpSocket* client_socket);
bool IpIsPrivate(const QHostAddress& address);
2012-12-31 23:37:39 +01:00
};
#endif // NETWORKREMOTE_H