Added translator comment about government overthrown message.
[freeciv.git] / client / gui-qt / menu.h
blob95eda920e2d578c16cfdedc9a6237b1d8c0e0ba6
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifndef FC__MENU_H
15 #define FC__MENU_H
17 extern "C" {
18 #include "menu_g.h"
21 #ifdef HAVE_CONFIG_H
22 #include <fc_config.h>
23 #endif
25 // Qt
26 #include <QDialog>
27 #include <QMenuBar>
29 // client
30 #include "control.h"
32 class QLabel;
33 class QPushButton;
34 class QSignalMapper;
35 class QScrollArea;
37 void qt_start_turn();
39 /** used for indicating menu about current option - for renaming
40 * and enabling, disabling */
41 enum munit {
42 STANDARD,
43 EXPLORE,
44 LOAD,
45 UNLOAD,
46 TRANSPORTER,
47 DISBAND,
48 CONVERT,
49 MINE,
50 IRRIGATION,
51 TRANSFORM,
52 PILLAGE,
53 BUILD,
54 ROAD,
55 FORTIFY,
56 FORTRESS,
57 AIRBASE,
58 POLLUTION,
59 FALLOUT,
60 SENTRY,
61 HOMECITY,
62 WAKEUP,
63 AUTOSETTLER,
64 CONNECT_ROAD,
65 CONNECT_RAIL,
66 CONNECT_IRRIGATION,
67 GOTO_CITY,
68 AIRLIFT,
69 BUILD_WONDER,
70 AUTOTRADEROUTE,
71 ORDER_TRADEROUTE,
72 ORDER_DIPLOMAT_DLG,
73 NUKE,
74 UPGRADE,
75 GO_AND_BUILD_CITY,
76 NOT_4_OBS,
77 MULTIPLIERS,
78 ENDGAME,
79 SAVE
82 enum delay_order{
83 D_GOTO,
84 D_NUKE,
85 D_PARADROP,
86 D_FORT
89 /**************************************************************************
90 Struct holding rally point for city
91 **************************************************************************/
92 struct qfc_rally
94 struct city *pcity;
95 struct tile *ptile;
98 /**************************************************************************
99 Class holding city list for rally points
100 **************************************************************************/
101 class qfc_rally_list
103 public:
104 qfc_rally_list() {
105 hover_tile = false;
106 hover_city = false;
108 void add(qfc_rally* rally);
109 bool clear(struct city *rcity);
110 QList<qfc_rally*> rally_list;
111 void run();
112 bool hover_tile;
113 bool hover_city;
114 struct city *rally_city;
117 void multiairlift(struct city *acity, Unit_type_id ut);
119 /**************************************************************************
120 Class representing one unit for delayed goto
121 **************************************************************************/
122 class qfc_delayed_unit_item
124 public:
125 qfc_delayed_unit_item(delay_order dg, int i) {
126 order = dg;
127 id = i;
128 ptile = nullptr;
130 delay_order order;
131 int id;
132 struct tile *ptile;
135 /**************************************************************************
136 Class holding unit list for delayed goto
137 **************************************************************************/
138 class qfc_units_list
140 public:
141 qfc_units_list();
142 void add(qfc_delayed_unit_item* fui);
143 void clear();
144 QList<qfc_delayed_unit_item*> unit_list;
145 int nr_units;
148 /**************************************************************************
149 Helper item for trade calculation
150 ***************************************************************************/
151 class trade_city
153 public:
154 trade_city(struct city *pcity);
156 bool done;
157 int over_max;
158 int poss_trade_num;
159 int trade_num; // already created + generated
160 QList<struct city *> curr_tr_cities;
161 QList<struct city *> new_tr_cities;
162 QList<struct city *> pos_cities;
163 struct city *city;
164 struct tile *tile;
168 /**************************************************************************
169 Struct of 2 tiles, used for drawing trade routes.
170 Also assigned caravan if it was sent
171 ***************************************************************************/
172 struct qtiles
174 struct tile *t1;
175 struct tile *t2;
176 struct unit *autocaravan;
178 bool operator==(const qtiles& a) const
180 return (t1 == a.t1 && t2 == a.t2 && autocaravan == a.autocaravan);
184 /**************************************************************************
185 Class trade generator, used for calulating possible trade routes
186 ***************************************************************************/
187 class trade_generator
189 public:
190 trade_generator();
192 bool hover_city;
193 QList<qtiles> lines;
194 QList<struct city *> virtual_cities;
195 QList<trade_city*> cities;
197 void add_all_cities();
198 void add_city(struct city *pcity);
199 void add_tile(struct tile *ptile);
200 void calculate();
201 void clear_trade_planing();
202 void remove_city(struct city *pcity);
203 void remove_virtual_city(struct tile *ptile);
205 private:
206 bool discard_any(trade_city *tc, int freeroutes);
207 bool discard_one(trade_city *tc);
208 int find_over_max(struct city *pcity);
209 trade_city* find_most_free();
210 void check_if_done(trade_city *tc1, trade_city *tc2);
211 void discard();
212 void discard_trade(trade_city *tc1, trade_city *tc2);
213 void find_certain_routes();
217 /****************************************************************************
218 Instantiable government menu.
219 ****************************************************************************/
220 class gov_menu : public QMenu
222 Q_OBJECT
223 static QSet<gov_menu *> instances;
225 QSignalMapper *gov_mapper;
226 QVector<QAction *> actions;
228 public:
229 gov_menu(QWidget* parent = 0);
230 virtual ~gov_menu();
232 static void create_all();
233 static void update_all();
235 public slots:
236 void revolution();
237 void change_gov(int target_gov);
239 void create();
240 void update();
243 /**************************************************************************
244 Class representing global menus in gameview
245 **************************************************************************/
246 class mr_menu : public QMenuBar
248 Q_OBJECT
249 QMenu *menu;
250 QMenu *airlift_menu;
251 QMenu *multiplayer_menu;
252 QActionGroup *airlift_type;
253 QActionGroup *action_vs_city;
254 QActionGroup *action_vs_unit;
255 QMenu *action_unit_menu;
256 QMenu *action_city_menu;
257 QHash<munit, QAction*> menu_list;
258 qfc_units_list units_list;
259 public:
260 mr_menu();
261 void setup_menus();
262 void menus_sensitive();
263 void update_airlift_menu();
264 void set_tile_for_order(struct tile *ptile);
265 void execute_shortcut(int sid);
266 QString shortcut_2_menustring(int sid);
267 QAction *minimap_status;
268 QAction *lock_status;
269 QAction *osd_status;
270 QAction *chat_status;
271 QAction *messages_status;
272 bool delayed_order;
273 bool quick_airlifting;
274 Unit_type_id airlift_type_id;
275 private slots:
276 /* game menu */
277 void local_options();
278 void shortcut_options();
279 void server_options();
280 void messages_options();
281 void save_options_now();
282 void save_game();
283 void save_game_as();
284 void back_to_menu();
285 void quit_game();
287 /* help menu */
288 void slot_help(const QString &topic);
290 /*used by work menu*/
291 void slot_build_city();
292 void slot_go_build_city();
293 void slot_auto_settler();
294 void slot_build_road();
295 void slot_build_irrigation();
296 void slot_build_mine();
297 void slot_conn_road();
298 void slot_conn_rail();
299 void slot_conn_irrigation();
300 void slot_transform();
301 void slot_clean_pollution();
302 void slot_clean_fallout();
304 /*used by unit menu */
305 void slot_unit_sentry();
306 void slot_unit_explore();
307 void slot_unit_goto();
308 void slot_airlift();
309 void slot_return_to_city();
310 void slot_patrol();
311 void slot_unsentry();
312 void slot_load();
313 void slot_unload();
314 void slot_unload_all();
315 void slot_set_home();
316 void slot_upgrade();
317 void slot_convert();
318 void slot_disband();
320 /*used by combat menu*/
321 void slot_unit_fortify();
322 void slot_unit_fortress();
323 void slot_unit_airbase();
324 void slot_pillage();
325 void slot_action();
326 void slot_explode_nuclear();
328 /*used by view menu*/
329 void slot_center_view();
330 void slot_minimap_view();
331 void slot_show_new_turn_text();
332 void slot_fullscreen();
333 void slot_lock();
334 void slot_city_outlines();
335 void slot_city_output();
336 void slot_map_grid();
337 void slot_borders();
338 void slot_fullbar();
339 void slot_native_tiles();
340 void slot_city_growth();
341 void slot_city_production();
342 void slot_city_buycost();
343 void slot_city_traderoutes();
344 void slot_city_names();
346 /*used by select menu */
347 void slot_select_one();
348 void slot_select_all_tile();
349 void slot_select_same_tile();
350 void slot_select_same_continent();
351 void slot_select_same_everywhere();
352 void slot_done_moving();
353 void slot_wait();
354 void slot_unit_filter();
356 /* used by multiplayer menu */
357 void slot_orders_clear();
358 void slot_execute_orders();
359 void slot_delayed_goto();
360 void slot_trade_add_all();
361 void slot_trade_city();
362 void slot_calculate();
363 void slot_clear_trade();
364 void slot_autocaravan();
365 void slot_rally();
366 void slot_quickairlift_set();
367 void slot_quickairlift();
368 void slot_action_vs_unit();
369 void slot_action_vs_city();
371 /*used by civilization menu */
372 void slot_show_map();
373 void calc_trade_routes();
374 void slot_popup_tax_rates();
375 void slot_popup_mult_rates();
376 void slot_show_eco_report();
377 void slot_show_units_report();
378 void slot_show_nations();
379 void slot_show_cities();
380 void slot_show_research_tab();
381 void slot_spaceship();
382 void slot_demographics();
383 void slot_achievements();
384 void slot_endgame();
385 void slot_top_five();
386 void slot_traveler();
388 private:
389 struct tile* find_last_unit_pos(struct unit* punit, int pos);
390 QSignalMapper *signal_help_mapper;
393 #endif /* FC__MENU_H */