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

#include <helpdlg.h>

+ Inheritance diagram for help_widget:
+ Collaboration diagram for help_widget:

Public Slots

void set_topic (const help_item *item)
 Shows the given help page. More...
 

Public Member Functions

 help_widget (QWidget *parent=0)
 Creates a new, empty help widget. More...
 
 help_widget (const help_item *item, QWidget *parent=0)
 Creates a new help widget displaying the specified topic. More...
 
 ~help_widget () override
 Destructor. More...
 
void update_fonts ()
 Updates fonts for manual. More...
 
struct terrainterrain_max_values ()
 Retrieves the maximum values any terrain will ever have. More...
 
struct unit_typeuclass_max_values (struct unit_class *uclass)
 Retrieves the maximum values any unit of uclass will ever have. More...
 

Private Slots

void anchor_clicked (const QString &link)
 Hyperlink clicked, link has 2 variables, string(name of given help) and int(help_page_type) More...
 

Private Member Functions

void setup_ui ()
 Creates the UI. More...
 
void do_layout ()
 Lays things out. More...
 
void undo_layout ()
 Deletes the widgets created by do_complex_layout(). More...
 
void show_info_panel ()
 Creates the information panel. More...
 
void add_info_pixmap (const QPixmap *pm, bool shadow=false)
 Adds a pixmap to the information panel. More...
 
void add_info_label (const QString &text)
 Adds a text label to the information panel. More...
 
void add_info_progress (const QString &label, int progress, int min, int max, const QString &value=QString())
 Adds a widget indicating a progress to the information panel. More...
 
void add_extras_of_act_for_terrain (struct terrain *pterr, enum unit_activity act, const char *label)
 Create labels about all extras of one cause buildable to the terrain. More...
 
void add_info_separator ()
 Adds a separator to the information panel. More...
 
void info_panel_done ()
 Called when everything needed has been added to the information panel. More...
 
void set_bottom_panel (QWidget *widget)
 Sets the bottom panel. More...
 
QLayout * create_terrain_widget (const QString &title, const QPixmap *image, const int &food, const int &sh, const int &eco, const QString &tooltip=QString())
 Creates a terrain widget with title, terrain image, legend. More...
 
void set_topic_other (const help_item *item, const char *title)
 Creates help pages with no special widgets. More...
 
void set_topic_unit (const help_item *item, const char *title)
 Creates unit help pages. More...
 
void set_topic_building (const help_item *item, const char *title)
 Creates improvement help pages. More...
 
void set_topic_tech (const help_item *item, const char *title)
 Creates technology help pages. More...
 
void set_topic_terrain (const help_item *item, const char *title)
 Creates terrain help pages. More...
 
void set_topic_extra (const help_item *item, const char *title)
 Creates extra help pages. More...
 
void set_topic_specialist (const help_item *item, const char *title)
 Creates specialist help pages. More...
 
void set_topic_government (const help_item *item, const char *title)
 Creates government help pages. More...
 
void set_topic_nation (const help_item *item, const char *title)
 Creates nation help pages. More...
 
void set_topic_goods (const help_item *item, const char *title)
 Creates goods help page. More...
 
void make_terrain_lab (QString &str)
 
QString link_me (const char *str, help_page_type hpt)
 Creates link to given help page. More...
 

Private Attributes

QFrame * box_wdg
 
QLabel * title_label
 
QWidget * main_widget
 
QTextBrowser * text_browser
 
QWidget * bottom_panel
 
QWidget * info_panel
 
QSplitter * splitter
 
QVBoxLayout * info_layout
 
QList< int > splitter_sizes
 

Detailed Description

Definition at line 72 of file helpdlg.h.

Constructor & Destructor Documentation

◆ help_widget() [1/2]

help_widget::help_widget ( QWidget *  parent = 0)

Creates a new, empty help widget.

Definition at line 414 of file helpdlg.cpp.

◆ help_widget() [2/2]

help_widget::help_widget ( const help_item item,
QWidget *  parent = 0 
)

Creates a new help widget displaying the specified topic.

Definition at line 425 of file helpdlg.cpp.

◆ ~help_widget()

help_widget::~help_widget ( )
override

Destructor.

Definition at line 437 of file helpdlg.cpp.

Member Function Documentation

◆ add_extras_of_act_for_terrain()

void help_widget::add_extras_of_act_for_terrain ( struct terrain pterr,
enum unit_activity  act,
const char *  label 
)
private

