16 #define GETTEXT_DOMAIN "wesnoth-lib" 38 #define ERR_GUI LOG_STREAM(err, log_gui) 39 #define WRN_GUI LOG_STREAM(warn, log_gui) 40 #define LOG_GUI LOG_STREAM(info, log_gui) 41 #define DBG_GUI LOG_STREAM(debug, log_gui) 59 listbox& sides_list = find_widget<listbox>(&window,
"sides_list",
false);
60 listbox& nicks_list = find_widget<listbox>(&window,
"nicks_list",
false);
73 for(
unsigned int side = 1; side <= num_sides; ++side) {
80 std::map<std::string, string_map> data;
83 std::string side_str =
VGETTEXT(
"Side $side", {{
"side", std::to_string(side)}});
86 item[
"id"] = (
formatter() <<
"side_" << side).str();
87 item[
"label"] = side_str;
88 item[
"use_markup"] =
"true";
89 data.emplace(
"side", item);
97 std::set<std::string> temp_nicks;
107 temp_nicks.insert(observers.begin(), observers.end());
115 for(
const std::string& nick : temp_nicks) {
118 std::map<std::string, string_map> data;
122 item[
"label"] = nick;
123 item[
"use_markup"] =
"true";
124 data.emplace(
"nick", item);
126 nicks_list.add_row(data);
151 for(
const std::string& nick :
nicks_) {
152 std::string label_str =
"";
155 label_str =
formatter() <<
"<b>" << nick <<
"</b>";
161 find_widget<label>(row_grid, nick,
false).set_label(label_str);
170 DBG_GUI <<
"Main: changing control of side " unsigned int selected_side_
unsigned int selected_nick_
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
virtual const std::vector< team > & teams() const override
void request_control_change(int side_num, const std::string &player)
bool is_network_ai() const
This shows the multiplayer change control dialog.
window * get_window() const
Returns a pointer to the dialog's window.
events::menu_handler & menu_handler_
game_board & board() const
std::string span_color(const color_t &color)
Returns a Pango formatting string using the provided color_t object.
This class stores all the data for a single 'side' (in game nomenclature).
This file contains the settings handling of the widget library.
virtual const std::set< std::string > & observers() const override
std::vector< std::string > nicks_
std::vector< int > sides_
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.
const std::string & current_player() const
grid & add_row(const string_map &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
static lg::log_domain log_gui("gui/dialogs/mp_change_control")
void handle_nicks_list_item_clicked()
Handling of system events.
const grid * get_row_grid(const unsigned row) const
Returns the grid of the wanted row.
void highlight_side_nick()
void handle_sides_list_item_clicked()
static color_t get_side_color(int side)
Standard logging facilities (interface).
Dialog was closed with the OK button.
base class of top level items, the only item which needs to store the final canvases to draw on...
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
std::pair< std::string, unsigned > item
static game_display * get_singleton()