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

#include <optiondlg.h>

+ Inheritance diagram for option_dialog:
+ Collaboration diagram for option_dialog:

Public Member Functions

 option_dialog (const QString &name, const option_set *options, QWidget *parent=0)
 Constructor for options dialog. More...
 
 ~option_dialog () override
 Destructor for options dialog. More...
 
void fill (const struct option_set *poptset)
 Create all widgets. More...
 
void add_option (struct option *poption)
 Create widget for option. More...
 
void option_dialog_refresh (struct option *poption)
 Refresh one given option for option dialog. More...
 
void option_dialog_reset (struct option *poption)
 Reset one option. More...
 
void full_refresh ()
 Refresh all options. More...
 
void apply_options ()
 Apply all options. More...
 
- Public Member Functions inherited from qfc_dialog
 qfc_dialog (QWidget *parent)
 Constructor for custom dialog with themed titlebar. More...
 
 ~qfc_dialog () override
 

Private Slots

void apply_option (int response)
 Apply desired action depending on user's request (clicked button). More...
 
void set_color ()
 Set color of buttons (user just changed colors). More...
 
void set_font ()
 Sets font and text in pushbutton (user just chosen font) More...
 

Private Member Functions

void set_bool (struct option *poption, bool value)
 Set the boolean value of the option. More...
 
void set_int (struct option *poption, int value)
 Set the integer value of the option. More...
 
void set_string (struct option *poption, const char *string)
 Set the string value of the option. More...
 
void set_enum (struct option *poption, int index)
 Set desired index(text) in combobox. More...
 
void set_bitwise (struct option *poption, unsigned value)
 Set the enum value of the option. More...
 
void set_color (struct option *poption, struct ft_color color)
 Set color of the buttons depending on given colors. More...
 
void set_font (struct option *poption, const QFont &font)
 Sets desired font name in button text and sets global font for that option That function is not executed when user changes font, but when applying or resetting options. More...
 
void get_color (struct option *poption, QByteArray &a1, QByteArray &a2)
 Return selected colors (for highlighting chat). More...
 
bool get_bool (struct option *poption)
 Get the boolean value from checkbox. More...
 
int get_int (struct option *poption)
 Get int value from spinbox. More...
 
QFont get_font (struct option *poption)
 
QFont get_button_font (struct option *poption)
 Get font from pushbutton. More...
 
QByteArray get_string (struct option *poption)
 Get string for desired option from combobox or lineedit. More...
 
int get_enum (struct option *poption)
 Get indexed value from combobox. More...
 
struct optionget_color_option ()
 Find option indicating colors. More...
 
unsigned get_bitwise (struct option *poption)
 Return the enum value from groupbox. More...
 
void full_reset ()
 Reset all options. More...
 

Private Attributes

QVBoxLayout * main_layout
 
QTabWidget * tab_widget
 
QDialogButtonBox * button_box
 
QList< QString > categories
 
QMap< QString, QWidget * > widget_map
 
const option_setcurr_options
 

Additional Inherited Members

- Protected Member Functions inherited from qfc_dialog
void paintEvent (QPaintEvent *event) override
 Paint event for themed dialog. More...
 
void mouseMoveEvent (QMouseEvent *event) override
 Mouse move event for themed titlebar (moves dialog with left mouse) More...
 
void mousePressEvent (QMouseEvent *event) override
 Mouse press event - catches left click. More...
 
void mouseReleaseEvent (QMouseEvent *event) override
 Mouse release event for themed dialog. More...
 

Detailed Description

Definition at line 27 of file optiondlg.h.

Constructor & Destructor Documentation

◆ option_dialog()

option_dialog::option_dialog ( const QString &  name,
const option_set options,
QWidget *  parent = 0 
)

Constructor for options dialog.

Definition at line 109 of file optiondlg.cpp.

◆ ~option_dialog()

option_dialog::~option_dialog ( )
override

Destructor for options dialog.

Definition at line 173 of file optiondlg.cpp.

Member Function Documentation

◆ add_option()

void option_dialog::add_option ( struct option poption)

Create widget for option.

Definition at line 566 of file optiondlg.cpp.

Referenced by fill().

◆ apply_option

void option_dialog::apply_option ( int  response)
privateslot

Apply desired action depending on user's request (clicked button).

Definition at line 184 of file optiondlg.cpp.

Referenced by option_dialog().

◆ apply_options()

void option_dialog::apply_options ( )

Apply all options.

Definition at line 237 of file optiondlg.cpp.

Referenced by apply_option().

◆ fill()

void option_dialog::fill ( const struct option_set poptset)

Create all widgets.

Definition at line 557 of file optiondlg.cpp.

Referenced by option_dialog().

◆ full_refresh()

void option_dialog::full_refresh ( )

Refresh all options.

Definition at line 509 of file optiondlg.cpp.

Referenced by apply_option().

◆ full_reset()

void option_dialog::full_reset ( )
private

Reset all options.

Definition at line 518 of file optiondlg.cpp.

Referenced by apply_option().

◆ get_bitwise()

unsigned int option_dialog::get_bitwise ( struct option poption)
private

