Freeciv-3.3
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_worker();
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:897
virtual ~go_act_menu()
Definition menu.cpp:709
void start_go_act(int act_id, int sub_tgt_id)
Definition menu.cpp:874
void reset()
Definition menu.cpp:718
static QSet< go_act_menu * > instances
Definition menu.h:237
void update()
Definition menu.cpp:834
static void reset_all()
Definition menu.cpp:887
void create()
Definition menu.cpp:730
QMap< QAction *, int > items
Definition menu.h:239
static QSet< gov_menu * > instances
Definition menu.h:212
virtual ~gov_menu()
Definition menu.cpp:580
static void create_all()
Definition menu.cpp:679
void revolution()
Definition menu.cpp:658
QVector< QAction * > actions
Definition menu.h:214
static void update_all()
Definition menu.cpp:689
void change_gov(int target_gov)
Definition menu.cpp:666
void create()
Definition menu.cpp:589
void update()
Definition menu.cpp:630
bool shortcut_2_menustring_inner(const QMenu *m, QKeySequence seq, QString *ret)
Definition menu.cpp:1890
void slot_unit_sentry()
Definition menu.cpp:2858
QActionGroup * action_vs_city
Definition menu.h:267
void slot_bg3select()
Definition menu.cpp:3576
void slot_auto_worker()
Definition menu.cpp:2784
void slot_traveler()
Definition menu.cpp:3520
bool execute_shortcut_inner(const QMenu *m, QKeySequence seq)
Definition menu.cpp:1808
void slot_delayed_goto()
Definition menu.cpp:3017
void zoom_in()
Definition menu.cpp:3301
void slot_autocaravan()
Definition menu.cpp:2932
QMenu * multiplayer_menu
Definition menu.h:264
void slot_build_irrigation()
Definition menu.cpp:2818
void slot_execute_orders()
Definition menu.cpp:3048
void update_bases_menu()
Definition menu.cpp:2018
QString shortcut_exist(fc_shortcut *fcs)
Definition menu.cpp:1867
void tileset_custom_load()
Definition menu.cpp:3624
void update_roads_menu()
Definition menu.cpp:1971
void slot_calculate()
Definition menu.cpp:2916
void slot_conn_road()
Definition menu.cpp:2733
void slot_conn_irrigation()
Definition menu.cpp:2671
QMenu * bases_menu
Definition menu.h:263
QActionGroup * airlift_type
Definition menu.h:266
void slot_quickairlift_set()
Definition menu.cpp:2974
void slot_battlelog()
Definition menu.cpp:3257
QMultiHash< munit, QAction * > menu_list
Definition menu.h:271
void slot_trade_add_all()
Definition menu.cpp:2908
void update_airlift_menu()
Definition menu.cpp:1932
void slot_show_cities()
Definition menu.cpp:2628
void slot_transform()
Definition menu.cpp:2748
void slot_top_cities()
Definition menu.cpp:3512
void slot_action_vs_unit()
Definition menu.cpp:2987
void slot_achievements()
Definition menu.cpp:3496
void slot_show_research_tab()
Definition menu.cpp:2576
void shortcut_options()
Definition menu.cpp:3753
void slot_city_output()
Definition menu.cpp:3369
void slot_show_eco_report()
Definition menu.cpp:2596
QMenu * airlift_menu
Definition menu.h:262
QAction * osd_status
Definition menu.h:287
void slot_bg1select()
Definition menu.cpp:3528
void slot_unload_all()
Definition menu.cpp:3137
void slot_airlift()
Definition menu.cpp:3111
void slot_select_same_continent()
Definition menu.cpp:3441
void slot_city_production()
Definition menu.cpp:3377
void slot_set_home()
Definition menu.cpp:3119
QAction * lock_status
Definition menu.h:286
void slot_native_tiles()
Definition menu.cpp:3277
void slot_unit_explore()
Definition menu.cpp:3169
void slot_bg4assign()
Definition menu.cpp:3608
void slot_bg1append()
Definition menu.cpp:3544
void slot_upgrade()
Definition menu.cpp:3153
void execute_shortcut(int sid)
Definition menu.cpp:1823
void slot_popup_mult_rates()
Definition menu.cpp:3695
void slot_select_same_everywhere()
Definition menu.cpp:3451
void slot_map_grid()
Definition menu.cpp:3409
void slot_unit_filter()
Definition menu.cpp:3477
void slot_bg2select()
Definition menu.cpp:3552
void slot_done_moving()
Definition menu.cpp:3417
void calc_trade_routes()
Definition menu.cpp:3679
void slot_city_buycost()
Definition menu.cpp:3285
void slot_action()
Definition menu.cpp:2776
void slot_bg4append()
Definition menu.cpp:3616
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:1850
void slot_select_all_tile()
Definition menu.cpp:3425
void save_game()
Definition menu.cpp:3843
struct tile * find_last_unit_pos(struct unit *punit, int pos)
Definition menu.cpp:907
void save_image()
Definition menu.cpp:3793
void slot_pillage()
Definition menu.cpp:2768
void slot_clean()
Definition menu.cpp:2654
void zoom_reset()
Definition menu.cpp:3310
void slot_board()
Definition menu.cpp:3083
void slot_center_view()
Definition menu.cpp:3177
void slot_build_mine()
Definition menu.cpp:2834
void server_options()
Definition menu.cpp:3761
void load_new_tileset()
Definition menu.cpp:3664
void set_tile_for_order(struct tile *ptile)
Definition menu.cpp:1796
void slot_fullscreen()
Definition menu.cpp:3223
void slot_bg4select()
Definition menu.cpp:3600
void slot_show_nations()
Definition menu.cpp:2620
QAction * messages_status
Definition menu.h:290
void slot_build_road()
Definition menu.cpp:2792
void slot_unsentry()
Definition menu.cpp:3145
void slot_show_new_turn_text()
Definition menu.cpp:3245
void local_options()
Definition menu.cpp:3745
bool delayed_order
Definition menu.h:291
void slot_borders()
Definition menu.cpp:3269
void slot_clear_trade()
Definition menu.cpp:2924
void zoom_scale_fonts()
Definition menu.cpp:3325
void slot_conn_rail()
Definition menu.cpp:2687
void slot_select_same_tile()
Definition menu.cpp:3461
void slot_convert()
Definition menu.cpp:2866
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:3504
void slot_bg2assign()
Definition menu.cpp:3560
void slot_select_one()
Definition menu.cpp:3433
void menus_sensitive()
Definition menu.cpp:2065
void messages_options()
Definition menu.cpp:3769
void slot_unit_goto()
Definition menu.cpp:3161
void slot_cultivate()
Definition menu.cpp:2826
void slot_stack_size()
Definition menu.cpp:3393
void slot_conn_maglev()
Definition menu.cpp:2702
void slot_patrol()
Definition menu.cpp:3093
void slot_unit_fortress()
Definition menu.cpp:2717
void slot_wait()
Definition menu.cpp:3469
void slot_demographics()
Definition menu.cpp:3488
void slot_build_city()
Definition menu.cpp:2636
void slot_city_growth()
Definition menu.cpp:3293
void slot_city_trade_routes()
Definition menu.cpp:3385
void slot_rally()
Definition menu.cpp:2891
void slot_plant()
Definition menu.cpp:2842
void slot_paradrop()
Definition menu.cpp:2756
void slot_build_path(int id)
Definition menu.cpp:3711
void slot_bg1assign()
Definition menu.cpp:3536
void slot_return_to_city()
Definition menu.cpp:3101
Unit_type_id airlift_type_id
Definition menu.h:293
void slot_show_map()
Definition menu.cpp:2604
void slot_bg3assign()
Definition menu.cpp:3584
QAction * scale_fonts_status
Definition menu.h:285
void slot_minimap_view()
Definition menu.cpp:3233
void slot_trade_city()
Definition menu.cpp:2900
void quit_game()
Definition menu.cpp:3785
void slot_help(const QString &topic)
Definition menu.cpp:3703
void save_game_as()
Definition menu.cpp:3851
void slot_bg2append()
Definition menu.cpp:3568
bool quick_airlifting
Definition menu.h:292
void slot_spaceship()
Definition menu.cpp:2584
void slot_city_names()
Definition menu.cpp:3353
QMenu * action_city_menu
Definition menu.h:270
void save_options_now()
Definition menu.cpp:3777
QAction * btlog_status
Definition menu.h:288
void slot_unit_fortify()
Definition menu.cpp:2850
void slot_show_units_report()
Definition menu.cpp:2612
void slot_quickairlift()
Definition menu.cpp:3009
QString shortcut_2_menustring(int sid)
Definition menu.cpp:1908
void slot_lock()
Definition menu.cpp:3185
void back_to_menu()
Definition menu.cpp:3878
void slot_deboard()
Definition menu.cpp:3127
void slot_popup_tax_rates()
Definition menu.cpp:3687
void slot_build_base(int id)
Definition menu.cpp:3727
qfc_units_list units_list
Definition menu.h:272
void setup_menus()
Definition menu.cpp:958
mr_menu()
Definition menu.cpp:949
void slot_bg3append()
Definition menu.cpp:3592
void slot_action_vs_city()
Definition menu.cpp:2998
void zoom_out()
Definition menu.cpp:3344
void slot_disband()
Definition menu.cpp:2874
void slot_unit_airbase()
Definition menu.cpp:2725
void slot_fullbar()
Definition menu.cpp:3401
void slot_city_outlines()
Definition menu.cpp:3361
bool confirm_disruptive_selection()
Definition menu.cpp:3903
void slot_orders_clear()
Definition menu.cpp:2882
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:495
int nr_units
Definition menu.h:132
void clear()
Definition menu.cpp:503
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:216
bool discard_one(trade_city *tc)
Definition menu.cpp:378
void add_city(struct city *pcity)
Definition menu.cpp:127
void find_certain_routes()
Definition menu.cpp:460
QList< trade_city * > cities
Definition menu.h:182
void find_certain_routes_inner(trade_city *tc)
Definition menu.cpp:425
trade_city * find_most_free()
Definition menu.cpp:327
void discard_trade(trade_city *tc1, trade_city *tc2)
Definition menu.cpp:364
void add_tile(struct tile *ptile)
Definition menu.cpp:139
void remove_virtual_city(struct tile *ptile)
Definition menu.cpp:190
bool hover_city
Definition menu.h:179
void add_all_cities()
Definition menu.cpp:87
void clear_trade_planing()
Definition menu.cpp:107
void discard()
Definition menu.cpp:345
void remove_city(struct city *pcity)
Definition menu.cpp:172
QList< qtiles > lines
Definition menu.h:180
bool discard_any(trade_city *tc, int freeroutes)
Definition menu.cpp:404
void check_if_done(trade_city *tc1, trade_city *tc2)
Definition menu.cpp:475
QList< struct city * > virtual_cities
Definition menu.h:181
int find_over_max(struct city *pcity)
Definition menu.cpp:311
void calculate()
Definition menu.cpp:234
char * incite_cost
Definition comments.c:76
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
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 int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
int Unit_type_id
Definition fc_types.h:241
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:3919
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
@ AUTOWORKER
Definition menu.h:63
@ ROAD
Definition menu.h:55
@ CONNECT_MAGLEV
Definition menu.h:66
@ CULTIVATE
Definition menu.h:50
@ PARADROP
Definition menu.h:52
@ 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:317
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:140