Freeciv21
Develop your civilization from humble roots to a global empire
fc_client Class Reference

#include <fc_client.h>

+ Inheritance diagram for fc_client:
+ Collaboration diagram for fc_client:

Public Slots

void slot_disconnect ()
 Disconnect from server and return to MAIN PAGE. More...
 
void start_tutorial ()
 start tutorial More...
 
void start_from_file (const QString &file)
 start from save file More...
 
void start_new_game ()
 spawn a server, if there isn't one, using the default settings. More...
 
void switch_page (int i)
 Switch from one client page to another. More...
 
void load_modpack ()
 Load the modpack-installer from the start menu. More...
 

Signals

void keyCaught (QKeyEvent *e)
 

Public Member Functions

 fc_client ()
 Constructor. More...
 
 ~fc_client () override
 Destructor. More...
 
void fc_main (QApplication *)
 This is not called simply 'fc_client::main()', since SDL includes ould sometimes cause 'main' to be considered an macro that expands to 'SDL_main'. More...
 
void add_server_source (QIODevice *socket)
 Add notifier for server input. More...
 
enum client_pages current_page ()
 Returns currently open page. More...
 
void set_status_bar (const QString &str, int timeout=20000)
 Sets application status bar for given time in miliseconds. More...
 
void set_diplo_dialog (choice_dialog *widget)
 Set current diplo dialog. More...
 
choice_dialogget_diplo_dialog ()
 Get current diplo dialog. More...
 
void write_settings ()
 Save qt-specific options. More...
 
bool is_closing ()
 Returns status if fc_client is being closed. More...
 

Public Attributes

QWidget * pages [static_cast< int >(PAGE_GAME)+2]
 
QCursor * fc_cursors [CURSOR_LAST][NUM_CURSOR_FRAMES]
 
QWidget * central_wdg {nullptr}
 
bool interface_locked {false}
 
fc_cornercorner_wid
 
fc_settings qt_settings
 
mr_menumenu_bar {nullptr}
 
qfc_rally_list rallies
 
trade_generator trade_gen
 

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *event) override
 Used to keep track of the size and location of the chat widget. More...
 
void timerEvent (QTimerEvent *) override
 Timer event handling. More...
 
void closeEvent (QCloseEvent *event) override
 Closes main window. More...
 

Private Slots

void server_input ()
 There is input from server. More...
 
void closing ()
 Called when fc_client is going to quit. More...
 
void clear_status_bar ()
 Clears status bar or shows next message in queue if exists. More...
 

Private Member Functions

void create_loading_page ()
 Creates page LOADING, showing label with Loading text. More...
 
void create_cursors ()
 Setup cursors. More...
 
void delete_cursors ()
 Deletes cursors. More...
 
void read_settings ()
 Loads qt-specific options. More...
 

Private Attributes

enum client_pages page
 
QGridLayout * pages_layout [PAGE_COUNT]
 
QLabel * status_bar_label {nullptr}
 
QSocketNotifier * server_notifier {nullptr}
 
QStackedLayout * central_layout {nullptr}
 
QStatusBar * status_bar {nullptr}
 
QString current_file
 
QStringList status_bar_queue
 
bool quitting {false}
 
bool send_new_aifill_to_server
 
choice_dialogopened_dialog {nullptr}
 

Detailed Description

Definition at line 93 of file fc_client.h.

Constructor & Destructor Documentation

◆ fc_client()

fc_client::fc_client ( )

Constructor.

Definition at line 58 of file fc_client.cpp.

Referenced by ui_main().

◆ ~fc_client()

fc_client::~fc_client ( )
override

Destructor.

Definition at line 130 of file fc_client.cpp.

Member Function Documentation

◆ add_server_source()

void fc_client::add_server_source ( QIODevice *  socket)

Add notifier for server input.

Definition at line 279 of file fc_client.cpp.

Referenced by add_net_input().

◆ clear_status_bar

