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:
|