20#include <QApplication>
41extern void pixmap_copy(QPixmap *dest, QPixmap *src,
int src_x,
int src_y,
66 pix =
new QPixmap(12,12);
88 setContextMenuPolicy(Qt::CustomContextMenu);
90 timer->setSingleShot(
false);
91 timer->setInterval(700);
134 if (
sfont !=
nullptr) {
138 sfont->setCapitalization(QFont::SmallCaps);
139 sfont->setItalic(
true);
197 Qt::SmoothTransformation);
235 update_final_pixmap();
236 QWidget::enterEvent(
event);
249 QWidget::leaveEvent(
event);
263 QWidget::contextMenuEvent(
event);
312 gui()->game_tab_widget->setCurrentIndex(0);
321 int delta =
event->angleDelta().y();
325 }
else if (delta > 90 &&
wheel_up) {
338 if (!
timer->isActive()) {
344 if (
timer->isActive()) {
359 struct player *obs_player;
362 act = qobject_cast<QAction *>(sender());
365 if (!qvar.isValid()) {
369 if (act->property(
"scimenu").toBool()) {
374 if (qvar.toInt() == -1) {
379 obs_player =
reinterpret_cast<struct
player *
>(qvar.value<
void *>());
380 if (obs_player !=
nullptr) {
384 s = QString(
"/observe \"%1\"").arg(obs_player->
name);
385 cn_bytes = s.toUtf8();
399 bool current =
false;
405 i =
gui()->gimme_index_of(
page);
406 if (i ==
gui()->game_tab_widget->currentIndex()) {
418 pen.setColor(QColor(232, 255, 0));
430 modulo =
width() % 10;
437 p.drawPixmap(
pos, 5,
sprite->
pm->scaled(w, h), 0, 0, w, h);
446 p.drawPixmap(
pos, 5,
sprite->
pm->scaled(w, h), 0, 0, w, h);
453 for (; d < 10 ; ++d) {
454 p.drawPixmap(
pos, 5,
sprite->
pm->scaled(w, h), 0, 0, w, h);
478 p.setPen(palette().
color(QPalette::Text));
481 p.drawText(0, 0,
width(),
height(), Qt::AlignLeft | Qt::TextWordWrap,
486 p.setPen(palette().
color(QPalette::Highlight));
491 p.setCompositionMode(QPainter::CompositionMode_ColorDodge);
492 p.setPen(palette().
color(QPalette::Highlight));
493 p.setBrush(palette().
color(QPalette::AlternateBase));
498 p.setCompositionMode(QPainter::CompositionMode_Darken);
499 p.setPen(QColor(0, 0, 0));
500 p.setBrush(QColor(0, 0, 50, 95));
505 p.setCompositionMode(QPainter::CompositionMode_ColorDodge);
506 p.setPen(QColor(0, 0, 0));
507 p.setBrush(palette().
color(QPalette::HighlightedText));
520 setAttribute(Qt::WA_OpaquePaintEvent,
true);
522 layout->setContentsMargins(0, 0, 0, 0);
524 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored);
561 painter->setBrush(QBrush(QColor(40, 40, 40)));
562 painter->drawRect(
event->rect());
572 int w, h, non_std, non_std_count, screen_hres;
575 screen_hres = QApplication::primaryScreen()->availableGeometry().width();
576 w = (100 * screen_hres) / 1920;
590 sw->setFixedSize(w, sw->
get_pixmap()->height());
592 non_std = non_std + sw->
get_pixmap()->height();
598 h = h / (
objects.count() - non_std_count) - 2;
603 sw->setFixedSize(w, h);
626 gui()->game_tab_widget->setCurrentIndex(0);
652 gui()->game_tab_widget->setCurrentIndex(0);
664 gui()->sw_endturn->setToolTip(
_(
"Fixed length turns"));
669 _(
"Turn Done"),
_(
"Shift+Return"));
670 gui()->sw_endturn->setToolTip(buf);
683 gui()->sw_endturn->disabled = !do_restore;
684 gui()->sw_endturn->update_final_pixmap();
695 gui()->sw_endturn->blink = !do_restore;
696 gui()->sw_endturn->update_final_pixmap();
708 menu->popup(QCursor::pos());
719 QMenu *menu =
new QMenu(
gui()->central_wdg);
727 erwischt = QString(
_(
"Observe %1")).arg(pplayer->name);
728 erwischt = erwischt +
" ("
730 eiskalt =
new QAction(erwischt,
gui()->mapview_wdg);
731 eiskalt->setData(QVariant::fromValue((
void *)pplayer));
732 QObject::connect(eiskalt, &QAction::triggered,
gui()->sw_diplo,
734 menu->addAction(eiskalt);
738 eiskalt =
new QAction(
_(
"Observe globally"),
gui()->mapview_wdg);
739 eiskalt->setData(-1);
740 menu->addAction(eiskalt);
741 QObject::connect(eiskalt, &QAction::triggered,
gui()->sw_diplo,
745 menu->setAttribute(Qt::WA_DeleteOnClose);
746 menu->popup(QCursor::pos());
749 i =
gui()->gimme_index_of(
"DDI");
753 gui()->game_tab_widget->setCurrentIndex(i);
765 QList<qlist_item> curr_list;
777 curr_list.append(
item);
780 if (curr_list.isEmpty()) {
784 menu =
new QMenu(
gui()->central_wdg);
785 for (
int i = 0; i < curr_list.count(); i++) {
789 qvar = curr_list.at(i).id;
794 act =
new QAction(ic, curr_list.at(i).tech_str,
gui()->mapview_wdg);
796 act->setProperty(
"scimenu",
true);
797 menu->addAction(act);
798 QObject::connect(act, &QAction::triggered,
gui()->sw_science,
801 menu->setAttribute(Qt::WA_DeleteOnClose);
802 menu->popup(QCursor::pos());
818 if (!
gui()->is_repo_dlg_open(
"SCI")) {
822 i =
gui()->gimme_index_of(
"SCI");
823 w =
gui()->game_tab_widget->widget(i);
824 if (w->isVisible()) {
825 gui()->game_tab_widget->setCurrentIndex(0);
829 gui()->game_tab_widget->setCurrentWidget(sci_rep);
static QFont * get_font(enum client_font font)
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite int int int width
int send_chat(const char *message)
static fc_font * instance()
bool client_is_global_observer(void)
bool client_is_observer(void)
struct sprite * client_warming_sprite(void)
struct sprite * client_cooling_sprite(void)
struct sprite * client_research_sprite(void)
struct sprite * client_government_sprite(void)
void request_center_focus_unit(void)
void popup_rates_dialog(void)
static enum client_pages current_page
const char *const notify_label
const char * nation_plural_translation(const struct nation_type *pnation)
const struct option_set * server_optset
bool option_bool_get(const struct option *poption)
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
int dsend_packet_player_research(struct connection *pc, int tech)
#define players_iterate_end
#define players_iterate(_pplayer)
bool comp_less_than(const qlist_item &q1, const qlist_item &q2)
struct research * research_get(const struct player *pplayer)
struct player_economic economic
struct research::research_invention inventions[A_ARRAY_SIZE]
int fc_snprintf(char *str, size_t n, const char *format,...)
struct advance * advance_by_number(const Tech_type_id atype)
const char * advance_name_translation(const struct advance *padvance)
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
struct sprite * get_tax_sprite(const struct tileset *t, Output_type_id otype)
struct sprite * get_tech_sprite(const struct tileset *t, Tech_type_id tech)