The Battle for Wesnoth  1.15.1+dev
Classes | Namespaces | Macros | Functions | Variables
general.cpp File Reference

Get and set user-preferences. More...

#include "preferences/general.hpp"
#include "config.hpp"
#include "credentials.hpp"
#include "filesystem.hpp"
#include "game_config.hpp"
#include "hotkey/hotkey_item.hpp"
#include "lexical_cast.hpp"
#include "log.hpp"
#include "sdl/point.hpp"
#include "serialization/parser.hpp"
#include "sound.hpp"
#include "utils/general.hpp"
#include "video.hpp"
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for general.cpp:

Go to the source code of this file.

Classes

class  preferences::prefs_event_handler
 

Namespaces

 preferences
 Modify, read and display user preferences.
 

Macros

#define GETTEXT_DOMAIN   "wesnoth-lib"
 
#define ERR_CFG   LOG_STREAM(err , log_config)
 
#define ERR_FS   LOG_STREAM(err, log_filesystem)
 

Functions

void preferences::write_preferences ()
 
void preferences::set (const std::string &key, bool value)
 
void preferences::set (const std::string &key, int value)
 
void preferences::set (const std::string &key, char const *value)
 
void preferences::set (const std::string &key, const std::string &value)
 
void preferences::set (const std::string &key, const config::attribute_value &value)
 
void preferences::clear (const std::string &key)
 
void preferences::set_child (const std::string &key, const config &val)
 
const configpreferences::get_child (const std::string &key)
 
void preferences::erase (const std::string &key)
 
bool preferences::have_setting (const std::string &key)
 
std::string preferences::get (const std::string &key)
 
std::string preferences::get (const std::string &key, const std::string &def)
 
bool preferences::get (const std::string &key, bool def)
 
config::attribute_value preferences::get_as_attribute (const std::string &key)
 
void preferences::disable_preferences_save ()
 
configpreferences::get_prefs ()
 
bool preferences::show_allied_orb ()
 
void preferences::set_show_allied_orb (bool show_orb)
 
bool preferences::show_enemy_orb ()
 
void preferences::set_show_enemy_orb (bool show_orb)
 
bool preferences::show_moved_orb ()
 
void preferences::set_show_moved_orb (bool show_orb)
 
bool preferences::show_unmoved_orb ()
 
void preferences::set_show_unmoved_orb (bool show_orb)
 
bool preferences::show_partial_orb ()
 
void preferences::set_show_partial_orb (bool show_orb)
 
static std::string preferences::fix_orb_color_name (const std::string &color)
 
std::string preferences::allied_color ()
 
void preferences::set_allied_color (const std::string &color_id)
 
std::string preferences::core_id ()
 
void preferences::set_core_id (const std::string &core_id)
 
std::string preferences::enemy_color ()
 
void preferences::set_enemy_color (const std::string &color_id)
 
std::string preferences::moved_color ()
 
void preferences::set_moved_color (const std::string &color_id)
 
std::string preferences::unmoved_color ()
 
void preferences::set_unmoved_color (const std::string &color_id)
 
std::string preferences::partial_color ()
 
void preferences::set_partial_color (const std::string &color_id)
 
bool preferences::scroll_to_action ()
 
void preferences::set_scroll_to_action (bool ison)
 
point preferences::resolution ()
 
bool preferences::maximized ()
 
bool preferences::fullscreen ()
 
void preferences::_set_resolution (const point &res)
 
void preferences::_set_maximized (bool ison)
 
void preferences::_set_fullscreen (bool ison)
 
bool preferences::turbo ()
 
void preferences::_set_turbo (bool ison)
 
double preferences::turbo_speed ()
 
void preferences::save_turbo_speed (const double speed)
 
int preferences::font_scaling ()
 
void preferences::set_font_scaling (int scale)
 
int preferences::font_scaled (int size)
 
bool preferences::idle_anim ()
 
void preferences::_set_idle_anim (const bool ison)
 
int preferences::idle_anim_rate ()
 
void preferences::_set_idle_anim_rate (const int rate)
 
std::string preferences::language ()
 
void preferences::set_language (const std::string &s)
 
std::string preferences::gui_theme ()
 
void preferences::set_gui_theme (const std::string &s)
 
bool preferences::ellipses ()
 
void preferences::set_ellipses (bool ison)
 
bool preferences::grid ()
 
void preferences::_set_grid (bool ison)
 
std::size_t preferences::sound_buffer_size ()
 
void preferences::save_sound_buffer_size (const std::size_t size)
 
int preferences::music_volume ()
 
void preferences::set_music_volume (int vol)
 
int preferences::sound_volume ()
 
void preferences::set_sound_volume (int vol)
 
int preferences::bell_volume ()
 
void preferences::set_bell_volume (int vol)
 
int preferences::UI_volume ()
 
void preferences::set_UI_volume (int vol)
 
bool preferences::turn_bell ()
 
bool preferences::set_turn_bell (bool ison)
 
bool preferences::UI_sound_on ()
 
bool preferences::set_UI_sound (bool ison)
 
bool preferences::message_bell ()
 
