15 #define GETTEXT_DOMAIN "wesnoth-lib"
37 void strip_trailing_dir_separators(
std::string& str)
40 str.erase(str.size() - 1);
44 std::string format_file_list(
const std::vector<std::string>& files_original)
46 if(files_original.empty()) {
51 std::vector<std::string> files(files_original);
59 const bool is_main_cfg = filename ==
"_main.cfg";
78 strip_trailing_dir_separators(base);
98 if(base.size() > wml_suffix.size()) {
99 const size_t suffix_pos = base.size() - wml_suffix.size();
100 if(base.substr(suffix_pos) == wml_suffix) {
101 base.erase(suffix_pos);
114 if(info_cfg && !info_cfg[
"title"].empty()) {
115 file = info_cfg[
"title"].str();
125 if(files.size() == 1) {
172 const
std::
string& post_summary,
173 const
std::vector<
std::
string>& files,
174 const
std::
string& details)
175 : have_files_(!files.empty())
176 , have_post_summary_(!post_summary.empty())
181 const std::string& file_list_text = format_file_list(files);
185 if(!file_list_text.empty()) {
186 report_ +=
"\n" + file_list_text;
189 if(!post_summary.empty()) {
190 report_ +=
"\n\n" + post_summary;
194 report_ +=
_(
"Details:");
200 register_label(
"summary",
true, summary);
201 register_label(
"post_summary",
true, post_summary);
202 register_label(
"files",
true, file_list_text);
203 register_label(
"details",
true, details);
209 tcontrol& filelist = find_widget<tcontrol>(&window,
"files",
false);
215 = find_widget<tcontrol>(&window,
"post_summary",
false);
219 tbutton& copy_button = find_widget<tbutton>(&window,
"copy",
false);
226 copy_button.
set_tooltip(
_(
"Clipboard support not found, contact your packager"));
std::string bullet_list(const T &v, size_t indent=4, const std::string &bullet=unicode_bullet)
Generates a new string containing a bullet list.
void pre_show(twindow &window)
Inherited from tdialog.
bool available()
Whether wesnoth was compiled with support for a clipboard.
REGISTER_DIALOG(label_settings)
void get_addon_install_info(const std::string &addon_name, config &cfg)
Gets the installation info (_info.cfg) for an add-on.
void connect_signal_mouse_left_click(tdispatcher &dispatcher, const tsignal_function &signal)
Connects a signal handler for a left mouse button click.
base class of top level items, the only item which needs to store the final canvases to draw on ...
A class inherited from ttext_box that displays its input as stars.
bool have_addon_install_info(const std::string &addon_name)
Returns true if there is a local installation info (_info.cfg) file for the add-on.
static UNUSEDNOWARN std::string _(const char *str)
WML preprocessor/parser error report dialog.
std::string normalize_path(const std::string &path)
Returns the absolute path of a file.
std::string base_name(const std::string &file)
Returns the base filename of a file, with directory name stripped.
void copy_report_callback()
void set_tooltip(const t_string &tooltip)
std::string indent(const std::string &string, size_t indent_size)
Indent a block of text.
bool is_path_sep(char c)
Returns whether c is a path separator.
std::stringstream & wml_error()
Use this logger to send errors due to deprecated WML.
Declarations for File-IO.
Base class for all visible items.
void copy_to_clipboard(const std::string &text, const bool)
Copies text to the clipboard.
std::string make_addon_title(const std::string &id)
Replaces underscores to dress up file or dirnames as add-on titles.
std::string get_addons_dir()
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
std::string directory_name(const std::string &file)
Returns the directory name of a file, with filename stripped.