19#include <QApplication>
25#include <QResizeEvent>
28#include <QSocketNotifier>
30#include <QStackedLayout>
31#include <QStandardPaths>
33#include <QStyleFactory>
75 QTextCodec::setCodecForLocale(QTextCodec::codecForName(
"UTF-8"));
200 path = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
201 if (!path.isEmpty()) {
202 QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, path);
238 QPixmapCache::setCacheLimit(80000);
429 gui()->showFullScreen();
470 if (
event->type() == QEvent::User) {
476 return QMainWindow::event(
event);
529 if (
qapp !=
nullptr) {
607 log_error(
"Failed to find place for new tab widget");
656 QSettings s(QSettings::IniFormat, QSettings::UserScope,
659 if (s.contains(
"Chat-fx-size")) {
664 if (s.contains(
"Chat-fy-size")) {
669 if (s.contains(
"Chat-fx-pos")) {
674 if (s.contains(
"Chat-fy-pos")) {
679 if (s.contains(
"unit_fx")) {
684 if (s.contains(
"unit_fy")) {
689 if (s.contains(
"minimap_x")) {
694 if (s.contains(
"minimap_y")) {
699 if (s.contains(
"minimap_width")) {
704 if (s.contains(
"minimap_height")) {
709 if (s.contains(
"battlelog_scale")) {
715 if (s.contains(
"City-dialog")) {
718 if (s.contains(
"splitter1")) {
721 if (s.contains(
"splitter2")) {
724 if (s.contains(
"splitter3")) {
727 if (s.contains(
"help-dialog")) {
730 if (s.contains(
"help_splitter1")) {
733 if (s.contains(
"opt-client-dialog")) {
736 if (s.contains(
"opt-server-dialog")) {
739 if (s.contains(
"new_turn_text")) {
744 if (s.contains(
"show_battle_log")) {
749 if (s.contains(
"battlelog_x")) {
754 if (s.contains(
"minimap_y")) {
799 QSettings s(QSettings::IniFormat, QSettings::UserScope,
904 c =
new QCursor(*pix, hot_x, hot_y);
920 if (
f->pointSize() > 0) {
928 qpb->setFixedSize(h, h);
932 qpb->setFixedSize(h, h);
936 qpb->setFixedSize(h, h);
955 if (!
mw->isMaximized()) {
1028 +
id +
".png").toUtf8();
1033 if (icon.isNull()) {
1054 if (QPixmapCache::find(
id, pm)) {
1059 +
id +
".png").toUtf8();
1068 QPixmapCache::insert(
id, *pm);
1096 size =
event->size();
1101 *
gui()->qt_settings.chat_fwidth)),
1103 *
gui()->qt_settings.chat_fheight)));
1105 *
gui()->qt_settings.chat_fx_pos)),
1107 *
gui()->qt_settings.chat_fy_pos)));
1115 qRound(
gui()->qt_settings.minimap_height
1128 event->setAccepted(
true);
1139 if (
gui()->is_closing()) {
1177 nation =
new QPushButton(
this);
1185 connect(
nation, &QPushButton::clicked,
1188 SLOT(popup_client_options()));
1192 static_cast<ai_level
>(
level));
1205 but =
new QPushButton;
1206 but->setText(
_(
"More Game Options"));
1208 QObject::connect(
but, &QAbstractButton::clicked,
this,
1211 layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
1238 if (!
strcmp(
"default", rulesets[
i])) {
1269 if (pplayer !=
nullptr) {
1270 if (pplayer->
nation !=
nullptr) {
1317 enum ai_level k =
static_cast<ai_level
>(v.toInt());
1333 if (!
cruleset->currentText().isEmpty()) {
static QFont * get_font(enum client_font font)
struct canvas int int struct sprite int int int width
QString apply_tags(QString str, const struct text_tag_list *tags, QColor bg_color)
int send_chat_printf(const char *format,...)
int send_chat(const char *message)
void fc_allocate_ow_mutex(void)
void fc_release_ow_mutex(void)
void chat_welcome_message(bool gui_has_copying_mitem)
void send_chat_message(const QString &message)
fc_game_tab_widget * game_tab_widget
void chat_message_received(const QString &message, const struct text_tag_list *tags)
info_tile * info_tile_wdg
QStringList status_bar_queue
QSocketNotifier * server_notifier
QLineEdit * connect_host_edit
QTextEdit * output_window
void update_sidebar_tooltips()
hud_battle_log * battlelog_wdg
QTableWidget * lan_widget
QWidget * connect_metaserver
QLineEdit * connect_confirm_password_edit
choice_dialog * opened_dialog
QTableWidget * saves_load
void set_status_bar(QString str, int timeout=2000)
bool is_repo_dlg_open(QString str)
void server_input(int sock)
enum client_pages current_page()
QLineEdit * connect_password_edit
minimap_view * minimapview_wdg
QTableWidget * wan_widget
void gimme_place(QWidget *widget, QString str)
QCursor * fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]
void delete_cursors(void)
QStackedLayout * central_layout
QWidget * pages[(int) PAGE_GAME+2]
void slot_pregame_observe()
QTableWidget * info_widget
void set_connection_state(enum connection_state state)
QLabel * status_bar_label
QGridLayout * pages_layout[PAGE_GAME+2]
QLineEdit * connect_login_edit
void add_server_source(int)
QTextEdit * scenarios_view
QDialogButtonBox * button_box
void destroy_server_scans(void)
void create_cursors(void)
void create_network_page()
QTreeWidget * start_players_tree
bool chat_active_on_page(enum client_pages)
QLineEdit * connect_port_edit
bool event(QEvent *event)
void create_loading_page()
void update_network_lists()
void fc_main(QApplication *qapp)
QMap< QString, QWidget * > opened_repo_dlgs
void closeEvent(QCloseEvent *event)
void remove_repo_dlg(QString str)
void slot_pregame_start()
QTimer * update_info_timer
void toggle_unit_sel_widget(struct tile *ptile)
void popup_client_options()
void update_load_page(void)
QTableWidget * scenarios_load
int gimme_index_of(QString str)
void send_fake_chat_message(const QString &message)
void timerEvent(QTimerEvent *)
void create_scenario_page()
void remove_server_source()
void update_scenarios_page(void)
fc_corner(QMainWindow *qmw)
static fc_font * m_instance
static fc_font * instance()
QFont * get_font(QString name)
QIcon get_icon(const QString &id)
static fc_icons * m_instance
QPixmap * get_pixmap(const QString &id)
static fc_icons * instance()
QString get_path(const QString &id)
static fc_shortcuts * sc()
void update_actions(unit_list *punits)
void popup_server_options()
void ailevel_change(int i)
void set_rulesets(int num_rulesets, char **rulesets)
void set_aifill(int aifill)
void max_players_change(int i)
pregame_options(QWidget *parent)
void ruleset_change(int i)
bool is_client_quitting(void)
bool can_client_control(void)
bool client_is_global_observer(void)
bool client_is_observer(void)
double real_timer_callback(void)
enum client_states client_state(void)
void set_client_state(enum client_states newstate)
enum ai_level server_ai_level(void)
void center_on_something(void)
void disconnect_from_server(bool leaving_sound)
void input_from_server(int fd)
void set_ruleset(const char *ruleset)
bool is_server_running(void)
bool get_turn_done_button_state()
void real_science_report_dialog_update(void *)
static PangoLayout * layout
void real_output_window_append(const char *astring, const struct text_tag_list *tags, int conn_id)
void popup_races_dialog(struct player *pplayer)
void popup_quit_dialog(void)
void overview_size_changed(void)
void option_dialog_popup(const char *name, const struct option_set *poptset)
static enum client_pages current_page
void real_science_report_dialog_update(void *unused)
void voteinfo_gui_update(void)
static QApplication * qapp
QApplication * current_app()
#define log_error(message,...)
void side_disable_endturn(bool do_restore)
void init_mapcanvas_and_overview(void)
void free_mapcanvas_and_overview(void)
bool map_canvas_resized(int width, int height)
const char *const default_font
const char * nation_adjective_for_player(const struct player *pplayer)
const struct option_set * server_optset
const struct option_set * client_optset
struct client_options gui_options
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
bool option_int_set(struct option *poption, int val)
#define MAJOR_NEW_OPTION_FILE_NAME
#define MINOR_NEW_OPTION_FILE_NAME
int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
void client_start_server_and_set_page(enum client_pages page)
void set_client_page(enum client_pages page)
bool is_settable_ai_level(enum ai_level level)
int player_number(const struct player *pplayer)
#define ai_level_cmd(_level_)
struct setting_list * level[OLEVELS_NUM]
const char * fileinfoname(const struct strvec *dirs, const char *filename)
const struct strvec * get_data_dirs(void)
const char * aifill(int amount)
struct packet_game_info info
bool gui_qt_allied_chat_only
bool gui_qt_show_titlebar
QByteArray city_splitter2
QByteArray options_client_geometry
QByteArray help_splitter1
QByteArray city_splitter3
QByteArray options_server_geometry
QByteArray city_splitter1
struct nation_type * nation
int fc_snprintf(char *str, size_t n, const char *format,...)
void tileset_free_tiles(struct tileset *t)
struct sprite * get_nation_shield_sprite(const struct tileset *t, const struct nation_type *pnation)
struct sprite * get_cursor_sprite(const struct tileset *t, enum cursor_type cursor, int *hot_x, int *hot_y, int frame)
#define NUM_CURSOR_FRAMES