19#include <QApplication>
25#include <QResizeEvent>
28#include <QSocketNotifier>
30#include <QStackedLayout>
31#include <QStandardPaths>
33#include <QStyleFactory>
74 QTextCodec::setCodecForLocale(QTextCodec::codecForName(
"UTF-8"));
202 path = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
203 if (!path.isEmpty()) {
204 QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, path);
240 QPixmapCache::setCacheLimit(80000);
431 gui()->showFullScreen();
472 if (
event->type() == QEvent::User) {
478 return QMainWindow::event(
event);
531 if (
qapp !=
nullptr) {
609 log_error(
"Failed to find place for new tab widget");
658 QSettings s(QSettings::IniFormat, QSettings::UserScope,
661 if (s.contains(
"Chat-fx-size")) {
666 if (s.contains(
"Chat-fy-size")) {
671 if (s.contains(
"Chat-fx-pos")) {
676 if (s.contains(
"Chat-fy-pos")) {
681 if (s.contains(
"unit_fx")) {
686 if (s.contains(
"unit_fy")) {
691 if (s.contains(
"minimap_x")) {
696 if (s.contains(
"minimap_y")) {
701 if (s.contains(
"minimap_width")) {
706 if (s.contains(
"minimap_height")) {
711 if (s.contains(
"battlelog_scale")) {
717 if (s.contains(
"City-dialog")) {
720 if (s.contains(
"splitter1")) {
723 if (s.contains(
"splitter2")) {
726 if (s.contains(
"splitter3")) {
729 if (s.contains(
"help-dialog")) {
732 if (s.contains(
"help_splitter1")) {
735 if (s.contains(
"opt-client-dialog")) {
738 if (s.contains(
"opt-server-dialog")) {
741 if (s.contains(
"new_turn_text")) {
746 if (s.contains(
"show_battle_log")) {
751 if (s.contains(
"battlelog_x")) {
756 if (s.contains(
"minimap_y")) {
801 QSettings s(QSettings::IniFormat, QSettings::UserScope,
906 c =
new QCursor(*pix, hot_x, hot_y);
922 if (
f->pointSize() > 0) {
930 qpb->setFixedSize(h, h);
934 qpb->setFixedSize(h, h);
938 qpb->setFixedSize(h, h);
957 if (!
mw->isMaximized()) {
1030 +
id +
".png").toUtf8();
1035 if (icon.isNull()) {
1056 if (QPixmapCache::find(
id, pm)) {
1061 +
id +
".png").toUtf8();
1070 QPixmapCache::insert(
id, *pm);
1098 size =
event->size();
1103 *
gui()->qt_settings.chat_fwidth)),
1105 *
gui()->qt_settings.chat_fheight)));
1107 *
gui()->qt_settings.chat_fx_pos)),
1109 *
gui()->qt_settings.chat_fy_pos)));
1117 qRound(
gui()->qt_settings.minimap_height
1130 event->setAccepted(
true);
1141 if (
gui()->is_closing()) {
1179 nation =
new QPushButton(
this);
1187 connect(
nation, &QPushButton::clicked,
1190 SLOT(popup_client_options()));
1194 static_cast<ai_level
>(
level));
1207 but =
new QPushButton;
1208 but->setText(
_(
"More Game Options"));
1210 QObject::connect(
but, &QAbstractButton::clicked,
this,
1213 layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
1240 if (!
strcmp(
"default", rulesets[
i])) {
1271 if (pplayer !=
nullptr) {
1272 if (pplayer->
nation !=
nullptr) {
1275 .replace(
"&",
"&&"));
1319 enum ai_level k =
static_cast<ai_level
>(v.toInt());
1335 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()
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 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)
bool is_settable_ai_level(enum ai_level level)
int player_number(const struct player *pplayer)
#define ai_level_cmd(_level_)
void qtg_real_science_report_dialog_update(void *unused)
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
void client_start_server_and_set_page(enum client_pages page)
void set_client_page(enum client_pages page)