File: networkClient.h

package info (click to toggle)
gpsshogi 0.7.0-3.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 111,280 kB
  • sloc: cpp: 80,962; perl: 12,610; ruby: 3,929; javascript: 1,631; makefile: 1,202; sh: 473; tcl: 166; ansic: 67
file content (74 lines) | stat: -rw-r--r-- 1,660 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef _NETWORK_CLIENT_H
#define _NETWORK_CLIENT_H
#include <qglobal.h>
#include <QTcpSocket>
#include <qtextedit.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qstringlist.h>
#include <qtextstream.h>
#include <qregexp.h>

class NetworkClient : public QWidget
{
  Q_OBJECT

 public:
  NetworkClient(QWidget *parent = 0);

 public slots:
  void setHostname(QString);
  void setUsername(QString);
  void setPassword(QString);
  void openConnection();
  void closeConnection();
  void toggleConnection();
  void updateList();
  void show(QString);

 signals:
  void gotWho(QString);
  void gotGames(QString);
  void gotBoard(QString);
  void gotLastMove(QString);
  void chatReceived();

 private slots:
  void socketReadyRead();
  void socketConnected();
  void socketConnectionClosed();
  void socketClosed();
  void socketError(QAbstractSocket::SocketError e);

  void send_chat();
  void show_game();
  void monitor_game();
  void show_message(QString);
  void update_who(QString);
  void update_games(QString);

private:
  bool connected, monitoring, retr_who, retr_games, retr_board;

  void handle_command(QString com, QString arg);

  QTcpSocket *socket;
  QString who_str, games_str, board_str;
  QString monitoring_game, last_player;
  QComboBox *who, *games;
  QTextEdit *info_text;
  QLineEdit *input;
  QLineEdit *hostname, *username, *password;
  QPushButton *toggle, *update, *shownow;
  QCheckBox *monitor;
  QRegExp chat_re, monitor_re, command_re, who_re;
};

#endif // _NETWORK_CLIENT_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: