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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301, USA.
#ifndef ATLANTIK_ATLANTIK_H
#define ATLANTIK_ATLANTIK_H
#include <tqwidget.h>
#include <tqlayout.h>
#include <tqtextedit.h>
#include <tqlabel.h>
#include <tqptrlist.h>
#include <kmainwindow.h>
#include "configdlg.h"
#include "portfolioview.h"
#include "board.h"
class TQScrollView;
class AtlanticCore;
class AtlantikNetwork;
struct AtlantikConfig
{
// General options;
bool chatTimestamps;
// Personalization options
TQString playerName, playerImage;
// Board options
bool indicateUnowned;
bool highliteUnowned;
bool darkenMortgaged;
bool quartzEffects;
bool animateTokens;
// Meta server options
bool connectOnStart;
bool hideDevelopmentServers;
// Portfolio colors
TQColor activeColor, inactiveColor;
};
class EventLog;
class EventLogWidget;
class SelectServer;
class SelectGame;
class SelectConfiguration;
class TradeDisplay;
class Player;
class Estate;
class Trade;
class LogTextEdit : public TQTextEdit
{
Q_OBJECT
public:
LogTextEdit( TQWidget *parent = 0, const char *name = 0 );
virtual ~LogTextEdit();
TQPopupMenu *createPopupMenu( const TQPoint & pos );
private:
KAction *m_clear, *m_selectAll, *m_copy;
};
/**
* Main Atlantik window.
* Manages gameboard, portfolios and pretty much everything else.
*
* @author Rob Kaper <[email protected]>
*/
class Atlantik : public KMainWindow
{
Q_OBJECT
public:
/**
* Create an Atlantik window.
*
*/
Atlantik();
/**
* Read the configuration settings using KConfig.
*
*/
void readConfig();
/**
* Appends a message the text view.
*
* @param msg Message to be appended.
*/
void serverMsgsAppend(TQString msg);
AtlantikConfig config() { return m_config; }
private slots:
void showSelectServer();
void showSelectGame();
void showSelectConfiguration();
void initBoard();
void showBoard();
void freezeBoard();
void clientCookie(TQString cookie);
void sendHandshake();
void statusBarClick(int);
public slots:
/**
* A network connection has been established, so we can show the game
* list instead of the server list.
*
*/
void slotNetworkConnected();
/**
* An error occurred while setting up the network connection. Inform the
* user.
*
* @param errno See http://doc.trolltech.com/3.0/tqsocket.html#Error-enum
*/
void slotNetworkError(int errnum);
void networkClosed(int status);
/**
* Creates a new modeless configure dialog or raises it when it already exists.
*
*/
void slotConfigure();
/**
* Opens the event log widget.
*
*/
void showEventLog();
/**
* Opens the KNotify dialog for configuration events.
*
*/
void configureNotifications();
/**
* Reads values from configuration dialog and stores them into
* global configuration struct. If values have changed, appropriate
* methods within the application are called. Configuration is saved
* to file in any case.
*
*/
void slotUpdateConfig();
/**
* Writes the contents of the text input field to the network
* interface and clears the text input field.
*
*/
void slotSendMsg();
/**
* Informs serverMsgs() to append an incoming message from the
* server to the text view as informational message.
*
* @param msg The message to be appended.
*/
void slotMsgInfo(TQString msg);
void slotMsgStatus(const TQString &message, const TQString &icon = TQString());
/**
* Informs serverMsgs() to append an incoming message from the
* server to the text view as error message.
*
* @param msg The error message to be appended.
*/
void slotMsgError(TQString msg);
/**
* Informs serverMsgs() to append an incoming message from the
* server to the text view as chat message.
*
* @param player The name of the player chatting.
* @param msg The chat message to be appended.
*/
void slotMsgChat(TQString player, TQString msg);
void newPlayer(Player *player);
void newEstate(Estate *estate);
void newTrade(Trade *trade);
void newAuction(Auction *auction);
void removeGUI(Player *player);
void removeGUI(Trade *trade);
void playerChanged(Player *player);
void gainedTurn();
signals:
void rollDice();
void buyEstate();
void auctionEstate();
void endTurn();
void jailCard();
void jailPay();
void jailRoll();
protected:
void closeEvent(TQCloseEvent *);
private:
void initEventLog();
void initNetworkObject();
PortfolioView *addPortfolioView(Player *player);
PortfolioView *findPortfolioView(Player *player);
TQScrollView *m_portfolioScroll;
TQWidget *m_mainWidget, *m_portfolioWidget;
TQGridLayout *m_mainLayout;
TQVBoxLayout *m_portfolioLayout;
TQLabel *m_portfolioLabel;
TQLineEdit *m_input;
TQTextEdit *m_serverMsgs;
KAction *m_roll, *m_buyEstate, *m_auctionEstate, *m_endTurn,
*m_jailCard, *m_jailPay, *m_jailRoll, *m_configure,
*m_showEventLog;
AtlanticCore *m_atlanticCore;
AtlantikNetwork *m_atlantikNetwork;
AtlantikConfig m_config;
ConfigDialog *m_configDialog;
AtlantikBoard *m_board;
SelectServer *m_selectServer;
SelectGame *m_selectGame;
SelectConfiguration *m_selectConfiguration;
EventLog *m_eventLog;
EventLogWidget *m_eventLogWidget;
TQPtrList<PortfolioView> m_portfolioViews;
TQMap<Trade *, TradeDisplay *> m_tradeGUIMap;
bool m_runningGame;
};
#endif
|