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

#include <citydlg.h>

+ Inheritance diagram for city_dialog:
+ Collaboration diagram for city_dialog:

Public Member Functions

 city_dialog (QWidget *parent=0)
 Constructor for city_dialog, sets layouts, policies ... More...
 
 ~city_dialog () override
 City dialog destructor. More...
 
void setup_ui (struct city *qcity)
 Setups whole city dialog, public function. More...
 
void refresh ()
 Various refresh after getting new info/reply from server. More...
 

Public Attributes

struct citypcity = nullptr
 
bool dont_focus {false}
 
bool present_units_exp = false
 

Protected Member Functions

void showEvent (QShowEvent *event) override
 Show event. More...
 
void hideEvent (QHideEvent *event) override
 Hide event. More...
 
bool eventFilter (QObject *obj, QEvent *event) override
 Event filter for catching keybaord events. More...
 

Private Slots

void next_city ()
 Changes city_dialog to next city after pushing next city button. More...
 
void prev_city ()
 Changes city_dialog to previous city after pushing prev city button. More...
 
void get_city (bool next)
 
void show_targets ()
 Shows customized table widget with available items to produce Shows default targets in overview city page. More...
 
void show_targets_worklist ()
 Shows customized table widget with available items to produce Shows customized targets in city production page. More...
 
void buy ()
 Buy button. More...
 
void dbl_click_p (QTableWidgetItem *item)
 Double clicked item in worklist table in production tab. More...
 
void item_selected (const QItemSelection &sl, const QItemSelection &ds)
 Selection changed in production tab, in worklist tab. More...
 
void clear_worklist ()
 Clears worklist in production page. More...
 
void save_worklist ()
 Save worklist. More...
 
void worklist_up ()
 Move current item on worklist up. More...
 
void worklist_down ()
 Move current item on worklist down. More...
 
void worklist_del ()
 Remove current item on worklist. More...
 
void display_worklist_menu (const QPoint)
 Context menu on production tab in city worklist. More...
 
void disband_state_changed (bool allow_disband)
 Received signal about changed qcheckbox - allow disbanding city. More...
 
void cma_remove ()
 Removes selected CMA. More...
 
void cma_enable ()
 Enables cma slot, triggered by clicked button or changed cma. More...
 
void cma_changed ()
 Sliders moved and cma has been changed. More...
 
void cma_check_agent (const cm_parameter &params)
 Triggers a governor update if the parameters changed. More...
 
void cma_selected (const QItemSelection &sl, const QItemSelection &ds)
 CMA has been selected from list. More...
 
void cma_double_clicked (int row, int column)
 Double click on some row ( column is unused ) More...
 
void cma_context_menu (const QPoint p)
 Context menu on governor tab in city worklist. More...
 
void save_cma ()
 Save cma dialog input. More...
 
void city_rename ()
 City rename dialog input. More...
 
void present_units_exp_col ()
 Slot to expand or collapse the present units list. More...
 

Private Member Functions

 Q_DISABLE_COPY (city_dialog)
 
void update_title ()
 Puts city name and people count on title. More...
 
void update_building ()
 Updates building improvement/unit. More...
 
