1 | /* |
2 | Copyright (C) 2002-2005, Jason Katz-Brown <jasonkb@mit.edu> |
3 | Copyright 2010 Stefan Majewsky <majewsky@gmx.net> |
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; either version 2 of the License, or |
8 | (at your option) any later version. |
9 | |
10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18 | */ |
19 | |
20 | #ifndef KOLF_H |
21 | #define KOLF_H |
22 | |
23 | #include <kolflib_export.h> |
24 | #include <KXmlGuiWindow> |
25 | |
26 | #include "game.h" |
27 | #include "itemfactory.h" |
28 | |
29 | class QGridLayout; |
30 | class KAction; |
31 | class KSelectAction; |
32 | class KToggleAction; |
33 | |
34 | class Editor; |
35 | class ScoreBoard; |
36 | |
37 | class KOLFLIB_EXPORT KolfWindow : public KXmlGuiWindow |
38 | { |
39 | Q_OBJECT |
40 | |
41 | public: |
42 | KolfWindow(); |
43 | ~KolfWindow(); |
44 | |
45 | void openUrl(KUrl url); |
46 | |
47 | public slots: |
48 | void closeGame(); |
49 | void updateModified(bool); |
50 | |
51 | protected: |
52 | virtual bool queryClose(); |
53 | |
54 | protected slots: |
55 | void startNewGame(); |
56 | void loadGame(); |
57 | void tutorial(); |
58 | void newGame(); |
59 | void save(); |
60 | void saveAs(); |
61 | void saveGame(); |
62 | void saveGameAs(); |
63 | void newPlayersTurn(Player *); |
64 | void gameOver(); |
65 | void editingStarted(); |
66 | void editingEnded(); |
67 | void checkEditing(); |
68 | void setHoleFocus() { game->setFocus(); } |
69 | void inPlayStart(); |
70 | void inPlayEnd(); |
71 | void maxStrokesReached(const QString &); |
72 | void (int); |
73 | void titleChanged(const QString &); |
74 | void newStatusText(const QString &); |
75 | void showInfoChanged(bool); |
76 | void useMouseChanged(bool); |
77 | void useAdvancedPuttingChanged(bool); |
78 | void showGuideLineChanged(bool); |
79 | void soundChanged(bool); |
80 | void showHighScores(); |
81 | void enableAllMessages(); |
82 | void createSpacer(); |
83 | |
84 | void emptySlot() {} |
85 | |
86 | void setCurrentHole(int); |
87 | |
88 | private: |
89 | QWidget *dummy; |
90 | KolfGame *game; |
91 | Editor *editor; |
92 | KolfGame *spacer; |
93 | void setupActions(); |
94 | QString filename; |
95 | PlayerList players; |
96 | PlayerList spacerPlayers; |
97 | QGridLayout *layout; |
98 | ScoreBoard *scoreboard; |
99 | KToggleAction *editingAction; |
100 | KAction *newHoleAction; |
101 | KAction *resetHoleAction; |
102 | QAction *undoShotAction; |
103 | //QAction *replayShotAction; |
104 | KAction *clearHoleAction; |
105 | QAction *tutorialAction; |
106 | QAction *newAction; |
107 | QAction *endAction; |
108 | QAction *saveAction; |
109 | QAction *saveAsAction; |
110 | QAction *saveGameAction; |
111 | QAction *saveGameAsAction; |
112 | QAction *loadGameAction; |
113 | QAction *aboutAction; |
114 | KSelectAction *holeAction; |
115 | QAction *highScoreAction; |
116 | KAction *nextAction; |
117 | KAction *prevAction; |
118 | KAction *firstAction; |
119 | KAction *lastAction; |
120 | QAction *randAction; |
121 | KToggleAction *showInfoAction; |
122 | KToggleAction *useMouseAction; |
123 | KToggleAction *useAdvancedPuttingAction; |
124 | KToggleAction *showGuideLineAction; |
125 | KToggleAction *soundAction; |
126 | void setHoleMovementEnabled(bool); |
127 | void setHoleOtherEnabled(bool); |
128 | inline void setEditingEnabled(bool); |
129 | bool competition; |
130 | |
131 | Kolf::ItemFactory m_itemFactory; |
132 | |
133 | QString loadedGame; |
134 | |
135 | bool isTutorial; |
136 | bool courseModified; |
137 | QString title; |
138 | QString tempStatusBarText; |
139 | }; |
140 | |
141 | struct HighScore |
142 | { |
143 | HighScore() {} |
144 | HighScore(const QString &name, int score) { this->name = name; this->score = score; } |
145 | QString name; |
146 | int score; |
147 | }; |
148 | typedef QList<HighScore> HighScoreList; |
149 | |
150 | #endif |
151 | |