Freeciv-3.2
Loading...
Searching...
No Matches
menu.h
Go to the documentation of this file.
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.
7
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***********************************************************************/
13
14#ifndef FC__MENU_H
15#define FC__MENU_H
16
17extern "C" {
18#include "menu_g.h"
19}
20
21#ifdef HAVE_CONFIG_H
22#include <fc_config.h>
23#endif
24
25// Qt
26#include <QDialog>
27#include <QMenuBar>
28
29// client
30#include "control.h"
31
32class QLabel;
33class QPushButton;
34class QScrollArea;
35struct fc_shortcut;
36
81
88
89/**************************************************************************
90 Class holding city list for rally points
91**************************************************************************/
93{
94public:
96 hover_tile = false;
97 hover_city = false;
98 };
102};
103
104void multiairlift(struct city *acity, Unit_type_id ut);
105
106/**************************************************************************
107 Class representing one unit for delayed goto
108**************************************************************************/
110{
111public:
113 order = dg;
114 id = i;
115 ptile = nullptr;
116 }
118 int id;
119 struct tile *ptile;
120};
121
122/**************************************************************************
123 Class holding unit list for delayed goto
124**************************************************************************/
134
135/**************************************************************************
136 Helper item for trade calculation
137***************************************************************************/
139{
140public:
141 trade_city(struct city *pcity);
142
143 bool done;
146 unsigned trade_num; // already created + generated
150 struct city *city;
151 struct tile *tile;
152
153};
154
155/**************************************************************************
156 Struct of 2 tiles, used for drawing trade routes.
157 Also assigned caravan if it was sent
158***************************************************************************/
159struct qtiles
160{
161 struct tile *t1;
162 struct tile *t2;
164
165 bool operator==(const qtiles& a) const
166 {
167 return (t1 == a.t1 && t2 == a.t2 && autocaravan == a.autocaravan);
168 }
169};
170
171/***************************************************************************
172 Class trade generator, used for calculating possible trade routes
173***************************************************************************/
175{
176public:
178
183
184 void add_all_cities();
185 void add_city(struct city *pcity);
186 void add_tile(struct tile *ptile);
187 void calculate();
188 void clear_trade_planing();
189 void remove_city(struct city *pcity);
190 void remove_virtual_city(struct tile *ptile);
191
192private:
193 bool discard_any(trade_city *tc, int freeroutes);
194 bool discard_one(trade_city *tc);
195 int find_over_max(struct city *pcity);
198 void discard();
200 void find_certain_routes();
202 void calculate_inner(trade_city *tc);
203};
204
205
206/****************************************************************************
207 Instantiable government menu.
208****************************************************************************/
209class gov_menu : public QMenu
210{
213
215
216public:
217 gov_menu(QWidget* parent = 0);
218 virtual ~gov_menu();
219
220 static void create_all();
221 static void update_all();
222
223public slots:
224 void revolution();
225 void change_gov(int target_gov);
226
227 void create();
228 void update();
229};
230
231/****************************************************************************
232 Go to and... menu.
233****************************************************************************/
234class go_act_menu : public QMenu
235{
238
240
241public:
242 go_act_menu(QWidget *parent = nullptr);
243 virtual ~go_act_menu();
244
245 static void reset_all();
246 static void update_all();
247
248public slots:
249 void start_go_act(int act_id, int sub_tgt_id);
250
251 void reset();
252 void create();
253 void update();
254};
255
256/**************************************************************************
257 Class representing global menus in gameview
258**************************************************************************/
259class mr_menu : public QMenuBar
260{
273public:
274 mr_menu();
275 void setup_menus();
276 void menus_sensitive();
277 void update_airlift_menu();
278 void update_roads_menu();
279 void update_bases_menu();
280 void set_tile_for_order(struct tile *ptile);
281 void execute_shortcut(int sid);
294private slots:
295 // Game menu
296 void local_options();
297 void shortcut_options();
298 void server_options();
299 void messages_options();
300 void save_options_now();
301 void save_game();
302 void save_game_as();
303 void save_image();
304 void tileset_custom_load();
305 void load_new_tileset();
306 void back_to_menu();
308 void quit_game();
309
310 // Help menu
311 void slot_help(const QString &topic);
312
313 // Used by work menu
314 void slot_build_path(int id);
315 void slot_build_base(int id);
316 void slot_build_city();
317 void slot_auto_settler();
318 void slot_build_road();
320 void slot_cultivate();
321 void slot_build_mine();
322 void slot_plant();
323 void slot_conn_road();
324 void slot_conn_rail();
325 void slot_conn_maglev();
327 void slot_transform();
328 void slot_clean();
329
330 // Used by unit menu
331 void slot_unit_sentry();
332 void slot_unit_explore();
333 void slot_unit_goto();
334 void slot_airlift();
335 void slot_return_to_city();
336 void slot_patrol();
337 void slot_unsentry();
338 void slot_board();
339 void slot_deboard();
340 void slot_unload_all();
341 void slot_set_home();
342 void slot_upgrade();
343 void slot_convert();
344 void slot_disband();
345
346 // Used by combat menu
347 void slot_unit_fortify();
348 void slot_unit_fortress();
349 void slot_unit_airbase();
350 void slot_paradrop();
351 void slot_pillage();
352 void slot_action();
353
354 // Used by view menu
355 void slot_center_view();
356 void slot_minimap_view();
358 void slot_battlelog();
359 void slot_fullscreen();
360 void slot_lock();
361 void slot_city_outlines();
362 void slot_city_output();
363 void slot_map_grid();
364 void slot_borders();
365 void slot_fullbar();
366 void slot_native_tiles();
367 void slot_city_growth();
369 void slot_city_buycost();
371 void slot_stack_size();
372 void slot_city_names();
373 void zoom_in();
374 void zoom_scale_fonts();
375 void zoom_reset();
376 void zoom_out();
377
378 // Used by select menu
379 void slot_select_one();
384 void slot_done_moving();
385 void slot_wait();
386 void slot_unit_filter();
387
388 // Used by multiplayer menu
389 void slot_orders_clear();
390 void slot_execute_orders();
391 void slot_delayed_goto();
392 void slot_trade_add_all();
393 void slot_trade_city();
394 void slot_calculate();
395 void slot_clear_trade();
396 void slot_autocaravan();
397 void slot_rally();
399 void slot_quickairlift();
400 void slot_action_vs_unit();
401 void slot_action_vs_city();
402
403 // Used by civilization menu
404 void slot_show_map();
405 void calc_trade_routes();
410 void slot_show_nations();
411 void slot_show_cities();
413 void slot_spaceship();
414 void slot_demographics();
415 void slot_achievements();
416 void slot_endgame();
417 void slot_top_cities();
418 void slot_traveler();
419 void slot_bg1select();
420 void slot_bg1assign();
421 void slot_bg1append();
422 void slot_bg2select();
423 void slot_bg2assign();
424 void slot_bg2append();
425 void slot_bg3select();
426 void slot_bg3assign();
427 void slot_bg3append();
428 void slot_bg4select();
429 void slot_bg4assign();
430 void slot_bg4append();
431
432private:
433 struct tile *find_last_unit_pos(struct unit *punit, int pos);
434 bool execute_shortcut_inner(const QMenu *m, QKeySequence seq);
435 bool shortcut_exist_inner(const QMenu *m, QKeySequence seq,
438 QString *ret);
439};
440
441#endif // FC__MENU_H
static void update_all()
Definition menu.cpp:895
virtual ~go_act_menu()
Definition menu.cpp:707
void start_go_act(int act_id, int sub_tgt_id)
Definition menu.cpp:872
void reset()
Definition menu.cpp:716
static QSet< go_act_menu * > instances
Definition menu.h:237
void update()
Definition menu.cpp:832
static void reset_all()
Definition menu.cpp:885
void create()
Definition menu.cpp:728
QMap< QAction *, int > items
Definition menu.h:239
static QSet< gov_menu * > instances
Definition menu.h:212
virtual ~gov_menu()
Definition menu.cpp:578
static void create_all()
Definition menu.cpp:677
void revolution()
Definition menu.cpp:656
QVector< QAction * > actions
Definition menu.h:214
static void update_all()
Definition menu.cpp:687
void change_gov(int target_gov)
Definition menu.cpp:664
void create()
Definition menu.cpp:587
void update()
Definition menu.cpp:628
bool shortcut_2_menustring_inner(const QMenu *m, QKeySequence seq, QString *ret)
Definition menu.cpp:1888
void slot_unit_sentry()
Definition menu.cpp:2851
QActionGroup * action_vs_city
Definition menu.h:267
void slot_bg3select()
Definition menu.cpp:3569
void slot_traveler()
Definition menu.cpp:3513
bool execute_shortcut_inner(const QMenu *m, QKeySequence seq)
Definition menu.cpp:1806
void slot_delayed_goto()
Definition menu.cpp:3010
void zoom_in()
Definition menu.cpp:3294
void slot_autocaravan()
Definition menu.cpp:2925
QMenu * multiplayer_menu
Definition menu.h:264
void slot_build_irrigation()
Definition menu.cpp:2811
void slot_execute_orders()
Definition menu.cpp:3041
void update_bases_menu()
Definition menu.cpp:2013
QString shortcut_exist(fc_shortcut *fcs)
Definition menu.cpp:1865
void tileset_custom_load()
Definition menu.cpp:3617
void update_roads_menu()
Definition menu.cpp:1966
void slot_calculate()
Definition menu.cpp:2909
void slot_conn_road()
Definition menu.cpp:2726
void slot_conn_irrigation()
Definition menu.cpp:2664
QMenu * bases_menu
Definition menu.h:263
QActionGroup * airlift_type
Definition menu.h:266
void slot_quickairlift_set()
Definition menu.cpp:2967
void slot_battlelog()
Definition menu.cpp:3250
QMultiHash< munit, QAction * > menu_list
Definition menu.h:271
void slot_trade_add_all()
Definition menu.cpp:2901
void update_airlift_menu()
Definition menu.cpp:1930
void slot_show_cities()
Definition menu.cpp:2621
void slot_transform()
Definition menu.cpp:2741
void slot_top_cities()
Definition menu.cpp:3505
void slot_action_vs_unit()
Definition menu.cpp:2980
void slot_achievements()
Definition menu.cpp:3489
void slot_show_research_tab()
Definition menu.cpp:2571
void shortcut_options()
Definition menu.cpp:3746
void slot_city_output()
Definition menu.cpp:3362
void slot_show_eco_report()
Definition menu.cpp:2589
QMenu * airlift_menu
Definition menu.h:262
QAction * osd_status
Definition menu.h:287
void slot_bg1select()
Definition menu.cpp:3521
void slot_unload_all()
Definition menu.cpp:3130
void slot_airlift()
Definition menu.cpp:3104
void slot_select_same_continent()
Definition menu.cpp:3434
void slot_city_production()
Definition menu.cpp:3370
void slot_set_home()
Definition menu.cpp:3112
QAction * lock_status
Definition menu.h:286
void slot_native_tiles()
Definition menu.cpp:3270
void slot_unit_explore()
Definition menu.cpp:3162
void slot_bg4assign()
Definition menu.cpp:3601
void slot_bg1append()
Definition menu.cpp:3537
void slot_upgrade()
Definition menu.cpp:3146
void execute_shortcut(int sid)
Definition menu.cpp:1821
void slot_popup_mult_rates()
Definition menu.cpp:3688
void slot_select_same_everywhere()
Definition menu.cpp:3444
void slot_map_grid()
Definition menu.cpp:3402
void slot_unit_filter()
Definition menu.cpp:3470
void slot_bg2select()
Definition menu.cpp:3545
void slot_done_moving()
Definition menu.cpp:3410
void calc_trade_routes()
Definition menu.cpp:3672
void slot_city_buycost()
Definition menu.cpp:3278
void slot_action()
Definition menu.cpp:2769
void slot_bg4append()
Definition menu.cpp:3609
QMenu * roads_menu
Definition menu.h:265
QAction * minimap_status
Definition menu.h:284
bool shortcut_exist_inner(const QMenu *m, QKeySequence seq, fc_shortcut *fcs, QString *ret)
Definition menu.cpp:1848
void slot_select_all_tile()
Definition menu.cpp:3418
void save_game()
Definition menu.cpp:3836
struct tile * find_last_unit_pos(struct unit *punit, int pos)
Definition menu.cpp:905
void save_image()
Definition menu.cpp:3786
void slot_pillage()
Definition menu.cpp:2761
void slot_clean()
Definition menu.cpp:2647
void zoom_reset()
Definition menu.cpp:3303
void slot_board()
Definition menu.cpp:3076
void slot_center_view()
Definition menu.cpp:3170
void slot_build_mine()
Definition menu.cpp:2827
void server_options()
Definition menu.cpp:3754
void load_new_tileset()
Definition menu.cpp:3657
void set_tile_for_order(struct tile *ptile)
Definition menu.cpp:1794
void slot_fullscreen()
Definition menu.cpp:3216
void slot_bg4select()
Definition menu.cpp:3593
void slot_show_nations()
Definition menu.cpp:2613
QAction * messages_status
Definition menu.h:290
void slot_build_road()
Definition menu.cpp:2785
void slot_unsentry()
Definition menu.cpp:3138
void slot_show_new_turn_text()
Definition menu.cpp:3238
void local_options()
Definition menu.cpp:3738
bool delayed_order
Definition menu.h:291
void slot_borders()
Definition menu.cpp:3262
void slot_clear_trade()
Definition menu.cpp:2917
void zoom_scale_fonts()
Definition menu.cpp:3318
void slot_conn_rail()
Definition menu.cpp:2680
void slot_select_same_tile()
Definition menu.cpp:3454
void slot_convert()
Definition menu.cpp:2859
QMenu * action_unit_menu
Definition menu.h:269
QActionGroup * action_vs_unit
Definition menu.h:268
QAction * chat_status
Definition menu.h:289
void slot_endgame()
Definition menu.cpp:3497
void slot_bg2assign()
Definition menu.cpp:3553
void slot_select_one()
Definition menu.cpp:3426
void menus_sensitive()
Definition menu.cpp:2060
void messages_options()
Definition menu.cpp:3762
void slot_unit_goto()
Definition menu.cpp:3154
void slot_cultivate()
Definition menu.cpp:2819
void slot_stack_size()
Definition menu.cpp:3386
void slot_conn_maglev()
Definition menu.cpp:2695
void slot_patrol()
Definition menu.cpp:3086
void slot_unit_fortress()
Definition menu.cpp:2710
void slot_wait()
Definition menu.cpp:3462
void slot_demographics()
Definition menu.cpp:3481
void slot_build_city()
Definition menu.cpp:2629
void slot_city_growth()
Definition menu.cpp:3286
void slot_city_trade_routes()
Definition menu.cpp:3378
void slot_rally()
Definition menu.cpp:2884
void slot_plant()
Definition menu.cpp:2835
void slot_paradrop()
Definition menu.cpp:2749
void slot_build_path(int id)
Definition menu.cpp:3704
void slot_bg1assign()
Definition menu.cpp:3529
void slot_return_to_city()
Definition menu.cpp:3094
Unit_type_id airlift_type_id
Definition menu.h:293
void slot_show_map()
Definition menu.cpp:2597
void slot_bg3assign()
Definition menu.cpp:3577
QAction * scale_fonts_status
Definition menu.h:285
void slot_minimap_view()
Definition menu.cpp:3226
void slot_trade_city()
Definition menu.cpp:2893
void quit_game()
Definition menu.cpp:3778
void slot_help(const QString &topic)
Definition menu.cpp:3696
void save_game_as()
Definition menu.cpp:3844
void slot_bg2append()
Definition menu.cpp:3561
bool quick_airlifting
Definition menu.h:292
void slot_spaceship()
Definition menu.cpp:2579
void slot_city_names()
Definition menu.cpp:3346
QMenu * action_city_menu
Definition menu.h:270
void save_options_now()
Definition menu.cpp:3770
QAction * btlog_status
Definition menu.h:288
void slot_unit_fortify()
Definition menu.cpp:2843
void slot_show_units_report()
Definition menu.cpp:2605
void slot_quickairlift()
Definition menu.cpp:3002
QString shortcut_2_menustring(int sid)
Definition menu.cpp:1906
void slot_lock()
Definition menu.cpp:3178
void back_to_menu()
Definition menu.cpp:3871
void slot_deboard()
Definition menu.cpp:3120
void slot_popup_tax_rates()
Definition menu.cpp:3680
void slot_auto_settler()
Definition menu.cpp:2777
void slot_build_base(int id)
Definition menu.cpp:3720
qfc_units_list units_list
Definition menu.h:272
void setup_menus()
Definition menu.cpp:956
mr_menu()
Definition menu.cpp:947
void slot_bg3append()
Definition menu.cpp:3585
void slot_action_vs_city()
Definition menu.cpp:2991
void zoom_out()
Definition menu.cpp:3337
void slot_disband()
Definition menu.cpp:2867
void slot_unit_airbase()
Definition menu.cpp:2718
void slot_fullbar()
Definition menu.cpp:3394
void slot_city_outlines()
Definition menu.cpp:3354
bool confirm_disruptive_selection()
Definition menu.cpp:3896
void slot_orders_clear()
Definition menu.cpp:2875
qfc_delayed_unit_item(delay_order dg, int i)
Definition menu.h:112
struct tile * ptile
Definition menu.h:119
delay_order order
Definition menu.h:117
bool hover_city
Definition menu.h:100
bool hover_tile
Definition menu.h:99
qfc_rally_list()
Definition menu.h:95
struct city * rally_city
Definition menu.h:101
QList< qfc_delayed_unit_item * > unit_list
Definition menu.h:131
void add(qfc_delayed_unit_item *fui)
Definition menu.cpp:493
int nr_units
Definition menu.h:132
void clear()
Definition menu.cpp:501
struct tile * tile
Definition menu.h:151
bool done
Definition menu.h:143
unsigned trade_num
Definition menu.h:146
int poss_trade_num
Definition menu.h:145
QList< struct city * > pos_cities
Definition menu.h:149
QList< struct city * > new_tr_cities
Definition menu.h:148
int over_max
Definition menu.h:144
QList< struct city * > curr_tr_cities
Definition menu.h:147
struct city * city
Definition menu.h:150
void calculate_inner(trade_city *tc)
Definition menu.cpp:214
bool discard_one(trade_city *tc)
Definition menu.cpp:376
void add_city(struct city *pcity)
Definition menu.cpp:125
void find_certain_routes()
Definition menu.cpp:458
QList< trade_city * > cities
Definition menu.h:182
void find_certain_routes_inner(trade_city *tc)
Definition menu.cpp:423
trade_city * find_most_free()
Definition menu.cpp:325
void discard_trade(trade_city *tc1, trade_city *tc2)
Definition menu.cpp:362
void add_tile(struct tile *ptile)
Definition menu.cpp:137
void remove_virtual_city(struct tile *ptile)
Definition menu.cpp:188
bool hover_city
Definition menu.h:179
void add_all_cities()
Definition menu.cpp:87
void clear_trade_planing()
Definition menu.cpp:105
void discard()
Definition menu.cpp:343
void remove_city(struct city *pcity)
Definition menu.cpp:170
QList< qtiles > lines
Definition menu.h:180
bool discard_any(trade_city *tc, int freeroutes)
Definition menu.cpp:402
void check_if_done(trade_city *tc1, trade_city *tc2)
Definition menu.cpp:473
QList< struct city * > virtual_cities
Definition menu.h:181
int find_over_max(struct city *pcity)
Definition menu.cpp:309
void calculate()
Definition menu.cpp:232
char * incite_cost
Definition comments.c:75
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
int Unit_type_id
Definition fc_types.h:382
static struct tile * pos
Definition finddlg.c:53
delay_order
Definition menu.h:82
@ D_NUKE
Definition menu.h:84
@ D_FORT
Definition menu.h:86
@ D_PARADROP
Definition menu.h:85
@ D_GOTO
Definition menu.h:83
void multiairlift(struct city *acity, Unit_type_id ut)
Definition menu.cpp:3912
munit
Definition menu.h:39
@ AIRLIFT
Definition menu.h:69
@ CONNECT_RAIL
Definition menu.h:65
@ TRANSFORM
Definition menu.h:51
@ FORTIFY
Definition menu.h:56
@ GOTO_CITY
Definition menu.h:68
@ TRANSPORTER
Definition menu.h:44
@ BUILD
Definition menu.h:54
@ IRRIGATION
Definition menu.h:49
@ CONNECT_IRRIGATION
Definition menu.h:67
@ CONNECT_ROAD
Definition menu.h:64
@ HOMECITY
Definition menu.h:61
@ CONVERT
Definition menu.h:46
@ PILLAGE
Definition menu.h:53
@ TOP_CITIES
Definition menu.h:79
@ BUILD_WONDER
Definition menu.h:70
@ DISBAND
Definition menu.h:45
@ DEBOARD
Definition menu.h:43
@ CLEAN
Definition menu.h:59
@ NOT_4_OBS
Definition menu.h:75
@ UPGRADE
Definition menu.h:74
@ SAVE
Definition menu.h:78
@ MULTIPLIERS
Definition menu.h:76
@ PLANT
Definition menu.h:48
@ ORDER_TRADE_ROUTE
Definition menu.h:72
@ WAKEUP
Definition menu.h:62
@ MINE
Definition menu.h:47
@ SENTRY
Definition menu.h:60
@ ORDER_DIPLOMAT_DLG
Definition menu.h:73
@ EXPLORE
Definition menu.h:41
@ STANDARD
Definition menu.h:40
@ ROAD
Definition menu.h:55
@ CONNECT_MAGLEV
Definition menu.h:66
@ CULTIVATE
Definition menu.h:50
@ PARADROP
Definition menu.h:52
@ AUTOSETTLER
Definition menu.h:63
@ BOARD
Definition menu.h:42
@ FORTRESS
Definition menu.h:57
@ ENDGAME
Definition menu.h:77
@ AUTOTRADEROUTE
Definition menu.h:71
@ AIRBASE
Definition menu.h:58
struct player_slot * slots
Definition player.c:51
Definition city.h:320
Definition menu.h:160
struct tile * t1
Definition menu.h:161
struct tile * t2
Definition menu.h:162
bool operator==(const qtiles &a) const
Definition menu.h:165
struct unit * autocaravan
Definition menu.h:163
Definition tile.h:50
Definition unit.h:138