author | unc0rr |
Wed, 28 May 2008 19:18:02 +0000 | |
changeset 961 | a9a349b2b3fa |
parent 788 | 00720357601f |
child 1066 | 1f1b3686a2b0 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
2 |
* Hedgewars, a worms-like game |
|
486 | 3 |
* Copyright (c) 2005-2007 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef HWFORM_H |
|
20 |
#define HWFORM_H |
|
21 |
||
471 | 22 |
#include <QMainWindow> |
289 | 23 |
#include <QStack> |
530 | 24 |
#include <QTime> |
184 | 25 |
|
314 | 26 |
#include "netserver.h" |
306 | 27 |
#include "game.h" |
184 | 28 |
#include "ui_hwform.h" |
29 |
||
30 |
class HWGame; |
|
31 |
class HWTeam; |
|
314 | 32 |
class HWNewNet; |
184 | 33 |
class GameUIConfig; |
634 | 34 |
class HWNetRegisterServer; |
674 | 35 |
class QCloseEvent; |
184 | 36 |
|
37 |
class HWForm : public QMainWindow |
|
38 |
{ |
|
39 |
Q_OBJECT |
|
40 |
||
41 |
public: |
|
42 |
HWForm(QWidget *parent = 0); |
|
43 |
Ui_HWForm ui; |
|
44 |
||
45 |
private slots: |
|
46 |
void GoToMain(); |
|
47 |
void GoToSinglePlayer(); |
|
48 |
void GoToSetup(); |
|
49 |
void GoToMultiplayer(); |
|
579 | 50 |
void GoToSaves(); |
184 | 51 |
void GoToDemos(); |
52 |
void GoToNet(); |
|
187 | 53 |
void GoToInfo(); |
587 | 54 |
void GoToTraining(); |
600 | 55 |
void GoToSelectWeapon(); |
694 | 56 |
void GoToSelectNewWeapon(); |
646 | 57 |
void GoToNetServer(); |
289 | 58 |
void GoToPage(quint8 id); |
59 |
void GoBack(); |
|
530 | 60 |
void btnExitPressed(); |
61 |
void btnExitClicked(); |
|
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
62 |
void IntermediateSetup(); |
184 | 63 |
void NewTeam(); |
64 |
void EditTeam(); |
|
65 |
void TeamSave(); |
|
66 |
void TeamDiscard(); |
|
67 |
void SimpleGame(); |
|
68 |
void PlayDemo(); |
|
587 | 69 |
void StartTraining(); |
184 | 70 |
void NetConnect(); |
666 | 71 |
void NetConnectServer(const QString & host, quint16 port); |
314 | 72 |
void NetStartServer(); |
184 | 73 |
void NetDisconnect(); |
74 |
void NetGameEnter(); |
|
75 |
void NetStartGame(); |
|
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
338
diff
changeset
|
76 |
void AddNetTeam(const HWTeam& team); |
184 | 77 |
void StartMPGame(); |
306 | 78 |
void GameStateChanged(GameState gameState); |
79 |
void GameStats(char type, const QString & info); |
|
383 | 80 |
void ForcedDisconnect(); |
425 | 81 |
void ShowErrorMessage(const QString &); |
533 | 82 |
void GetRecord(bool isDemo, const QByteArray & record); |
660 | 83 |
void CreateNetGame(); |
695 | 84 |
void UpdateWeapons(); |
697 | 85 |
void NetWeaponNameChanged(const QString& name); |
660 | 86 |
|
184 | 87 |
private: |
314 | 88 |
void _NetConnect(const QString & hostName, quint16 port, const QString & nick); |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
89 |
void UpdateTeamsLists(const QStringList* editable_teams=0); |
696 | 90 |
void CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo); |
674 | 91 |
void closeEvent(QCloseEvent *event); |
187 | 92 |
enum PageIDs { |
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
93 |
ID_PAGE_SETUP_TEAM = 0, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
94 |
ID_PAGE_SETUP = 1, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
95 |
ID_PAGE_MULTIPLAYER = 2, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
96 |
ID_PAGE_DEMOS = 3, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
97 |
ID_PAGE_NET = 4, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
98 |
ID_PAGE_NETCFG = 5, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
99 |
ID_PAGE_INFO = 6, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
100 |
ID_PAGE_MAIN = 7, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
101 |
ID_PAGE_GAMESTATS = 8, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
102 |
ID_PAGE_SINGLEPLAYER = 9, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
103 |
ID_PAGE_TRAINING = 10, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
104 |
ID_PAGE_SELECTWEAPON = 11, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
105 |
ID_PAGE_NETSERVER = 12, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
106 |
ID_PAGE_INGAME = 13 |
187 | 107 |
}; |
184 | 108 |
HWGame * game; |
245 | 109 |
HWTeam * editedTeam; |
314 | 110 |
HWNewNet * hwnet; |
184 | 111 |
GameUIConfig * config; |
289 | 112 |
QStack<quint8> PagesStack; |
314 | 113 |
HWNetServer* pnetserver; |
634 | 114 |
HWNetRegisterServer* pRegisterServer; |
530 | 115 |
QTime eggTimer; |
307 | 116 |
void AddStatText(const QString & msg); |
496 | 117 |
void OnPageShown(quint8 id, quint8 lastid=0); |
184 | 118 |
}; |
119 |
||
120 |
#endif |