The Battle for Wesnoth  1.19.0-dev
depcheck_confirm_change.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2024
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 "formula/string_utils.hpp"
21 #include "gettext.hpp"
22 
23 namespace gui2::dialogs
24 {
25 
26 REGISTER_DIALOG(depcheck_confirm_change)
27 
29  bool action,
30  const std::vector<std::string>& mods,
31  const std::string& requester)
32  : modal_dialog(window_id())
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
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.
REGISTER_DIALOG(tod_new_schedule)
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