Freeciv-3.2
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Data Fields | Private Types | Private Member Functions | Private Attributes
city_widget Class Reference

#include <cityrep.h>

+ Inheritance diagram for city_widget:

Public Slots

void display_header_menu (const QPoint &)
 
void hide_columns ()
 
void city_doubleclick (const QModelIndex &index)
 
void city_view ()
 
void clear_worlist ()
 
void cities_selected (const QItemSelection &sl, const QItemSelection &ds)
 
void display_list_menu (const QPoint &)
 
void buy ()
 
void center ()
 
void select_all ()
 
void select_none ()
 
void invert_selection ()
 
void select_coastal ()
 
void select_building_something ()
 
void select_same_island ()
 

Public Member Functions

 city_widget (city_report *ctr)
 
 ~city_widget ()
 
city_modelget_model () const
 
void update_model ()
 
void update_city (struct city *pcity)
 

Data Fields

QList< city * > selected_cities
 

Private Types

enum  menu_labels {
  CHANGE_PROD_NOW = 1 , CHANGE_PROD_NEXT , CHANGE_PROD_LAST , CHANGE_PROD_BEF_LAST ,
  CMA , SELL , WORKLIST_ADD , WORKLIST_CHANGE ,
  SELECT_IMPR , SELECT_WONDERS , SELECT_SUPP_UNITS , SELECT_PRES_UNITS ,
  SELECT_AVAIL_UNITS , SELECT_AVAIL_IMPR , SELECT_AVAIL_WONDERS , BUY
}
 

Private Member Functions

void restore_selection ()
 
void select_city (struct city *pcity)
 
void gen_cma_labels (QMap< QString, int > &list)
 
void gen_select_labels (QMenu *menu)
 
void gen_worklist_labels (QMap< QString, int > &list)
 
void gen_production_labels (menu_labels which, QMap< QString, cid > &list, bool append_units, bool append_wonders, TestCityFunc test_func, bool global=false)
 
void fill_data (menu_labels which, QMap< QString, cid > &custom_labels, QMenu *menu)
 
void fill_production_menus (city_widget::menu_labels what, QMap< QString, cid > &custom_labels, TestCityFunc test_func, QMenu *menu)
 

Private Attributes

city_modellist_model
 
QSortFilterProxyModel * filter_model
 
city_item_delegatec_i_d
 
city_reportcr
 

Detailed Description

Definition at line 135 of file cityrep.h.

Member Enumeration Documentation

◆ menu_labels

Enumerator
CHANGE_PROD_NOW 
CHANGE_PROD_NEXT 
CHANGE_PROD_LAST 
CHANGE_PROD_BEF_LAST 
CMA 
SELL 
WORKLIST_ADD 
WORKLIST_CHANGE 
SELECT_IMPR 
SELECT_WONDERS 
SELECT_SUPP_UNITS 
SELECT_PRES_UNITS 
SELECT_AVAIL_UNITS 
SELECT_AVAIL_IMPR 
SELECT_AVAIL_WONDERS 
BUY 

Definition at line 142 of file cityrep.h.

Constructor & Destructor Documentation

◆ city_widget()

city_widget::city_widget ( city_report ctr)

Constructor for city widget

Definition at line 355 of file cityrep.cpp.

◆ ~city_widget()

city_widget::~city_widget ( )

Destructor for city widget

Definition at line 1212 of file cityrep.cpp.

Member Function Documentation

◆ buy

void city_widget::buy ( )
slot

Buys current item in city

Definition at line 437 of file cityrep.cpp.

Referenced by display_list_menu().

◆ center

void city_widget::center ( )
slot

Centers map on city

Definition at line 450 of file cityrep.cpp.

Referenced by display_list_menu().

◆ cities_selected

void city_widget::cities_selected ( const QItemSelection sl,
const QItemSelection ds 
)
slot

Slot for selecting items in city widget, they are stored in selected_cities until deselected

Definition at line 1178 of file cityrep.cpp.

Referenced by city_widget().

◆ city_doubleclick

void city_widget::city_doubleclick ( const QModelIndex index)
slot

Slot for double clicking row

Definition at line 395 of file cityrep.cpp.

Referenced by city_widget().

◆ city_view

void city_widget::city_view ( )
slot

Shows first selected city

Definition at line 403 of file cityrep.cpp.

Referenced by city_doubleclick(), and display_list_menu().

◆ clear_worlist

void city_widget::clear_worlist ( )
slot

Clears worklist for selected cities

Definition at line 422 of file cityrep.cpp.

Referenced by display_list_menu().

◆ display_header_menu

void city_widget::display_header_menu ( const QPoint )
slot

Context menu for header

