16 #define GETTEXT_DOMAIN "wesnoth-lib"
35 const std::string translations_wiki_url =
"https://wiki.wesnoth.org/WesnothTranslations";
44 , complete_langs_(langs_.
size())
51 for(std::size_t
i = 0;
i < langs_.size(); ++
i) {
52 if(langs_[
i] == current_language) {
56 complete_langs_[
i] =
true;
65 register_bool(
"show_all",
true,
show_all);
67 register_label(
"contrib_url",
true, translations_wiki_url,
true);
75 listbox& list = find_widget<listbox>(&
window,
"language_list",
false);
86 listbox& list = find_widget<listbox>(&
window,
"language_list",
false);
95 for(
const auto& lang :
langs_) {
98 data[
"language"][
"label"] = lang.language;
100 data[
"translated_total"][
"use_markup"] =
"true";
104 if(lang == current_language) {
117 const int res = find_widget<listbox>(&
window,
"language_list",
false)
This shows the dialog to select the language to use.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
boost::dynamic_bitset complete_langs_
const std::vector< language_def > langs_
void shown_filter_callback()
Abstract base class for all modal dialogs.
int get_retval() const
Returns the cached window exit code.
window * get_window()
Returns a pointer to the dialog's window.
bool select_last_row(const bool select=true)
Does exactly as advertised: selects the list's last row.
void set_row_shown(const unsigned row, const bool shown)
Makes a row visible or invisible.
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
bool get_value_bool() const
base class of top level items, the only item which needs to store the final canvases to draw on.
void keyboard_capture(widget *widget)
int get_min_translation_percent()
const language_def & get_language()
language_list get_languages(bool all)
Return a list of available translations.
color_t red_to_green(double val, bool for_text)
Return a color corresponding to the value val red for val=0.0 to green for val=100....
REGISTER_DIALOG(editor_edit_unit)
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button click.
std::map< std::string, widget_item > widget_data
@ OK
Dialog was closed with the OK button.
void set_language(const std::string &s)
void set_language(const std::string &language, const std::vector< std::string > *)
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
std::string to_hex_string() const
Returns the stored color in rrggbb hex format.