The Battle for Wesnoth  1.17.17+dev
depcheck_confirm_change.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2023
3  by Boldizsár Lipka <lipkab@zoho.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 
16 #define GETTEXT_DOMAIN "wesnoth-lib"
17 
19 
20 #include "gui/widgets/settings.hpp"
21 #include "gui/widgets/window.hpp"
22 #include "formula/string_utils.hpp"
23 #include "gettext.hpp"
24 
25 namespace gui2::dialogs
26 {
27 
28 REGISTER_DIALOG(depcheck_confirm_change)
29 
31  bool action,
32  const std::vector<std::string>& mods,
33  const std::string& requester)
34  : modal_dialog(window_id())
35 {
36  utils::string_map symbols;
37  symbols["requester"] = requester;
38  std::string message;
39  if(action) {
40  message = VGETTEXT("$requester requires the following modifications to "
41  "be enabled:",
42  symbols);
43  } else {
44  message = VGETTEXT("$requester requires the following modifications to "
45  "be disabled:",
46  symbols);
47  }
48 
49  std::string list = "\t";
50  list += utils::join(mods, "\n\t");
51 
52  register_label("message", false, message);
53 
54  register_label("itemlist", false, list);
55 }
56 } // namespace dialogs
Asks the user to confirm a change required to proceed.
Main class to show messages to the user.
Definition: message.hpp:36
Abstract base class for all modal dialogs.
#define VGETTEXT(msgid,...)
Handy wrappers around interpolate_variables_into_string and gettext.
This file contains the window object, this object is a top level container which has the event manage...
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::map< std::string, t_string > string_map
This file contains the settings handling of the widget library.