void fc_client::clear_status_bar ( )
privateslot

Clears status bar or shows next message in queue if exists.

Definition at line 622 of file fc_client.cpp.

Referenced by set_status_bar().

◆ closeEvent()

void fc_client::closeEvent ( QCloseEvent *  event)
overrideprotected

Closes main window.

Definition at line 291 of file fc_client.cpp.

◆ closing

void fc_client::closing ( )
privateslot

Called when fc_client is going to quit.

Definition at line 172 of file fc_client.cpp.

Referenced by fc_main().

◆ create_cursors()

void fc_client::create_cursors ( )
private

Setup cursors.

Definition at line 554 of file fc_client.cpp.

Referenced by fc_client().

◆ create_loading_page()

void fc_client::create_loading_page ( )
private

Creates page LOADING, showing label with Loading text.

Definition at line 638 of file fc_client.cpp.

Referenced by fc_client().

◆ current_page()

enum client_pages fc_client::current_page ( )

Returns currently open page.

Definition at line 180 of file fc_client.cpp.

◆ delete_cursors()

void fc_client::delete_cursors ( )
private

Deletes cursors.

Definition at line 334 of file fc_client.cpp.

Referenced by ~fc_client().

◆ eventFilter()

bool fc_client::eventFilter ( QObject *  obj,
QEvent *  event 
)
overrideprotected

Used to keep track of the size and location of the chat widget.

Definition at line 349 of file fc_client.cpp.

◆ fc_main()

void fc_client::fc_main ( QApplication *  qapp)

This is not called simply 'fc_client::main()', since SDL includes ould sometimes cause 'main' to be considered an macro that expands to 'SDL_main'.

Definition at line 144 of file fc_client.cpp.

Referenced by ui_main().

◆ get_diplo_dialog()

◆ is_closing()

bool fc_client::is_closing ( )

Returns status if fc_client is being closed.

Definition at line 167 of file fc_client.cpp.

◆ keyCaught

void fc_client::keyCaught ( QKeyEvent *  e)
signal

◆ load_modpack

void fc_client::load_modpack ( )
slot

Load the modpack-installer from the start menu.

Definition at line 695 of file fc_client.cpp.

Referenced by mr_menu::add_modpacks(), and page_main::page_main().

◆ read_settings()

void fc_client::read_settings ( )
private

Loads qt-specific options.

Definition at line 372 of file fc_client.cpp.

Referenced by fc_client().

◆ server_input

void fc_client::server_input ( )
privateslot

There is input from server.

Definition at line 300 of file fc_client.cpp.

Referenced by add_server_source().

◆ set_diplo_dialog()

void fc_client::set_diplo_dialog ( choice_dialog widget)

Set current diplo dialog.

Definition at line 3804 of file dialogs.cpp.

Referenced by choice_dialog::choice_dialog(), and choice_dialog::~choice_dialog().

◆ set_status_bar()

void fc_client::set_status_bar ( const QString &  str,
int  timeout = 20000 
)

Sets application status bar for given time in miliseconds.

Definition at line 606 of file fc_client.cpp.

Referenced by fc_client(), page_network::handle_authentication_req(), real_output_window_append(), page_network::set_connection_state(), page_network::slot_connect(), and version_message().

◆ slot_disconnect

void fc_client::slot_disconnect ( )
slot

Disconnect from server and return to MAIN PAGE.

Definition at line 323 of file fc_client.cpp.

Referenced by page_load::page_load(), page_pregame::page_pregame(), and page_scenario::page_scenario().

◆ start_from_file

void fc_client::start_from_file ( const QString &  file)
slot

start from save file

Definition at line 669 of file fc_client.cpp.

Referenced by page_load::start_from_save(), and page_scenario::start_scenario().

◆ start_new_game

void fc_client::start_new_game ( )
slot

spawn a server, if there isn't one, using the default settings.

Definition at line 685 of file fc_client.cpp.

