Freeciv-3.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
unit_item Class Reference

#include <citydlg.h>

+ Inheritance diagram for unit_item:

Public Member Functions

 unit_item (QWidget *parent, struct unit *punit, bool supp=false, int happy_cost=0)
 
 ~unit_item ()
 
void init_pix ()
 

Protected Member Functions

void wheelEvent (QWheelEvent *event)
 
void mousePressEvent (QMouseEvent *event)
 
void leaveEvent (QEvent *event)
 
void enterEvent (QEnterEvent *event)
 

Private Slots

void disband ()
 
void change_homecity ()
 
void activate_unit ()
 
void activate_and_close_dialog ()
 
void sentry_unit ()
 
void fortify_unit ()
 
void upgrade_unit ()
 
void load_unit ()
 
void unload_unit ()
 
void unload_all ()
 

Private Member Functions

void contextMenuEvent (QContextMenuEvent *ev)
 
void create_actions ()
 

Private Attributes

QActiondisband_action
 
QActionchange_home
 
QActionactivate
 
QActionactivate_and_close
 
QActionsentry
 
QActionfortify
 
QActionload
 
QActionunload
 
QActionupgrade
 
QActionunload_trans
 
QMenu * unit_menu
 
struct unitqunit
 
QImage unit_img
 
int happy_cost
 
bool supported
 

Detailed Description

Definition at line 142 of file citydlg.h.

Constructor & Destructor Documentation

◆ unit_item()

unit_item::unit_item ( QWidget *  parent,
struct unit punit,
bool  supp = false,
int  hppy_cost = 0 
)

Class representing one unit, allows context menu, holds pixmap for it

Definition at line 663 of file citydlg.cpp.

◆ ~unit_item()

unit_item::~unit_item ( )

Destructor for unit item

Definition at line 743 of file citydlg.cpp.

Member Function Documentation

◆ activate_and_close_dialog

void unit_item::activate_and_close_dialog ( )
privateslot

Activates unit and closes city dialog

Definition at line 946 of file citydlg.cpp.

Referenced by create_actions().

◆ activate_unit

void unit_item::activate_unit ( )
privateslot

Activates unit in city dialog

Definition at line 957 of file citydlg.cpp.

Referenced by create_actions().

◆ change_homecity

void unit_item::change_homecity ( )
privateslot

Changes homecity for given unit

Definition at line 936 of file citydlg.cpp.

Referenced by create_actions().

◆ contextMenuEvent()

void unit_item::contextMenuEvent ( QContextMenuEvent event)
private

Context menu handler

Definition at line 750 of file citydlg.cpp.

◆ create_actions()

void unit_item::create_actions ( )
private

Initializes context menu

Definition at line 804 of file citydlg.cpp.

Referenced by unit_item().

◆ disband

void unit_item::disband ( )
privateslot

Popups MessageBox for disbanding unit and disbands it

Definition at line 882 of file citydlg.cpp.

Referenced by create_actions().

◆ enterEvent()

void unit_item::enterEvent ( QEnterEvent event)
protected

Mouse entered widget

Definition at line 978 of file citydlg.cpp.

◆ fortify_unit

void unit_item::fortify_unit ( )
privateslot

Fortifies unit in city dialog

Definition at line 967 of file citydlg.cpp.

Referenced by create_actions().

◆ init_pix()

void unit_item::init_pix ( )

Sets pixmap for unit_item class

Definition at line 734 of file citydlg.cpp.

Referenced by leaveEvent(), and city_dialog::update_units().

◆ leaveEvent()

void unit_item::leaveEvent ( QEvent *  event)
protected

Mouse left widget

Definition at line 999 of file citydlg.cpp.

◆ load_unit

void unit_item::load_unit ( )
privateslot

Loads unit into some transport

Definition at line 900 of file citydlg.cpp.

Referenced by create_actions().

◆ mousePressEvent()

void unit_item::mousePressEvent ( QMouseEvent event)
protected

Mouse press event -activates unit and closes dialog

Definition at line 1033 of file citydlg.cpp.

◆ sentry_unit

void unit_item::sentry_unit ( )
privateslot

Sentries unit in city dialog

Definition at line 1046 of file citydlg.cpp.

Referenced by create_actions().

◆ unload_all

void unit_item::unload_all ( )
privateslot

Unloads all units from transporter

Definition at line 916 of file citydlg.cpp.

Referenced by create_actions().

◆ unload_unit

void unit_item::unload_unit ( )
privateslot

Unloads unit

Definition at line 908 of file citydlg.cpp.

Referenced by create_actions().

◆ upgrade_unit

void unit_item::upgrade_unit ( )
privateslot

Upgrades unit

Definition at line 924 of file citydlg.cpp.

Referenced by create_actions().

◆ wheelEvent()

void unit_item::wheelEvent ( QWheelEvent event)
protected

Mouse wheel event - send it to scrollbar

Definition at line 1007 of file citydlg.cpp.

Field Documentation

◆ activate

QAction* unit_item::activate
private

Definition at line 147 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ activate_and_close

QAction* unit_item::activate_and_close
private

Definition at line 148 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ change_home

QAction* unit_item::change_home
private

Definition at line 146 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ disband_action

QAction* unit_item::disband_action
private

Definition at line 145 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ fortify

QAction* unit_item::fortify
private

Definition at line 150 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ happy_cost

int unit_item::happy_cost
private

Definition at line 168 of file citydlg.h.

Referenced by unit_item().

◆ load

QAction* unit_item::load
private

Definition at line 151 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ qunit

struct unit* unit_item::qunit
private

◆ sentry

QAction* unit_item::sentry
private

Definition at line 149 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ supported

bool unit_item::supported
private

Definition at line 169 of file citydlg.h.

Referenced by unit_item().

◆ unit_img

QImage unit_item::unit_img
private

Definition at line 165 of file citydlg.h.

Referenced by init_pix(), and unit_item().

◆ unit_menu

QMenu* unit_item::unit_menu
private

Definition at line 155 of file citydlg.h.

◆ unload

QAction* unit_item::unload
private

Definition at line 152 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ unload_trans

QAction* unit_item::unload_trans
private

Definition at line 154 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

◆ upgrade

QAction* unit_item::upgrade
private

Definition at line 153 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().