QWClient.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. #include "QWClient.h"
  16. #include "QWClientPrivate.h"
  17. #include <stdio.h>
  18. QWClient::QWClient():
  19. myImplementation(new QWClientPrivate(this))
  20. {
  21. }
  22. void QWClient::connect(const char *host, quint16 port)
  23. {
  24. myImplementation->connect(host, port);
  25. }
  26. void QWClient::run()
  27. {
  28. myImplementation->run();
  29. }
  30. void QWClient::disconnect()
  31. {
  32. myImplementation->disconnect();
  33. }
  34. QWClient::~QWClient()
  35. {
  36. delete myImplementation;
  37. }
  38. void QWClient::join()
  39. {
  40. myImplementation->join();
  41. }
  42. void QWClient::observe()
  43. {
  44. myImplementation->observe();
  45. }
  46. void QWClient::setQuakeFolder(const char *path)
  47. {
  48. myImplementation->setQuakeFolder(path);
  49. }
  50. void QWClient::setColor(quint8 bottom, quint8 top)
  51. {
  52. myImplementation->setColor(bottom, top);
  53. }
  54. void QWClient::setName(const char *name)
  55. {
  56. myImplementation->setName(name);
  57. }
  58. void QWClient::setSpectator(bool spectate)
  59. {
  60. myImplementation->setSpectator(spectate);
  61. }
  62. void QWClient::stripColor(char *string)
  63. {
  64. QWClientPrivate::stripColor(string);
  65. }
  66. void QWClient::sendCmd(const char *cmd)
  67. {
  68. QString command(cmd);
  69. myImplementation->sendCmd(cmd);
  70. }
  71. void QWClient::setRate(quint16 rate)
  72. {
  73. myImplementation->setRate(rate);
  74. }
  75. void QWClient::setPing(quint16 ping)
  76. {
  77. myImplementation->setPing(ping);
  78. }
  79. void QWClient::reconnect()
  80. {
  81. myImplementation->reconnect();
  82. }
  83. const char* QWClient::host() const
  84. {
  85. static char host[255];
  86. memcpy(host, myImplementation->host().toLatin1().data(), myImplementation->host().toLatin1().size()+1);
  87. return host;
  88. }
  89. quint16 QWClient::port() const
  90. {
  91. return myImplementation->port();
  92. }
  93. QWClient::ClientState QWClient::state() const
  94. {
  95. return myImplementation->state();
  96. }
  97. const QString& QWClient::gameDir() const
  98. {
  99. return myImplementation->gameDir();
  100. }
  101. const QString& QWClient::quakeDir() const
  102. {
  103. return myImplementation->quakeDir();
  104. }
  105. void QWClient::setPassword(const char *password)
  106. {
  107. myImplementation->setPassword(QString(password));
  108. }
  109. //========================================================================
  110. // Events
  111. void QWClient::onCenterPrint(const char *)
  112. {
  113. }
  114. void QWClient::onDamage(int, int)
  115. {
  116. }
  117. void QWClient::onDisconnect()
  118. {
  119. }
  120. void QWClient::onDownloadFinished()
  121. {
  122. }
  123. void QWClient::onDownloadProgress(int)
  124. {
  125. }
  126. void QWClient::onDownloadStarted(const char *)
  127. {
  128. }
  129. void QWClient::onEntGravityChange(float)
  130. {
  131. }
  132. void QWClient::onLevelChanged(int, const char*, float, float, float, float, float, float, float, float, float, float)
  133. {
  134. }
  135. void QWClient::onMaxSpeedChange(float)
  136. {
  137. }
  138. void QWClient::onModelListFile(const char *)
  139. {
  140. }
  141. void QWClient::onPlayerInfo(int, float, float, float)
  142. {
  143. }
  144. void QWClient::onPlaySound(int)
  145. {
  146. }
  147. void QWClient::onPrint(int, const char *)
  148. {
  149. }
  150. void QWClient::onServerInfo(const char *, const char *)
  151. {
  152. }
  153. void QWClient::onSetInfo(int, const char *, const char *)
  154. {
  155. }
  156. void QWClient::onSetPause(bool)
  157. {
  158. }
  159. void QWClient::onSoundListFile(const char *)
  160. {
  161. }
  162. void QWClient::onStuffedCmd(const char *)
  163. {
  164. }
  165. void QWClient::onUpdateFrags(int, int)
  166. {
  167. }
  168. void QWClient::onUpdatePing(int, int)
  169. {
  170. }
  171. void QWClient::onUpdatePL(int, int)
  172. {
  173. }
  174. void QWClient::onUpdateUserInfo(int, int, const char *)
  175. {
  176. }
  177. void QWClient::onError(const char *)
  178. {
  179. }
  180. void QWClient::onOOBCommand(const char *)
  181. {
  182. }
  183. void QWClient::onOOBEcho(const char *)
  184. {
  185. }
  186. void QWClient::onOOBPrint(const char *)
  187. {
  188. }
  189. void QWClient::onChallenge()
  190. {
  191. }
  192. void QWClient::onConnection()
  193. {
  194. }
  195. void QWClient::onConnected()
  196. {
  197. }