~ubuntu-branches/ubuntu/maverick/qgo/maverick

« back to all changes in this revision

Viewing changes to src/tables.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2005-01-01 23:07:10 UTC
  • Revision ID: james.westby@ubuntu.com-20050101230710-fhng6yidm47xlb2i
Tags: upstream-1.0.0-r2
ImportĀ upstreamĀ versionĀ 1.0.0-r2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   tables.h
 
3
 */
 
4
 
 
5
#ifndef TABLES_H
 
6
#define TABLES_H
 
7
 
 
8
#include "gs_globals.h"
 
9
#include "parser.h"
 
10
#include "talk_gui.h"
 
11
#include <qstring.h>
 
12
#include <qobject.h>
 
13
#include <qlistview.h>
 
14
//#include <qmultilineedit.h>
 
15
#include <qtextedit.h>        //eb16
 
16
#include <qlineedit.h>
 
17
#include <qlayout.h>
 
18
#include <qpushbutton.h>
 
19
#include <qwidget.h>
 
20
#include <qpalette.h>
 
21
 
 
22
//-----------
 
23
 
 
24
class Channel
 
25
{
 
26
private:
 
27
        int     nr;
 
28
        QString title;
 
29
        QString users;
 
30
        int     count;
 
31
 
 
32
public:
 
33
        Channel(int nr_, const QString &title_=QString(), const QString &users_=QString(), int count_=0)
 
34
        {
 
35
                nr = nr_;
 
36
                title = title_;
 
37
                users = users_;
 
38
                count = count_;
 
39
        }
 
40
        ~Channel() {};
 
41
        int     get_nr() const { return nr; }
 
42
        QString get_title() const { return title; }
 
43
        QString get_users() const { return users; }
 
44
        int     get_count() const { return count; }
 
45
        void    set_channel(int nr_, const QString &title_, const QString &users_=QString(), int count_=0)
 
46
        {
 
47
                if (this->nr == nr_)
 
48
                {
 
49
                        if (title_)
 
50
                                this->title = title_;
 
51
                        if (users_)
 
52
                                this->users = users_;
 
53
                        if (count_)
 
54
                                this->count = count_;
 
55
                }
 
56
        }
 
57
 
 
58
        // operators <, ==
 
59
        int operator== (Channel h)
 
60
                { return (this->get_nr() == h.get_nr()); };
 
61
        int operator== (Channel *h)
 
62
                { return (this->get_nr() == h->get_nr()); };
 
63
        bool operator< (Channel h)
 
64
                { return (this->get_nr() < h.get_nr()); };
 
65
        bool operator< (Channel *h)
 
66
                { return (this->get_nr() < h->get_nr()); };
 
67
};
 
68
 
 
69
class ChannelList : public QPtrList<Channel>
 
70
{
 
71
public:
 
72
        ChannelList() {};
 
73
        ~ChannelList() {};
 
74
        
 
75
        virtual int compareItems(Item d1, Item d2);
 
76
};
 
77
 
 
78
//-----------
 
79
 
 
80
class Talk : public TalkGui
 
81
{
 
82
        Q_OBJECT
 
83
 
 
84
private:
 
85
        QString        name;
 
86
//      QTextEdit      *MultiLineEdit1;     //eb16
 
87
//      QLineEdit      *LineEdit1;
 
88
//      QGridLayout    *TalkDialogWidgetLayout;
 
89
//      QPushButton    *pb_releaseTalkTab;
 
90
//      QWidget        *widget;
 
91
//      QBoxLayout     *buttonLayout;
 
92
        static int     counter;
 
93
 
 
94
public:
 
95
        Talk(const QString&, QWidget*, bool isplayer = true);
 
96
        ~Talk();
 
97
        QTextEdit      *get_mle() const { return MultiLineEdit1; } //eb16
 
98
        QLineEdit      *get_le() const {return LineEdit1; }
 
99
        QWidget        *get_tabWidget()  { return this; }
 
100
//      QPushButton    *get_pb() const { return pb_releaseTalkTab; }
 
101
        QString        get_name() const { return name; }
 
102
        void           set_name(QString &n) { name = n; }
 
103
        void           write(const QString &text = QString()) const;
 
104
        bool           pageActive;
 
105
        void           setTalkWindowColor(QPalette pal);
 
106
 
 
107
public slots:
 
108
        void slot_returnPressed();
 
109
        void slot_pbRelTab();
 
110
  void slot_match();
 
111
 
 
112
signals:
 
113
        void signal_talkto(QString&, QString&);
 
114
        void signal_pbRelOneTab(QWidget*);
 
115
  void signal_matchrequest(const QString&,bool);
 
116
};
 
