19#include <QApplication>
41 QStyle::SE_CheckBoxIndicator, &
cbso);
60 r = QItemDelegate::sizeHint(
option, index);
61 r.setHeight(r.height() + 4);
86 QItemDelegate::drawBackground(
painter,
opt, index);
87 pm = index.data().value<
QPixmap>();
94 pm = pm.scaledToHeight(
fm->height());
99 pix.fill(index.data().value <
QColor> ());
100 QItemDelegate::drawBackground(
painter,
opt, index);
104 b = index.data().toBool();
105 QItemDelegate::drawBackground(
painter,
opt, index);
106 cbso.state |= QStyle::State_Enabled;
108 cbso.state |= QStyle::State_On;
110 cbso.state |= QStyle::State_Off;
114 QApplication::style()->drawControl(QStyle::CE_CheckBox, &
cbso,
painter);
120 QItemDelegate::drawBackground(
painter,
opt, index);
121 opt.displayAlignment = Qt::AlignRight;
123 rct.setTop((
rct.top() +
rct.bottom()) / 2
124 -
opt.fontMetrics.height() / 2);
125 rct.setBottom((
rct.top()+
rct.bottom()) / 2
126 +
opt.fontMetrics.height() / 2);
127 if (index.data().toInt() == -1) {
130 str = index.data().toString();
165 if (
role == Qt::UserRole) {
166 return QVariant::fromValue((
void *)
ipplayer);
168 if (
role != Qt::DisplayRole) {
187 if (
str.toInt() != 0) {
189 }
else if (
str ==
"?") {
220 if (!index.isValid()) {
224 if (index.row() >= 0 && index.row() <
rowCount() && index.column() >= 0
226 return plr_list[index.row()]->data(index.column(),
role);
241 if (
role == Qt::DisplayRole) {
257 if (!index.isValid() ||
role != Qt::DisplayRole) {
261 if (index.row() >= 0 && index.row() <
rowCount() && index.column() >= 0
263 bool change =
plr_list[index.row()]->setData(index.column(), value,
role);
331 int ri = right.row();
356 return QSortFilterProxyModel::lessThan(left, right);
382 header()->setContextMenuPolicy(Qt::CustomContextMenu);
384 connect(header(), &QWidget::customContextMenuRequested,
409 qvar =
i.data(Qt::UserRole);
419 | QItemSelectionModel::SelectCurrent);
435 Qt::DisplayRole).toString());
436 myAct->setCheckable(
true);
532 qvar = index.data(Qt::UserRole);
533 pplayer =
reinterpret_cast<player *
>(
qvar.value<
void *>());
548 res =
_(
"(Unknown)");
554 res =
_(
"(Unknown)");
570 etax =
_(
"(Unknown)");
571 esci =
_(
"(Unknown)");
572 elux =
_(
"(Unknown)");
573 cult =
_(
"(Unknown)");
583 egov =
_(
"(Unknown)");
593 +
QString(
"</td></tr><tr><td><b>") +
_(
"Government:")
595 +
QString(
"</td></tr><tr><td><b>") +
_(
"Capital:")
599 +
QString(
"</td></tr><tr><td><b>") +
_(
"Gold:")
601 +
QString(
"</td></tr><tr><td><b>") +
_(
"Tax:")
603 +
QString(
"</td></tr><tr><td><b>") +
_(
"Science:")
605 +
QString(
"</td></tr><tr><td><b>") +
_(
"Luxury:")
607 +
QString(
"</td></tr><tr><td><b>") +
_(
"Researching:")
608 +
QString(
"</b></td><td>") +
res.toHtmlEscaped()
609 +
QString(
"<td></tr><tr><td><b>") +
_(
"Culture:")
627 if (
static_cast<int>(state->
type) ==
i &&
intel) {
680 +
res.toHtmlEscaped() +
","
685 +
res.toHtmlEscaped() +
","
720 rule =
_(
"All Wonders are known");
723 rule =
_(
"Small Wonders not known");
726 rule =
_(
"Small Wonders visible if we have an embassy");
786 gui()->qt_settings.player_repo_sort_col = header()->sortIndicatorSection();
787 gui()->qt_settings.player_report_sort = header()->sortIndicatorOrder();
803 plr_label->setFrameStyle(QFrame::StyledPanel);
804 plr_label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
808 ally_label->setFrameStyle(QFrame::StyledPanel);
810 ally_label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
814 tech_label->setFrameStyle(QFrame::StyledPanel);
815 tech_label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
819 wonder_label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
870 line->setFrameShape(QFrame::VLine);
886 if (
gui()->qt_settings.player_repo_sort_col != -1) {
887 plr_wdg->sortByColumn(
gui()->qt_settings.player_repo_sort_col,
888 gui()->qt_settings.player_report_sort);
897 gui()->remove_repo_dlg(
"PLR");
905 gui()->gimme_place(
this,
"PLR");
907 gui()->game_tab_widget->setCurrentIndex(
index);
966 QMenu *
ai_menu =
new QMenu(
this);
985 ai_menu->setAttribute(Qt::WA_DeleteOnClose);
986 connect(
ai_menu, &QMenu::triggered,
996 if (act && act->isVisible()) {
997 lvl = act->data().toInt();
1007 ai_menu->popup(QCursor::pos());
1066 if (index.isValid() &&
event->button() == Qt::RightButton
1071 QTreeView::mousePressEvent(
event);
1100 if (
qmi.isValid()) {
1106 plr_wdg->header()->resizeSections(QHeaderView::ResizeToContents);
1151 if (!
gui()->is_repo_dlg_open(
"PLR")) {
1155 pr->update_report();
1159 i =
gui()->gimme_index_of(
"PLR");
1160 w =
gui()->game_tab_widget->widget(
i);
1161 if (w->isVisible()) {
1162 gui()->game_tab_widget->setCurrentIndex(0);
1166 gui()->game_tab_widget->setCurrentWidget(
pr);
1167 pr->update_report();
1180 if (
gui()->is_repo_dlg_open(
"PLR")) {
1181 i =
gui()->gimme_index_of(
"PLR");
1182 if (
gui()->game_tab_widget->currentIndex() ==
i) {
1183 w =
gui()->game_tab_widget->widget(
i);
1199 if (
gui()->is_repo_dlg_open(
"PLR")) {
1200 i =
gui()->gimme_index_of(
"PLR");
1202 w =
gui()->game_tab_widget->widget(
i);
static struct action * actions[MAX_NUM_ACTIONS]
int send_chat_printf(const char *format,...)
const char * city_name_get(const struct city *pcity)
static fc_font * instance()
QFont * get_font(QString name)
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
bool setData(int column, const QVariant &value, int role=Qt::DisplayRole)
QVariant data(int column, int role=Qt::DisplayRole) const
plr_item(struct player *pplayer)
plr_model(QObject *parent=0)
int rowCount(const QModelIndex &index=QModelIndex()) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole)
QVariant hide_data(int section) const
QList< plr_item * > plr_list
void notify_plr_changed(int row)
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
int columnCount(const QModelIndex &parent=QModelIndex()) const
void req_caancel_threaty()
void update_report(bool update_selection=true)
struct player * other_player
QPushButton * toggle_ai_but
void show_wonders_toggle()
void show_relations_toggle()
QPushButton * withdraw_but
QPushButton * show_relations
void req_wiithdrw_vision()
QPushButton * show_wonders
plr_sorter(QObject *parent)
bool lessThan(const QModelIndex &left, const QModelIndex &right) const
bool client_is_global_observer(void)
bool can_meet_with_player(const struct player *pplayer)
bool can_client_issue_orders(void)
const char * title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
struct color * get_player_color(const struct tileset *t, const struct player *pplayer)
void qtg_init_meeting(struct Treaty *ptreaty, struct player *they, struct player *initiator)
bool could_intel_with_player(const struct player *pplayer, const struct player *aplayer)
struct Treaty * find_treaty(struct player *plr0, struct player *plr1)
const char * government_name_for_player(const struct player *pplayer)
#define CAPTURE_DEFAULT_THIS
bool wonder_is_lost(const struct player *pplayer, const struct impr_type *pimprove)
bool wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
struct city * city_from_wonder(const struct player *pplayer, const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
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)
const char *const default_font
const char * nation_adjective_for_player(const struct player *pplayer)
struct nation_type * nation_of_player(const struct player *pplayer)
const char * nation_plural_for_player(const struct player *pplayer)
struct client_options gui_options
int dsend_packet_diplomacy_cancel_pact(struct connection *pc, int other_player_id, enum clause_type clause)
int dsend_packet_diplomacy_init_meeting_req(struct connection *pc, int counterpart)
bool is_settable_ai_level(enum ai_level level)
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
struct city * player_primary_capital(const struct player *pplayer)
enum dipl_reason pplayer_can_cancel_treaty(const struct player *p1, const struct player *p2)
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
bool gives_shared_vision(const struct player *me, const struct player *them)
#define ai_level_cmd(_level_)
#define players_iterate_end
#define players_iterate(_pplayer)
static bool is_barbarian(const struct player *pplayer)
#define players_iterate_alive_end
#define players_iterate_alive(_pplayer)
void popdown_players_report()
void real_players_dialog_update(void *unused)
void popup_players_dialog(bool raise)
static QRect check_box_rect(const QStyleOptionViewItem &view_item_style_options)
struct player_dlg_column player_dlg_columns[]
const int num_player_dlg_columns
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 setting_list * level[OLEVELS_NUM]
struct packet_game_info info
bool gui_qt_show_relations_panel
bool gui_qt_show_techs_panel
bool gui_qt_show_wonders_panel
enum wonder_visib_type small_wonder_visibility
enum player_dlg_column_type type
struct player::@70::@73 client
struct player_economic economic
struct research::@76::@78 client
Tech_type_id advance_number(const struct advance *padvance)
#define advance_iterate(_p)
#define advance_iterate_end
struct sprite * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)