Freeciv-3.1
Loading...
Searching...
No Matches
Macros | Functions | Variables
gui_main.cpp File Reference
#include <stdio.h>
#include <QApplication>
#include <QLibraryInfo>
#include <QMessageBox>
#include <QScrollBar>
#include <QStyleFactory>
#include "fc_cmdline.h"
#include "fciconv.h"
#include "log.h"
#include "client_main.h"
#include "editgui_g.h"
#include "options.h"
#include "sprite.h"
#include "themes_common.h"
#include "tilespec.h"
#include "fc_client.h"
#include "fonts.h"
#include "gui_main.h"
#include "helpdlg.h"
#include "hudwidget.h"
#include "qtg_cxxside.h"

Go to the source code of this file.

Macros

#define option_var_set_callback(var, callback)
 

Functions

void real_science_report_dialog_update (void *)
 
void restart_notify_dialogs ()
 
void city_font_update ()
 
void reset_unit_table (void)
 
static void apply_font (struct option *poption)
 
static void apply_help_font (struct option *poption)
 
static void apply_notify_font (struct option *poption)
 
static void apply_sidebar (struct option *poption)
 
static void apply_titlebar (struct option *poption)
 
static void apply_fullscreen (struct option *poption)
 
class fc_clientgui ()
 
void qtg_ui_init ()
 
int main (int argc, char **argv)
 
static void print_usage ()
 
static bool parse_options (int argc, char **argv)
 
static void migrate_options_from_2_5 ()
 
int qtg_ui_main (int argc, char *argv[])
 
QApplication * current_app ()
 
void qtg_options_extra_init ()
 
void qtg_ui_exit ()
 
void qtg_real_conn_list_dialog_update (void *unused)
 
void qtg_sound_bell ()
 
void qtg_add_net_input (int sock)
 
void qtg_remove_net_input ()
 
void qtg_set_unit_icon (int idx, struct unit *punit)
 
void qtg_set_unit_icons_more_arrow (bool onoff)
 
void qtg_real_focus_units_changed (void)
 
void qtg_add_idle_callback (void(callback)(void *), void *data)
 
void qtg_editgui_tileset_changed ()
 
void qtg_editgui_refresh ()
 
void qtg_editgui_popup_properties (const struct tile_list *tiles, int objtype)
 
void qtg_editgui_popdown_all ()
 
void qtg_editgui_notify_object_changed (int objtype, int object_id, bool removal)
 
void qtg_editgui_notify_object_created (int tag, int id)
 
void qtg_gui_update_font (const char *font_name, const char *font_value)
 
enum gui_type qtg_get_gui_type ()
 
void popup_quit_dialog ()
 
void qtg_insert_client_build_info (char *outbuf, size_t outlen)
 

Variables

const bool gui_use_transliteration = false
 
const char *const gui_character_encoding = "UTF-8"
 
const char * client_string = "gui-qt"
 
static fc_clientfreeciv_qt
 
static QApplication * qapp = nullptr
 

Macro Definition Documentation

◆ option_var_set_callback