bool preferences::sound_on ()
 
bool preferences::set_sound (bool ison)
 
bool preferences::music_on ()
 
bool preferences::set_music (bool ison)
 
bool preferences::stop_music_in_background ()
 
void preferences::set_stop_music_in_background (bool ison)
 
bool preferences::joystick_support_enabled ()
 
int preferences::joystick_mouse_deadzone ()
 
int preferences::joystick_num_mouse_xaxis ()
 
int preferences::joystick_mouse_xaxis_num ()
 
int preferences::joystick_num_mouse_yaxis ()
 
int preferences::joystick_mouse_yaxis_num ()
 
int preferences::joystick_scroll_deadzone ()
 
int preferences::joystick_cursor_deadzone ()
 
int preferences::joystick_thrusta_deadzone ()
 
int preferences::joystick_thrustb_deadzone ()
 
int preferences::joystick_cursor_threshold ()
 
int preferences::joystick_num_scroll_xaxis ()
 
int preferences::joystick_scroll_xaxis_num ()
 
int preferences::joystick_num_scroll_yaxis ()
 
int preferences::joystick_scroll_yaxis_num ()
 
int preferences::joystick_num_cursor_xaxis ()
 
int preferences::joystick_cursor_xaxis_num ()
 
int preferences::joystick_num_cursor_yaxis ()
 
int preferences::joystick_cursor_yaxis_num ()
 
int preferences::joystick_num_thrusta_axis ()
 
int preferences::joystick_thrusta_axis_num ()
 
int preferences::joystick_num_thrustb_axis ()
 
int preferences::joystick_thrustb_axis_num ()
 
int preferences::scroll_speed ()
 
void preferences::set_scroll_speed (const int new_speed)
 
bool preferences::middle_click_scrolls ()
 
bool preferences::mouse_scroll_enabled ()
 
void preferences::enable_mouse_scroll (bool value)
 
int preferences::mouse_scroll_threshold ()
 Gets the threshold for when to scroll. More...
 
bool preferences::animate_map ()
 
bool preferences::animate_water ()
 
bool preferences::minimap_movement_coding ()
 
void preferences::toggle_minimap_movement_coding ()
 
bool preferences::minimap_terrain_coding ()
 
void preferences::toggle_minimap_terrain_coding ()
 
bool preferences::minimap_draw_units ()
 
void preferences::toggle_minimap_draw_units ()
 
bool preferences::minimap_draw_villages ()
 
void preferences::toggle_minimap_draw_villages ()
 
bool preferences::minimap_draw_terrain ()
 
void preferences::toggle_minimap_draw_terrain ()
 
void preferences::set_animate_map (bool value)
 
void preferences::set_animate_water (bool value)
 
bool preferences::show_fps ()
 
void preferences::set_show_fps (bool value)
 
int preferences::draw_delay ()
 
void preferences::set_draw_delay (int value)
 
bool preferences::use_color_cursors ()
 
void preferences::_set_color_cursors (bool value)
 
void preferences::load_hotkeys ()
 
void preferences::save_hotkeys ()
 
void preferences::clear_hotkeys ()
 
void preferences::add_alias (const std::string &alias, const std::string &command)
 
const configpreferences::get_alias ()
 
unsigned int preferences::sample_rate ()
 
void preferences::save_sample_rate (const unsigned int rate)
 
bool preferences::confirm_load_save_from_different_version ()
 
bool preferences::use_twelve_hour_clock_format ()
 
bool preferences::disable_auto_moves ()
 
void preferences::set_disable_auto_moves (bool value)
 
bool preferences::disable_loadingscreen_animation ()
 
void preferences::set_disable_loadingscreen_animation (bool value)
 
bool preferences::damage_prediction_allow_monte_carlo_simulation ()
 
void preferences::set_damage_prediction_allow_monte_carlo_simulation (bool value)
 

Variables

static lg::log_domain log_config ("config")
 
static lg::log_domain log_filesystem ("filesystem")
 
const int preferences::min_window_width = 800
 
const int preferences::min_window_height = 600
 
const int preferences::def_window_width = 1280
 
const int preferences::def_window_height = 720
 
const int preferences::min_font_scaling = 80
 
const int preferences::max_font_scaling = 150
 
const SCALING_ALGORITHM preferences::default_scaling_algorithm = SCALING_ALGORITHM::XBRZ_NN
 
prefs_event_handler preferences::event_handler_
 

Detailed Description

Get and set user-preferences.

Definition in file general.cpp.

Macro Definition Documentation

◆ ERR_CFG

#define ERR_CFG   LOG_STREAM(err , log_config)

Definition at line 43 of file general.cpp.

Referenced by preferences::base_manager::base_manager().

◆ ERR_FS

#define ERR_FS   LOG_STREAM(err, log_filesystem)

Definition at line 46 of file general.cpp.

Referenced by preferences::write_preferences().

◆ GETTEXT_DOMAIN

#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 20 of file general.cpp.

Variable Documentation

◆ log_config

lg::log_domain log_config("config")
static

◆ log_filesystem

lg::log_domain log_filesystem("filesystem")
static