Return the enum value from groupbox.

Definition at line 417 of file optiondlg.cpp.

Referenced by apply_options().

◆ get_bool()

bool option_dialog::get_bool ( struct option poption)
private

Get the boolean value from checkbox.

Definition at line 289 of file optiondlg.cpp.

Referenced by apply_options().

◆ get_button_font()

QFont option_dialog::get_button_font ( struct option poption)
private

Get font from pushbutton.

Definition at line 757 of file optiondlg.cpp.

Referenced by apply_options().

◆ get_color()

void option_dialog::get_color ( struct option poption,
QByteArray &  a1,
QByteArray &  a2 
)
private

Return selected colors (for highlighting chat).

Definition at line 215 of file optiondlg.cpp.

Referenced by apply_options().

◆ get_color_option()

struct option * option_dialog::get_color_option ( )
private

Find option indicating colors.

Definition at line 438 of file optiondlg.cpp.

Referenced by set_color().

◆ get_enum()

int option_dialog::get_enum ( struct option poption)
private

Get indexed value from combobox.

Definition at line 385 of file optiondlg.cpp.

Referenced by apply_options().

◆ get_font()

QFont option_dialog::get_font ( struct option poption)
private

◆ get_int()

int option_dialog::get_int ( struct option poption)
private

Get int value from spinbox.

Definition at line 325 of file optiondlg.cpp.

Referenced by apply_options().

◆ get_string()

QByteArray option_dialog::get_string ( struct option poption)
private

Get string for desired option from combobox or lineedit.

Definition at line 357 of file optiondlg.cpp.

Referenced by apply_options().

◆ option_dialog_refresh()

void option_dialog::option_dialog_refresh ( struct option poption)

Refresh one given option for option dialog.

Definition at line 479 of file optiondlg.cpp.

Referenced by add_option(), full_refresh(), and option_gui_update().

◆ option_dialog_reset()

void option_dialog::option_dialog_reset ( struct option poption)

Reset one option.

Definition at line 527 of file optiondlg.cpp.

Referenced by full_reset().

◆ set_bitwise()

void option_dialog::set_bitwise ( struct option poption,
unsigned  value 
)
private

Set the enum value of the option.

Definition at line 396 of file optiondlg.cpp.

Referenced by option_dialog_refresh(), and option_dialog_reset().

◆ set_bool()

void option_dialog::set_bool ( struct option poption,
bool  value 
)
private

Set the boolean value of the option.

Definition at line 274 of file optiondlg.cpp.

Referenced by option_dialog_refresh(), and option_dialog_reset().

◆ set_color [1/2]

void option_dialog::set_color ( )
privateslot

Set color of buttons (user just changed colors).

Definition at line 766 of file optiondlg.cpp.

Referenced by add_option(), option_dialog_refresh(), and option_dialog_reset().

◆ set_color() [2/2]

void option_dialog::set_color ( struct option poption,
struct ft_color  color 
)
private

Set color of the buttons depending on given colors.

Definition at line 453 of file optiondlg.cpp.

◆ set_enum()

void option_dialog::set_enum ( struct option poption,
int  index 
)
private

Set desired index(text) in combobox.

Definition at line 374 of file optiondlg.cpp.

Referenced by option_dialog_refresh(), and option_dialog_reset().

◆ set_font [1/2]

void option_dialog::set_font ( )
privateslot

Sets font and text in pushbutton (user just chosen font)

Definition at line 739 of file optiondlg.cpp.

Referenced by add_option(), option_dialog_refresh(), and option_dialog_reset().

◆ set_font() [2/2]

void option_dialog::set_font ( struct option poption,
const QFont &  font 
)
private

Sets desired font name in button text and sets global font for that option That function is not executed when user changes font, but when applying or resetting options.

Definition at line 313 of file optiondlg.cpp.

◆ set_int()

void option_dialog::set_int ( struct option poption,
int  value 
)
private

Set the integer value of the option.

Definition at line 300 of file optiondlg.cpp.

Referenced by option_dialog_refresh(), and option_dialog_reset().

◆ set_string()

void option_dialog::set_string ( struct option poption,
const char *  string 
)
private

Set the string value of the option.

Definition at line 336 of file optiondlg.cpp.

Referenced by option_dialog_refresh(), and option_dialog_reset().

Member Data Documentation

◆ button_box

QDialogButtonBox* option_dialog::button_box
private

Definition at line 31 of file optiondlg.h.

Referenced by option_dialog().

◆ categories

QList<QString> option_dialog::categories
private

Definition at line 32 of file optiondlg.h.

Referenced by add_option(), and option_dialog().

◆ curr_options

const option_set* option_dialog::curr_options
private

◆ main_layout

QVBoxLayout* option_dialog::main_layout
private

Definition at line 29 of file optiondlg.h.

Referenced by option_dialog().

◆ tab_widget

QTabWidget* option_dialog::tab_widget
private

Definition at line 30 of file optiondlg.h.

Referenced by add_option(), and option_dialog().

◆ widget_map

QMap<QString, QWidget *> option_dialog::widget_map
private

Definition at line 33 of file optiondlg.h.

Referenced by add_option().