Viergewinnt (four-in-a-row) implementation in c++ and QT
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

findserver.h 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef __FINDSERVER_H
  2. #define __FINDSERVER_H
  3. #include <QApplication>
  4. #include <QStringList>
  5. #include <QTreeWidget>
  6. #include <QTextEdit>
  7. /* VierGewinnt - A simple 4-in-a-row network game
  8. *
  9. * Copyright (c) 2008 by Sebastian Lohff, seba@seba-geek.de
  10. * http://www.seba-geek.de
  11. *
  12. * This file is part of VierGewinnt.
  13. *
  14. * VierGewinnt is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation, either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * VierGewinnt is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with VierGewinnt. If not, see <http://www.gnu.org/licenses/>.
  26. */
  27. #include <QLayout>
  28. #include <QPushButton>
  29. #include <QWidget>
  30. #include <QTcpSocket>
  31. #include "selectmaster.h"
  32. #include "creategame.h"
  33. #include "viergewinnt.h"
  34. #include "about.h"
  35. class FindServerWidget : public QWidget {
  36. Q_OBJECT
  37. public:
  38. FindServerWidget(QWidget *parent=0);
  39. private slots:
  40. void refreshServerList();
  41. void changeMaster();
  42. void createGame();
  43. void joinGame();
  44. void procNet();
  45. void procNetError(QAbstractSocket::SocketError e);
  46. void procNetDisconnect();
  47. private:
  48. // main stuff
  49. void addLog(QString str);
  50. void startConnect();
  51. void goToGameWindow();
  52. // gns stuff
  53. QTcpSocket *mysock;
  54. QString masterserver;
  55. int masterport;
  56. bool ingame;
  57. bool refreshonconnect;
  58. int loginstate;
  59. CreateGameDialog *cgamedialog;
  60. // gui stuff
  61. QTreeWidget *nettable;
  62. QHBoxLayout *buttonrow;
  63. QPushButton *refresh;
  64. QPushButton *create;
  65. QPushButton *join;
  66. QPushButton *othermaster;
  67. QPushButton *butabout;
  68. QTextEdit *status;
  69. SelectMasterDialog *masterdialog;
  70. QVBoxLayout *layout;
  71. VierGewinntWidget *vwinwid;
  72. AboutDialog *about;
  73. };
  74. #endif