Mihawk před 11 roky
rodič
revize
4fe08f9229
2 změnil soubory, kde provedl 31 přidání a 28 odebrání
  1. 7 4
      ActiveClient.h
  2. 24 24
      App.h

+ 7 - 4
ActiveClient.h

@@ -56,22 +56,25 @@ private slots:
 
 private:
   App*              myApp;
-  Client*           myClient;
-  ServerQuery*      myQuery;
-  QTime*            myDisconnectTime;
+  Client*           myClient; //the QW bot
+  ServerQuery*      myQuery; //queries all players information from the server
+  QTime*            myDisconnectTime; //timer to avoid too fast reconnections
 
   /* Count server reply while timer is active */
   QString           myReplyHash;
   QTimer*           myBroadcastReplyTimer;
+
+  /* How much time to wait b4 next query for player information */
   QTimer*           myQueryTimer;
   quint32           myQueryInterval;
 
+  /* Reply counters */
   int               myUniqueUserCount;
   int               myUniqueChannelCount;
   int               myUniqueServerCount;
   int               myUniquePlayerCount;
 
-  bool              myReplyTimerWasActive;
+  bool              myReplyTimerWasActive; //for printing the reply counters
 };
 
 #endif // ACTIVECLIENT_H

+ 24 - 24
App.h

@@ -17,11 +17,11 @@ class App : public QCoreApplication
 {
   Q_OBJECT
 public:
-  explicit							App(int &argc, char **argv);
-  ~App();
+  explicit              App(int &argc, char **argv);
+                        ~App();
 
-  void									print(const QString& msg);
-  void									broadcast(const QString& msg, int *serverCount, int *userCount);
+  void                  print(const QString& msg);
+  void                  broadcast(const QString& msg, int *serverCount, int *userCount);
   void                  broadcast(const QString& msg, ActiveClient* ignoredClient = 0);
   void                  requestBroadcast(const QString& type, const QString& user, const QString& server, const QString& message);
   void                  setReplyHash(const QString& serverAddress, const QString& hash);
@@ -35,39 +35,39 @@ protected:
 private:
   QTcpSocket*           mySocket;
   QTcpServer*           myServer;
-  bool									mySocketConnectedFlag;
+  bool                  mySocketConnectedFlag;
   SshClient*            myQWNETSshClient;
 
   QList<ActiveClient*>  myClients;
-  quint32								myCurrentClient;
-  QSettings							mySettings;
-  int										myClientsFrameTimerID; //timer for mainloop
+  quint32               myCurrentClient;
+  QSettings             mySettings;
+  int                   myClientsFrameTimerID; //timer for mainloop
   QStringList           myLastMessages;
 
-  void									loadServerList();
+  void                  loadServerList();
   void                  saveServerList();
-  void									cleanup();
+  void                  cleanup();
   void                  addMessageToHistory(const QString& msg);
 
   /* TCP Server */
-  bool									checkPassword(const QString& password);
-  void									addClient(const QString& host, quint16 port);
-  void									removeClient(const QString& host, quint16 port);
-  void									parseAddClientCommand(const QString& args);
-  void									parseRemoveClientCommand(const QString& args);
-  void									setTeam(const QString& team);
-  void									listClients();
-  void									setColor(const QString& args);
-  void									setNick(const QString& args);
-  void									setPing(const QString& args);
-  void									help();
+  bool                  checkPassword(const QString& password);
+  void                  addClient(const QString& host, quint16 port);
+  void                  removeClient(const QString& host, quint16 port);
+  void                  parseAddClientCommand(const QString& args);
+  void                  parseRemoveClientCommand(const QString& args);
+  void                  setTeam(const QString& team);
+  void                  listClients();
+  void                  setColor(const QString& args);
+  void                  setNick(const QString& args);
+  void                  setPing(const QString& args);
+  void                  help();
   bool                  parseCommandLine();
 
 private slots:
   /* TCP server */
-  void									onDataArrival();
-  void									onNewConnection();
-  void									onDisconnection();
+  void                  onDataArrival();
+  void                  onNewConnection();
+  void                  onDisconnection();
 };
 
 #endif // APP_H