Create labels about all extras of one cause buildable to the terrain.

Definition at line 680 of file helpdlg.cpp.

Referenced by set_topic_terrain().

◆ add_info_label()

void help_widget::add_info_label ( const QString &  text)
private

Adds a text label to the information panel.

Definition at line 615 of file helpdlg.cpp.

Referenced by set_topic_building(), and set_topic_unit().

◆ add_info_pixmap()

void help_widget::add_info_pixmap ( const QPixmap *  pm,
bool  shadow = false 
)
private

Adds a pixmap to the information panel.

Definition at line 594 of file helpdlg.cpp.

Referenced by set_topic_building(), set_topic_tech(), set_topic_terrain(), and set_topic_unit().

◆ add_info_progress()

void help_widget::add_info_progress ( const QString &  text,
int  progress,
int  min,
int  max,
const QString &  value = QString() 
)
private

Adds a widget indicating a progress to the information panel.

Arguments: text: A descriptive text progress: The progress to display [min,max]: The interval progress is in value: Use this to display a non-numeral value

Definition at line 632 of file helpdlg.cpp.

Referenced by set_topic_terrain(), and set_topic_unit().

◆ add_info_separator()

void help_widget::add_info_separator ( )
private

Adds a separator to the information panel.

Definition at line 727 of file helpdlg.cpp.

Referenced by set_topic_terrain(), and set_topic_unit().

◆ anchor_clicked

void help_widget::anchor_clicked ( const QString &  link)
privateslot

Hyperlink clicked, link has 2 variables, string(name of given help) and int(help_page_type)

Definition at line 741 of file helpdlg.cpp.

Referenced by add_extras_of_act_for_terrain(), make_terrain_lab(), set_topic_building(), set_topic_tech(), and set_topic_unit().

◆ create_terrain_widget()

QLayout * help_widget::create_terrain_widget ( const QString &  title,
const QPixmap *  image,
const int &  food,
const int &  sh,
const int &  eco,
const QString &  tooltip = QString() 
)
private

Creates a terrain widget with title, terrain image, legend.

An optional tooltip can be given to explain the legend.

Definition at line 1239 of file helpdlg.cpp.

Referenced by set_topic_terrain().

◆ do_layout()

void help_widget::do_layout ( )
private

Lays things out.

The widget is organized as follows, with the additional complexity that info_ and/or bottom_panel may be absent.

+------------------------------—+ | title_label | +------------------------------—+ |+-main_widget----------------—+| ||+---------—+ +-----------—+|| ||| | | ||| ||| info_panel | | text_browser ||| ||| | | ||| ||| |.+-----------—+|| ||| |. ... || ||| |.+-----------—+|| ||| | | ||| ||| | | bottom_panel ||| ||| | | ||| ||+---------—+ +-----------—+|| |+----------------------------—+| +------------------------------—+

Definition at line 495 of file helpdlg.cpp.

Referenced by set_topic().

◆ info_panel_done()

void help_widget::info_panel_done ( )
private

Called when everything needed has been added to the information panel.

Definition at line 735 of file helpdlg.cpp.

Referenced by set_topic_building(), set_topic_tech(), set_topic_terrain(), and set_topic_unit().

◆ link_me()

QString help_widget::link_me ( const char *  str,
help_page_type  hpt 
)
private

Creates link to given help page.

Definition at line 716 of file helpdlg.cpp.

Referenced by add_extras_of_act_for_terrain(), set_topic_building(), set_topic_tech(), set_topic_terrain(), and set_topic_unit().

◆ make_terrain_lab()

void help_widget::make_terrain_lab ( QString &  str)
private

Definition at line 1284 of file helpdlg.cpp.

Referenced by set_topic_terrain().

◆ set_bottom_panel()

void help_widget::set_bottom_panel ( QWidget *  widget)
private

Sets the bottom panel.

Definition at line 826 of file helpdlg.cpp.

Referenced by set_topic_terrain().

◆ set_topic

void help_widget::set_topic ( const help_item item)
slot

Shows the given help page.

Definition at line 768 of file helpdlg.cpp.

Referenced by help_widget(), help_dialog::item_changed(), and help_dialog::set_topic().

◆ set_topic_building()

void help_widget::set_topic_building ( const help_item item,
const char *  title 
)
private

Creates improvement help pages.

Definition at line 959 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_extra()

void help_widget::set_topic_extra ( const help_item item,
const char *  title 
)
private

Creates extra help pages.

