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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#ifndef MEETING_H
#define MEETING_H
#include <tqstatusbar.h>
#include <kdialogbase.h>
#include "smanager.h"
#include "pline.h"
#include "types.h"
class MPOptionWidget;
/** Internal class : net meeting. */
class NetMeeting : public KDialogBase
{
TQ_OBJECT
public:
// "gameName" and "gameId" are TQByteArray because they are
// used for ID comparing between games.
NetMeeting(const cId &id, Socket *, MPOptionWidget *option, bool server,
TQWidget *parent = 0, const char * name = 0);
virtual ~NetMeeting();
protected slots:
void readNotifier(int socket);
virtual void textChanged(const TQString &) = 0;
virtual void typeChanged(MeetingCheckBox::Type) = 0;
virtual void reject();
virtual void accept();
protected:
enum PlayerState { NewPlayer, IdChecked, Accepted };
TQValueList<PlayerState> players;
bool server;
MeetingLine *spl;
WidgetList<MeetingLine> *wl;
SocketManager sm;
MPOptionWidget *ow;
cId id;
bool socketRemoved;
void appendLine(const MeetingLineData &pld, bool server);
void removeLine(uint i);
void setType(const TypeInfo &ti);
void setText(const TextInfo &ti);
void cleanReject(const TQString &str = TQString());
bool checkState(uint i, PlayerState s);
bool checkAndSetState(uint i, PlayerState os, PlayerState ns);
bool ready() const;
virtual void idFlag(uint i) { dataError(i); }
virtual void newFlag(uint i) { dataError(i); }
virtual void endFlag(uint i) { dataError(i); }
virtual void modTypeFlag(uint i) { dataError(i); }
virtual void modTextFlag(uint i) { dataError(i); }
virtual void delFlag(uint i) { dataError(i); }
virtual void modOptFlag(uint i) { dataError(i); }
virtual void playFlag(uint i) { dataError(i); }
virtual void netError(uint i, const TQString &str) = 0;
virtual void writeToAll(uint i=0) = 0;
void readError(uint i);
void writeError(uint i);
void dataError(uint i);
void brokeError(uint i);
void message(const TQString &str);
private:
TQLabel *labWait;
TQStatusBar *status;
void waiting();
void readData(uint i);
};
class ServerNetMeeting : public NetMeeting
{
TQ_OBJECT
public:
ServerNetMeeting(const cId &id,
const RemoteHostData &rhd, MPOptionWidget *options,
TQPtrList<RemoteHostData> &arhd,
TQWidget *parent = 0, const char * name = 0);
private slots:
void newHost(int);
void textChanged(const TQString &text);
void typeChanged(MeetingCheckBox::Type);
void accept();
void optionsChanged();
private:
TQPtrList<RemoteHostData> &rhd;
void idFlag(uint i);
void newFlag(uint i);
void endFlag(uint i);
void modTypeFlag(uint i);
void modTextFlag(uint i);
void netError(uint i, const TQString &str);
void writeToAll(uint i = 0);
void disconnectHost(uint i, const TQString &str);
};
class ClientNetMeeting : public NetMeeting
{
TQ_OBJECT
public:
ClientNetMeeting(const cId &id,
const RemoteHostData &rhd, MPOptionWidget *options,
TQWidget *parent = 0, const char * name = 0);
private slots:
void textChanged(const TQString &text);
void typeChanged(MeetingCheckBox::Type);
private:
TQValueList<BoardData> bds;
void idFlag(uint);
void newFlag(uint);
void endFlag(uint);
void delFlag(uint);
void modTypeFlag(uint);
void modTextFlag(uint);
void modOptFlag(uint);
void playFlag(uint);
void writeToAll(uint i=0);
void netError(uint, const TQString &str);
};
#endif // MEETING_H
|