Freeciv-3.3
Loading...
Searching...
No Matches
dialogs.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__DIALOGS_H
15#define FC__DIALOGS_H
16
17#ifdef HAVE_CONFIG_H
18#include <fc_config.h>
19#endif
20
21extern "C" {
22#include "dialogs_g.h"
23}
24
25// Qt
26#include <QDialog>
27#include <QMessageBox>
28#include <QVariant>
29
30// gui-qt
31#include "fonts.h"
32#include "hudwidget.h"
33#include "mapview.h"
34
35class QButtonGroup;
36class QComboBox;
37class QGridLayout;
38class QGroupBox;
39class QItemSelection;
40class QRadioButton;
41class QTableView;
42class QTableWidget;
43class QTextEdit;
44class QWidget;
45
48void popup_races_dialog(struct player *pplayer);
50
51
53{
55
56private:
57 explicit qdef_act();
61public:
62 static qdef_act *action();
63 static void drop();
64 void vs_city_set(int i);
65 void vs_unit_set(int i);
68};
69
70/***************************************************************************
71 Dialog with themed titlebar
72***************************************************************************/
73class qfc_dialog : public QDialog
74{
76public:
77 qfc_dialog(QWidget *parent);
78 void reactivate();
79private:
84protected:
89};
90
91/***************************************************************************
92 Nonmodal message box for disbanding units
93***************************************************************************/
95{
97 struct unit_list *cpunits;
98public:
99 explicit disband_box(struct unit_list *punits, QWidget *parent = 0);
100 ~disband_box();
101private slots:
102 void disband_clicked();
103};
104
105/***************************************************************************
106 Dialog for goto popup
107***************************************************************************/
108class notify_goto : public QMessageBox
109{
111 QPushButton *goto_but;
112 QPushButton *inspect_but;
113 QPushButton *close_but;
114 struct tile *gtile;
115public:
116 notify_goto(const char *headline, const char *lines,
117 const struct text_tag_list *tags, struct tile *ptile,
118 QWidget *parent);
119
120private slots:
121 void goto_tile();
122 void inspect_city();
123};
124
125/***************************************************************************
126 Dialog for selecting nation, style and leader leader
127***************************************************************************/
129{
132 QTableWidget *nation_tabs;
134 QTableWidget *selected_nation_tabs;
140 QTableWidget *styles;
142 QPushButton *ok_button;
143 QPushButton *random_button;
144
145public:
146 races_dialog(struct player *pplayer, QWidget *parent = 0);
148 void refresh();
150
151private slots:
152 void set_index(int index);
154 void style_selected(const QItemSelection &sl, const QItemSelection &ds);
155 void group_selected(const QItemSelection &sl, const QItemSelection &ds);
156 void nationset_changed(int index);
157 void leader_selected(int index);
158 void ok_pressed();
159 void cancel_pressed();
160 void random_pressed();
161
162private:
167};
168
169/***************************************************************************
170 Widget around map view to display informations like demographics report,
171 top cities, traveler's report.
172***************************************************************************/
174{
176public:
177 notify_dialog(const char *caption, const char *headline,
178 const char *lines, QWidget *parent = 0);
179 virtual void update_menu();
181 void restart();
182protected:
186private:
188 void calc_size(int &x, int&y);
190 QLabel *label;
197};
198
199/***************************************************************************
200 Transparent widget for selecting units
201***************************************************************************/
203{
206 QPixmap *h_pix; // pixmap for highlighting
207 QSize item_size; // size of each pixmap of unit
214public:
215 units_select(struct tile *ptile, QWidget *parent);
217 void update_menu();
218 void update_units();
219 void create_pixmap();
221protected:
229private slots:
230 void update_img();
231private:
232 bool more;
236};
237
238/**************************************************************************
239 A QPushButton that includes data like function to call and parmeters
240**************************************************************************/
255
256/***************************************************************************
257 Simple choice dialog, allowing choosing one of set actions
258***************************************************************************/
259class choice_dialog: public QWidget
260{
262 QPushButton *target_unit_button;
269 void switch_target();
270public:
271 choice_dialog(const QString title, const QString text,
272 QWidget *parent = nullptr,
273 void (*run_on_close_in)(int) = nullptr);
275 void set_layout();
277 QVariant data2, QString tool_tip, const int button_id);
278 void show_me();
280 void unstack_all_buttons();
287 void update_dialog(const struct act_prob *act_probs);
288public slots:
289 void execute_action(const int action);
290private slots:
291 void prev_unit();
292 void next_unit();
293};
294
295void popup_revolution_dialog(struct government *gov = nullptr);
296void revolution_response(struct government *gov);
297void popup_upgrade_dialog(struct unit_list *punits);
298void popup_disband_dialog(struct unit_list *punits);
301
302#endif // FC__DIALOGS_H
void setData2(QVariant wariat)
Definition dialogs.cpp:1387
void setData1(QVariant wariat)
Definition dialogs.cpp:1379
pfcn_void getFunc()
Definition dialogs.cpp:1353
void stack_button(Choice_dialog_button *button)
Definition dialogs.cpp:1713
void prev_unit()
Definition dialogs.cpp:1630
QVBoxLayout * layout
Definition dialogs.h:263
struct unit * targeted_unit
Definition dialogs.h:286
void unstack_all_buttons()
Definition dialogs.cpp:1730
Choice_dialog_button * get_identified_button(const int id)
Definition dialogs.cpp:1542
QPushButton * target_unit_button
Definition dialogs.h:262
void set_layout()
Definition dialogs.cpp:1448
void update_dialog(const struct act_prob *act_probs)
Definition dialogs.cpp:1659
QList< Choice_dialog_button * > last_buttons_stack
Definition dialogs.h:266
void next_unit()
Definition dialogs.cpp:1590
QVBoxLayout * get_layout()
Definition dialogs.cpp:1534
QHBoxLayout * unit_skip
Definition dialogs.h:264
QList< Choice_dialog_button * > buttons_list
Definition dialogs.h:265
void(* run_on_close)(int)
Definition dialogs.h:268
int target_id[ATK_COUNT]
Definition dialogs.h:284
void switch_target()
Definition dialogs.cpp:1677
QList< Choice_dialog_button * > action_button_map
Definition dialogs.h:267
int sub_target_id[ASTK_COUNT]
Definition dialogs.h:285
void execute_action(const int action)
Definition dialogs.cpp:1696
void add_item(QString title, pfcn_void func, QVariant data1, QVariant data2, QString tool_tip, const int button_id)
Definition dialogs.cpp:1490
void disband_clicked()
Definition dialogs.cpp:4001
struct unit_list * cpunits
Definition dialogs.h:97
QLabel * label
Definition dialogs.h:190
QString qheadline
Definition dialogs.h:193
void restart()
Definition dialogs.cpp:913
close_widget * cw
Definition dialogs.h:189
void mouseReleaseEvent(QMouseEvent *event)
Definition dialogs.cpp:1006
QFont small_font
Definition dialogs.h:195
QString qcaption
Definition dialogs.h:192
void calc_size(int &x, int &y)
Definition dialogs.cpp:941
void paintEvent(QPaintEvent *paint_event)
Definition dialogs.cpp:960
QPoint cursor
Definition dialogs.h:196
void mouseMoveEvent(QMouseEvent *event)
Definition dialogs.cpp:996
virtual void update_menu()
Definition dialogs.cpp:1014
void mousePressEvent(QMouseEvent *event)
Definition dialogs.cpp:983
QVBoxLayout * layout
Definition dialogs.h:191
QStringList qlist
Definition dialogs.h:194
QPushButton * close_but
Definition dialogs.h:113
QPushButton * goto_but
Definition dialogs.h:111
void inspect_city()
Definition dialogs.cpp:1158
struct tile * gtile
Definition dialogs.h:114
QPushButton * inspect_but
Definition dialogs.h:112
void goto_tile()
Definition dialogs.cpp:1149
action_id vs_unit
Definition dialogs.h:60
static qdef_act * action()
Definition dialogs.cpp:1043
action_id vs_city_get()
Definition dialogs.cpp:1081
static qdef_act * m_instance
Definition dialogs.h:58
Q_DISABLE_COPY(qdef_act)
static void drop()
Definition dialogs.cpp:1054
action_id vs_city
Definition dialogs.h:59
void vs_city_set(int i)
Definition dialogs.cpp:1065
void vs_unit_set(int i)
Definition dialogs.cpp:1073
action_id vs_unit_get()
Definition dialogs.cpp:1089
QPoint point
Definition dialogs.h:81
void paintEvent(QPaintEvent *event)
Definition dialogs.cpp:351
QPixmap close_pix
Definition dialogs.h:83
void reactivate()
Definition dialogs.cpp:343
void mouseMoveEvent(QMouseEvent *event)
Definition dialogs.cpp:392
int titlebar_height
Definition dialogs.h:80
void mousePressEvent(QMouseEvent *event)
Definition dialogs.cpp:402
void mouseReleaseEvent(QMouseEvent *event)
Definition dialogs.cpp:422
bool moving_now
Definition dialogs.h:82
int selected_style
Definition dialogs.h:164
QComboBox * leader_name
Definition dialogs.h:135
void random_pressed()
Definition dialogs.cpp:1105
void style_selected(const QItemSelection &sl, const QItemSelection &ds)
Definition dialogs.cpp:808
int last_index
Definition dialogs.h:166
QTableWidget * selected_nation_tabs
Definition dialogs.h:134
QPushButton * random_button
Definition dialogs.h:143
void refresh()
Definition dialogs.cpp:614
void nation_selected(const QItemSelection &sl, const QItemSelection &ds)
Definition dialogs.cpp:757
int selected_nation
Definition dialogs.h:163
void ok_pressed()
Definition dialogs.cpp:842
void leader_selected(int index)
Definition dialogs.cpp:827
QPushButton * ok_button
Definition dialogs.h:142
QList< QWidget * > * nations_tabs_list
Definition dialogs.h:133
QTextEdit * description
Definition dialogs.h:141
void group_selected(const QItemSelection &sl, const QItemSelection &ds)
Definition dialogs.cpp:680
void set_index(int index)
Definition dialogs.cpp:697
QComboBox * qnation_set
Definition dialogs.h:136
QRadioButton * is_male
Definition dialogs.h:138
QButtonGroup * sex_buttons
Definition dialogs.h:137
void update_nationset_combo()
Definition dialogs.cpp:664
QTableWidget * styles
Definition dialogs.h:140
struct player * tplayer
Definition dialogs.h:165
QRadioButton * is_female
Definition dialogs.h:139
QTableWidget * nation_tabs
Definition dialogs.h:132
QGridLayout * main_layout
Definition dialogs.h:131
void cancel_pressed()
Definition dialogs.cpp:1097
QPixmap * h_pix
Definition dialogs.h:206
QFont ufont
Definition dialogs.h:210
QFont info_font
Definition dialogs.h:211
void closeEvent(QCloseEvent *event)
Definition dialogs.cpp:4866
void update_img()
Definition dialogs.cpp:4724
int show_line
Definition dialogs.h:233
void mouseMoveEvent(QMouseEvent *event)
Definition dialogs.cpp:4668
int highligh_num
Definition dialogs.h:234
void paint(QPainter *painter, QPaintEvent *event)
Definition dialogs.cpp:4733
void update_menu()
Definition dialogs.cpp:4824
QPixmap * pix
Definition dialogs.h:205
int row_count
Definition dialogs.h:212
QList< unit * > unit_list
Definition dialogs.h:208
void update_units()
Definition dialogs.cpp:4834
tile * utile
Definition dialogs.h:220
int unit_count
Definition dialogs.h:235
QSize item_size
Definition dialogs.h:207
void paintEvent(QPaintEvent *event)
Definition dialogs.cpp:4811
void create_pixmap()
Definition dialogs.cpp:4533
void wheelEvent(QWheelEvent *event)
Definition dialogs.cpp:4875
void keyPressEvent(QKeyEvent *event)
Definition dialogs.cpp:4899
void mousePressEvent(QMouseEvent *event)
Definition dialogs.cpp:4699
close_widget * cw
Definition dialogs.h:213
char * incite_cost
Definition comments.c:76
const char * caption
Definition dialogs_g.h:37
const char const char * headline
Definition dialogs_g.h:38
enum event_type event
Definition events.c:81
int action_id
Definition fc_types.h:248
const char * title
Definition repodlgs.c:1314
void(* pfcn_void)(QVariant, QVariant)
Definition dialogs.h:46
bool try_default_unit_action(QVariant q1, QVariant q2)
Definition dialogs.cpp:1555
void popup_upgrade_dialog(struct unit_list *punits)
Definition dialogs.c:1435
void update_nationset_combo()
Definition dialogs.cpp:1275
void popup_races_dialog(struct player *pplayer)
Definition dialogs.c:1215
void popup_disband_dialog(struct unit_list *punits)
Definition dialogs.c:1473
void revolution_response(struct government *gov)
Definition dialogs.cpp:1928
bool try_default_city_action(QVariant q1, QVariant q2)
Definition dialogs.cpp:1573
void restart_notify_dialogs()
Definition dialogs.cpp:4121
void nationset_changed(void)
Definition dialogs.c:3565
void popup_revolution_dialog(void)
Definition dialogs.c:112
get_token_fn_t func
Definition inputfile.c:128
char * lines
Definition packhand.c:131
struct player_slot * slots
Definition player.c:51
struct sprite int int y
Definition sprite_g.h:31
struct sprite int x
Definition sprite_g.h:31
Definition tile.h:50
Definition unit.h:140