gui2/log_settings: Permit disabling logdomains (log level -1)
(cherry-picked from commit ae5ab22b1a
)
This commit is contained in:
parent
da4d4a1be6
commit
450092033a
3 changed files with 22 additions and 8 deletions
|
@ -118,6 +118,7 @@
|
|||
* Fixed locations not being added to the palette when loading a map (#1023)
|
||||
* Fixed an AI assertion when a unit with one disabled attack attacked a unit
|
||||
with no attacks or a single disabled attack.
|
||||
* It is now possible to disable logdomains in the Logging Options dialog.
|
||||
|
||||
## Version 1.13.12
|
||||
### Security fixes
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Definition of the window to select logging options.
|
||||
### These first five things match the names from logging.cpp
|
||||
### These first six strings match the names from logging.cpp
|
||||
###
|
||||
#define _NAME
|
||||
"label"#enddef
|
||||
|
@ -13,6 +13,8 @@
|
|||
"warn"#enddef
|
||||
#define _ERR
|
||||
"err"#enddef
|
||||
#define _NONE
|
||||
"none"#enddef
|
||||
|
||||
#define _GUI_LOGGER_RADIOS GROUP TOOLTIP
|
||||
[column]
|
||||
|
@ -67,6 +69,11 @@
|
|||
fixed_width = true
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = {_NONE}
|
||||
fixed_width = true
|
||||
[/linked_group]
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip"
|
||||
[/tooltip]
|
||||
|
@ -130,6 +137,7 @@
|
|||
{_GUI_LOGGER_RADIOS {_INFO} ( _ "Info level logging: more information")}
|
||||
{_GUI_LOGGER_RADIOS {_WARN} ( _ "Warning level logging: less information")}
|
||||
{_GUI_LOGGER_RADIOS {_ERR} ( _ "Error level logging: minimum information")}
|
||||
{_GUI_LOGGER_RADIOS {_NONE} ( _ "Disable logging")}
|
||||
|
||||
[/row]
|
||||
[/grid]
|
||||
|
|
|
@ -34,6 +34,7 @@ REGISTER_DIALOG(log_settings)
|
|||
log_settings::log_settings()
|
||||
{
|
||||
//list of names must match those in logging.cfg
|
||||
widget_id_.push_back("none");
|
||||
widget_id_.push_back("err");
|
||||
widget_id_.push_back("warn");
|
||||
widget_id_.push_back("info");
|
||||
|
@ -77,9 +78,11 @@ void log_settings::pre_show(window& window)
|
|||
group.add_member(button, this_id);
|
||||
}
|
||||
}
|
||||
int current_sev, max_sev = widget_id_.size() - 1;
|
||||
if (lg::get_log_domain_severity(this_domain, current_sev) && current_sev >= 0 && current_sev <= max_sev){
|
||||
group.set_member_states(widget_id_[current_sev]);
|
||||
int current_sev, max_sev = widget_id_.size();
|
||||
if (lg::get_log_domain_severity(this_domain, current_sev)) {
|
||||
if (current_sev <= max_sev) {
|
||||
group.set_member_states(widget_id_[current_sev + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,14 +98,16 @@ void log_settings::set_logger(const std::string log_domain)
|
|||
{
|
||||
std::string active_value = groups_[log_domain].get_active_member_value();
|
||||
|
||||
if(active_value == widget_id_[1]){ //default value, level1: warning
|
||||
if(active_value == widget_id_[2]){ //default value, level1: warning
|
||||
lg::set_log_domain_severity(log_domain, lg::warn());
|
||||
} else if(active_value == widget_id_[3]){ //level3: debug
|
||||
} else if(active_value == widget_id_[4]){ //level3: debug
|
||||
lg::set_log_domain_severity(log_domain, lg::debug());
|
||||
} else if(active_value == widget_id_[2]){ //level2: info
|
||||
} else if(active_value == widget_id_[3]){ //level2: info
|
||||
lg::set_log_domain_severity(log_domain, lg::info());
|
||||
} else if(active_value == widget_id_[0]){ //level0: error
|
||||
} else if(active_value == widget_id_[1]){ //level0: error
|
||||
lg::set_log_domain_severity(log_domain, lg::err());
|
||||
} else if(active_value == widget_id_[0]){ //level-1: disable
|
||||
lg::set_log_domain_severity(log_domain, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue