QTfrontend/netserver.h
changeset 1374 f33fa81e583d
parent 1066 1f1b3686a2b0
child 1375 c95c6887b289
equal deleted inserted replaced
1373:ca719502b87f 1374:f33fa81e583d
    18 
    18 
    19 #ifndef _NETSERVER_INCLUDED
    19 #ifndef _NETSERVER_INCLUDED
    20 #define _NETSERVER_INCLUDED
    20 #define _NETSERVER_INCLUDED
    21 
    21 
    22 #include <QObject>
    22 #include <QObject>
    23 #include <QList>
       
    24 #include <QMap>
       
    25 
       
    26 #include "team.h"
       
    27 
       
    28 class HWNetServer;
       
    29 class QTcpSocket;
       
    30 class QTcpServer;
       
    31 class HWConnectedClient;
       
    32 
    23 
    33 class HWNetServer : public QObject
    24 class HWNetServer : public QObject
    34 {
    25 {
    35   Q_OBJECT
    26 	Q_OBJECT
    36 
    27 
    37  public:
    28 public:
    38   bool StartServer(quint16 port);
    29 	bool StartServer(quint16 port);
    39   void StopServer();
    30 	void StopServer();
    40   bool isChiefClient(HWConnectedClient* cl) const;
    31 	QString getRunningHostName() const;
    41   QMap<QString, QStringList> getGameCfg() const;
    32 	quint16 getRunningPort() const;
    42   void sendAll(QString gameCfg);
       
    43   void sendOthers(HWConnectedClient* this_cl, QString gameCfg);
       
    44   void sendNicks(HWConnectedClient* cl) const;
       
    45   bool haveNick(const QString& nick) const;
       
    46   QString getRunningHostName() const;
       
    47   quint16 getRunningPort() const;
       
    48   QList<QStringList> getTeamsConfig() const;
       
    49   void teamChanged();
       
    50   bool shouldStart(HWConnectedClient* client);
       
    51   QString prepareConfig(QStringList lst);
       
    52   void resetStart();
       
    53 
    33 
    54   QMap<QString, QStringList> m_gameCfg; // config_param - value
    34 private:
    55   int hhnum;
    35 	quint16 ds_port;
    56 
       
    57  private:
       
    58   HWConnectedClient* getChiefClient() const;
       
    59   quint16 ds_port;
       
    60   QTcpServer* IPCServer;
       
    61   QList<HWConnectedClient*> connclients;
       
    62 
       
    63  private slots:
       
    64   void NewConnection();
       
    65   void ClientDisconnect(HWConnectedClient* client);
       
    66 };
    36 };
    67 
    37 
    68 #endif // _NETSERVER_INCLUDED
    38 #endif // _NETSERVER_INCLUDED