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",
nullptr,
"",
"",
false);
151 lab->setPixmap(pix.scaledToHeight(
isize));
154 QSizePolicy::Minimum);
158 lab =
new QLabel(
"");
162 QSizePolicy::Minimum);
165 lab =
new QLabel(
"");
167 "citybar.food",
nullptr,
"",
"",
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++;
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;
704 if (
req !=
nullptr) {
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) {
781 if (
rttp->tech_id != -1) {
785 def_str =
"<p style='white-space:pre'><b>"
789 }
else if (
rttp->timpr !=
nullptr) {
792 pplayer,
nullptr,
rttp->timpr);
794 }
else if (
rttp->tunit !=
nullptr) {
799 }
else if (
rttp->tgov !=
nullptr) {
804 def_str =
"<p style='white-space:pre'><b>"
870 QSizePolicy::Expanding);
898 scroll->setAutoFillBackground(
true);
927 gui()->remove_repo_dlg(
"SCI");
937 gui()->gimme_place(
this,
"SCI");
939 gui()->game_tab_widget->setCurrentIndex(
index);
1002 str = QString::fromUtf8(text);
1008 if (done <= total) {
1169 if (plr !=
nullptr) {
1188 gui()->sw_science->keep_blinking =
true;
1189 gui()->sw_science->set_custom_labels(
str);
1190 gui()->sw_science->sblink();
1192 gui()->sw_science->keep_blinking =
false;
1193 gui()->sw_science->set_custom_labels(
str);
1194 gui()->sw_science->update_final_pixmap();
1196 gui()->update_sidebar_tooltips();
1198 if (
gui()->is_repo_dlg_open(
"SCI")) {
1199 i =
gui()->gimme_index_of(
"SCI");
1201 w =
gui()->game_tab_widget->widget(
i);
1221 slist <<
_(
"Type") <<
Q_(
"?Building or Unit type:Name") <<
_(
"Redundant")
1222 <<
_(
"Count") <<
_(
"Cost") <<
_(
"U Total");
1225 eco_widget->setProperty(
"showGrid",
"false");
1226 eco_widget->setProperty(
"selectionBehavior",
"SelectRows");
1227 eco_widget->setEditTriggers(QAbstractItemView::NoEditTriggers);
1228 eco_widget->horizontalHeader()->resizeSections(QHeaderView::Stretch);
1229 eco_widget->verticalHeader()->setVisible(
false);
1230 eco_widget->setSelectionMode(QAbstractItemView::SingleSelection);
1233 header->setSectionResizeMode(1, QHeaderView::Stretch);
1234 header->setStretchLastSection(
true);
1263 gui()->remove_repo_dlg(
"ECO");
1272 gui()->gimme_place(
this,
"ECO");
1274 gui()->game_tab_widget->setCurrentIndex(
index);
1287 QFont f = QApplication::font();
1290 h =
fm.height() + 6;
1308 if (pix !=
nullptr) {
1316 for (j = 0; j < 6; j++) {
1321 item->setData(Qt::UserRole,
id);
1324 item->setTextAlignment(Qt::AlignLeft);
1328 item->setData(Qt::DisplayRole,
pentry->redundant);
1331 item->setData(Qt::DisplayRole,
pentry->count);
1334 item->setData(Qt::DisplayRole,
pentry->cost);
1337 item->setData(Qt::DisplayRole,
pentry->total_cost);
1340 item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
1360 for (j = 0; j < 6; j++) {
1362 item->setTextAlignment(Qt::AlignHCenter);
1365 if (pix !=
nullptr) {
1369 item->setData(Qt::UserRole,
id);
1372 item->setTextAlignment(Qt::AlignLeft);
1376 item->setData(Qt::DisplayRole, 0);
1379 item->setData(Qt::DisplayRole,
pentry->count);
1382 item->setData(Qt::DisplayRole,
pentry->cost);
1385 item->setData(Qt::DisplayRole,
pentry->total_cost);
1388 item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
1420 qvar =
itm->data(Qt::UserRole);
1423 switch (selected.
kind) {
1431 i =
itm->text().toInt();
1459 _(
"Do you really wish to disband every %s (%d total)?"),
1462 ask->set_text_title(
title,
_(
"Disband Units"));
1463 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
1464 ask->setDefaultButton(QMessageBox::Cancel);
1465 ask->setAttribute(Qt::WA_DeleteOnClose);
1466 connect(
ask, &hud_message_box::accepted, [=]() {
1477 result->setStandardButtons(QMessageBox::Ok);
1478 result->setAttribute(Qt::WA_DeleteOnClose);
1499 _(
"Do you really wish to sell "
1500 "every %s (%d total)?"),
1503 ask->set_text_title(
title,
_(
"Sell Improvements"));
1504 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
1505 ask->setDefaultButton(QMessageBox::Cancel);
1506 ask->setAttribute(Qt::WA_DeleteOnClose);
1507 connect(
ask, &hud_message_box::accepted, [=]() {
1520 result->setStandardButtons(QMessageBox::Ok);
1521 result->setAttribute(Qt::WA_DeleteOnClose);
1542 _(
"Do you really wish to sell "
1543 "every redundant %s (%d total)?"),
1546 ask->set_text_title(
title,
_(
"Sell Improvements"));
1547 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
1548 ask->setDefaultButton(QMessageBox::Cancel);
1549 ask->setAttribute(Qt::WA_DeleteOnClose);
1550 connect(
ask, &hud_message_box::accepted, [=]() {
1563 result->setStandardButtons(QMessageBox::Ok);
1564 result->setAttribute(Qt::WA_DeleteOnClose);
1582 slist <<
_(
"Player") <<
_(
"Nation") <<
_(
"Score");
1588 end_widget->setProperty(
"showGrid",
"false");
1589 end_widget->setProperty(
"selectionBehavior",
"SelectRows");
1590 end_widget->setEditTriggers(QAbstractItemView::NoEditTriggers);
1591 end_widget->verticalHeader()->setVisible(
false);
1592 end_widget->setSelectionMode(QAbstractItemView::SingleSelection);
1593 end_widget->horizontalHeader()->setSectionResizeMode(
1594 QHeaderView::ResizeToContents);
1604 gui()->remove_repo_dlg(
"END");
1612 gui()->gimme_place(
this,
"END");
1614 gui()->game_tab_widget->setCurrentIndex(
index);
1637 if (pix !=
nullptr) {
1638 item->setData(Qt::DecorationRole, *pix);
1642 item->setText(QString::number(packet->
score));
1643 item->setTextAlignment(Qt::AlignHCenter);
1647 item->setTextAlignment(Qt::AlignHCenter);
1669 if (!
gui()->is_repo_dlg_open(
"SCI")) {
1673 i =
gui()->gimme_index_of(
"SCI");
1674 w =
gui()->game_tab_widget->widget(
i);
1676 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1679 gui()->game_tab_widget->setCurrentWidget(
sci_rep);
1693 if (
gui()->is_repo_dlg_open(
"ECO")) {
1694 i =
gui()->gimme_index_of(
"ECO");
1695 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1696 w =
gui()->game_tab_widget->widget(
i);
1701 gui()->update_sidebar_tooltips();
1713 if (!
gui()->is_repo_dlg_open(
"ECO")) {
1718 i =
gui()->gimme_index_of(
"ECO");
1720 w =
gui()->game_tab_widget->widget(
i);
1721 if (w->isVisible()) {
1722 gui()->game_tab_widget->setCurrentIndex(0);
1727 gui()->game_tab_widget->setCurrentWidget(
eco_rep);
1746 gui()->game_tab_widget->setCurrentIndex(0);
1768 if (
gui()->is_repo_dlg_open(
"END")) {
1769 i =
gui()->gimme_index_of(
"END");
1771 delete gui()->game_tab_widget->widget(
i);
1782 if (
gui()->is_repo_dlg_open(
"END")) {
1783 i =
gui()->gimme_index_of(
"END");
1784 gui()->game_tab_widget->setCurrentIndex(
i);
1797 if (
gui()->is_repo_dlg_open(
"END")) {
1798 i =
gui()->gimme_index_of(
"END");
1800 w =
gui()->game_tab_widget->widget(
i);
1815 if (
gui()->is_repo_dlg_open(
"SCI")) {
1816 i =
gui()->gimme_index_of(
"SCI");
1817 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1818 w =
gui()->game_tab_widget->widget(
i);
1834 if (
gui()->is_repo_dlg_open(
"ECO")) {
1835 i =
gui()->gimme_index_of(
"ECO");
1837 w =
gui()->game_tab_widget->widget(
i);
1852 if (
gui()->is_repo_dlg_open(
"SCI")) {
1853 i =
gui()->gimme_index_of(
"SCI");
1855 w =
gui()->game_tab_widget->widget(
i);
1876 &&
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
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 int const struct action *paction struct unit struct city * pcity
#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 qtg_real_economy_report_dialog_update(void *unused)
QString get_tooltip_improvement(impr_type *building, struct city *pcity, bool ext)
QString split_text(QString text, bool cut)
void qtg_science_report_dialog_redraw()
bool comp_less_than(const qlist_item &q1, const qlist_item &q2)
void popdown_economy_report()
void economy_report_dialog_popup(bool raise)
void qtg_real_units_report_dialog_update(void *unused)
void qtg_endgame_report_dialog_player(const struct packet_endgame_player *packet)
void popdown_science_report()
void units_report_dialog_popup(bool raise)
void qtg_real_science_report_dialog_update(void *unused)
void popdown_endgame_report()
void popdown_units_report()
void qtg_science_report_dialog_popup(bool raise)
void toggle_units_report(bool x)
void popup_endgame_report()
QString cut_helptext(QString text)
void qtg_endgame_report_dialog_start(const struct packet_endgame_report *packet)
QString get_tooltip_unit(struct unit_type *unit, bool ext)
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)
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::@79::@81 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