Freeciv-3.3
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Private Slots | Private Member Functions | Private Attributes
help_widget Class Reference

#include <helpdlg.h>

+ Inheritance diagram for help_widget:

Public Slots

void set_topic (const help_item *item)
 

Public Member Functions

 help_widget (QWidget *parent=0)
 
 help_widget (const help_item *item, QWidget *parent=0)
 
 ~help_widget ()
 
void update_fonts ()
 
struct terrainterrain_max_values ()
 
struct unit_typeuclass_max_values (struct unit_class *uclass)
 

Private Slots

void anchor_clicked (const QString &link)
 

Private Member Functions

void setup_ui ()
 
void set_main_widget (QWidget *main_widget)
 
void do_layout (bool horizontal)
 
void undo_layout ()
 
void show_info_panel ()
 
void add_info_pixmap (QPixmap *pm, bool shadow=false)
 
void add_info_label (const QString &text)
 
void add_info_progress (const QString &label, int progress, int min, int max, const QString &value=QString())
 
void add_extras_of_act_for_terrain (struct terrain *pterr, enum unit_activity act, const char *label)
 
void add_info_separator ()
 
void add_info_widget (QWidget *widget)
 
void info_panel_done ()
 
void set_bottom_panel (QWidget *widget)
 
QLayoutcreate_terrain_widget (const QString &title, const struct canvas *image, const QString &legend, const QString &tooltip=QString())
 
void set_topic_other (const help_item *item, const char *title)
 
void set_topic_any (const help_item *item, const char *title)
 
void set_topic_text (const help_item *item, const char *title)
 
void set_topic_unit (const help_item *item, const char *title)
 
void set_topic_building (const help_item *item, const char *title)
 
void set_topic_tech (const help_item *item, const char *title)
 
void set_topic_terrain (const help_item *item, const char *title)
 
bool set_topic_extra (const help_item *item, const char *title)
 
void set_topic_specialist (const help_item *item, const char *title)
 
void set_topic_government (const help_item *item, const char *title)
 
void set_topic_nation (const help_item *item, const char *title)
 
void set_topic_goods (const help_item *item, const char *title)
 
QString link_me (const char *str, help_page_type hpt)
 

Private Attributes

QFrame * box_wdg
 
QLabel * title_label
 
QWidget * main_widget
 
QTextBrowser * text_browser
 
QWidget * bottom_panel
 
QWidget * info_panel
 
QSplittersplitter
 
QVBoxLayoutinfo_layout
 
QList< intsplitter_sizes
 

Detailed Description

Definition at line 79 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 437 of file helpdlg.cpp.

◆ help_widget() [2/2]

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

Creates a new help widget displaying the specified topic.

Definition at line 448 of file helpdlg.cpp.

◆ ~help_widget()

help_widget::~help_widget ( )

Destructor.

Definition at line 460 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 705 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 649 of file helpdlg.cpp.

Referenced by set_topic_building(), and set_topic_unit().

◆ add_info_pixmap()

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

Adds a pixmap to the information panel.

Definition at line 628 of file helpdlg.cpp.

Referenced by set_topic_building(), set_topic_extra(), 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 666 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 754 of file helpdlg.cpp.

Referenced by set_topic_terrain(), and set_topic_unit().

◆ add_info_widget()

void help_widget::add_info_widget ( QWidget *  widget)
private

◆ 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 771 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().

◆ create_terrain_widget()

QLayout * help_widget::create_terrain_widget ( const QString title,
const struct canvas image,
const QString legend,
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 1248 of file helpdlg.cpp.

Referenced by set_topic_terrain().

◆ do_layout()

void help_widget::do_layout ( bool  horizontal)
private

Lays things out. In case of horizontal being true, 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 518 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 762 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 743 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().

◆ set_bottom_panel()

void help_widget::set_bottom_panel ( QWidget *  widget)
private

Sets the bottom panel.

Definition at line 857 of file helpdlg.cpp.

Referenced by set_topic_terrain().

◆ set_main_widget()

void help_widget::set_main_widget ( QWidget *  main_widget)
private

◆ set_topic

void help_widget::set_topic ( const help_item topic)
slot

Shows the given help page.

Definition at line 796 of file helpdlg.cpp.

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

◆ set_topic_any()

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

◆ set_topic_building()

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

Creates improvement help pages.

Definition at line 1002 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_extra()

bool help_widget::set_topic_extra ( const help_item topic,
const char title 
)
private

Creates extra help pages.

Returns
use horizontal layout

Definition at line 1474 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_goods()

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

Creates goods help page.

Definition at line 1564 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_government()

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

Creates government help pages.

Definition at line 1531 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_nation()

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

Creates nation help pages.

Definition at line 1548 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_other()

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

◆ set_topic_specialist()

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

Creates specialist help pages.

Definition at line 1514 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_tech()

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

Creates technology help pages.

Definition at line 1094 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_terrain()

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

Creates terrain help pages.

Definition at line 1289 of file helpdlg.cpp.

Referenced by set_topic().

◆ set_topic_text()

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

◆ set_topic_unit()

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

Creates unit help pages.

Definition at line 877 of file helpdlg.cpp.

Referenced by set_topic().

◆ setup_ui()

void help_widget::setup_ui ( )
private

Creates the UI.

Definition at line 467 of file helpdlg.cpp.

Referenced by help_widget(), and 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 619 of file helpdlg.cpp.

Referenced by set_topic_building(), set_topic_extra(), 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, 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 1588 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 fields in returned value are undefined. Especially, all pointers are invalid except uclass.

Definition at line 1657 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 596 of file helpdlg.cpp.

Referenced by set_topic().

◆ update_fonts()

void help_widget::update_fonts ( )

Updates fonts for manual

Definition at line 566 of file helpdlg.cpp.

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

Field Documentation

◆ bottom_panel

QWidget* help_widget::bottom_panel
private

Definition at line 87 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 82 of file helpdlg.h.

Referenced by setup_ui().

◆ info_layout

QVBoxLayout* help_widget::info_layout
private

◆ info_panel

QWidget* help_widget::info_panel
private

Definition at line 88 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 85 of file helpdlg.h.

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

◆ splitter

QSplitter* help_widget::splitter
private

Definition at line 89 of file helpdlg.h.

Referenced by do_layout(), and undo_layout().

◆ splitter_sizes

QList<int> help_widget::splitter_sizes
private

Definition at line 91 of file helpdlg.h.

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

◆ text_browser

QTextBrowser* help_widget::text_browser
private

◆ title_label

QLabel* help_widget::title_label
private

Definition at line 83 of file helpdlg.h.

Referenced by set_topic(), and setup_ui().