--- a/QTfrontend/net/newnetclient.h Mon Jan 30 23:20:28 2012 +0100
+++ b/QTfrontend/net/newnetclient.h Mon Jan 30 17:32:18 2012 -0500
@@ -36,142 +36,144 @@
class HWNewNet : public QObject
{
- Q_OBJECT
+ Q_OBJECT
- public:
- enum ClientState { Disconnected, Connecting, Connected, InLobby, InRoom, InGame };
+ public:
+ enum ClientState { Disconnected, Connecting, Connected, InLobby, InRoom, InGame };
- HWNewNet();
- ~HWNewNet();
- void Connect(const QString & hostName, quint16 port, const QString & nick);
- void Disconnect();
- void SendPasswordHash(const QString & hash);
- void NewNick(const QString & nick);
- bool isRoomChief();
- bool isInRoom();
- ClientState clientState();
- QString getNick();
- QString getRoom();
- QString getHost();
+ HWNewNet();
+ ~HWNewNet();
+ void Connect(const QString & hostName, quint16 port, const QString & nick);
+ void Disconnect();
+ void SendPasswordHash(const QString & hash);
+ void NewNick(const QString & nick);
+ bool isRoomChief();
+ bool isInRoom();
+ ClientState clientState();
+ QString getNick();
+ QString getRoom();
+ QString getHost();
- private:
- bool isChief;
- QString mynick;
- QString myroom;
- QString myhost;
- QTcpSocket NetSocket;
- QString seed;
- bool m_game_connected;
+ private:
+ bool isChief;
+ QString mynick;
+ QString myroom;
+ QString myhost;
+ QTcpSocket NetSocket;
+ QString seed;
+ bool m_game_connected;
- template <typename T>
- void SendCfgStrNet(T a) {
- QByteArray strmsg;
- strmsg.append(a);
- quint8 sz = strmsg.size();
- QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg;
- QString _msg = delimeter + QString(enginemsg.toBase64());
- RawSendNet(_msg);
- }
+ template <typename T>
+ void SendCfgStrNet(T a)
+ {
+ QByteArray strmsg;
+ strmsg.append(a);
+ quint8 sz = strmsg.size();
+ QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg;
+ QString _msg = delimeter + QString(enginemsg.toBase64());
+ RawSendNet(_msg);
+ }
- template <typename T>
- void SendCfgStrLoc(T a) {
- QByteArray strmsg;
- strmsg.append(QString(a).toUtf8());
- quint8 sz = strmsg.size();
- QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg;
- emit FromNet(enginemsg);
- }
+ template <typename T>
+ void SendCfgStrLoc(T a)
+ {
+ QByteArray strmsg;
+ strmsg.append(QString(a).toUtf8());
+ quint8 sz = strmsg.size();
+ QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg;
+ emit FromNet(enginemsg);
+ }
- QStringList cmdbuf;
+ QStringList cmdbuf;
- void RawSendNet(const QString & buf);
- void RawSendNet(const QByteArray & buf);
- void ParseCmd(const QStringList & lst);
- void handleNotice(int n);
+ void RawSendNet(const QString & buf);
+ void RawSendNet(const QByteArray & buf);
+ void ParseCmd(const QStringList & lst);
+ void handleNotice(int n);
- int loginStep;
- ClientState netClientState;
+ int loginStep;
+ ClientState netClientState;
- signals:
- void AskForRunGame();
- void connected();
- void disconnected(const QString & reason);
- void Error(const QString & errmsg);
- void Warning(const QString & wrnmsg);
- void AskForPassword(const QString & nick);
- void NickTaken(const QString & nick);
- void AuthFailed();
- void EnteredGame();
- void LeftRoom(const QString & reason);
- void nickAdded(const QString& nick, bool notifyNick);
- void nickRemoved(const QString& nick);
- void nickAddedLobby(const QString& nick, bool notifyNick);
- void nickRemovedLobby(const QString& nick);
- void FromNet(const QByteArray & buf);
- void adminAccess(bool);
- void roomMaster(bool);
+ signals:
+ void AskForRunGame();
+ void connected();
+ void disconnected(const QString & reason);
+ void Error(const QString & errmsg);
+ void Warning(const QString & wrnmsg);
+ void AskForPassword(const QString & nick);
+ void NickTaken(const QString & nick);
+ void AuthFailed();
+ void EnteredGame();
+ void LeftRoom(const QString & reason);
+ void nickAdded(const QString& nick, bool notifyNick);
+ void nickRemoved(const QString& nick);
+ void nickAddedLobby(const QString& nick, bool notifyNick);
+ void nickRemovedLobby(const QString& nick);
+ void FromNet(const QByteArray & buf);
+ void adminAccess(bool);
+ void roomMaster(bool);
- void netSchemeConfig(QStringList &);
- void paramChanged(const QString & param, const QStringList & value);
- void configAsked();
+ void netSchemeConfig(QStringList &);
+ void paramChanged(const QString & param, const QStringList & value);
+ void configAsked();
- void TeamAccepted(const QString&);
- void AddNetTeam(const HWTeam&);
- void RemoveNetTeam(const HWTeam&);
- void hhnumChanged(const HWTeam&);
- void teamColorChanged(const HWTeam&);
- void chatStringLobby(const QString&);
- void chatStringLobby(const QString&, const QString&);
- void chatStringFromNet(const QString&);
- void chatStringFromMe(const QString&);
- void chatStringFromMeLobby(const QString&);
+ void TeamAccepted(const QString&);
+ void AddNetTeam(const HWTeam&);
+ void RemoveNetTeam(const HWTeam&);
+ void hhnumChanged(const HWTeam&);
+ void teamColorChanged(const HWTeam&);
+ void chatStringLobby(const QString&);
+ void chatStringLobby(const QString&, const QString&);
+ void chatStringFromNet(const QString&);
+ void chatStringFromMe(const QString&);
+ void chatStringFromMeLobby(const QString&);
- void roomsList(const QStringList&);
- void serverMessage(const QString &);
- void serverMessageNew(const QString &);
- void serverMessageOld(const QString &);
- void latestProtocolVar(int);
+ void roomsList(const QStringList&);
+ void serverMessage(const QString &);
+ void serverMessageNew(const QString &);
+ void serverMessageOld(const QString &);
+ void latestProtocolVar(int);
- void setReadyStatus(const QString & nick, bool isReady);
- void setMyReadyStatus(bool isReady);
+ void setReadyStatus(const QString & nick, bool isReady);
+ void setMyReadyStatus(bool isReady);
- public slots:
- void ToggleReady();
- void chatLineToNet(const QString& str);
- void chatLineToLobby(const QString& str);
- void SendTeamMessage(const QString& str);
- void SendNet(const QByteArray & buf);
- void AddTeam(const HWTeam & team);
- void RemoveTeam(const HWTeam& team);
- void onHedgehogsNumChanged(const HWTeam& team);
- void onTeamColorChanged(const HWTeam& team);
- void onParamChanged(const QString & param, const QStringList & value);
+ public slots:
+ void ToggleReady();
+ void chatLineToNet(const QString& str);
+ void chatLineToLobby(const QString& str);
+ void SendTeamMessage(const QString& str);
+ void SendNet(const QByteArray & buf);
+ void AddTeam(const HWTeam & team);
+ void RemoveTeam(const HWTeam& team);
+ void onHedgehogsNumChanged(const HWTeam& team);
+ void onTeamColorChanged(const HWTeam& team);
+ void onParamChanged(const QString & param, const QStringList & value);
- void setServerMessageNew(const QString &);
- void setServerMessageOld(const QString &);
- void setLatestProtocolVar(int proto);
- void askServerVars();
+ void setServerMessageNew(const QString &);
+ void setServerMessageOld(const QString &);
+ void setLatestProtocolVar(int proto);
+ void askServerVars();
- void JoinRoom(const QString & room);
- void CreateRoom(const QString & room);
- void updateRoomName(const QString &);
- void askRoomsList();
- void gameFinished(bool correcly);
- void banPlayer(const QString &);
- void kickPlayer(const QString &);
- void infoPlayer(const QString &);
- void followPlayer(const QString &);
- void startGame();
- void toggleRestrictJoins();
- void toggleRestrictTeamAdds();
- void partRoom();
- void clearAccountsCache();
+ void JoinRoom(const QString & room);
+ void CreateRoom(const QString & room);
+ void updateRoomName(const QString &);
+ void askRoomsList();
+ void gameFinished(bool correcly);
+ void banPlayer(const QString &);
+ void kickPlayer(const QString &);
+ void infoPlayer(const QString &);
+ void followPlayer(const QString &);
+ void startGame();
+ void toggleRestrictJoins();
+ void toggleRestrictTeamAdds();
+ void partRoom();
+ void clearAccountsCache();
- private slots:
- void ClientRead();
- void OnConnect();
- void OnDisconnect();
- void displayError(QAbstractSocket::SocketError socketError);
+ private slots:
+ void ClientRead();
+ void OnConnect();
+ void OnDisconnect();
+ void displayError(QAbstractSocket::SocketError socketError);
};
#endif // _NEW_NETCLIENT_INCLUDED