ActiveClient.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. GNU General Public License version 3 notice
  3. Copyright (C) 2012 Mihawk <luiz@netdome.biz>. All rights reserved.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see < http://www.gnu.org/licenses/ >.
  14. */
  15. #ifndef ACTIVECLIENT_H
  16. #define ACTIVECLIENT_H
  17. #include <QString>
  18. class QHostAddress;
  19. class ServerQueryThread;
  20. class QTimer;
  21. class QTime;
  22. class Client;
  23. class App;
  24. class ActiveClient
  25. {
  26. public:
  27. ActiveClient(App* app);
  28. ~ActiveClient();
  29. Client* client();
  30. ServerQueryThread*queryThread();
  31. void run();
  32. void setAddressAndStartThread(const QHostAddress &address, quint16 port);
  33. const QString serverAddressString();
  34. void setReplyHash(const QString& hash); //this activates the 5 seconds reply timer too
  35. const QString& replyHash() const;
  36. void incrementReplyCounters(int userCount, int channelCount, int playerCount, int serverCount);
  37. bool isWaitingReply() const;
  38. private:
  39. App* myApp;
  40. Client* myClient;
  41. ServerQueryThread*myQueryThread;
  42. QTime* myDisconnectTime;
  43. /* Count server reply while timer is active */
  44. QString myReplyHash;
  45. QTimer* myBroadcastReplyTimer;
  46. int myUniqueUserCount;
  47. int myUniqueChannelCount;
  48. int myUniqueServerCount;
  49. int myUniquePlayerCount;
  50. bool myReplyTimerWasActive;
  51. ActiveClient(const ActiveClient&) {}
  52. };
  53. #endif // ACTIVECLIENT_H