The Battle for Wesnoth  1.19.7+dev
Namespaces | Macros | Functions
mp_alerts_options.cpp File Reference
#include "gui/dialogs/multiplayer/mp_alerts_options.hpp"
#include "desktop/notifications.hpp"
#include "gui/widgets/button.hpp"
#include "gui/widgets/label.hpp"
#include "gui/widgets/toggle_button.hpp"
#include "gui/widgets/window.hpp"
#include "mp_ui_alerts.hpp"
#include "preferences/preferences.hpp"
#include <functional>
#include "gettext.hpp"
Include dependency graph for mp_alerts_options.cpp:

Go to the source code of this file.

Namespaces

 gui2
 Generic file dialog.
 
 gui2::dialogs
 

Macros

#define GETTEXT_DOMAIN   "wesnoth-lib"
 
#define SETUP_ITEMS(pref_item_sound, pref_item_notif, pref_item_lobby)
 Sets up the toggle buttons for a set of three MP lobby alerts. More...
 
#define RESET_DEFAULT(pref_item_sound, pref_item_notif, pref_item_lobby)
 Set the defaults on the UI after clearing the preferences. More...
 

Functions

static void gui2::dialogs::revert_to_default_pref_values (window &window)
 

Macro Definition Documentation

◆ GETTEXT_DOMAIN

#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 16 of file mp_alerts_options.cpp.

◆ RESET_DEFAULT

#define RESET_DEFAULT (   pref_item_sound,
  pref_item_notif,
  pref_item_lobby 
)
Value:
window.find_widget<toggle_button>(prefs_list::pref_item_sound).set_value(prefs::get().pref_item_sound()); \
window.find_widget<toggle_button>(prefs_list::pref_item_notif).set_value(prefs::get().pref_item_notif()); \
window.find_widget<toggle_button>(prefs_list::pref_item_lobby).set_value(prefs::get().pref_item_lobby());
static prefs & get()

Set the defaults on the UI after clearing the preferences.

Parameters
pref_item_soundprefs_list constant for the sound preference
pref_item_notifprefs_list constant for the notification preference
pref_item_lobbyprefs_list constant for the lobby preference

Definition at line 73 of file mp_alerts_options.cpp.

◆ SETUP_ITEMS

#define SETUP_ITEMS (   pref_item_sound,
  pref_item_notif,
  pref_item_lobby 
)
Value:
{ \
toggle_button* sound = find_widget<toggle_button>(prefs_list::pref_item_sound, false, true); \
sound->set_value(prefs::get().pref_item_sound()); \
connect_signal_mouse_left_click(*sound, std::bind([sound]() { prefs::get().set_##pref_item_sound(sound->get_value_bool()); })); \
\
toggle_button* notif = find_widget<toggle_button>(prefs_list::pref_item_notif, false, true); \
\
notif->set_value(false); \
notif->set_active(false); \
prefs::get().set_##pref_item_notif(false); \
} else { \
notif->set_active(true); \
notif->set_value(prefs::get().pref_item_notif()); \
connect_signal_mouse_left_click(*notif, std::bind([notif]() { prefs::get().set_##pref_item_notif(notif->get_value_bool()); }));\
} \
\
toggle_button* lobby = find_widget<toggle_button>(prefs_list::pref_item_lobby, false, true); \
lobby->set_value(prefs::get().pref_item_lobby()); \
connect_signal_mouse_left_click(*lobby, std::bind([lobby]() { prefs::get().set_##pref_item_lobby(lobby->get_value_bool()); })); \
}
bool available()
Returns whether we were compiled with support for desktop notifications.
Audio output for sound and music.
Definition: sound.cpp:42

Sets up the toggle buttons for a set of three MP lobby alerts.

Parameters
pref_item_soundprefs_list constant for the sound preference
pref_item_notifprefs_list constant for the notification preference
pref_item_lobbyprefs_list constant for the lobby preference

Definition at line 43 of file mp_alerts_options.cpp.