The Battle for Wesnoth  1.17.0-dev
depcheck_confirm_change.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2018 by Boldizs√°r Lipka <lipkab@zoho.com>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
18 
19 #include "gui/widgets/settings.hpp"
20 #include "gui/widgets/window.hpp"
21 #include "formula/string_utils.hpp"
22 #include "gettext.hpp"
23 
24 namespace gui2::dialogs
25 {
26 
27 REGISTER_DIALOG(depcheck_confirm_change)
28 
30  bool action,
31  const std::vector<std::string>& mods,
32  const std::string& requester)
33 {
34  utils::string_map symbols;
35  symbols["requester"] = requester;
36  std::string message;
37  if(action) {
38  message = VGETTEXT("$requester requires the following modifications to "
39  "be enabled:",
40  symbols);
41  } else {
42  message = VGETTEXT("$requester requires the following modifications to "
43  "be disabled:",
44  symbols);
45  }
46 
47  std::string list = "\t";
48  list += utils::join(mods, "\n\t");
49 
50  register_label("message", false, message);
51 
52  register_label("itemlist", false, list);
53 }
54 } // 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:34
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.