19#include <QApplication>
21#include <QElapsedTimer>
28#include <QRadioButton>
30#include <QTableWidget>
112 QSizePolicy::Slider);
140 hbox->addLayout(vbox);
144 lab =
new QLabel(
"");
146 "citybar.shields",
NULL,
"",
"",
false);
151 lab->setPixmap(pix.scaledToHeight(
isize));
154 QSizePolicy::Minimum);
158 lab =
new QLabel(
"");
162 QSizePolicy::Minimum);
165 lab =
new QLabel(
"");
167 "citybar.food",
NULL,
"",
"",
false);
172 lab->setPixmap(pix.scaledToHeight(
isize));
215 "Treasury contains %d gold.",
219 PL_(
"Upgrade as many %s to %s as possible "
220 "for %d gold each?\n%s",
221 "Upgrade as many %s to %s as possible "
222 "for %d gold each?\n%s",
price),
226 ask->set_text_title(
s2,
_(
"Upgrade Obsolete Units"));
227 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
228 ask->setDefaultButton(QMessageBox::Cancel);
229 ask->setAttribute(Qt::WA_DeleteOnClose);
230 connect(
ask, &hud_message_box::accepted, [=]() {
294 if (
event->angleDelta().y() < 0) {
334 cw->setFixedSize(12, 12);
394 QSizePolicy::Maximum,
395 QSizePolicy::Slider);
399 scroll->setWidgetResizable(
true);
400 scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
403 scroll->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
404 scroll->setProperty(
"city_scroll",
true);
448 for (output = 0; output <
O_LAST; output++) {
452 info->active_count++;
455 if (
VUT_UTYPE == pcity->production.kind) {
473 if (0 == info->active_count && 0 == info->building_count) {
496 for (j = 0; j <
i; j++) {
498 layout->addWidget(ui, 0, Qt::AlignVCenter);
528 for (j = 0; j <
i; j++) {
547 return (
q1.tech_str <
q2.tech_str);
595 if (
req ==
nullptr) {
601 for (
i = 0;
i <
tree->num_layers;
i++) {
602 for (j = 0; j <
tree->layer_size[
i]; j++) {
656 rttp->timpr = pimprove;
738 }
else if (
event->button() == Qt::RightButton) {
742 if (
rttp->tech_id != -1) {
746 }
else if (
rttp->timpr !=
nullptr) {
750 }
else if (
rttp->tunit !=
nullptr) {
753 }
else if (
rttp->tgov !=
nullptr) {
780 if (
rttp->tech_id != -1) {
784 def_str =
"<p style='white-space:pre'><b>"
788 }
else if (
rttp->timpr !=
nullptr) {
793 }
else if (
rttp->tunit !=
nullptr) {
798 }
else if (
rttp->tgov !=
nullptr) {
803 def_str =
"<p style='white-space:pre'><b>"
868 QSizePolicy::Expanding);
896 scroll->setAutoFillBackground(
true);
925 gui()->remove_repo_dlg(
"SCI");
935 gui()->gimme_place(
this,
"SCI");
937 gui()->game_tab_widget->setCurrentIndex(
index);
1000 str = QString::fromUtf8(text);
1006 if (done <= total) {
1186 gui()->sw_science->keep_blinking =
true;
1187 gui()->sw_science->set_custom_labels(
str);
1188 gui()->sw_science->sblink();
1190 gui()->sw_science->keep_blinking =
false;
1191 gui()->sw_science->set_custom_labels(
str);
1192 gui()->sw_science->update_final_pixmap();
1194 gui()->update_sidebar_tooltips();
1196 if (
gui()->is_repo_dlg_open(
"SCI")) {
1197 i =
gui()->gimme_index_of(
"SCI");
1199 w =
gui()->game_tab_widget->widget(
i);
1219 slist <<
_(
"Type") <<
Q_(
"?Building or Unit type:Name") <<
_(
"Redundant")
1220 <<
_(
"Count") <<
_(
"Cost") <<
_(
"U Total");
1223 eco_widget->setProperty(
"showGrid",
"false");
1224 eco_widget->setProperty(
"selectionBehavior",
"SelectRows");
1225 eco_widget->setEditTriggers(QAbstractItemView::NoEditTriggers);
1226 eco_widget->horizontalHeader()->resizeSections(QHeaderView::Stretch);
1227 eco_widget->verticalHeader()->setVisible(
false);
1228 eco_widget->setSelectionMode(QAbstractItemView::SingleSelection);
1231 header->setSectionResizeMode(1, QHeaderView::Stretch);
1232 header->setStretchLastSection(
true);
1261 gui()->remove_repo_dlg(
"ECO");
1270 gui()->gimme_place(
this,
"ECO");
1272 gui()->game_tab_widget->setCurrentIndex(
index);
1285 QFont f = QApplication::font();
1288 h =
fm.height() + 6;
1314 for (j = 0; j < 6; j++) {
1319 item->setData(Qt::UserRole,
id);
1322 item->setTextAlignment(Qt::AlignLeft);
1326 item->setData(Qt::DisplayRole,
pentry->redundant);
1329 item->setData(Qt::DisplayRole,
pentry->count);
1332 item->setData(Qt::DisplayRole,
pentry->cost);
1335 item->setData(Qt::DisplayRole,
pentry->total_cost);
1338 item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
1358 for (j = 0; j < 6; j++) {
1360 item->setTextAlignment(Qt::AlignHCenter);
1367 item->setData(Qt::UserRole,
id);
1370 item->setTextAlignment(Qt::AlignLeft);
1374 item->setData(Qt::DisplayRole, 0);
1377 item->setData(Qt::DisplayRole,
pentry->count);
1380 item->setData(Qt::DisplayRole,
pentry->cost);
1383 item->setData(Qt::DisplayRole,
pentry->total_cost);
1386 item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
1418 qvar =
itm->data(Qt::UserRole);
1421 switch (selected.
kind) {
1429 i =
itm->text().toInt();
1457 _(
"Do you really wish to disband every %s (%d total)?"),
1460 ask->set_text_title(
title,
_(
"Disband Units"));
1461 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
1462 ask->setDefaultButton(QMessageBox::Cancel);
1463 ask->setAttribute(Qt::WA_DeleteOnClose);
1464 connect(
ask, &hud_message_box::accepted, [=]() {
1475 result->setStandardButtons(QMessageBox::Ok);
1476 result->setAttribute(Qt::WA_DeleteOnClose);
1497 _(
"Do you really wish to sell "
1498 "every %s (%d total)?"),
1501 ask->set_text_title(
title,
_(
"Sell Improvements"));
1502 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
1503 ask->setDefaultButton(QMessageBox::Cancel);
1504 ask->setAttribute(Qt::WA_DeleteOnClose);
1505 connect(
ask, &hud_message_box::accepted, [=]() {
1518 result->setStandardButtons(QMessageBox::Ok);
1519 result->setAttribute(Qt::WA_DeleteOnClose);
1540 _(
"Do you really wish to sell "
1541 "every redundant %s (%d total)?"),
1544 ask->set_text_title(
title,
_(
"Sell Improvements"));
1545 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
1546 ask->setDefaultButton(QMessageBox::Cancel);
1547 ask->setAttribute(Qt::WA_DeleteOnClose);
1548 connect(
ask, &hud_message_box::accepted, [=]() {
1561 result->setStandardButtons(QMessageBox::Ok);
1562 result->setAttribute(Qt::WA_DeleteOnClose);
1580 slist <<
_(
"Player") <<
_(
"Nation") <<
_(
"Score");
1586 end_widget->setProperty(
"showGrid",
"false");
1587 end_widget->setProperty(
"selectionBehavior",
"SelectRows");
1588 end_widget->setEditTriggers(QAbstractItemView::NoEditTriggers);
1589 end_widget->verticalHeader()->setVisible(
false);
1590 end_widget->setSelectionMode(QAbstractItemView::SingleSelection);
1591 end_widget->horizontalHeader()->setSectionResizeMode(
1592 QHeaderView::ResizeToContents);
1602 gui()->remove_repo_dlg(
"END");
1610 gui()->gimme_place(
this,
"END");
1612 gui()->game_tab_widget->setCurrentIndex(
index);
1636 item->setData(Qt::DecorationRole, *pix);
1640 item->setText(QString::number(packet->
score));
1641 item->setTextAlignment(Qt::AlignHCenter);
1645 item->setTextAlignment(Qt::AlignHCenter);
1667 if (!
gui()->is_repo_dlg_open(
"SCI")) {
1671 i =
gui()->gimme_index_of(
"SCI");
1672 w =
gui()->game_tab_widget->widget(
i);
1674 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1677 gui()->game_tab_widget->setCurrentWidget(
sci_rep);
1691 if (
gui()->is_repo_dlg_open(
"ECO")) {
1692 i =
gui()->gimme_index_of(
"ECO");
1693 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1694 w =
gui()->game_tab_widget->widget(
i);
1699 gui()->update_sidebar_tooltips();
1711 if (!
gui()->is_repo_dlg_open(
"ECO")) {
1716 i =
gui()->gimme_index_of(
"ECO");
1718 w =
gui()->game_tab_widget->widget(
i);
1719 if (w->isVisible()) {
1720 gui()->game_tab_widget->setCurrentIndex(0);
1725 gui()->game_tab_widget->setCurrentWidget(
eco_rep);
1744 gui()->game_tab_widget->setCurrentIndex(0);
1766 if (
gui()->is_repo_dlg_open(
"END")) {
1767 i =
gui()->gimme_index_of(
"END");
1769 delete gui()->game_tab_widget->widget(
i);
1780 if (
gui()->is_repo_dlg_open(
"END")) {
1781 i =
gui()->gimme_index_of(
"END");
1782 gui()->game_tab_widget->setCurrentIndex(
i);
1795 if (
gui()->is_repo_dlg_open(
"END")) {
1796 i =
gui()->gimme_index_of(
"END");
1798 w =
gui()->game_tab_widget->widget(
i);
1813 if (
gui()->is_repo_dlg_open(
"SCI")) {
1814 i =
gui()->gimme_index_of(
"SCI");
1815 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1816 w =
gui()->game_tab_widget->widget(
i);
1832 if (
gui()->is_repo_dlg_open(
"ECO")) {
1833 i =
gui()->gimme_index_of(
"ECO");
1835 w =
gui()->game_tab_widget->widget(
i);
1850 if (
gui()->is_repo_dlg_open(
"SCI")) {
1851 i =
gui()->gimme_index_of(
"SCI");
1853 w =
gui()->game_tab_widget->widget(
i);
1874 &&
gui()->game_tab_widget->currentIndex() == 0) {
QRect zealous_crop_rect(QImage &p)
struct canvas * qtg_canvas_create(int width, int height)
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite int int int width
bool city_production_build_units(const struct city *pcity, bool add_production, int *num_units)
#define city_list_iterate(citylist, pcity)
#define city_list_iterate_end
QString split_text(QString text, bool cut)
QString get_tooltip_improvement(const impr_type *building, struct city *pcity, bool ext)
QString cut_helptext(QString text)
QString get_tooltip_unit(const struct unit_type *utype, bool ext)
QPushButton * sell_button
void selection_changed(const QItemSelection &sl, const QItemSelection &ds)
QPushButton * sell_redun_button
QPushButton * disband_button
QTableWidget * eco_widget
static fc_font * instance()
QFont * get_font(QString name)
int set_text_title(QString s1, QString s2, bool return_exec=false)
void set_pixmap(struct universal *target)
void mousePressEvent(QMouseEvent *event)
void create_tooltip_help()
QList< req_tooltip_help * > tt_help
void mouseMoveEvent(QMouseEvent *event)
void paintEvent(QPaintEvent *event)
research_diagram(QWidget *parent=nullptr)
static units_reports * m_instance
void paintEvent(QPaintEvent *event)
void add_item(unittype_item *item)
static units_reports * instance()
virtual void update_menu()
void update_units(bool show=false)
QList< unittype_item * > unittype_list
QHBoxLayout * scroll_layout
void leaveEvent(QEvent *event)
unittype_item(QWidget *parent, unit_type *ut)
QLabel label_info_inbuild
void enterEvent(QEnterEvent *event)
QPushButton upgrade_button
void paintEvent(QPaintEvent *event)
void wheelEvent(QWheelEvent *event)
bool client_is_global_observer(void)
bool client_is_observer(void)
bool can_client_issue_orders(void)
bool client_has_player(void)
cid cid_encode_building(const struct impr_type *pimprove)
struct universal cid_decode(cid id)
cid cid_encode_unit(const struct unit_type *punittype)
void unit_focus_set_and_select(struct unit *punit)
#define can_unit_do_activity_client(_punit_, _act_)
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
#define PL_(String1, String2, n)
const char * government_name_translation(const struct government *pgovern)
#define governments_iterate(NAME_pgov)
#define governments_iterate_end
void get_text_size(int *width, int *height, enum client_font font, const char *text)
void canvas_free(struct canvas *store)
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
#define mevent_gpos(__ev__)
bool comp_less_than(const qlist_item &q1, const qlist_item &q2)
void helptext_government(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct government *gov)
void helptext_advance(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i)
char * helptext_unit(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype, bool class_help)
char * helptext_building(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct impr_type *pimprove)
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
struct impr_type * improvement_by_number(const Impr_type_id id)
bool can_sell_building(const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define log_error(message,...)
#define fc_calloc(n, esz)
const char *const default_font
struct nation_type * nation_of_player(const struct player *pplayer)
struct client_options gui_options
int dsend_packet_player_tech_goal(struct connection *pc, int tech)
int dsend_packet_player_research(struct connection *pc, int tech)
int dsend_packet_unit_type_upgrade(struct connection *pc, Unit_type_id type)
const char * science_dialog_text(void)
struct player * player_by_number(const int player_id)
const char * player_name(const struct player *pplayer)
#define players_iterate_end
#define players_iterate(_pplayer)
void science_report_dialog_popup(bool raise)
QString get_tooltip_improvement(impr_type *building, struct city *pcity, bool ext)
void endgame_report_dialog_start(const struct packet_endgame_report *packet)
QString split_text(QString text, bool cut)
void real_units_report_dialog_update(void *unused)
void real_economy_report_dialog_update(void *unused)
bool comp_less_than(const qlist_item &q1, const qlist_item &q2)
void popdown_economy_report()
void economy_report_dialog_popup(bool raise)
void popdown_science_report()
void units_report_dialog_popup(bool raise)
void popdown_endgame_report()
void science_report_dialog_redraw(void)
void popdown_units_report()
void toggle_units_report(bool x)
void popup_endgame_report()
QString cut_helptext(QString text)
QString get_tooltip_unit(struct unit_type *unit, bool ext)
void real_science_report_dialog_update(void *unused)
void get_economy_report_units_data(struct unit_entry *entries, int *num_entries_used, int *total_cost)
void get_economy_report_data(struct improvement_entry *entries, int *num_entries_used, int *total_cost, int *total_income)
void sell_all_improvements(const struct impr_type *pimprove, bool redundant_only, char *message, size_t message_sz)
void disband_all_units(const struct unit_type *punittype, bool in_cities_only, char *message, size_t message_sz)
endgame_report_dialog_player
void draw_reqtree(struct reqtree *tree, struct canvas *pcanvas, int canvas_x, int canvas_y, int tt_x, int tt_y, int w, int h)
void get_reqtree_dimensions(struct reqtree *reqtree, int *width, int *height)
Tech_type_id get_tech_on_reqtree(struct reqtree *tree, int x, int y)
void destroy_reqtree(struct reqtree *tree)
struct reqtree * create_reqtree(struct player *pplayer, bool show_all)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
bool research_invention_reachable(const struct research *presearch, const Tech_type_id tech)
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
struct sprite int int int int struct sprite int int float bool smooth get_sprite_dimensions
struct packet_ruleset_control control
QTableWidget * end_widget
endgame_report(const struct packet_endgame_report *packet)
void update_report(const struct packet_endgame_player *packet)
char category_name[32][MAX_LEN_NAME]
struct tree_node ** nodes
struct tree_node *** layers
struct research::@76::@78 client
struct research::research_invention inventions[A_ARRAY_SIZE]
GtkProgressBar * progress_bar
QList< qlist_item > * curr_list
research_diagram * res_diag
QList< qlist_item > * goal_list
void current_tech_changed(int index)
void goal_tech_changed(int index)
QComboBox * researching_combo
struct tree_node ** provide
struct tree_node ** require
enum unit_activity activity
const struct unit_type * utype
int fc_snprintf(char *str, size_t n, const char *format,...)
struct advance * advance_by_number(const Tech_type_id atype)
bool is_future_tech(Tech_type_id tech)
const char * advance_name_translation(const struct advance *padvance)
Tech_type_id advance_number(const struct advance *padvance)
#define advance_index_iterate_max(_start, _index, _max)
#define advance_index_iterate_max_end
static Tech_type_id advance_count(void)
const char * get_science_target_text(double *percent)
const char * get_science_goal_text(Tech_type_id goal)
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
struct sprite * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
struct tileset * get_tileset(void)
struct sprite * tiles_lookup_sprite_tag_alt(struct tileset *t, enum log_level level, const char *tag, const char *alt, const char *alt2, const char *what, const char *name, bool scale)
struct sprite * get_tax_sprite(const struct tileset *t, Output_type_id otype)
struct sprite * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum unit_activity activity, enum direction8 facing)
struct sprite * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)
struct sprite * get_tech_sprite(const struct tileset *t, Tech_type_id tech)
const struct unit_type * utype
const struct impr_type * building
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
bool is_tech_req_for_utype(const struct unit_type *ptype, struct advance *padv)
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Unit_type_id utype_count(void)
struct unit_type * utype_by_number(const Unit_type_id id)
Unit_type_id utype_number(const struct unit_type *punittype)
Unit_type_id utype_index(const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
int unit_upgrade_price(const struct player *pplayer, const struct unit_type *from, const struct unit_type *to)
#define unit_type_iterate(_p)
#define unit_type_iterate_end