The Battle for Wesnoth  1.19.7+dev
mp_host_game_prompt.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2024
3  by Iris Morelle <shadowm2006@gmail.com>
4  Copyright (C) 2008 - 2018 by Jörg Hinrichs <joerg.hinrichs@alice-dsl.de>
5  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY.
13 
14  See the COPYING file for more details.
15 */
16 
18 
20 
21 namespace gui2::dialogs
22 {
23 
24 REGISTER_DIALOG(mp_host_game_prompt)
25 
26 /**
27  * Helper for @ref prefs::get().ask_delete_saves.
28  */
29 static bool get_do_not_show_again()
30 {
31  return prefs::get().mp_server_warning_disabled() != 1;
32 }
33 
34 /**
35  * Helper for @ref prefs::get().set_ask_delete_saves.
36  */
37 static void set_do_not_show_again(const bool do_not_show_again)
38 {
39  prefs::get().set_mp_server_warning_disabled(do_not_show_again ? 2 : 1);
40 }
41 
43  : modal_dialog(window_id())
44 {
45  register_bool("do_not_show_again",
46  true,
49 }
50 
51 } // namespace dialogs
Abstract base class for all modal dialogs.
field_bool * register_bool(const std::string &id, const bool mandatory, const std::function< bool()> &callback_load_value=nullptr, const std::function< void(bool)> &callback_save_value=nullptr, const std::function< void(widget &)> &callback_change=nullptr, const bool initial_fire=false)
Creates a new boolean field.
static prefs & get()
static bool get_do_not_show_again()
Helper for .ask_delete_saves.
REGISTER_DIALOG(editor_edit_unit)
static void set_do_not_show_again(const bool do_not_show_again)
Helper for .set_ask_delete_saves.