The Battle for Wesnoth  1.17.0-dev
depcheck_confirm_change.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2021
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 {
35  utils::string_map symbols;
36  symbols["requester"] = requester;
37  std::string message;
38  if(action) {
39  message = VGETTEXT("$requester requires the following modifications to "
40  "be enabled:",
41  symbols);
42  } else {
43  message = VGETTEXT("$requester requires the following modifications to "
44  "be disabled:",
45  symbols);
46  }
47 
48  std::string list = "\t";
49  list += utils::join(mods, "\n\t");
50 
51  register_label("message", false, message);
52 
53  register_label("itemlist", false, list);
54 }
55 } // namespace dialogs
std::map< std::string, t_string > string_map
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
Main class to show messages to the user.
Definition: message.hpp:35
This file contains the window object, this object is a top level container which has the event manage...
STL namespace.
This file contains the settings handling of the widget library.
Asks the user to confirm a change required to proceed.
#define VGETTEXT(msgid,...)
Handy wrappers around interpolate_variables_into_string and gettext.