The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mp_host_game_prompt.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Jörg Hinrichs <[email protected]>
3  Copyright (C) 2012 - 2016 by Ignacio Riquelme Morelle <[email protected]>
4  Part of the Battle for Wesnoth Project http://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 "game_preferences.hpp"
19 #include "gui/widgets/settings.hpp"
20 
21 namespace gui2
22 {
23 
24 /*WIKI
25  * @page = GUIWindowDefinitionWML
26  * @order = 2_mp_host_game_prompt
27  *
28  * == Host Networked Game prompt ==
29  *
30  * This shows the dialog to confirm deleting a savegame file.
31  *
32  * @begin{table}{dialog_widgets}
33  *
34  * do_not_show_again & & boolean_selector & m &
35  * A checkbox to not show this dialog again. $
36  *
37  * @end{table}
38  */
39 
40 REGISTER_DIALOG(mp_host_game_prompt)
41 
42 /**
43  * Helper for @ref preferences::ask_delete_saves.
44  */
45 static bool get_do_not_show_again()
46 {
48 }
49 
50 /**
51  * Helper for @ref preferences::set_ask_delete_saves.
52  */
53 static void set_do_not_show_again(const bool do_not_show_again)
54 {
55  preferences::set_mp_server_warning_disabled(do_not_show_again ? 2 : 1);
56 }
57 
59 {
60  set_restore(true);
61 
62  register_bool("do_not_show_again",
63  true,
66 }
67 
68 } // namespace gui2
static bool get_do_not_show_again()
Helper for preferences::ask_delete_saves.
void set_mp_server_warning_disabled(int value)
static void set_do_not_show_again(const bool do_not_show_again)
Helper for preferences::set_ask_delete_saves.
REGISTER_DIALOG(label_settings)
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
This file contains the settings handling of the widget library.
void set_restore(const bool restore)
Definition: dialog.hpp:171
int mp_server_warning_disabled()
tfield_bool * register_bool(const std::string &id, const bool mandatory, const std::function< bool()> &callback_load_value=std::function< bool()>(), const std::function< void(const bool)> &callback_save_value=std::function< void(const bool)>(), const std::function< void(twidget &)> &callback_change=std::function< void(twidget &)>())
Creates a new boolean field.
Definition: dialog.cpp:74