123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef CLIENT_H
- #define CLIENT_H
- #include "QWClient.h"
- #include <QString>
- #include <QList>
- #include <QTime>
- class App;
- class QTcpSocket;
- class Client : public QWClient
- {
- public:
- Client(App* app);
- ~Client();
- void disconnect();
- void say(const QString& msg);
- void sayTeam(const QString& msg);
- void setTeam(const QString& msg);
- void setSocket(class QTcpSocket* socket);
- void retryConnection(); //unused
- bool isOnServer() const;
- // quint8 playerCount() const;
- protected:
- void onLevelChanged(int playerNum, const char *levelName, float gravity, float stopSpeed, float maxSpeed, float spectatorMaxSpeed, float accelerate, float airAccelerate, float waterAccelerate, float friction, float waterFriction, float entGravity);
- void onDisconnect();
- void onPrint(int level, const char *msg);
- void onChallenge();
- void onConnection();
- void onConnected();
- void onDownloadStarted(const char *fileName);
- void onDownloadFinished();
- void onDownloadProgress(int percent);
- void onStuffedCmd(const char *cmd);
- void onError(const char *description);
- void onOOBPrint(const char *msg);
- private:
- App* myApp;
- QTcpSocket* mySocket;
- QTime myTimer;
- bool myFloodMsgPrinted;
- int myConnectionRetries;
- static const int ConnectionRetries = 10;
- QString myPrintLine;
- bool myDownloadProgressPrintedFlag;
- bool myOnServerFlag;
- // struct Player {
- // int slot;
- // int userID;
- // QString team;
- // QString name;
- // };
- // Player* myPlayers[32];
- // quint8 myPlayerCount;
- // void cleanupPlayers();
- void print(const QString& msg);
- void parsePrintedLine();
- // static const QString& getInfoKeyValue(const QStringList& infoString, const QString& key);
- static void yellowText(const QString& text);
- };
- #endif // CLIENT_H
|