19#include <QApplication>
64 QFont f = QApplication::font();
84 if (
txt ==
"cityname") {
85 font.setCapitalization(QFont::SmallCaps);
89 if (
txt ==
"hstate_verbose") {
93 if (
txt ==
"prodplus") {
94 txt = index.data().toString();
95 if (
txt.toInt() < 0) {
151 return QVariant::fromValue((
void *)
i_city);
153 if (
role != Qt::DisplayRole) {
192 if (!index.isValid()) {
195 if (index.row() >= 0 && index.row() <
rowCount() && index.column() >= 0
208 if (!index.isValid() ||
role != Qt::DisplayRole) {
211 if (index.row() >= 0 && index.row() <
rowCount() && index.column() >= 0
213 bool change =
city_list[index.row()]->setData(index.column(), value,
role);
233 if (
role == Qt::DisplayRole) {
240 if (
role == Qt::ToolTipRole) {
339 qvar =
i.data(Qt::UserRole);
349 | QItemSelectionModel::SelectCurrent);
375 header()->setContextMenuPolicy(Qt::CustomContextMenu);
376 header()->setMinimumSectionSize(10);
379 connect(header(), &QWidget::customContextMenuRequested,
386 connect(
this, &QAbstractItemView::doubleClicked,
this,
388 connect(
this, &QWidget::customContextMenuRequested,
460 gui()->game_tab_widget->setCurrentIndex(0);
531 connect(
some_menu->addAction(
_(
"View")), &QAction::triggered,
this,
533 connect(
some_menu->addAction(
_(
"Center")), &QAction::triggered,
this,
546 list_menu->setAttribute(Qt::WA_DeleteOnClose);
547 connect(
list_menu, &QMenu::triggered,
this,
554 const char *imprname;
566 qvar2 = act->property(
"FC");
667 _(
"Are you sure you want to sell those %s?"),
670 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
671 ask->setDefaultButton(QMessageBox::Cancel);
672 ask->set_text_title(
buf,
_(
"Sell?"));
673 ask->setAttribute(Qt::WA_DeleteOnClose);
676 connect(
ask, &hud_message_box::accepted,
this, [=]() {
680 if (!
pcity || !building) {
739 m1 = menu->addMenu(
_(
"Buildings"));
740 m2 = menu->addMenu(
_(
"Units"));
741 m3 = menu->addMenu(
_(
"Wonders"));
758 QMap<QString, cid>::const_iterator
map_iter;
768 menu->setDisabled(
true);
800 qvar =
i.data(Qt::UserRole);
811 | QItemSelectionModel::SelectCurrent);
827 qvar =
i.data(Qt::UserRole);
837 | QItemSelectionModel::Select);
854 qvar =
i.data(Qt::UserRole);
865 | QItemSelectionModel::SelectCurrent);
881 qvar =
i.data(Qt::UserRole);
895 | QItemSelectionModel::SelectCurrent);
914 qvar =
i.data(Qt::UserRole);
922 if (
pcity !=
nullptr) {
929 }
else if (
str ==
"wonder"
937 | QItemSelectionModel::SelectCurrent);
960 act = menu->addAction(
_(
"All Cities"));
962 act = menu->addAction(
_(
"No Cities"));
964 act = menu->addAction(
_(
"Invert Selection"));
966 menu->addSeparator();
967 act = menu->addAction(
_(
"Coastal Cities"));
969 act = menu->addAction(
_(
"Same Island"));
972 act->setDisabled(
true);
974 menu->addSeparator();
975 act = menu->addAction(
_(
"Building Units"));
976 act->setData(
"unit");
978 act = menu->addAction(
_(
"Building Improvements"));
979 act->setData(
"impr");
981 act = menu->addAction(
_(
"Building Wonders"));
982 act->setData(
"wonder");
984 menu->addSeparator();
985 tmp_menu = menu->addMenu(
_(
"Improvements in City"));
989 tmp_menu = menu->addMenu(
_(
"Wonders in City"));
993 menu->addSeparator();
994 tmp_menu = menu->addMenu(
_(
"Supported Units"));
998 tmp_menu = menu->addMenu(
_(
"Units Present"));
1002 menu->addSeparator();
1003 tmp_menu = menu->addMenu(
_(
"Available Units"));
1007 tmp_menu = menu->addMenu(
_(
"Available Improvements"));
1011 tmp_menu = menu->addMenu(
_(
"Available Wonders"));
1070 for (
i = 0;
i < 4;
i++) {
1100 QFont f = QApplication::font();
1109 header()->resizeSections(QHeaderView::ResizeToContents);
1110 for (
int j = 0; j <
filter_model->columnCount(); j++) {
1112 if (
str.contains(
'\n')) {
1113 sl =
str.split(
'\n');
1118 header()->resizeSection(j,
width + 10);
1136 myAct->setCheckable(
true);
1192 qvar =
i.data(Qt::UserRole);
1193 if (
qvar.isNull()) {
1217 gui()->qt_settings.city_repo_sort_col = header()->sortIndicatorSection();
1218 gui()->qt_settings.city_report_sort = header()->sortIndicatorOrder();
1228 if (
gui()->qt_settings.city_repo_sort_col != -1) {
1229 city_wdg->sortByColumn(
gui()->qt_settings.city_repo_sort_col,
1230 gui()->qt_settings.city_report_sort);
1241 gui()->remove_repo_dlg(
"CTS");
1249 gui()->gimme_place(
this,
"CTS");
1251 gui()->game_tab_widget->setCurrentIndex(
index);
1279 if (!
gui()->is_repo_dlg_open(
"CTS")) {
1284 i =
gui()->gimme_index_of(
"CTS");
1286 w =
gui()->game_tab_widget->widget(
i);
1287 if (w->isVisible()) {
1288 gui()->game_tab_widget->setCurrentIndex(0);
1292 gui()->game_tab_widget->setCurrentWidget(cr);
1306 if (
gui()->is_repo_dlg_open(
"CTS")) {
1307 i =
gui()->gimme_index_of(
"CTS");
1308 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1309 w =
gui()->game_tab_widget->widget(
i);
1325 if (
gui()->is_repo_dlg_open(
"CTS")) {
1326 i =
gui()->gimme_index_of(
"CTS");
1327 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1328 w =
gui()->game_tab_widget->widget(
i);
1344 if (
gui()->is_repo_dlg_open(
"CTS")) {
1345 i =
gui()->gimme_index_of(
"CTS");
1347 w =
gui()->game_tab_widget->widget(
i);
static struct action * actions[MAX_NUM_ACTIONS]
struct canvas int int struct sprite int int int width
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
bool can_city_build_now(const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
#define cities_iterate_end
#define city_list_iterate(citylist, pcity)
#define cities_iterate(pcity)
#define city_list_iterate_end
void qtg_real_city_dialog_popup(struct city *pcity)
void get_city_dialog_production_row(char *buf[], size_t column_size, struct universal *target, struct city *pcity)
int city_set_worklist(struct city *pcity, const struct worklist *pworklist)
int city_buy_production(struct city *pcity)
bool city_queue_insert(struct city *pcity, int position, struct universal *item)
bool city_queue_insert_worklist(struct city *pcity, int position, const struct worklist *worklist)
bool city_set_queue(struct city *pcity, const struct worklist *pqueue)
int city_change_production(struct city *pcity, struct universal *target)
int city_sell_improvement(struct city *pcity, Impr_type_id sell_id)
bool city_can_buy(const struct city *pcity)
void real_city_report_dialog_update(void *unused)
void real_city_report_update_city(struct city *pcity)
void toggle_city_hilite(struct city *pcity, bool on_off)
void hilite_cities_from_canvas(void)
void city_report_dialog_popup(bool raise)
void popdown_city_report()
bool can_city_sell_universal(const struct city *pcity, const struct universal *target)
struct city_report_spec * city_report_specs
int cityrepfield_compare(const char *str1, const char *str2)
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
city_item_delegate(QObject *parent)
QVariant data(int column, int role=Qt::DisplayRole) const
city_item(struct city *pcity)
bool setData(int column, const QVariant &value, int role=Qt::DisplayRole)
void city_changed(struct city *pcity)
QVariant headerData(int section, Qt::Orientation orientation, int role) const
QVariant hide_data(int section) const
int columnCount(const QModelIndex &parent=QModelIndex()) const
QVariant menu_data(int section) const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
QList< city_item * > city_list
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole)
city_model(QObject *parent=0)
int rowCount(const QModelIndex &index=QModelIndex()) const
void notify_city_changed(int row)
void update_city(struct city *pcity)
bool lessThan(const QModelIndex &left, const QModelIndex &right) const
bool can_client_issue_orders(void)
bool client_has_player(void)
bool city_unit_supported(const struct city *pcity, const struct universal *target)
void cityrep_buy(struct city *pcity)
void name_and_sort_items(struct universal *targets, int num_targets, struct item *items, bool show_cost, struct city *pcity)
cid cid_encode(struct universal target)
bool city_building_present(const struct city *pcity, const struct universal *target)
struct universal cid_decode(cid id)
bool can_city_build_now_client(const struct city *pcity, const struct universal *target)
bool city_unit_present(const struct city *pcity, const struct universal *target)
int collect_production_targets(struct universal *targets, struct city **selected_cities, int num_selected_cities, bool append_units, bool append_wonders, bool change_prod, TestCityFunc test_func)
#define MAX_NUM_PRODUCTION_TARGETS
bool(* TestCityFunc)(const struct city *, const struct universal *)
static struct fc_sockaddr_list * list
void cma_put_city_under_agent(struct city *pcity, const struct cm_parameter *const parameter)
void cma_release_city(struct city *pcity)
char * cmafec_preset_get_descr(int idx)
const struct cm_parameter * cmafec_preset_get_parameter(int idx)
int cmafec_preset_num(void)
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
struct city * game_city_by_number(int id)
struct global_worklist * global_worklist_by_id(int id)
const char * global_worklist_name(const struct global_worklist *pgwl)
int global_worklist_id(const struct global_worklist *pgwl)
const struct worklist * global_worklist_get(const struct global_worklist *pgwl)
#define global_worklists_iterate(pgwl)
#define global_worklists_iterate_end
#define CAPTURE_DEFAULT_THIS
struct impr_type * improvement_by_number(const Impr_type_id id)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool is_convert_improvement(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define fc_assert_ret(condition)
#define fc_assert(condition)
void center_tile_mapcanvas(const struct tile *ptile)
struct client_options gui_options
struct city_list * cities
const char *(* func)(const struct city *pcity, const void *data)
bool center_when_popup_city
struct city_list * cities
int fc_snprintf(char *str, size_t n, const char *format,...)
bool is_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
#define tile_continent(_tile)
const struct impr_type * building
void worklist_init(struct worklist *pwl)
int worklist_length(const struct worklist *pwl)