15 #define GETTEXT_DOMAIN "wesnoth-lib"
41 char buf[1024] = { 0 };
42 struct std::tm*
const t = std::localtime(&time);
60 if(ld.localename == lcode || ld.localename.substr(0, 2) == lcode) {
81 colorname =
"#00ff00";
84 colorname =
"#ffff00";
87 colorname =
"#ff7f00";
90 colorname =
"#ff0000";
93 colorname =
"#777777";
97 return "<span color='" + colorname +
"'>" + str +
"</span>";
107 switch(state.
state) {
110 s =
_(
"addon_state^Not installed");
112 s =
_(
"addon_state^Published, not installed");
117 s =
_(
"addon_state^Installed");
119 s =
_(
"addon_state^Published");
124 s =
_(
"addon_state^Installed, not tracking local version");
128 s =
_(
"addon_state^Published, not tracking local version");
134 ?
_(
"addon_state^Installed ($local_version|), "
136 :
_(
"addon_state^Published ($local_version| "
137 "installed), upgradable");
143 ?
_(
"addon_state^Installed ($local_version|), "
144 "outdated on server")
145 :
_(
"addon_state^Published ($local_version| "
146 "installed), outdated on server");
151 s =
_(
"addon_state^Installed, broken");
153 s =
_(
"addon_state^Published, broken");
157 s =
_(
"addon_state^Unknown");
173 template <
typename MapT>
174 typename MapT::mapped_type
const& const_at(
typename MapT::key_type
const& key,
177 typename MapT::const_iterator it = map.find(key);
178 if(it == map.end()) {
179 assert(it != map.end());
180 throw std::out_of_range(
190 const addon_info& addon = const_at(addon_id, addons_list);
195 for(
const auto & dep_id : deps)
200 addons_list::const_iterator ali = addons_list.find(dep_id);
201 addons_tracking_list::const_iterator tli = addon_states.find(dep_id);
203 if(ali == addons_list.end()) {
209 if(tli == addon_states.end()) {
212 depstate = tli->second;
311 const addon_info& addon = const_at(addon_id, addons_list);
318 register_label(
"title",
true, addon.
title);
319 register_label(
"version",
true, addon.
version);
320 register_label(
"status",
true, describe_addon_state_info(state),
true);
321 register_label(
"author",
true, addon.
author);
324 register_label(
"downloads",
true, std::to_string(addon.
downloads));
325 register_label(
"created",
true, created_text);
326 register_label(
"updated",
true, updated_text);
328 register_label(
"description",
true, addon.
description);
334 make_display_dependencies(addon_id, addons_list, addon_states),
342 for(
const auto & lc : addon.
locales)
344 const std::string& langlabel = langcode_to_string(lc);
345 if(!langlabel.empty()) {
346 if(!languages.empty()) {
349 languages += langlabel;
353 if(!languages.empty()) {
354 register_label(
"translations",
true, languages);
372 tcontrol& url_none = find_widget<tcontrol>(&window,
"url_none",
false);
373 tbutton& url_go_button = find_widget<tbutton>(&window,
"url_go",
false);
374 tbutton& url_copy_button = find_widget<tbutton>(&window,
"url_copy",
false);
375 ttext_box& url_textbox = find_widget<ttext_box>(&window,
"url",
false);
378 url_textbox.set_active(
false);
392 url_copy_button.set_active(
false);
393 url_copy_button.set_tooltip(
_(
"Clipboard support not found, contact your packager"));
396 url_go_button.set_active(
false);
397 url_copy_button.set_active(
false);
size_t strftime(char *str, size_t count, const std::string &format, const std::tm *time)
std::string interpolate_variables_into_string(const std::string &str, const string_map *const symbols)
Function which will interpolate variables, starting with '$' in the string 'str' with the equivalent ...
bool available()
Whether wesnoth was compiled with support for a clipboard.
std::string size_display_string(double size)
Get a human-readable representation of the specified byte count.
REGISTER_DIALOG(label_settings)
void connect_signal_mouse_left_click(tdispatcher &dispatcher, const tsignal_function &signal)
Connects a signal handler for a left mouse button click.
Class for a single line text area.
version_info installed_version
virtual void set_value(const std::string &text)
The set_value is virtual for the tpassword_box class.
No tracking information available.
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.
Desktop environment interaction functions.
static UNUSEDNOWARN std::string _(const char *str)
Version in the server is older than local installation.
std::map< std::string, t_string > string_map
std::string display_title() const
Get a title or automatic title for display.
std::map< std::string, addon_info > addons_list
Version in the server is newer than local installation.
GLenum GLuint GLsizei const char * buf
const std::string unicode_em_dash
Dependencies not satisfied.
std::string str() const
Serializes the version number into string form.
std::string display_icon() const
Get an icon path fixed for display (e.g.
bool open_object(const std::string &path_or_url)
Opens the specified object with the default application configured for its type.
std::vector< std::string > locales
void pre_show(twindow &window)
Inherited from tdialog.
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
static std::string colorify_addon_state_string(const std::string &str, const addon_tracking_info &state, bool verbose=false)
std::string display_type() const
Get an add-on type identifier for display in the user's language.
language_list get_languages()
Base class for all visible items.
bool open_object_is_supported()
Returns whether open_object() is supported/implemented for the current platform.
std::string feedback_url_
void copy_to_clipboard(const std::string &text, const bool)
Copies text to the clipboard.
std::vector< std::string > depends
addon_tracking_info get_addon_tracking_info(const addon_info &addon)
Get information about an add-on comparing its local state with the add-ons server entry...
void browse_url_callback()
std::map< std::string, addon_tracking_info > addons_tracking_list
static std::string format_addon_time(time_t time)
Stores additional status information about add-ons.
GLsizei const GLcharARB ** string
std::set< std::string > resolve_dependencies(const addons_list &addons) const
Resolve an add-on's dependency tree in a recursive fashion.
bool use_twelve_hour_clock_format()
Version in the server matches local installation.