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

« back to all changes in this revision

Viewing changes to src/mainwin.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
 * mainwindow.h
 
3
 */
 
4
 
 
5
#ifndef MAINWIN_H
 
6
#define MAINWIN_H
 
7
 
 
8
#include "clientwindow_gui.h"
 
9
#include "gui_dialog.h"
 
10
#include "setting.h"
 
11
#include "tables.h"
 
12
#include "config.h"
 
13
#include "telnet.h"
 
14
#include "igsinterface.h"
 
15
#include "parser.h"
 
16
#include "gs_globals.h"
 
17
#include "misc.h"
 
18
#include "gamedialog.h"
 
19
#include "maintable.h"
 
20
#include "gamestable.h"
 
21
#include "playertable.h"
 
22
#include "mainwindow.h"
 
23
#include <qwidget.h>
 
24
#include <qapplication.h>
 
25
#include <qdialog.h>
 
26
#include <qpushbutton.h>
 
27
#include <qmessagebox.h>
 
28
#include <qfiledialog.h>
 
29
#include <qdir.h>
 
30
#include <qlabel.h>
 
31
#include <qlistview.h>
 
32
#include <qcheckbox.h>
 
33
#include <qtextstream.h>
 
34
#include <qtextview.h>
 
35
//#include <qmultilineedit.h>
 
36
#include <qtextedit.h>
 
37
#include <qtextbrowser.h> 
 
38
#include <qstring.h>
 
39
#include <qobject.h>
 
40
#include <qdragobject.h>
 
41
#include <qevent.h>
 
42
#include <qtooltip.h>
 
43
#include <qwhatsthis.h>
 
44
#include <qtextstream.h>
 
45
#include <qstatusbar.h>
 
46
#include <qtoolbar.h>
 
47
#include <qmenubar.h>                //SL added eb 3
 
48
#include <qptrlist.h>
 
49
 
 
50
//#include <qstyle.h>
 
51
 
 
52
class GamesTable;
 
53
//class QStyle;
 
54
 
 
55
class sendBuf
 
56
{
 
57
public:
 
58
        sendBuf(QString text, bool echo=true) { txt = text; localecho = echo; }
 
59
        ~sendBuf() {}
 
60
        QString get_txt() { return txt; }
 
61
        bool get_localecho() { return localecho; }
 
62
        QString txt;
 
63
    
 
64
private:
 
65
        bool localecho;
 
66
};
 
67
 
 
68
class ClientWindow : public ClientWindowGui, public Misc<QString>
 
