The Battle for Wesnoth  1.15.1+dev
mp_host_game_prompt.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by Jörg Hinrichs <joerg.hinrichs@alice-dsl.de>
3  Copyright (C) 2012 - 2018 by Iris Morelle <shadowm2006@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
17 
18 #include "preferences/game.hpp"
19 #include "gui/widgets/settings.hpp"
20 
21 namespace gui2
22 {
23 namespace dialogs
24 {
25 
26 /*WIKI
27  * @page = GUIWindowDefinitionWML
28  * @order = 2_mp_host_game_prompt
29  *
30  * == Host Networked Game prompt ==
31  *
32  * This shows the dialog to confirm deleting a savegame file.
33  *
34  * @begin{table}{dialog_widgets}
35  *
36  * do_not_show_again & & boolean_selector & m &
37  * A checkbox to not show this dialog again. $
38  *
39  * @end{table}
40  */
41 
42 REGISTER_DIALOG(mp_host_game_prompt)
43 
44 /**
45  * Helper for @ref preferences::ask_delete_saves.
46  */
47 static bool get_do_not_show_again()
48 {
50 }
51 
52 /**
53  * Helper for @ref preferences::set_ask_delete_saves.
54  */
55 static void set_do_not_show_again(const bool do_not_show_again)
56 {
57  preferences::set_mp_server_warning_disabled(do_not_show_again ? 2 : 1);
58 }
59 
61 {
62  set_restore(true);
63 
64  register_bool("do_not_show_again",
65  true,
68 }
69 
70 } // namespace dialogs
71 } // namespace gui2
void set_mp_server_warning_disabled(int value)
Definition: game.cpp:520
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.
Generic file dialog.
Definition: field-fwd.hpp:22
This file contains the settings handling of the widget library.
Various uncategorised dialogs.
int mp_server_warning_disabled()
Definition: game.cpp:515
static bool get_do_not_show_again()
Helper for preferences::ask_delete_saves.
static void set_do_not_show_again(const bool do_not_show_again)
Helper for preferences::set_ask_delete_saves.
void set_restore(const bool restore)