void update_info_label ()
 Updates information label ( food, prod ... More...
 
void update_buy_button ()
 Enables/disables buy buttons depending on gold. More...
 
void fill_citizens_pixmap (QPixmap *pixmap, QPainter *painter, const citizen_category *categories, int num_citizens)
 Fill a pixmap with citizen sprites. More...
 
void update_citizens ()
 Redraws citizens for city_label (citizens_label) More...
 
void update_improvements ()
 Updates list of improvements. More...
 
void update_units ()
 Updates layouts for supported and present units in city. More...
 
void update_nation_table ()
 Updates nationality table in happiness tab. More...
 
void update_cma_tab ()
 Updates cma tab. More...
 
void update_disabled ()
 Updates buttons/widgets which should be enabled/disabled. More...
 
void update_sliders ()
 
void update_prod_buttons ()
 Update sensitivity of buttons in production tab. More...
 
void change_production (bool next)
 Changes production to next one or previous. More...
 

Private Attributes

Ui::FormCityDlg ui
 
QPixmap * citizen_pixmap
 
bool future_targets {false}
 
bool show_units {true}
 
bool show_wonders {true}
 
bool show_buildings {true}
 
int selected_row_p
 
city_labellab_table [6]
 

Detailed Description

Definition at line 282 of file citydlg.h.

Constructor & Destructor Documentation

◆ city_dialog()

city_dialog::city_dialog ( QWidget *  parent = 0)

Constructor for city_dialog, sets layouts, policies ...

Definition at line 833 of file citydlg.cpp.

◆ ~city_dialog()

city_dialog::~city_dialog ( )
override

City dialog destructor.

Definition at line 1059 of file citydlg.cpp.

Member Function Documentation

◆ buy

void city_dialog::buy ( )
privateslot

Buy button.

Shows message box asking for confirmation

Definition at line 1921 of file citydlg.cpp.

Referenced by city_dialog().

◆ change_production()

void city_dialog::change_production ( bool  next)
private

Changes production to next one or previous.

Definition at line 972 of file citydlg.cpp.

Referenced by eventFilter().

◆ city_rename

void city_dialog::city_rename ( )
privateslot

City rename dialog input.

Definition at line 1128 of file citydlg.cpp.

Referenced by city_dialog().

◆ clear_worklist

void city_dialog::clear_worklist ( )
privateslot

Clears worklist in production page.

Definition at line 2087 of file citydlg.cpp.

Referenced by display_worklist_menu().

◆ cma_changed

void city_dialog::cma_changed ( )
privateslot

Sliders moved and cma has been changed.

Definition at line 1193 of file citydlg.cpp.

Referenced by cma_check_agent(), and cma_enable().

◆ cma_check_agent

void city_dialog::cma_check_agent ( const cm_parameter params)
privateslot

Triggers a governor update if the parameters changed.

Definition at line 2197 of file citydlg.cpp.

Referenced by city_dialog().

◆ cma_context_menu

void city_dialog::cma_context_menu ( const QPoint  p)
privateslot

Context menu on governor tab in city worklist.

Definition at line 1361 of file citydlg.cpp.

Referenced by city_dialog().

◆ cma_double_clicked

void city_dialog::cma_double_clicked ( int  row,
int  column 
)
privateslot

Double click on some row ( column is unused )

Definition at line 1202 of file citydlg.cpp.

Referenced by city_dialog().

◆ cma_enable

void city_dialog::cma_enable ( )
privateslot

Enables cma slot, triggered by clicked button or changed cma.

Definition at line 1179 of file citydlg.cpp.

Referenced by city_dialog().

◆ cma_remove

void city_dialog::cma_remove ( )
privateslot

Removes selected CMA.

Definition at line 1315 of file citydlg.cpp.

Referenced by cma_context_menu().

◆ cma_selected

void city_dialog::cma_selected ( const QItemSelection &  sl,
const QItemSelection &  ds 
)
privateslot

CMA has been selected from list.

Definition at line 1221 of file citydlg.cpp.

Referenced by city_dialog().

◆ dbl_click_p

void city_dialog::dbl_click_p ( QTableWidgetItem *  item)
privateslot

Double clicked item in worklist table in production tab.

Definition at line 1753 of file citydlg.cpp.

Referenced by city_dialog(), and worklist_del().

◆ disband_state_changed

void city_dialog::disband_state_changed ( bool  allow_disband)
privateslot

Received signal about changed qcheckbox - allow disbanding city.

Definition at line 1341 of file citydlg.cpp.

Referenced by display_worklist_menu().

◆ display_worklist_menu

void city_dialog::display_worklist_menu ( const  QPoint)
privateslot

Context menu on production tab in city worklist.

Definition at line 1380 of file citydlg.cpp.

Referenced by city_dialog().

◆ eventFilter()

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

Event filter for catching keybaord events.

Definition at line 1105 of file citydlg.cpp.

◆ fill_citizens_pixmap()

void city_dialog::fill_citizens_pixmap ( QPixmap *  pixmap,
QPainter *  painter,
const citizen_category categories,
int  num_citizens 
)
private

Fill a pixmap with citizen sprites.

Definition at line 1513 of file citydlg.cpp.

Referenced by update_citizens().

◆ get_city

void city_dialog::get_city ( bool  next)
privateslot

Definition at line 1850 of file citydlg.cpp.

Referenced by next_city(), and prev_city().

◆ hideEvent()

void city_dialog::hideEvent ( QHideEvent *  event)
overrideprotected

Hide event.

Definition at line 1068 of file citydlg.cpp.

◆ item_selected

void city_dialog::item_selected ( const QItemSelection &  sl,
const QItemSelection &  ds 
)
privateslot

Selection changed in production tab, in worklist tab.

Definition at line 1834 of file citydlg.cpp.

Referenced by city_dialog().

◆ next_city

void city_dialog::next_city ( )
privateslot

Changes city_dialog to next city after pushing next city button.

Definition at line 1883 of file citydlg.cpp.

Referenced by city_dialog().

◆ present_units_exp_col

void city_dialog::present_units_exp_col ( )
privateslot

Slot to expand or collapse the present units list.

Definition at line 1812 of file citydlg.cpp.

Referenced by city_dialog().

◆ prev_city

void city_dialog::prev_city ( )
privateslot

Changes city_dialog to previous city after pushing prev city button.

Definition at line 1888 of file citydlg.cpp.

Referenced by city_dialog().

◆ Q_DISABLE_COPY()

city_dialog::Q_DISABLE_COPY ( city_dialog  )
private

◆ refresh()

void city_dialog::refresh ( )

Various refresh after getting new info/reply from server.

Definition at line 1597 of file citydlg.cpp.

Referenced by pageGame::pageGame(), real_city_dialog_refresh(), and setup_ui().

◆ save_cma

void city_dialog::save_cma ( )
privateslot

Save cma dialog input.

Definition at line 1158 of file citydlg.cpp.

Referenced by city_dialog().

◆ save_worklist

void city_dialog::save_worklist ( )
privateslot

Save worklist.

Definition at line 2166 of file citydlg.cpp.

Referenced by display_worklist_menu().

◆ setup_ui()

void city_dialog::setup_ui ( struct city qcity)

Setups whole city dialog, public function.

Definition at line 1733 of file citydlg.cpp.

Referenced by get_city().

◆ show_targets

void city_dialog::show_targets ( )
privateslot

Shows customized table widget with available items to produce Shows default targets in overview city page.

Definition at line 2060 of file citydlg.cpp.

Referenced by city_dialog().

◆ show_targets_worklist

void city_dialog::show_targets_worklist ( )
privateslot

Shows customized table widget with available items to produce Shows customized targets in city production page.

Definition at line 2074 of file citydlg.cpp.

Referenced by city_dialog().

◆ showEvent()

void city_dialog::showEvent ( QShowEvent *  event)
overrideprotected

Show event.

Definition at line 1088 of file citydlg.cpp.

◆ update_building()

void city_dialog::update_building ( )
private

Updates building improvement/unit.

Definition at line 1893 of file citydlg.cpp.

Referenced by refresh().

◆ update_buy_button()

void city_dialog::update_buy_button ( )
private

Enables/disables buy buttons depending on gold.

Definition at line 1488 of file citydlg.cpp.

Referenced by refresh().

◆ update_citizens()

void city_dialog::update_citizens ( )
private

Redraws citizens for city_label (citizens_label)

Definition at line 1537 of file citydlg.cpp.

Referenced by refresh().

◆ update_cma_tab()

void city_dialog::update_cma_tab ( )
private

Updates cma tab.

Definition at line 1256 of file citydlg.cpp.

Referenced by cma_check_agent(), cma_double_clicked(), cma_enable(), cma_remove(), cma_selected(), and refresh().

◆ update_disabled()

void city_dialog::update_disabled ( )
private

Updates buttons/widgets which should be enabled/disabled.

Definition at line 1015 of file citydlg.cpp.

Referenced by refresh().

◆ update_improvements()

void city_dialog::update_improvements ( )
private

Updates list of improvements.

Definition at line 1961 of file citydlg.cpp.

Referenced by refresh().

◆ update_info_label()

void city_dialog::update_info_label ( )
private

Updates information label ( food, prod ...

surpluses ...)

Definition at line 1723 of file citydlg.cpp.

Referenced by refresh().

◆ update_nation_table()

void city_dialog::update_nation_table ( )
private

Updates nationality table in happiness tab.

Definition at line 1650 of file citydlg.cpp.

Referenced by refresh().

◆ update_prod_buttons()

void city_dialog::update_prod_buttons ( )
private

Update sensitivity of buttons in production tab.

Definition at line 1030 of file citydlg.cpp.

Referenced by item_selected(), update_disabled(), and worklist_del().

◆ update_sliders()

void city_dialog::update_sliders ( )
private

Definition at line 1634 of file citydlg.cpp.

Referenced by cma_selected(), and update_cma_tab().

◆ update_title()

void city_dialog::update_title ( )
private

Puts city name and people count on title.

Definition at line 2209 of file citydlg.cpp.

Referenced by refresh().

◆ update_units()

void city_dialog::update_units ( )
private

Updates layouts for supported and present units in city.

Definition at line 1770 of file citydlg.cpp.

Referenced by refresh().

◆ worklist_del

void city_dialog::worklist_del ( )
privateslot

Remove current item on worklist.

Definition at line 2126 of file citydlg.cpp.

Referenced by city_dialog().

◆ worklist_down

void city_dialog::worklist_down ( )
privateslot

Move current item on worklist down.

Definition at line 2142 of file citydlg.cpp.

Referenced by city_dialog().

◆ worklist_up

void city_dialog::worklist_up ( )
privateslot

Move current item on worklist up.

Definition at line 2102 of file citydlg.cpp.

Referenced by city_dialog().

Member Data Documentation

◆ citizen_pixmap

QPixmap* city_dialog::citizen_pixmap
private

Definition at line 287 of file citydlg.h.

Referenced by city_dialog(), fill_citizens_pixmap(), update_citizens(), and ~city_dialog().

◆ dont_focus

bool city_dialog::dont_focus {false}

◆ future_targets

bool city_dialog::future_targets {false}
private

Definition at line 288 of file citydlg.h.

Referenced by display_worklist_menu(), show_targets(), and show_targets_worklist().

◆ lab_table

city_label* city_dialog::lab_table[6]
private

Definition at line 291 of file citydlg.h.

Referenced by city_dialog(), and update_citizens().

◆ pcity

◆ present_units_exp

bool city_dialog::present_units_exp = false

Definition at line 301 of file citydlg.h.

Referenced by present_units_exp_col(), and update_units().

◆ selected_row_p

◆ show_buildings

bool city_dialog::show_buildings {true}
private

Definition at line 289 of file citydlg.h.

Referenced by display_worklist_menu(), show_targets(), and show_targets_worklist().

◆ show_units

bool city_dialog::show_units {true}
private

Definition at line 288 of file citydlg.h.

Referenced by display_worklist_menu(), show_targets(), and show_targets_worklist().

◆ show_wonders

bool city_dialog::show_wonders {true}
private

Definition at line 288 of file citydlg.h.

Referenced by display_worklist_menu(), show_targets(), and show_targets_worklist().

◆ ui