69
{
 
70
        Q_OBJECT
 
71
 
 
72
public:
 
73
        ClientWindow(QMainWindow* parent, const char* name, WFlags fl=WType_TopLevel);
 
74
        ~ClientWindow();
 
75
 
 
76
        int sendTextFromApp(const QString&, bool localecho=true);
 
77
        void sendcommand(const QString&, bool localecho=false);
 
78
        void prepare_tables(InfoType);
 
79
        void set_sessionparameter(QString, bool);
 
80
        QString getPlayerRk(QString);
 
81
        QString getPlayerExcludeListEntry(QString);
 
82
        void openLocalBoard(QString file=0) { qgoif->set_localboard(file); }
 
83
        void openLocalGame() { qgoif->set_localgame(); }
 
84
        void openPreferences() { qgoif->openPreferences(); }
 
85
        void saveMenuFrame(QPoint p, QSize s) { menu_p = p; menu_s = s; }
 
86
        void savePrefFrame(QPoint p, QSize s) { pref_p = p; pref_s = s; }
 
87
        QPoint getMenuPos() { return menu_p; }
 
88
        QSize getMenuSize() { return menu_s; }
 
89
        QPoint getViewPos() { return view_p; }
 
90
        QSize getViewSize() { return view_s; }
 
91
        QPoint getPrefPos() { return pref_p; }
 
92
        QSize getPrefSize() { return pref_s; }
 
93
        void setDebugDialog(Debug_Dialog *d) { DD = d; }
 
94
        void setColumnsForExtUserInfo();
 
95
        void reStoreWindowSize(QString strKey, bool store);
 
96
        void setBytesIn(int i) { if (i == -1) bytesIn = 0; else bytesIn += i; }
 
97
        void setBytesOut(int i) { if (i == -1) bytesOut = 0; else bytesOut += i; }
 
98
        void saveSettings();
 
99
 
 
100
        bool DODEBUG;
 
101
//      QSortedList<Host>  hostlist;
 
102
//      QPtrList<Host>  hostlist;
 
103
        HostList hostlist;
 
104
  QButtonGroup *userButtonGroup ;
 
105
  
 
106
        QString  defaultStyle ;
 
107
 
 
108
signals:
 
109
        void signal_cmdsent(const QString&);
 
110
        void signal_move(Game*);
 
111
        void signal_computer_game(QNewGameDlg*);       //SL added eb 12
 
112
 
 
113
public slots:
 
114
        void slot_setBytesIn(int i) { setBytesIn(i); }
 
115
        void slot_setBytesOut(int i) { setBytesOut(i); }
 
116
 
 
117
        void slot_updateFont();
 
118
        void slot_refresh(int);
 
119
        void slot_playerPopup(int);
 
120
        void slot_gamesPopup(int);
 
121
//      void slot_channelPopup(int);
 
122
        void slot_pbRelTabs();
 
123
        void slot_pbRelOneTab(QWidget*);
 
124
  void slot_statsPlayer(Player*);
 
125
 
 
126
        // QWidget
 
127
//      virtual void resizeEvent (QResizeEvent *);
 
128
 
 
129
        // gui_BaseTable:
 
130
        virtual void slot_cbExtUserInfo();
 
131
        virtual void slot_cblooking();
 
132
        virtual void slot_cbopen();
 
133
        virtual void slot_cbquiet();
 
134
        virtual void quit();
 
135
        virtual void slot_cbconnect(const QString&);
 
136
        virtual void slot_connect(bool);
 
137
        virtual void slot_pbrefreshgames();
 
138
        virtual void slot_pbrefreshplayers();
 
139
        virtual void slot_toolbaractivated(const QString&);
 
140
        virtual void slot_cmdactivated(const QString&);
 
141
        virtual void slot_cmdactivated_int(int);
 
142
        virtual void slot_watchplayer(const QString&);
 
143
        virtual void slot_excludeplayer(const QString&);
 
144
        virtual void slot_localBoard();
 
145
        virtual void slot_local19();
 
146
        virtual void slot_preferences();
 
147
//      virtual void slot_userDefinedKeysTextChanged();
 
148
        virtual void slot_pbuser1();
 
149
        virtual void slot_pbuser2();
 
150
        virtual void slot_pbuser3();
 
151
        virtual void slot_pbuser4();
 
152
 
 
153
        // telnet:
 
154
        void sendTextToApp(const QString&);
 
155
        // parser:
 
156
        void slot_player(Player*, bool);
 
157
        void slot_game(Game*);
 
158
  void slot_message(QString);
 
159
        void slot_message(QString, QColor);
 
160
        void slot_svname(GSName&);
 
161
        void slot_accname(QString&);
 
162
        void slot_status(Status);
 
163
        void slot_connclosed();
 
164
        void slot_talk(const QString&, const QString&, bool);
 
165
        void slot_checkbox(int, bool);
 
166
        void slot_addToObservationList(int);
 
167
        void slot_channelinfo(int, const QString&);
 
168
        void slot_matchrequest(const QString&, bool);
 
169
  void slot_matchCanceled(const QString&);
 
170
        void slot_shout(const QString&, const QString&);
 
171
        // gamestable/playertable:
 
172
        virtual void slot_mouse_games(int, QListViewItem*, const QPoint&, int);
 
173
        virtual void slot_mouse_players(int, QListViewItem*, const QPoint&, int);
 
174
        virtual void slot_click_games(QListViewItem*);
 
175
        virtual void slot_click_players(QListViewItem*);
 
176
        virtual void slot_menu_games(QListViewItem*, const QPoint&, int);
 
177
        virtual void slot_menu_players(QListViewItem*, const QPoint&, int);
 
178
//      void slot_moveOver_players();
 
179
//      void slot_moveOver_games();
 
180
        void slot_playerContentsMoving(int x, int y);
 
181
        void slot_gamesContentsMoving(int x, int y);
 
182
        // gui_talkdialog:
 
183
        virtual void slot_talkto(QString&, QString&);
 
184
        // gamedialog, qgoif
 
185
        void slot_sendcommand(const QString&, bool);
 
186
        //menus
 
187
        void slotFileNewBoard();        
 
188
        void slotFileNewGame();
 
189
        void slotFileOpen();
 
190
        void slotComputerPlay();        
 
191
 
 
192
        void slotHelpManual();
 
193
        void slotHelpSoundInfo();
 
194
        void slotHelpAbout();
 
195
        void slotHelpAboutQt();                           
 
196
 
 
197
        void slotMenuConnect();
 
198
        void slotMenuDisconnect();
 
199
        void slotMenuEditServers();
 
200
 
 
201
        void slotViewToolBar(bool toggle);
 
202
        void slotViewStatusBar(bool toggle);
 
203
        void slotViewMenuBar(bool toggle);
 
204
  void slotViewUserToolBar(bool toggle);
 
205
 
 
206
  void slotUserButtonClicked(int i);
 
207
 
 
208
protected slots:
 
209
        void set_tn_ready();
 
210
 
 
211
private:
 
212
        TelnetConnection   *telnetConnection;
 
213
        Parser             *parser;
 
214
        qGoIF              *qgoif;
 
215
        Account            *myAccount;
 
216
//      QTextCodec         *textCodec;
 
217
//      QTextStream        *textStream;
 
218
//      QString            buffer;
 
219
 
 
220
        // online time
 
221
        int                onlineCount;
 
222
        bool               youhavemsg;
 
223
        bool               playerListEmpty;
 
224
        bool               playerListSteadyUpdate;
 
225
        bool               gamesListSteadyUpdate;
 
226
//      bool               gamesListEmpty;
 
227
        bool               autoAwayMessage;
 
228
 
 
229
        // cmd_xx get current cmd number, and, if higher than last, cmd is valid,
 
230
        //    else cmd is from history list
 
231
        int                cmd_count;
 
232
        bool               cmd_valid;
 
233
        // telnet ready
 
234
        bool               tn_ready;
 
235
        bool               tn_wait_for_tn_ready;
 
236
//      bool               tn_active;
 
237
        ChannelList        channellist;
 
238
        QPtrList<Talk>     talklist;
 
239
        QPtrList<GameDialog> matchlist;
 
240
        QPtrList<sendBuf>  sendBuffer;
 
241
  sendBuf            *currentCommand;
 
242
 
 
243
//      QStatusBar         *statusBar;
 
244
        QLabel             *statusUsers, *statusGames, *statusServer, *statusChannel,
 
245
                           *statusOnlineTime, *statusMessage;
 
246
 
 
247
        // timing aids
 
248
        void timerEvent(QTimerEvent*);
 
249
        int                counter;
 
250
        // reset internal counter (half hour) for timing functions of class ClientWindow
 
251
        void               resetCounter() { counter = 1799; }
 
252
 
 
253
        void initStatusBar(QWidget*);
 
254
        void initmenus(QWidget*);                      
 
255
        void initToolBar();
 
256
        void initActions();                            
 
257
 
 
258
 
 
259
        void keyPressEvent(QKeyEvent*);
 
260
//      void keyReleaseEvent(QKeyEvent*);
 
261
 
 
262
        QString            watch;
 
263
        QString            exclude;
 
264
 
 
265
        // frame sizes
 
266
        QPoint             menu_p;
 
267
        QSize              menu_s;
 
268
        QPoint             view_p;
 
269
        QSize              view_s;
 
270
        QPoint             pref_p;
 
271
        QSize              pref_s;
 
272
        Debug_Dialog       *DD;
 
273
 
 
274
 
 
275
        // popup window save
 
276
        PlayerTableItem    *lv_popupPlayer;
 
277
        GamesTableItem     *lv_popupGames;
 
278
 
 
279
        // extended user info
 
280
        bool               extUserInfo;
 
281
 
 
282
        // statistics
 
283
        int                bytesIn, bytesOut;
 
284
 
 
285
        // event filter
 
286
        virtual bool       eventFilter(QObject *obj, QEvent *ev);
 
287
        QTimer             *timer;
 
288
 
 
289
  // menus
 
290
        QPixmap exitIcon, fileNewboardIcon, fileNewIcon, fileOpenIcon, fileSaveIcon, fileSaveAsIcon,                       
 
291
                connectedIcon,disconnectedIcon, prefsIcon, qgoIcon, manualIcon,
 
292
                OpenIcon, LookingIcon, QuietIcon, NotOpenIcon, NotLookingIcon, NotQuietIcon,
 
293
                RefreshPlayersIcon,  RefreshGamesIcon, ComputerPlayIcon;                                 //SL add eb 6
 
294
 
 
295
   //QPtrList<QToolButton> UserButtonList ;
 
296
 
 
297
};
 
298
 
 
299
#endif