Referenced by page_main::page_main().

◆ start_tutorial

void fc_client::start_tutorial ( )
slot

start tutorial

Definition at line 649 of file fc_client.cpp.

Referenced by page_main::page_main().

◆ switch_page

void fc_client::switch_page ( int  new_pg)
slot

Switch from one client page to another.

Argument is int cause QSignalMapper doesn't want to work with enum Because chat widget is in 2 layouts we need to switch between them here (addWidget removes it from prevoius layout automatically)

Definition at line 180 of file fc_client.cpp.

Referenced by handle_diplomacy_init_meeting(), real_set_client_page(), slot_disconnect(), and start_from_file().

◆ timerEvent()

void fc_client::timerEvent ( QTimerEvent *  event)
overrideprotected

Timer event handling.

Definition at line 310 of file fc_client.cpp.

◆ write_settings()

void fc_client::write_settings ( )

Save qt-specific options.

Definition at line 514 of file fc_client.cpp.

Referenced by popup_quit_dialog().

Member Data Documentation

◆ central_layout

QStackedLayout* fc_client::central_layout {nullptr}
private

Definition at line 100 of file fc_client.h.

Referenced by current_page(), and fc_client().

◆ central_wdg

QWidget* fc_client::central_wdg {nullptr}

Definition at line 123 of file fc_client.h.

Referenced by current_page(), and fc_client().

◆ corner_wid

fc_corner* fc_client::corner_wid

Definition at line 125 of file fc_client.h.

Referenced by apply_titlebar(), and fc_client().

◆ current_file

QString fc_client::current_file
private

Definition at line 102 of file fc_client.h.

Referenced by current_page(), and start_tutorial().

◆ fc_cursors

QCursor* fc_client::fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]

Definition at line 122 of file fc_client.h.

Referenced by create_cursors(), and delete_cursors().

◆ interface_locked

bool fc_client::interface_locked {false}

Definition at line 124 of file fc_client.h.

Referenced by mr_menu::slot_lock().

◆ menu_bar

◆ opened_dialog

choice_dialog* fc_client::opened_dialog {nullptr}
private

Definition at line 106 of file fc_client.h.

Referenced by get_diplo_dialog(), and set_diplo_dialog().

◆ page

enum client_pages fc_client::page
private

Definition at line 90 of file fc_client.h.

Referenced by current_page(), and fc_client().

◆ pages

QWidget* fc_client::pages[static_cast< int >(PAGE_GAME)+2]

Definition at line 111 of file fc_client.h.

Referenced by current_page(), eventFilter(), and fc_client().

◆ pages_layout

QGridLayout* fc_client::pages_layout[PAGE_COUNT]
private

Definition at line 97 of file fc_client.h.

Referenced by create_loading_page(), and fc_client().

◆ qt_settings

◆ quitting

bool fc_client::quitting {false}
private

Definition at line 104 of file fc_client.h.

Referenced by closing(), and is_closing().

◆ rallies

qfc_rally_list fc_client::rallies

◆ send_new_aifill_to_server

bool fc_client::send_new_aifill_to_server
private

Definition at line 105 of file fc_client.h.

◆ server_notifier

QSocketNotifier* fc_client::server_notifier {nullptr}
private

Definition at line 99 of file fc_client.h.

◆ status_bar

QStatusBar* fc_client::status_bar {nullptr}
private

Definition at line 101 of file fc_client.h.

Referenced by current_page(), and fc_client().

◆ status_bar_label

QLabel* fc_client::status_bar_label {nullptr}
private

Definition at line 98 of file fc_client.h.

Referenced by clear_status_bar(), fc_client(), and set_status_bar().

◆ status_bar_queue

QStringList fc_client::status_bar_queue
private

Definition at line 103 of file fc_client.h.

Referenced by clear_status_bar(), fc_client(), set_status_bar(), and ~fc_client().

◆ trade_gen