Added translator comment about government overthrown message.
[freeciv.git] / client / gui-qt / repodlgs.h
bloba9da0b4d1d3d19ed20276a97573ee44f137cb888
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__REPODLGS_H
15 #define FC__REPODLGS_H
17 #ifdef HAVE_CONFIG_H
18 #include <fc_config.h>
19 #endif
21 extern "C" {
22 #include "repodlgs_g.h"
25 // client
26 #include "climisc.h"
28 // gui-qt
29 #include "fonts.h"
31 // Qt
32 #include <QObject>
33 #include <QWidget>
35 class progress_bar;
36 class QComboBox;
37 class QGridLayout;
38 class QGroupBox;
39 class QHBoxLayout;
40 class QItemSelection;
41 class QLabel;
42 class QPushButton;
43 class QScrollArea;
44 class QTableWidget;
45 class QTableWidgetItem;
47 /****************************************************************************
48 Helper item for comboboxes, holding string of tech and its id
49 ****************************************************************************/
50 struct qlist_item {
51 QString tech_str;
52 Tech_type_id id;
55 /****************************************************************************
56 Helper item for research diagram, about drawn rectangles and what
57 tech/unit/improvement they point to.
58 ****************************************************************************/
59 class req_tooltip_help
61 public:
62 req_tooltip_help();
63 QRect rect;
64 Tech_type_id tech_id;
65 struct unit_type *tunit;
66 struct impr_type *timpr;
67 struct government *tgov;
69 /****************************************************************************
70 Custom widget representing research diagram in science_report
71 ****************************************************************************/
72 class research_diagram: public QWidget
74 Q_OBJECT
76 public:
77 research_diagram(QWidget *parent = 0);
78 ~research_diagram();
79 void update_reqtree();
80 void reset();
81 QSize size();
83 private:
84 void mousePressEvent(QMouseEvent *event);
85 void mouseMoveEvent(QMouseEvent *event);
86 void paintEvent(QPaintEvent *event);
87 void create_tooltip_help();
88 struct canvas *pcanvas;
89 struct reqtree *req;
90 int width;
91 int height;
92 QList<req_tooltip_help*> tt_help;
95 /****************************************************************************
96 Widget embedded as tab on game view (F6 default)
97 Uses string "SCI" to mark it as opened
98 You can check it using if (gui()->is_repo_dlg_open("SCI"))
99 ****************************************************************************/
100 class science_report: public QWidget
102 Q_OBJECT
104 QComboBox *goal_combo;
105 QComboBox *researching_combo;
106 QGridLayout *sci_layout;
107 progress_bar *progress;
108 QLabel *info_label;
109 QLabel *progress_label;
110 QList<qlist_item> *curr_list;
111 QList<qlist_item> *goal_list;
112 research_diagram *res_diag;
113 QScrollArea *scroll;
115 public:
116 science_report();
117 ~science_report();
118 void update_report();
119 void init(bool raise);
120 void redraw();
121 void reset_tree();
123 private:
124 void update_reqtree();
125 int index;
127 private slots:
128 void current_tech_changed(int index);
129 void goal_tech_changed(int index);
132 /****************************************************************************
133 Tab widget to display units report (F2)
134 ****************************************************************************/
135 class units_report: public QWidget
137 Q_OBJECT
138 QPushButton *find_button;
139 QPushButton *upgrade_button;
140 QTableWidget *units_widget;
142 public:
143 units_report();
144 ~units_report();
145 void update_report();
146 void init();
148 private:
149 int index;
150 int curr_row;
151 int max_row;
152 Unit_type_id uid;
153 struct unit *find_nearest_unit(const struct unit_type *utype,
154 struct tile *ptile);
156 private slots:
157 void find_units();
158 void upgrade_units();
159 void selection_changed(const QItemSelection &sl,
160 const QItemSelection &ds);
164 /****************************************************************************
165 Tab widget to display economy report (F5)
166 ****************************************************************************/
167 class eco_report: public QWidget
169 Q_OBJECT
170 QPushButton *disband_button;
171 QPushButton *sell_button;
172 QPushButton *sell_redun_button;
173 QTableWidget *eco_widget;
174 QLabel *eco_label;
176 public:
177 eco_report();
178 ~eco_report();
179 void update_report();
180 void init();
182 private:
183 int index;
184 int curr_row;
185 int max_row;
186 cid uid;
187 int counter;
189 private slots:
190 void disband_units();
191 void sell_buildings();
192 void sell_redundant();
193 void selection_changed(const QItemSelection &sl,
194 const QItemSelection &ds);
197 /****************************************************************************
198 Tab widget to display economy report (F5)
199 ****************************************************************************/
200 class endgame_report: public QWidget
202 Q_OBJECT
203 QTableWidget *end_widget;
205 public:
206 endgame_report(const struct packet_endgame_report *packet);
207 ~endgame_report();
208 void update_report(const struct packet_endgame_player *packet);
209 void init();
211 private:
212 int index;
213 int players;
218 bool comp_less_than(const qlist_item &q1, const qlist_item &q2);
219 void popdown_economy_report();
220 void popdown_units_report();
221 void popdown_science_report();
222 void popdown_endgame_report();
223 void popup_endgame_report();
225 #endif /* FC__REPODLGS_H */