Freeciv-3.2
Loading...
Searching...
No Matches
repodlgs.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__REPODLGS_H
15#define FC__REPODLGS_H
16
17#ifdef HAVE_CONFIG_H
18#include <fc_config.h>
19#endif
20
21extern "C" {
22#include "repodlgs_g.h"
23}
24
25// Qt
26#include <QLabel>
27#include <QPushButton>
28#include <QWidget>
29
30// client
31#include "climisc.h"
32
33// gui-qt
34#include "fonts.h"
35#include "mapview.h"
36
37class progress_bar;
38class QComboBox;
39class QGridLayout;
40class QGroupBox;
41class QHBoxLayout;
42class QItemSelection;
43class QPushButton;
44class QScrollArea;
45class QTableWidget;
47
48class unittype_item: public QFrame {
49
51
52 bool entered;
54 QLabel label_pix;
55
56public:
57 unittype_item(QWidget *parent, unit_type *ut);
59 void init_img();
66 QPushButton upgrade_button;
67
68private:
70
71private slots:
72 void upgrade_units();
73
74protected:
75#ifndef FC_QT5_MODE
77#else // FC_QT5_MODE
78 void enterEvent(QEvent *event);
79#endif // FC_QT5_MODE
80 void leaveEvent(QEvent *event);
83};
84
85class units_reports: public fcwidget {
86
89
91 explicit units_reports();
96
97public:
99 static units_reports *instance();
100 static void drop();
101 void clear_layout();
102 void init_layout();
103 void update_units(bool show = false);
105 virtual void update_menu();
108
109protected:
111};
112
113/****************************************************************************
114 Helper item for comboboxes, holding string of tech and its id
115****************************************************************************/
120
121/****************************************************************************
122 Helper item for research diagram, about drawn rectangles and what
123 tech/unit/improvement they point to.
124****************************************************************************/
135
136/****************************************************************************
137 Custom widget representing research diagram in science_report
138****************************************************************************/
139class research_diagram: public QWidget
140{
142
143public:
144 research_diagram(QWidget *parent = nullptr);
146 void update_reqtree();
147 void reset();
148 QSize size();
149private slots:
150 void show_tooltip();
151private:
155 void create_tooltip_help();
157 struct reqtree *req;
159 int width;
165};
166
167/****************************************************************************
168 Widget embedded as tab on game view (F6 default)
169 Uses string "SCI" to mark it as opened
170 You can check it using if (gui()->is_repo_dlg_open("SCI"))
171****************************************************************************/
172class science_report: public QWidget
173{
175
180 QLabel *info_label;
186
187public:
190 void update_report();
191 void init();
192 void redraw();
193 void reset_tree();
194
195private:
196 void update_reqtree();
197 int index;
198
199private slots:
200 void current_tech_changed(int index);
201 void goal_tech_changed(int index);
202};
203
204
205/****************************************************************************
206 Tab widget to display economy report (F5)
207****************************************************************************/
208class eco_report: public QWidget
209{
211 QPushButton *disband_button;
212 QPushButton *sell_button;
213 QPushButton *sell_redun_button;
214 QTableWidget *eco_widget;
215 QLabel *eco_label;
216
217public:
218 eco_report();
219 ~eco_report();
220 void update_report();
221 void init();
222
223private:
224 int index;
229
230private slots:
231 void disband_units();
232 void sell_buildings();
233 void sell_redundant();
235 const QItemSelection &ds);
236};
237
238/****************************************************************************
239 Tab widget to display economy report (F5)
240****************************************************************************/
241class endgame_report: public QWidget
242{
244 QTableWidget *end_widget;
245
246public:
247 endgame_report(const struct packet_endgame_report *packet);
249 void update_report(const struct packet_endgame_player *packet);
250 void init();
251
252private:
253 int index;
255};
256
257
258bool comp_less_than(const qlist_item &q1, const qlist_item &q2);
264void toggle_units_report(bool);
265
266#endif // FC__REPODLGS_H
QPushButton * sell_button
Definition repodlgs.h:212
void selection_changed(const QItemSelection &sl, const QItemSelection &ds)
QPushButton * sell_redun_button
Definition repodlgs.h:213
QPushButton * disband_button
Definition repodlgs.h:211
void disband_units()
QTableWidget * eco_widget
Definition repodlgs.h:214
int max_row
Definition repodlgs.h:226
void sell_buildings()
void init()
void sell_redundant()
int curr_row
Definition repodlgs.h:225
void update_report()
QLabel * eco_label
Definition repodlgs.h:215
int counter
Definition repodlgs.h:228
struct government * tgov
Definition repodlgs.h:133
Tech_type_id tech_id
Definition repodlgs.h:130
struct unit_type * tunit
Definition repodlgs.h:131
struct impr_type * timpr
Definition repodlgs.h:132
struct canvas * pcanvas
Definition repodlgs.h:156
void mousePressEvent(QMouseEvent *event)
Definition repodlgs.cpp:720
void create_tooltip_help()
Definition repodlgs.cpp:585
struct reqtree * req
Definition repodlgs.h:157
QString tooltip_text
Definition repodlgs.h:163
QList< req_tooltip_help * > tt_help
Definition repodlgs.h:161
void mouseMoveEvent(QMouseEvent *event)
Definition repodlgs.cpp:767
void update_reqtree()
Definition repodlgs.cpp:690
void paintEvent(QPaintEvent *event)
Definition repodlgs.cpp:840
QPoint tooltip_pos
Definition repodlgs.h:162
static units_reports * m_instance
Definition repodlgs.h:95
void clear_layout()
Definition repodlgs.cpp:519
void paintEvent(QPaintEvent *event)
Definition repodlgs.cpp:412
static void drop()
Definition repodlgs.cpp:371
close_widget * cw
Definition repodlgs.h:90
void add_item(unittype_item *item)
Definition repodlgs.cpp:351
static units_reports * instance()
Definition repodlgs.cpp:359
virtual void update_menu()
Definition repodlgs.cpp:382
Q_DISABLE_COPY(units_reports)
void update_units(bool show=false)
Definition repodlgs.cpp:420
QHBoxLayout * layout
Definition repodlgs.h:106
QList< unittype_item * > unittype_list
Definition repodlgs.h:107
QHBoxLayout * scroll_layout
Definition repodlgs.h:92
QWidget scroll_widget
Definition repodlgs.h:94
QScrollArea * scroll
Definition repodlgs.h:93
void init_layout()
Definition repodlgs.cpp:391
QLabel label_pix
Definition repodlgs.h:54
int unit_scroll
Definition repodlgs.h:53
QLabel label_info_active
Definition repodlgs.h:62
void leaveEvent(QEvent *event)
Definition repodlgs.cpp:269
QLabel gold_upkeep
Definition repodlgs.h:61
QLabel label_info_inbuild
Definition repodlgs.h:63
QLabel shield_upkeep
Definition repodlgs.h:65
void init_img()
Definition repodlgs.cpp:190
void upgrade_units()
Definition repodlgs.cpp:202
void enterEvent(QEnterEvent *event)
Definition repodlgs.cpp:240
QLabel food_upkeep
Definition repodlgs.h:60
QLabel label_info_unit
Definition repodlgs.h:64
unit_type * utype
Definition repodlgs.h:69
QPushButton upgrade_button
Definition repodlgs.h:66
void paintEvent(QPaintEvent *event)
Definition repodlgs.cpp:252
void wheelEvent(QWheelEvent *event)
Definition repodlgs.cpp:278
int cid
Definition climisc.h:31
char * incite_cost
Definition comments.c:75
enum event_type event
Definition events.c:81
int Tech_type_id
Definition fc_types.h:377
bool comp_less_than(const qlist_item &q1, const qlist_item &q2)
Definition repodlgs.cpp:545
void popdown_economy_report()
void toggle_units_report(bool)
void popdown_science_report()
void popdown_endgame_report()
void popdown_units_report()
void popup_endgame_report()
#define show(id)
Definition widget.h:235
struct player_slot * slots
Definition player.c:51
QTableWidget * end_widget
Definition repodlgs.h:244
void update_report(const struct packet_endgame_player *packet)
Definition climisc.h:82
Tech_type_id id
Definition repodlgs.h:118
QString tech_str
Definition repodlgs.h:117
QGridLayout * sci_layout
Definition repodlgs.h:178
QLabel * progress_label
Definition repodlgs.h:181
progress_bar * progress
Definition repodlgs.h:179
QScrollArea * scroll
Definition repodlgs.h:185
QComboBox * goal_combo
Definition repodlgs.h:176
QList< qlist_item > * curr_list
Definition repodlgs.h:182
QLabel * info_label
Definition repodlgs.h:180
research_diagram * res_diag
Definition repodlgs.h:184
QList< qlist_item > * goal_list
Definition repodlgs.h:183
void update_report()
Definition repodlgs.cpp:964
void update_reqtree()
void reset_tree()
Definition repodlgs.cpp:952
void current_tech_changed(int index)
void goal_tech_changed(int index)
QComboBox * researching_combo
Definition repodlgs.h:177