Definition at line 1127 of file cityrep.cpp.

Referenced by city_widget().

◆ display_list_menu

void city_widget::display_list_menu ( const QPoint )
slot

Displays right click menu on city row

Definition at line 466 of file cityrep.cpp.

Referenced by city_widget().

◆ fill_data()

void city_widget::fill_data ( menu_labels  which,
QMap< QString, cid > &  custom_labels,
QMenu *  menu 
)
private

Fills menu actions

Definition at line 754 of file cityrep.cpp.

Referenced by display_list_menu(), fill_production_menus(), and gen_select_labels().

◆ fill_production_menus()

void city_widget::fill_production_menus ( city_widget::menu_labels  what,
QMap< QString, cid > &  custom_labels,
TestCityFunc  test_func,
QMenu *  menu 
)
private

Fills menu items that can be produced or sold

Definition at line 733 of file cityrep.cpp.

Referenced by display_list_menu().

◆ gen_cma_labels()

void city_widget::gen_cma_labels ( QMap< QString, int > &  list)
private

Creates menu labels and id of available cma, stored in list

Definition at line 943 of file cityrep.cpp.

Referenced by display_list_menu().

◆ gen_production_labels()

void city_widget::gen_production_labels ( city_widget::menu_labels  what,
QMap< QString, cid > &  list,
bool  append_units,
bool  append_wonders,
TestCityFunc  test_func,
bool  global = false 
)
private

Creates menu labels and id about available production targets

Definition at line 1031 of file cityrep.cpp.

Referenced by display_list_menu(), fill_production_menus(), and gen_select_labels().

◆ gen_select_labels()

void city_widget::gen_select_labels ( QMenu *  menu)
private

Creates menu labels for selecting cities

Definition at line 954 of file cityrep.cpp.

Referenced by display_list_menu().

◆ gen_worklist_labels()

void city_widget::gen_worklist_labels ( QMap< QString, int > &  list)
private

Creates menu labels and info of available worklists, stored in list

Definition at line 1020 of file cityrep.cpp.

Referenced by display_list_menu().

◆ get_model()

city_model * city_widget::get_model ( ) const

Returns used model

Definition at line 1204 of file cityrep.cpp.

◆ hide_columns

void city_widget::hide_columns ( )
slot

Hides columns for city widget, depending on stored data (bool spec->show)

Definition at line 1163 of file cityrep.cpp.

Referenced by city_widget().

◆ invert_selection

void city_widget::invert_selection ( )
slot

Inverts selection on report

Definition at line 791 of file cityrep.cpp.

Referenced by gen_select_labels().

◆ restore_selection()

void city_widget::restore_selection ( )
private

Restores last selection

Definition at line 327 of file cityrep.cpp.

Referenced by update_city(), and update_model().

◆ select_all

void city_widget::select_all ( )
slot

Selects all cities on report

Definition at line 775 of file cityrep.cpp.

Referenced by gen_select_labels().

◆ select_building_something

void city_widget::select_building_something ( )
slot

Selects cities building units or buildings or wonders depending on data stored in QAction

Definition at line 902 of file cityrep.cpp.

Referenced by gen_select_labels().

◆ select_city()

void city_widget::select_city ( struct city pcity)
private

Marks given city selected

Definition at line 818 of file cityrep.cpp.

Referenced by display_list_menu().

◆ select_coastal

void city_widget::select_coastal ( )
slot

Selects coastal cities on report

Definition at line 844 of file cityrep.cpp.

Referenced by gen_select_labels().

◆ select_none

void city_widget::select_none ( )
slot

Selects no cities on report

Definition at line 783 of file cityrep.cpp.

Referenced by gen_select_labels().

◆ select_same_island

void city_widget::select_same_island ( )
slot

Selects same cities on the same island

Definition at line 871 of file cityrep.cpp.

Referenced by gen_select_labels().

◆ update_city()

void city_widget::update_city ( struct city pcity)

Updates single city

Definition at line 1089 of file cityrep.cpp.

Referenced by city_report::update_city().

◆ update_model()

void city_widget::update_model ( )

Updates whole model

Definition at line 1098 of file cityrep.cpp.

Referenced by city_report::update_report().

Field Documentation

◆ c_i_d

city_item_delegate* city_widget::c_i_d
private

Definition at line 140 of file cityrep.h.

Referenced by city_widget(), and ~city_widget().

◆ cr

city_report* city_widget::cr
private

Definition at line 141 of file cityrep.h.

Referenced by city_widget().

◆ filter_model

QSortFilterProxyModel* city_widget::filter_model
private

◆ list_model

city_model* city_widget::list_model
private

◆ selected_cities

QList<city *> city_widget::selected_cities