117
 
 
118
//-----------
 
119
 
 
120
class Host
 
121
{
 
122
public:
 
123
        Host(const QString&, const QString&, const unsigned int, const QString&, const QString&);
 
124
        ~Host() {};
 
125
        QString title() const { return t; };
 
126
        QString host() const { return h; };
 
127
        unsigned int port() const { return pt; };
 
128
        QString loginName() const { return lg; };
 
129
        QString password() const { return pw; };
 
130
        // operators <, ==
 
131
        int operator== (Host h)
 
132
                { return (this->title() == h.title()); };
 
133
        int operator== (Host *h)
 
134
                { return (this->title() == h->title()); };
 
135
        bool operator< (Host h)
 
136
                { return (this->title() < h.title()); };
 
137
        bool operator< (Host *h)
 
138
                { return (this->title() < h->title()); };
 
139
 
 
140
private:
 
141
        QString t;
 
142
        QString h;
 
143
        QString lg;
 
144
        QString pw;
 
145
        unsigned int pt;
 
146
};
 
147
 
 
148
class HostList : public QPtrList<Host>
 
149
{
 
150
public:
 
151
        HostList() {};
 
152
        ~HostList() {};
 
153
        
 
154
        virtual int compareItems(Item d1, Item d2);
 
155
};
 
156
 
 
157
//-----------
 
158
 
 
159
class Player
 
160
{
 
161
public:
 
162
        Player() {};
 
163
        ~Player() {};
 
164
        // #> Info Name Idle Rank | Info Name Idle Rank 
 
165
        QString info;
 
166
        QString name;
 
167
        QString idle;
 
168
        QString rank;
 
169
        QString play_str;
 
170
        QString obs_str;
 
171
        QString extInfo;
 
172
        QString won;
 
173
        QString lost;
 
174
        QString country;
 
175
        QString language;
 
176
        QString rated;
 
177
        QString address;
 
178
        int     playing;
 
179
        int     observing;
 
180
        bool    online;
 
181
};
 
182
 
 
183
//-----------
 
184
 
 
185
class Game
 
186
{
 
187
public:
 
188
        Game() {};
 
189
        ~Game() {};
 
190
        // #> [##] white name [ rk ] black name [ rk ] (Move size H Komi BY FR) (###) 
 
191
        QString nr;
 
192
        QString wname;
 
193
        QString wrank;
 
194
        QString bname;
 
195
        QString brank;
 
196
//      QString status;
 
197
        QString mv;
 
198
        QString Sz;
 
199
        QString H;
 
200
        QString K;
 
201
        QString By;
 
202
        QString FR;
 
203
        QString ob;
 
204
        bool    running;
 
205
  bool oneColorGo ;
 
206
};
 
207
 
 
208
//-----------
 
209
 
 
210
class Account
 
211
{
 
212
public:
 
213
        Account(QWidget*);
 
214
        ~Account();
 
215
        void set_caption();
 
216
        void set_gsname(GSName);
 
217
        void set_offline();
 
218
        void set_accname(QString&);
 
219
        void set_status(Status);
 
220
        void set_rank(QString &rk) { rank = rk; }
 
221
        QString get_rank() { return rank; }
 
222
        Status  get_status();
 
223
        GSName  get_gsname();
 
224
 
 
225
        GSName  gsName;
 
226
        QString svname;
 
227
        QString acc_name;
 
228
        Status  status;
 
229
        int     num_players;
 
230
        int     num_games;
 
231
        int     num_watchedplayers;
 
232
        int     num_observedgames;
 
233
 
 
234
private:
 
235
        QString rank;
 
236
        QString line;
 
237
        QString standard;
 
238
        QWidget *parent;
 
239
};
 
240
 
 
241
 
 
242
#endif
 
243