#define option_var_set_callback (   var,
  callback 
)
Value:
if ((poption = optset_option_by_name(client_optset, #var))) { \
option_set_changed_callback(poption, callback); \
} else { \
log_error("Didn't find option %s!", #var); \
}
const struct option_set * client_optset
Definition options.c:1255
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:406

Function Documentation

◆ apply_font()

static void apply_font ( struct option poption)
static

Change the given font.

Definition at line 412 of file gui_main.cpp.

Referenced by qtg_options_extra_init().

◆ apply_fullscreen()

static void apply_fullscreen ( struct option poption)
static

Applies fullscreen changes

Definition at line 477 of file gui_main.cpp.

Referenced by qtg_options_extra_init().

◆ apply_help_font()

static void apply_help_font ( struct option poption)
static

Applies help font

Definition at line 441 of file gui_main.cpp.

Referenced by apply_font(), and qtg_options_extra_init().

◆ apply_notify_font()

static void apply_notify_font ( struct option poption)
static

Applies help font

Definition at line 462 of file gui_main.cpp.

Referenced by qtg_options_extra_init().

◆ apply_sidebar()

void apply_sidebar ( struct option poption)
static

Change sidebar position

Definition at line 404 of file gui_main.cpp.

Referenced by qtg_options_extra_init().

◆ apply_titlebar()

void apply_titlebar ( struct option poption)
static

Shows/Hides titlebar

Definition at line 375 of file gui_main.cpp.

Referenced by qtg_options_extra_init().

◆ city_font_update()

void city_font_update ( )
extern

Updates city font

Definition at line 3783 of file citydlg.cpp.

Referenced by apply_notify_font().

◆ current_app()

QApplication * current_app ( )

◆ gui()

class fc_client * gui ( )

◆ main()

int main ( int  argc,
char **  argv 
)

Entry point for whole freeciv client program.

Definition at line 97 of file gui_main.cpp.

◆ migrate_options_from_2_5()

static void migrate_options_from_2_5 ( void  )
static

Migrate Qt client specific options from freeciv-2.5 options

Definition at line 156 of file gui_main.cpp.

Referenced by qtg_ui_main().

◆ parse_options()

static bool parse_options ( int  argc,
char **  argv 
)
static

Search for gui-specific command line options, that are not handled by Qt (QApplication). Returns true iff program is to be executed, and not to exit after showing the results from option parsing.

Definition at line 133 of file gui_main.cpp.

Referenced by qtg_ui_main().

◆ popup_quit_dialog()

void popup_quit_dialog ( void  )

Open dialog to confirm that user wants to quit client.

Definition at line 556 of file gui_main.cpp.

◆ print_usage()

static void print_usage ( void  )
static

Print extra usage information, including one line help on each option, to stderr.

Definition at line 108 of file gui_main.cpp.

Referenced by parse_options().

◆ qtg_add_idle_callback()

void qtg_add_idle_callback ( void(callback)(void *)  ,
void *  data 
)

Enqueue a callback to be called during an idle moment. The 'callback' function should be called sometimes soon, and passed the 'data' pointer as its data.

Definition at line 363 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_add_net_input()

void qtg_add_net_input ( int  sock)

Wait for data on the given socket. Call input_from_server() when data is ready to be read.

This function is called after the client has successfully connected to the server.

Definition at line 299 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_editgui_notify_object_changed()

void qtg_editgui_notify_object_changed ( int  objtype,
int  object_id,
bool  removal 
)

Stub for editor function

Definition at line 509 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_editgui_notify_object_created()

void qtg_editgui_notify_object_created ( int  tag,
int  id 
)

Stub for editor function

Definition at line 516 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_editgui_popdown_all()

void qtg_editgui_popdown_all ( )

Stub for editor function

Definition at line 503 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_editgui_popup_properties()

void qtg_editgui_popup_properties ( const struct tile_list *  tiles,
int  objtype 
)

Stub for editor function

Definition at line 497 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_editgui_refresh()

void qtg_editgui_refresh ( )

Stub for editor function

Definition at line 491 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_editgui_tileset_changed()

void qtg_editgui_tileset_changed ( )

Stub for editor function

Definition at line 485 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_get_gui_type()

enum gui_type qtg_get_gui_type ( )

Returns gui type of the client

Definition at line 540 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_gui_update_font()

void qtg_gui_update_font ( const char *  font_name,
const char *  font_value 
)

Updates a gui font style.

Definition at line 522 of file gui_main.cpp.

Referenced by apply_notify_font(), and setup_gui_funcs().

◆ qtg_insert_client_build_info()

void qtg_insert_client_build_info ( char *  outbuf,
size_t  outlen 
)

Insert build information to help

Definition at line 578 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_options_extra_init()

void qtg_options_extra_init ( )

Extra initializers for client options.

Definition at line 228 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_real_conn_list_dialog_update()

void qtg_real_conn_list_dialog_update ( void *  unused)

Update the connected users list at pregame state.

Definition at line 274 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_real_focus_units_changed()

void qtg_real_focus_units_changed ( void  )

Called when the set of units in focus (get_units_in_focus()) changes. Standard updates like update_unit_info_label() are handled in the platform- independent code, so some clients will not need to do anything here.

Definition at line 347 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_remove_net_input()

void qtg_remove_net_input ( )

Stop waiting for any server network data. See add_net_input().

This function is called if the client disconnects from the server.

Definition at line 309 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_set_unit_icon()

void qtg_set_unit_icon ( int  idx,
struct unit punit 
)

Set one of the unit icons (specified by idx) in the information area based on punit.

punit is the unit the information should be taken from. Use NULL to clear the icon.

idx specified which icon should be modified. Use idx == -1 to indicate the icon for the active unit. Or idx in [0..num_units_below-1] for secondary (inactive) units on the same tile.

Definition at line 325 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_set_unit_icons_more_arrow()

void qtg_set_unit_icons_more_arrow ( bool  onoff)

Most clients use an arrow (e.g., sprites.right_arrow) to indicate when the units_below will not fit. This function is called to activate or deactivate the arrow.

Is disabled by default.

Definition at line 337 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_sound_bell()

void qtg_sound_bell ( )

Make a bell noise (beep). This provides low-level sound alerts even if there is no real sound support.

Definition at line 286 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_ui_exit()

void qtg_ui_exit ( )

Do any necessary UI-specific cleanup

Definition at line 264 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_ui_init()

void qtg_ui_init ( )

Do any necessary pre-initialization of the UI, if necessary.

Definition at line 91 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ qtg_ui_main()

int qtg_ui_main ( int  argc,
char *  argv[] 
)

The main loop for the UI. This is called from main(), and when it exits the client will exit.

Definition at line 169 of file gui_main.cpp.

Referenced by setup_gui_funcs().

◆ real_science_report_dialog_update()

void real_science_report_dialog_update ( void *  unused)

Update the science report dialog.

Update the science report.

Definition at line 751 of file repodlgs.c.

Referenced by apply_font(), change_research_goal_callback(), science_dialog_callback(), science_report_dialog_popup(), science_report_dialog_update(), and fc_client::switch_page().

◆ reset_unit_table()

void reset_unit_table ( void  )

Called when the tileset is changed to reset the unit pixmap table.

Definition at line 548 of file gui_main.cpp.

◆ restart_notify_dialogs()

void restart_notify_dialogs ( )
extern

Restarts all notify dialogs

Definition at line 3942 of file dialogs.cpp.

Referenced by apply_notify_font().

Variable Documentation

◆ client_string

const char* client_string = "gui-qt"

Definition at line 68 of file gui_main.cpp.

◆ freeciv_qt

fc_client* freeciv_qt
static

Definition at line 69 of file gui_main.cpp.

Referenced by gui(), qtg_ui_exit(), and qtg_ui_main().

◆ gui_character_encoding

const char* const gui_character_encoding = "UTF-8"

Definition at line 67 of file gui_main.cpp.

◆ gui_use_transliteration

const bool gui_use_transliteration = false

Definition at line 66 of file gui_main.cpp.

◆ qapp

QApplication* qapp = nullptr
static