16 #define GETTEXT_DOMAIN "wesnoth-lib"
43 #define SETUP_ITEMS(pref_item_sound, pref_item_notif, pref_item_lobby) \
45 toggle_button* sound = find_widget<toggle_button>(prefs_list::pref_item_sound, false, true); \
46 sound->set_value(prefs::get().pref_item_sound()); \
47 connect_signal_mouse_left_click(*sound, std::bind([sound]() { prefs::get().set_##pref_item_sound(sound->get_value_bool()); })); \
49 toggle_button* notif = find_widget<toggle_button>(prefs_list::pref_item_notif, false, true); \
51 if (!desktop::notifications::available()) { \
52 notif->set_value(false); \
53 notif->set_active(false); \
54 prefs::get().set_##pref_item_notif(false); \
56 notif->set_active(true); \
57 notif->set_value(prefs::get().pref_item_notif()); \
58 connect_signal_mouse_left_click(*notif, std::bind([notif]() { prefs::get().set_##pref_item_notif(notif->get_value_bool()); }));\
61 toggle_button* lobby = find_widget<toggle_button>(prefs_list::pref_item_lobby, false, true); \
62 lobby->set_value(prefs::get().pref_item_lobby()); \
63 connect_signal_mouse_left_click(*lobby, std::bind([lobby]() { prefs::get().set_##pref_item_lobby(lobby->get_value_bool()); })); \
73 #define RESET_DEFAULT(pref_item_sound, pref_item_notif, pref_item_lobby) \
74 window.find_widget<toggle_button>(prefs_list::pref_item_sound).set_value(prefs::get().pref_item_sound()); \
75 window.find_widget<toggle_button>(prefs_list::pref_item_notif).set_value(prefs::get().pref_item_notif()); \
76 window.find_widget<toggle_button>(prefs_list::pref_item_lobby).set_value(prefs::get().pref_item_lobby());
85 RESET_DEFAULT(player_joins_sound, player_joins_notif, player_joins_lobby)
86 RESET_DEFAULT(player_leaves_sound, player_leaves_notif, player_leaves_lobby)
87 RESET_DEFAULT(private_message_sound, private_message_notif, private_message_lobby)
88 RESET_DEFAULT(friend_message_sound, friend_message_notif, friend_message_lobby)
89 RESET_DEFAULT(public_message_sound, public_message_notif, public_message_lobby)
90 RESET_DEFAULT(server_message_sound, server_message_notif, server_message_lobby)
91 RESET_DEFAULT(ready_for_start_sound, ready_for_start_notif, ready_for_start_lobby)
92 RESET_DEFAULT(game_has_begun_sound, game_has_begun_notif, game_has_begun_lobby)
93 RESET_DEFAULT(turn_changed_notif, turn_changed_notif, turn_changed_lobby)
94 RESET_DEFAULT(game_created_sound, game_created_notif, game_created_lobby)
106 SETUP_ITEMS(player_joins_sound, player_joins_notif, player_joins_lobby)
107 SETUP_ITEMS(player_leaves_sound, player_leaves_notif, player_leaves_lobby)
108 SETUP_ITEMS(private_message_sound, private_message_notif, private_message_lobby)
109 SETUP_ITEMS(friend_message_sound, friend_message_notif, friend_message_lobby)
110 SETUP_ITEMS(public_message_sound, public_message_notif, public_message_lobby)
111 SETUP_ITEMS(server_message_sound, server_message_notif, server_message_lobby)
112 SETUP_ITEMS(ready_for_start_sound, ready_for_start_notif, ready_for_start_lobby)
113 SETUP_ITEMS(game_has_begun_sound, game_has_begun_notif, game_has_begun_lobby)
114 SETUP_ITEMS(turn_changed_notif, turn_changed_notif, turn_changed_lobby)
115 SETUP_ITEMS(game_created_sound, game_created_notif, game_created_lobby)
118 label* nlabel = find_widget<label>(
"notification_label",
false,
true);
119 nlabel->
set_tooltip(
_(
"This build of wesnoth does not include support for desktop notifications, contact your package manager"));
123 in_lobby = find_widget<toggle_button>(prefs_list::ready_for_start_lobby,
false,
true);
126 in_lobby = find_widget<toggle_button>(prefs_list::game_has_begun_lobby,
false,
true);
129 in_lobby = find_widget<toggle_button>(prefs_list::turn_changed_sound,
false,
true);
132 in_lobby = find_widget<toggle_button>(prefs_list::turn_changed_lobby,
false,
true);
135 button& defaults = find_widget<button>(
"revert_to_defaults");
Abstract base class for all modal dialogs.
virtual void post_show() override
Actions to be taken after the window has been shown.
virtual void pre_show() override
Actions to be taken before showing the window.
base class of top level items, the only item which needs to store the final canvases to draw on.
void clear_mp_alert_prefs()
The most recently selected add-on id from the editor.
static std::string _(const char *str)
#define RESET_DEFAULT(pref_item_sound, pref_item_notif, pref_item_lobby)
Set the defaults on the UI after clearing the preferences.
#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.
bool available()
Returns whether we were compiled with support for desktop notifications.
static void revert_to_default_pref_values(window &window)
REGISTER_DIALOG(editor_edit_unit)
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button click.