Definition at line 1459 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_goods()

void help_widget::set_topic_goods ( const help_item item,
const char *  title 
)
private

Creates goods help page.

Definition at line 1524 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_government()

void help_widget::set_topic_government ( const help_item item,
const char *  title 
)
private

Creates government help pages.

Definition at line 1492 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_nation()

void help_widget::set_topic_nation ( const help_item item,
const char *  title 
)
private

Creates nation help pages.

Definition at line 1509 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_other()

void help_widget::set_topic_other ( const help_item item,
const char *  title 
)
private

◆ set_topic_specialist()

void help_widget::set_topic_specialist ( const help_item item,
const char *  title 
)
private

Creates specialist help pages.

Definition at line 1475 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_tech()

void help_widget::set_topic_tech ( const help_item item,
const char *  title 
)
private

Creates technology help pages.

Definition at line 1051 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_terrain()

void help_widget::set_topic_terrain ( const help_item item,
const char *  title 
)
private

Creates terrain help pages.

Definition at line 1295 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_unit()

void help_widget::set_topic_unit ( const help_item item,
const char *  title 
)
private

Creates unit help pages.

Definition at line 848 of file helpdlg.cpp.

Referenced by set_topic().

◆ setup_ui()

void help_widget::setup_ui ( )
private

Creates the UI.

Definition at line 445 of file helpdlg.cpp.

Referenced by help_widget().

◆ show_info_panel()

void help_widget::show_info_panel ( )
private

Creates the information panel.

It will be shown by do_complex_layout().

Definition at line 585 of file helpdlg.cpp.

Referenced by set_topic_building(), set_topic_tech(), set_topic_terrain(), and set_topic_unit().

◆ terrain_max_values()

struct terrain * help_widget::terrain_max_values ( )

Retrieves the maximum values any terrain will ever have.

Supported fields: base_time, clean_fallout_time, clean_pollution_time, defense_bonus, irrigation_food_incr, irrigation_time, mining_shield_incr, mining_time, movement_cost, output, pillage_time, road_output_incr_pct, road_time, transform_time Other fields in returned value are undefined. Especially, all pointers are invalid.

Definition at line 1547 of file helpdlg.cpp.

Referenced by set_topic_terrain().

◆ uclass_max_values()

struct unit_type * help_widget::uclass_max_values ( struct unit_class uclass)

Retrieves the maximum values any unit of uclass will ever have.

Supported fields: attack_strength, bombard_rate, build_cost, city_size, convert_time, defense_strength, firepower, fuel, happy_cost, hp, move_rate, pop_cost, upkeep, vision_radius_sq Other fiels in returned value are undefined. Especially, all pointers are invalid except uclass.

Definition at line 1618 of file helpdlg.cpp.

Referenced by set_topic_unit().

◆ undo_layout()

void help_widget::undo_layout ( )
private

Deletes the widgets created by do_complex_layout().

Definition at line 562 of file helpdlg.cpp.

Referenced by set_topic().

◆ update_fonts()

void help_widget::update_fonts ( )

Updates fonts for manual.

Definition at line 533 of file helpdlg.cpp.

Referenced by setup_ui(), and help_dialog::update_fonts().

Member Data Documentation

◆ bottom_panel

QWidget* help_widget::bottom_panel
private

Definition at line 79 of file helpdlg.h.

Referenced by do_layout(), set_bottom_panel(), and undo_layout().

◆ box_wdg

QFrame* help_widget::box_wdg
private

Definition at line 74 of file helpdlg.h.

Referenced by setup_ui().

◆ info_layout

◆ info_panel

QWidget* help_widget::info_panel
private

Definition at line 80 of file helpdlg.h.

Referenced by do_layout(), show_info_panel(), and undo_layout().

◆ main_widget

QWidget* help_widget::main_widget
private

Definition at line 77 of file helpdlg.h.

Referenced by do_layout(), setup_ui(), and undo_layout().

◆ splitter

QSplitter* help_widget::splitter
private

Definition at line 81 of file helpdlg.h.

Referenced by do_layout(), and undo_layout().

◆ splitter_sizes

QList<int> help_widget::splitter_sizes
private

Definition at line 83 of file helpdlg.h.

Referenced by do_layout(), setup_ui(), and undo_layout().

◆ text_browser

◆ title_label

QLabel* help_widget::title_label
private

Definition at line 75 of file helpdlg.h.

Referenced by set_topic(), and setup_ui().