Freeciv-3.3
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
21// Qt
22#include <QLabel>
23#include <QPushButton>
24#include <QWidget>
25
26// client
27#include "climisc.h"
28#include "repodlgs_g.h"
29
30// gui-qt
31#include "fonts.h"
32#include "mapview.h"
33
34class progress_bar;
35class QComboBox;
36class QGridLayout;
37class QGroupBox;
38class QHBoxLayout;
39class QItemSelection;
40class QPushButton;
41class QScrollArea;
42class QTableWidget;
44
45class unittype_item: public QFrame {
46
48
49 bool entered;
51 QLabel label_pix;
52
53public:
54 unittype_item(QWidget *parent, unit_type *ut);
56 void init_img();
63 QPushButton upgrade_button;
64
65private:
67
68private slots:
69 void upgrade_units();
70
71protected:
72#ifndef FC_QT5_MODE
74#else // FC_QT5_MODE
75 void enterEvent(QEvent *event);
76#endif // FC_QT5_MODE
77 void leaveEvent(QEvent *event);
80};
81
82class units_reports: public fcwidget {
83
86
88 explicit units_reports();
93
94public:
96 static units_reports *instance();
97 static void drop();
98 void clear_layout();
99 void init_layout();
100 void update_units(bool show = false);
102 virtual void update_menu();
105
106protected:
108};
109
110/****************************************************************************
111 Helper item for comboboxes, holding string of tech and its id
112****************************************************************************/
117
118/****************************************************************************
119 Helper item for research diagram, about drawn rectangles and what
120 tech/unit/improvement they point to.
121****************************************************************************/
132
133/****************************************************************************
134 Custom widget representing research diagram in science_report
135****************************************************************************/
136class research_diagram: public QWidget
137{
139
140public:
141 research_diagram(QWidget *parent = nullptr);
143 void update_reqtree();
144 void reset();
145 QSize size();
146private slots:
147 void show_tooltip();
148private:
152 void create_tooltip_help();
154 struct reqtree *req;
156 int width;
162};
163
164/****************************************************************************
165 Widget embedded as tab on game view (F6 default)
166 Uses string "SCI" to mark it as opened
167 You can check it using if (gui()->is_repo_dlg_open("SCI"))
168****************************************************************************/
169class science_report: public QWidget
170{
172
177 QLabel *info_label;
183
184public:
187 void update_report();
188 void init();
189 void redraw();
190 void reset_tree();
191
192private:
193 void update_reqtree();
194 int index;
195
196private slots:
197 void current_tech_changed(int index);
198 void goal_tech_changed(int index);
199};
200
201
202/****************************************************************************
203 Tab widget to display economy report (F5)
204****************************************************************************/
205class eco_report: public QWidget
206{
208 QPushButton *disband_button;
209 QPushButton *sell_button;
210 QPushButton *sell_redun_button;
211 QTableWidget *eco_widget;
212 QLabel *eco_label;
213
214public:
215 eco_report();
216 ~eco_report();
217 void update_report();
218 void init();
219
220private:
221 int index;
226
227private slots:
228 void disband_units();
229 void sell_buildings();
230 void sell_redundant();
232 const QItemSelection &ds);
233};
234
235/****************************************************************************
236 Tab widget to display economy report (F5)
237****************************************************************************/
238class endgame_report: public QWidget
239{
241 QTableWidget *end_widget;
242
243public:
244 endgame_report(const struct packet_endgame_report *packet);
246 void update_report(const struct packet_endgame_player *packet);
247 void init();
248
249private:
250 int index;
252};
253
254
255bool comp_less_than(const qlist_item &q1, const qlist_item &q2);
261void toggle_units_report(bool);
262
263#endif // FC__REPODLGS_H
QPushButton * sell_button
Definition repodlgs.h:209
void selection_changed(const QItemSelection &sl, const QItemSelection &ds)
QPushButton * sell_redun_button
Definition repodlgs.h:210
QPushButton * disband_button
Definition repodlgs.h:208
void disband_units()
QTableWidget * eco_widget
Definition repodlgs.h:211
int max_row
Definition repodlgs.h:223
void sell_buildings()
void init()
void sell_redundant()
int curr_row
Definition repodlgs.h:222
void update_report()
QLabel * eco_label
Definition repodlgs.h:212
int counter
Definition repodlgs.h:225
struct government * tgov
Definition repodlgs.h:130
Tech_type_id tech_id
Definition repodlgs.h:127
struct unit_type * tunit
Definition repodlgs.h:128
struct impr_type * timpr
Definition repodlgs.h:129
struct canvas * pcanvas
Definition repodlgs.h:153
void mousePressEvent(QMouseEvent *event)
Definition repodlgs.cpp:720
void create_tooltip_help()
Definition repodlgs.cpp:585
struct reqtree * req
Definition repodlgs.h:154
QString tooltip_text
Definition repodlgs.h:160
QList< req_tooltip_help * > tt_help
Definition repodlgs.h:158
void mouseMoveEvent(QMouseEvent *event)
Definition repodlgs.cpp:767
void update_reqtree()
Definition repodlgs.cpp:690
void paintEvent(QPaintEvent *event)
Definition repodlgs.cpp:841
QPoint tooltip_pos
Definition repodlgs.h:159
static units_reports * m_instance
Definition repodlgs.h:92
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:87
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:103
QList< unittype_item * > unittype_list
Definition repodlgs.h:104
QHBoxLayout * scroll_layout
Definition repodlgs.h:89
QWidget scroll_widget
Definition repodlgs.h:91
QScrollArea * scroll
Definition repodlgs.h:90
void init_layout()
Definition repodlgs.cpp:391
QLabel label_pix
Definition repodlgs.h:51
int unit_scroll
Definition repodlgs.h:50
QLabel label_info_active
Definition repodlgs.h:59
void leaveEvent(QEvent *event)
Definition repodlgs.cpp:269
QLabel gold_upkeep
Definition repodlgs.h:58
QLabel label_info_inbuild
Definition repodlgs.h:60
QLabel shield_upkeep
Definition repodlgs.h:62
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:57
QLabel label_info_unit
Definition repodlgs.h:61
unit_type * utype
Definition repodlgs.h:66
QPushButton upgrade_button
Definition repodlgs.h:63
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:76
enum event_type event
Definition events.c:81
int Tech_type_id
Definition fc_types.h:236
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:241
void update_report(const struct packet_endgame_player *packet)
Definition climisc.h:82
Tech_type_id id
Definition repodlgs.h:115
QString tech_str
Definition repodlgs.h:114
QGridLayout * sci_layout
Definition repodlgs.h:175
QLabel * progress_label
Definition repodlgs.h:178
progress_bar * progress
Definition repodlgs.h:176
QScrollArea * scroll
Definition repodlgs.h:182
QComboBox * goal_combo
Definition repodlgs.h:173
QList< qlist_item > * curr_list
Definition repodlgs.h:179
QLabel * info_label
Definition repodlgs.h:177
research_diagram * res_diag
Definition repodlgs.h:181
QList< qlist_item > * goal_list
Definition repodlgs.h:180
void update_report()
Definition repodlgs.cpp:966
void update_reqtree()
void reset_tree()
Definition repodlgs.cpp:954
void current_tech_changed(int index)
void goal_tech_changed(int index)
QComboBox * researching_combo
Definition repodlgs.h:174