14 #define GETTEXT_DOMAIN "wesnoth-lib"
27 #ifdef GUI2_EXPERIMENTAL_LISTBOX
53 #define DBG_NW LOG_STREAM(debug, log_network)
54 #define LOG_NW LOG_STREAM(info, log_network)
55 #define ERR_NW LOG_STREAM(err, log_network)
58 #define LOG_NG LOG_STREAM(info, log_engine)
59 #define ERR_NG LOG_STREAM(err, log_engine)
62 #define ERR_CF LOG_STREAM(err, log_config)
65 #define DBG_LB LOG_STREAM(debug, log_lobby)
66 #define LOG_LB LOG_STREAM(info, log_lobby)
67 #define ERR_LB LOG_STREAM(err, log_lobby)
68 #define SCOPE_LB log_scope2(log_lobby, __func__)
78 list = find_widget<tlistbox>(&
w,
id,
false,
true);
80 = find_widget<ttoggle_button>(&
w,
id +
"_show_toggle",
false,
true);
81 show_toggle->set_icon_name(
"lobby/group-expanded.png");
82 show_toggle->set_callback_state_change(
84 count = find_widget<tlabel>(&
w,
id +
"_count",
false,
true);
85 label = find_widget<tlabel>(&
w,
id +
"_label",
false,
true);
87 ttree_view& parent_tree = find_widget<ttree_view>(&
w,
"player_tree",
false);
90 std::map<std::string, string_map> tree_group_item;
92 tree_group_field[
"label"] =
id;
93 tree_group_item[
"tree_view_node_label"] = tree_group_field;
94 tree = &parent_tree.add_node(
"player_group", tree_group_item);
96 tree_label = find_widget<tlabel>(tree,
"tree_view_node_label",
false,
true);
98 tree_label->set_label(label->label());
129 std::stringstream ss;
143 &
w,
"player_list_sort_name",
false,
true);
145 &
w,
"player_list_sort_relation",
false,
true);
147 tree = find_widget<ttree_view>(&
w,
"player_tree",
false,
true);
149 find_widget<twidget>(&
w,
"old_player_list",
false)
190 std::stringstream ss;
191 ss <<
"<b>" << speaker <<
":</b> ";
208 symbols[
"receiver"] = receiver;
233 }
else if(can_go_to_active) {
237 LOG_LB <<
"Ignoring whisper from " << sender <<
"\n";
255 LOG_LB <<
"Cannot add sent message to ui for room " << room
256 <<
", player not in the room\n";
266 ri->log().add_message(speaker, message);
275 if(speaker ==
"server") {
282 do_notify(notify_mode, speaker, message);
284 LOG_LB <<
"Discarding message to room " << room <<
" from " << speaker
285 <<
" (room not open)\n";
304 if(chatbox_at_end || force_scroll) {
342 : legacy_result_(
QUIT)
343 , game_config_(game_config)
344 , gamelistbox_(nullptr)
345 , userlistbox_(nullptr)
346 , roomlistbox_(nullptr)
347 , chat_log_container_(nullptr)
348 , chat_input_(nullptr)
351 , preferences_callback_()
354 , filter_friends_(nullptr)
355 , filter_ignored_(nullptr)
356 , filter_slots_(nullptr)
357 , filter_invert_(nullptr)
358 , filter_text_(nullptr)
359 , selected_game_id_()
361 , player_list_dirty_(false)
362 , gamelist_dirty_(false)
363 , last_gamelist_update_(0)
364 , gamelist_diff_update_(true)
366 , wesnothd_connection_(wesnothd_connection)
367 , lobby_update_timer_(0)
368 , preferences_wrapper_()
369 , gamelist_id_at_row_()
370 , delay_playerlist_update_(false)
371 , delay_gamelist_update_(false)
383 l.delay_gamelist_update_ =
false;
430 void add_label_data(std::map<std::string, string_map>& map,
435 item[
"label"] = label;
436 item[
"use_markup"] =
"true";
437 map.insert(std::make_pair(key, item));
440 void add_tooltip_data(std::map<std::string, string_map>& map,
445 item[
"tooltip"] = label;
446 map.insert(std::make_pair(key, item));
449 void modify_grid_with_data(tgrid*
grid,
450 const std::map<std::string, string_map>& map)
452 for(
const auto &
v : map)
456 twidget*
w = grid->find(key,
false);
459 tcontrol*
c =
dynamic_cast<tcontrol*
>(
w);
462 for(
const auto & vv : strmap)
464 if(vv.first ==
"label") {
465 c->set_label(vv.second);
466 }
else if(vv.first ==
"tooltip") {
467 c->set_tooltip(vv.second);
473 void set_visible_if_exists(tgrid* grid,
const char*
id,
bool visible)
475 twidget* w = grid->find(
id,
false);
484 return "<span color=\"" + color +
"\">" + str +
"</span>";
489 return "<" + tag +
">" + str +
"</" + tag +
">";
507 LOG_LB <<
"Adding game to listbox (1)" << game.
id <<
"\n";
532 int list_rows_deleted = 0;
533 std::vector<int> next_gamelist_id_at_row;
537 LOG_LB <<
"Adding game to listbox " << game.
id <<
"\n";
540 DBG_LB <<
"Added a game listbox row not at the end" << list_i
551 next_gamelist_id_at_row.push_back(game.
id);
554 ERR_LB <<
"Ran out of listbox items -- triggering a full "
560 ERR_LB <<
"gamelist_id_at_row_ overflow! " << list_i <<
" + "
563 <<
" -- triggering a full refresh\n";
569 if(game.
id != listbox_game_id) {
570 ERR_LB <<
"Listbox game id does not match expected id "
571 << listbox_game_id <<
" " << game.
id <<
" (row "
577 LOG_LB <<
"Modifying game in listbox " << game.
id <<
" (row "
583 next_gamelist_id_at_row.push_back(game.
id);
585 LOG_LB <<
"Deleting game from listbox " << game.
id <<
" (row "
591 LOG_LB <<
"Clean game in listbox " << game.
id <<
" (row "
593 next_gamelist_id_at_row.push_back(game.
id);
598 for(
unsigned i = 0;
i < next_gamelist_id_at_row.size(); ++
i) {
605 ERR_LB <<
"Would select a row beyond the listbox" << select_row <<
" "
623 #ifndef GUI2_EXPERIMENTAL_LISTBOX
630 =
VGETTEXT(
"Games: showing $num_shown out of $num_total", symbols);
635 std::map<std::string, string_map>
638 std::map<std::string, string_map>
data;
640 const char* color_string;
643 color_string =
"yellow";
645 color_string =
"green";
649 color_string =
"#ddd";
651 color_string =
"red";
655 color_string =
"#444";
658 add_label_data(data,
"status", colorize(game.
status, color_string));
659 add_label_data(data,
"name", colorize(game.
name, color_string));
661 add_label_data(data,
"era", game.
era);
662 add_label_data(data,
"era_short", game.
era_short);
663 add_label_data(data,
"map_info", game.
map_info);
664 add_label_data(data,
"scenario", game.
scenario);
666 add_label_data(data,
"time_limit", game.
time_limit);
667 add_label_data(data,
"gold_text", game.
gold);
668 add_label_data(data,
"xp_text", game.
xp);
669 add_label_data(data,
"vision_text", game.
vision);
670 add_label_data(data,
"time_limit_text", game.
time_limit);
671 add_label_data(data,
"status", game.
status);
673 add_label_data(data,
"observer_icon",
"misc/eye.png");
674 add_tooltip_data(data,
"observer_icon",
_(
"Observers allowed"));
676 add_label_data(data,
"observer_icon",
"misc/no_observer.png");
677 add_tooltip_data(data,
"observer_icon",
_(
"Observers not allowed"));
680 const char* vision_icon;
683 vision_icon =
"misc/vision-fog-shroud.png";
685 vision_icon =
"misc/vision-fog.png";
689 vision_icon =
"misc/vision-shroud.png";
691 vision_icon =
"misc/vision-none.png";
694 add_label_data(data,
"vision_icon", vision_icon);
695 add_tooltip_data(data,
"vision_icon", game.
vision);
703 find_widget<tcontrol>(
grid,
"name",
false).set_use_markup(
true);
705 find_widget<tcontrol>(
grid,
"status",
false).set_use_markup(
true);
712 set_visible_if_exists(grid,
"time_limit_icon", !game.
time_limit.empty());
713 set_visible_if_exists(grid,
"vision_fog", game.
fog);
714 set_visible_if_exists(grid,
"vision_shroud", game.
shroud);
715 set_visible_if_exists(grid,
"vision_none", !(game.
fog || game.
shroud));
716 set_visible_if_exists(grid,
"observers_yes", game.
observers);
717 set_visible_if_exists(grid,
"shuffle_sides_icon", game.
shuffle_sides);
718 set_visible_if_exists(grid,
"observers_no", !game.
observers);
720 set_visible_if_exists(grid,
"reloaded", game.
reloaded);
721 set_visible_if_exists(grid,
"started", game.
started);
723 set_visible_if_exists(grid,
"no_era", !game.
have_era);
726 tbutton* join_button =
dynamic_cast<tbutton*
>(grid->find(
"join",
false));
736 =
dynamic_cast<tbutton*
>(grid->find(
"observe",
false));
754 DBG_LB <<
"tlobby_main::update_gamelist_filter\n";
775 if(ri->name() ==
"lobby") {
798 std::map<std::string, string_map>
data;
799 std::stringstream icon_ss;
801 icon_ss <<
"lobby/status";
815 name = colorize(name,
"cyan");
816 icon_ss << (user.
observing ?
"-obs" :
"-playing");
820 name = colorize(name,
"red");
821 icon_ss << (user.
observing ?
"-obs" :
"-playing");
825 ERR_LB <<
"Bad user state in lobby: " << user.
name <<
": "
826 << user.
state <<
"\n";
846 name = tag(name,
"b");
849 add_label_data(data,
"player", name);
850 add_label_data(data,
"main_icon", icon_ss.str());
855 assert(target_list->
tree);
858 std::map<std::string, string_map> tree_group_item;
861 tree_group_field[
"label"] = icon_ss.str();
862 tree_group_item[
"icon"] = tree_group_field;
864 tree_group_field[
"label"] =
name;
865 tree_group_field[
"use_markup"] =
"true";
866 tree_group_item[
"name"] = tree_group_field;
871 find_widget<ttoggle_panel>(&player,
"tree_view_node_label",
false)
872 .set_callback_mouse_left_double_click(std::bind(
886 bool can_join =
false, can_observe =
false;
895 find_widget<tbutton>(
window_,
"observe_global",
false)
896 .set_active(can_observe);
898 find_widget<tbutton>(
window_,
"join_global",
false).set_active(can_join);
906 roomlistbox_ = find_widget<tlistbox>(&window,
"room_list",
false,
true);
907 #ifdef GUI2_EXPERIMENTAL_LISTBOX
915 dialog_callback<tlobby_main, &tlobby_main::room_switch_callback>);
918 gamelistbox_ = find_widget<tlistbox>(&window,
"game_list",
false,
true);
919 #ifdef GUI2_EXPERIMENTAL_LISTBOX
944 &window,
"chat_log_container",
false,
true);
946 window.set_enter_disabled(
true);
950 chat_input_ = find_widget<ttext_box>(&window,
"chat_input",
false,
true);
962 find_widget<tbutton>(&window,
"create",
false),
968 find_widget<tbutton>(&window,
"refresh",
false),
974 find_widget<tbutton>(&window,
"show_preferences",
false),
980 find_widget<tbutton>(&window,
"join_global",
false),
984 find_widget<tbutton>(&window,
"join_global",
false).set_active(
false);
987 find_widget<tbutton>(&window,
"observe_global",
false),
991 find_widget<tbutton>(&window,
"observe_global",
false).set_active(
false);
994 = find_widget<ttoggle_button>(&window,
"skip_replay",
false);
1000 &window,
"filter_with_friends",
false,
true);
1002 &window,
"filter_without_ignored",
false,
true);
1004 &window,
"filter_vacant_slots",
false,
true);
1006 &window,
"filter_invert",
false,
true);
1007 filter_text_ = find_widget<ttext_box>(&window,
"filter_text",
false,
true);
1011 filter_ignored_->set_callback_state_change(
1013 filter_slots_->set_callback_state_change(
1015 filter_invert_->set_callback_state_change(
1066 if(
t.name == name &&
t.whisper == whisper)
1071 std::map<std::string, string_map>
data;
1073 symbols[
"name"] =
name;
1075 add_label_data(data,
1077 VGETTEXT(
"Whisper session with $name started. "
1078 "If you don’t want to receive messages "
1080 "type /ignore $name\n",
1084 data,
"log_text",
VGETTEXT(
"<i>Room $name joined</i>", symbols));
1088 std::map<std::string, string_map> data2;
1089 add_label_data(data2,
"room", whisper ?
"<" + name +
">" : name);
1098 if(name ==
"lobby") {
1102 return &open_windows_.back();
1122 t->pending_messages++;
1123 if(
t->pending_messages == 1) {
1125 <<
" with " <<
t->name <<
"\n";
1131 find_widget<timage>(
grid,
"pending_messages",
false)
1140 t->pending_messages++;
1141 if(
t->pending_messages == 1) {
1143 DBG_LB <<
"do room pending mark row " << idx <<
" with " <<
t->name
1150 find_widget<timage>(
grid,
"pending_messages",
false)
1159 std::stringstream ss;
1160 ss <<
"<" << sender <<
"> " <<
message;
1163 ERR_LB <<
"Whisper window not open in add_whisper_window_whisper for "
1172 const bool force_scroll)
1174 std::stringstream ss;
1184 std::stringstream ss;
1188 ERR_LB <<
"Room window not open in add_room_window_message for " << room
1197 const bool force_scroll)
1199 std::stringstream ss;
1223 << (t.
whisper ?
"w" :
"r") <<
" " << t.
name <<
"\n";
1227 find_widget<timage>(
grid,
"pending_messages",
false)
1237 DBG_LB <<
"Close window button clicked\n";
1245 DBG_LB <<
"Close window " << idx <<
" - " << t.
name <<
"\n";
1253 msg[
"room"] = t.
name;
1300 LOG_LB <<
"caught wesnothd_error in network_handler: " << e.
message
1310 }
else if(
const config& c = data.
child(
"message")) {
1312 }
else if(
const config& c = data.
child(
"whisper")) {
1314 }
else if(data.
child(
"gamelist")) {
1316 }
else if(
const config& c = data.
child(
"gamelist_diff")) {
1318 }
else if(
const config& c = data.
child(
"room_join")) {
1320 }
else if(
const config& c = data.
child(
"room_part")) {
1322 }
else if(
const config& c = data.
child(
"room_query_response")) {
1330 DBG_LB <<
"process message from " << sender <<
" " << (whisper ?
"(w)" :
"")
1331 <<
", len " << data[
"message"].str().size() <<
'\n';
1341 LOG_LB <<
"Message without a room from " << sender
1342 <<
", assuming lobby\n";
1352 DBG_LB <<
"Received gamelist\n";
1360 DBG_LB <<
"Received gamelist diff\n";
1363 ERR_LB <<
"process_gamelist_diff failed!" << std::endl;
1367 if(joined > 0 || left > 0) {
1381 DBG_LB <<
"room join: " << room <<
" " << player <<
" "
1382 <<
static_cast<void*
>(
r) <<
"\n";
1386 if(
const config& members = data.
child(
"members")) {
1393 symbols[
"player"] = player;
1397 VGETTEXT(
"$player has entered the room", symbols));
1408 if(
const config& members = data.
child(
"members")) {
1414 if(!topic.empty()) {
1416 "room",
"server", room +
": " + topic);
1419 LOG_LB <<
"Discarding join info for a room the player is not in\n";
1429 DBG_LB <<
"Room part: " << room <<
" " << player <<
"\n";
1435 symbols[
"player"] = player;
1437 room,
"server",
VGETTEXT(
"$player has left the room", symbols));
1442 LOG_LB <<
"Discarding part info for a room the player is not in\n";
1450 DBG_LB <<
"room query response: " << room <<
" " << message <<
"\n";
1452 if(!message.empty()) {
1457 std::stringstream ss;
1459 for(
const auto &
r : rooms.child_range(
"room"))
1461 ss <<
" " <<
r[
"name"];
1467 if(!message.empty()) {
1470 if(
const config& members = data.
child(
"members")) {
1479 if(!message.empty()) {
1488 LOG_LB <<
"join_button_callback\n";
1494 LOG_LB <<
"observe_button_callback\n";
1500 LOG_LB <<
"observe_global_button_callback\n";
1509 LOG_LB <<
"join_global_button_callback\n";
1528 ERR_LB <<
"Requested join/observe of a game with index out of range: "
1536 ERR_LB <<
"Requested observe of a game with observers disabled"
1542 ERR_LB <<
"Requested join to a game with no vacant slots"
1549 join[
"id"] = std::to_string(game.
id);
1550 join[
"observe"] = observe;
1571 if(input[0] ==
'/') {
1575 chat_handler::do_speak(input);
1639 if(key == SDLK_RETURN || key == SDLK_KP_ENTER) {
1643 }
else if(key == SDLK_TAB) {
1646 std::vector<std::string> matches;
1648 for(
const auto & ui : match_infos)
1651 matches.push_back(ui.name);
1656 if(matches.empty()) {
1660 if(matches.size() == 1) {
1661 text.append(line_start ?
": " :
" ");
1693 std::greater<size_t> >(0));
1700 if(key == SDLK_RETURN || key == SDLK_KP_ENTER) {
Define the common log macros for the gui toolkit.
void close_room(const std::string &name)
An error occured during when trying to coommunicate with the wesnothd server.
void add_active_window_whisper(const std::string &sender, const std::string &message, const bool force_scroll=false)
Add a whisper message to the current window which is not the whisper window for "name".
void connect_signal_pre_key_press(tdispatcher &dispatcher, const tsignal_keyboard_function &signal)
Connects the signal for 'snooping' on the keypress.
tplayer_list player_list_
size_t size() const
The "size" of the widget.
room_info * active_window_room()
Get the room* corresponding to the currently active window, or nullptr if a whisper window is active ...
void close_active_window()
bool room_window_active(const std::string &room)
std::function< void()> preferences_wrapper_
Wrapper for the preferences hotkey.
void observe_global_button_callback(twindow &window)
This class represents the information a client has about a room.
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
void set_row_shown(const unsigned row, const bool shown)
Makes a row visible or invisible.
void update_gamelist_filter()
ttoggle_button * sort_by_name
void remove_row(const unsigned row, unsigned count=1)
Removes a row in the listbox.
bool empty() const
Does the node have children?
void close_window(size_t idx)
const chat_log & log() const
virtual void add_whisper_received(const std::string &sender, const std::string &message)
inherited form chat_handler
bool do_game_join(int idx, bool observe)
Assemble and send a game join request.
bool show(CVideo &video, const unsigned auto_close_time=0)
Shows the window.
void set_preferences_callback(std::function< void()> f)
Set the callback used to show the preferences.
void active_window_changed()
const std::vector< bool > & games_visibility() const
void adjust_game_row_contents(const game_info &game, int idx, tgrid *grid)
void add_room_window_message(const std::string &room, const std::string &sender, const std::string &message)
Add a message to the window for room "room".
void connect_signal_notify_modified(tdispatcher &dispatcher, const tsignal_notification_function &signal)
Connects a signal handler for getting a notification upon modification.
bool delay_gamelist_update_
void increment_waiting_whsipers(const std::string &name)
Mark the whisper window for "name" as having one more pending message.
ttoggle_button * filter_slots_
GLenum GLenum GLenum input
R function_wrapper(const R result, const F &function)
Helper for function wrappers.
static lg::log_domain log_config("config")
bool select_row(const unsigned row, const bool select=true)
Selectes a row.
REGISTER_DIALOG(label_settings)
This class represents the collective information the client has about the players and games on the se...
void set_playerlist_sort_name(bool v)
void parse_admin_authentication(const std::string &sender, const std::string &message)
~lobby_delay_gamelist_update_guard()
bool receive_data(config &result)
virtual void set_label(const t_string &label)
void open_room(const std::string &name)
void process_gamelist(const config &data)
bool remove_timer(const size_t id)
Removes a timer.
lobby_delay_gamelist_update_guard(tlobby_main &l)
std::map< std::string, string_map > make_game_row_data(const game_info &game)
ttoggle_button * show_toggle
void send_to_server(const config &cfg) override
void connect_signal_mouse_left_click(tdispatcher &dispatcher, const tsignal_function &signal)
Connects a signal handler for a left mouse button click.
void update_gamelist_header()
void register_hotkey(const hotkey::HOTKEY_COMMAND id, const thotkey_function &function)
Registers a hotkey.
virtual void add_whisper_sent(const std::string &receiver, const std::string &message)
inherited form chat_handler
void process_gamelist_diff(const config &data)
void skip_replay_changed_callback(twidget &w)
void process_room_join(const config &data)
void pre_show(twindow &window)
Inherited from tdialog.
const std::vector< game_info * > & games_filtered() const
game_display_status display_status
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed...
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
tlobby_chat_window * search_create_window(const std::string &name, bool whisper, bool open_new)
Helper function to find and open a new window, used by *_window_open.
ttree_view_node & add_child(const std::string &id, const std::map< std::string, string_map > &data, const int index=-1)
Adds a child item to the list of child nodes.
const tgrid & page_grid(const unsigned page) const
Returns the grid for the page.
std::string get_value() const
This class represents the information a client has about another player.
virtual void set_value(const std::string &text)
The set_value is virtual for the tpassword_box class.
void process_network_data(const config &data)
void set_game_filter_invert(bool value)
bool whisper_friends_only()
void join_button_callback(twindow &window)
base class of top level items, the only item which needs to store the final canvases to draw on ...
bool gamelist_diff_update_
virtual void add_chat_room_message_sent(const std::string &room, const std::string &message)
inherited form chat_handler
A class inherited from ttext_box that displays its input as stars.
void set_playerlist_sort_relation(bool v)
void send_data(const configr_of &request)
void set_callback_mouse_left_double_click(std::function< void(twidget &)> callback)
void increment_waiting_messages(const std::string &room)
Mark the room window for "room" as having one more pending message.
void send_message_button_callback(twindow &window)
void friend_message(bool is_lobby, const std::string &sender, const std::string &message)
legacy_result legacy_result_
Result flag for interfacing with other MP dialogs.
std::vector< int > gamelist_id_at_row_
static UNUSEDNOWARN std::string _(const char *str)
std::string map_size_info
bool auto_open_whisper_windows()
static lg::log_domain log_lobby("lobby")
virtual void send_whisper(const std::string &receiver, const std::string &message)
ttoggle_button * filter_friends_
std::map< std::string, t_string > string_map
bool is_friend(const std::string &nick)
A class that represents a TCP/IP connection to the wesnothd server.
void process_message(const config &data, bool whisper=false)
void join_global_button_callback(twindow &window)
static lg::log_domain log_network("network")
unsigned get_item_count() const
Returns the number of items in the listbox.
void init(twindow &w, const std::string &id)
void 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.
void private_message(bool is_lobby, const std::string &sender, const std::string &message)
unsigned lobby_network_timer
void update_selected_game()
void post_show(twindow &window)
Inherited from tdialog.
bool get_value_bool() const
GLubyte GLubyte GLubyte GLubyte w
void send_message_to_active_window(const std::string &input)
ttoggle_button * sort_by_relation
virtual void send_chat_message(const std::string &message, bool)
inherited form chat_handler
void process_room_part(const config &data)
const config & game_config_
bool delay_playerlist_update_
config & add_child(const std::string &key)
virtual void user_relation_changed(const std::string &name)
Called when a processed command results in a relation (friend/ignore) change for a user whose name is...
void add_page(const string_map &item)
Adds single page to the grid.
void update_user_statuses(int game_id, const room_info *room)
std::vector< tlobby_chat_window > open_windows_
This represents the open chat windows (rooms and whispers at the moment) with 1 to 1 correspondence t...
void switch_to_window(tlobby_chat_window *t)
Switch to the window given by a valid pointer (e.g.
void room_switch_callback(twindow &window)
tsub_player_list active_room
const t_string & label() const
static size_t id
Ids for the timers.
std::function< void()> preferences_callback_
void close()
Requests to close the window.
void show_preferences_button_callback(twindow &window)
bool init()
Initializes the gui subsystems.
void chat_input_keypress_callback(bool &handled, bool &halt, const SDLKey key, twindow &window)
tsub_player_list other_rooms
ttoggle_button * filter_invert_
GLuint GLuint GLsizei count
bool is_ignored(const std::string &nick)
void refresh_button_callback(twindow &window)
void observe_button_callback(twindow &window)
std::map< std::string, t_string > string_map
std::string join(T const &v, const std::string &s=",")
Generates a new string joining container items in a list.
void sync_games_display_status()
void add_member(const std::string &user)
void save_to_history()
Saves the text in the widget to the history.
void game_filter_reload()
bool playerlist_sort_relation()
bool whisper_window_active(const std::string &name)
std::string escape_text(const std::string &text)
Escapes the markup characters in a text.
void add_message(const time_t ×tamp, const std::string &user, const std::string &message)
chat_log & get_whisper_log(const std::string &name)
static bool fullscreen(CVideo &video)
void close_window_button_callback(size_t idx)
Game configuration data as global variables.
size_t lobby_update_timer_
Timer for updating the lobby.
virtual void add_chat_room_message_received(const std::string &room, const std::string &speaker, const std::string &message)
inherited form chat_handler
void public_message(bool is_lobby, const std::string &sender, const std::string &message)
static bool execute(std::string &password, CVideo &video)
The execute function – see tdialog for more information.
void remove_page(const unsigned page, unsigned count=1)
Removes a page in the multi page.
void network_handler()
Network polling callback.
void update_gamelist_diff()
Contains the gui2 timer routines.
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
void set_fullscreen(bool ison)
virtual void post_build(twindow &window)
Inherited from tdialog.
void server_message(bool is_lobby, const std::string &sender, const std::string &message)
void set_skip_mp_replay(bool value)
GLdouble GLdouble GLdouble r
bool result_open_whisper() const
void game_filter_keypress_callback(const SDLKey key)
const std::vector< user_info > & users() const
tlobby_main(const config &game_config, lobby_info &info, CVideo &video, twesnothd_connection &wesnothd_connection)
unsigned child_count(const std::string &key) const
tlobby_chat_window * whisper_window_open(const std::string &name, bool open_new)
Check if a whisper window for user "name" is open, if open_new is true then it will be created if not...
void process_room_members(const config &data)
void create_button_callback(twindow &window)
GLuint const GLchar * name
void player_leaves(bool is_lobby)
void select_page(const unsigned page, const bool select=true)
Selectes a page.
void remove_member(const std::string &user)
void game_filter_change_callback(twidget &widget)
void add_game_filter(game_filter_base *f)
void sort_users(bool by_name, bool by_relation)
This class represents the info a client has about a game on the server.
std::string get_chat_timestamp(const time_t &t)
void do_notify(t_notify_mode mode)
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...
void process_gamelist(const config &data)
Process a full gamelist.
static lg::log_domain log_engine("engine")
tsub_player_list other_games
void player_joins(bool is_lobby)
tmulti_page * chat_log_container_
void player_filter_callback(twidget &widget)
void set_callback_value_change(const std::function< void(twidget &)> &callback)
void show_toggle_callback(twidget &widget)
GLsizei GLenum GLuint GLuint GLsizei char * message
static void set_label(twindow &window, const std::string &id, const std::string &label)
void add_active_window_message(const std::string &sender, const std::string &message, const bool force_scroll=false)
Add a message to the window for room "room".
void add_whisper_window_whisper(const std::string &sender, const std::string &message)
Add a whisper message to the whisper window.
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
void set_config(const ::config *terrain)
void process_room_query_response(const config &data)
ttoggle_button * filter_ignored_
tlobby_chat_window * room_window_open(const std::string &room, bool open_new)
Check if a room window for "room" is open, if open_new is true then it will be created if not found...
Class for a toggle button.
void gamelist_change_callback(twindow &window)
A config object defines a single node in a WML file, with access to child nodes.
int get_selected_row() const
Returns the first selected row.
void join_or_observe(int index)
const std::vector< game_info * > & games() const
size_t add_timer(const Uint32 interval, const std::function< void(size_t id)> &callback, const bool repeat)
Adds a new timer.
virtual void send_chat_room_message(const std::string &room, const std::string &message)
GLsizei const GLcharARB ** string
room_info * get_room(const std::string &name)
bool word_completion(std::string &text, std::vector< std::string > &wordlist)
Try to complete the last word of 'text' with the 'wordlist'.
void dialog_callback(twidget &caller)
Template for dialog callbacks.
const std::vector< user_info * > & users_sorted() const
void clear()
Removes all the rows in the listbox, clearing it.
bool process_gamelist_diff(const config &data)
Process a gamelist diff.
const tgrid * get_row_grid(const unsigned row) const
Returns the grid of the wanted row.
void append_to_chatbox(const std::string &text, const bool force_scroll=false)
Append some text to the active chat log.
virtual void add_chat_message(const time_t &time, const std::string &speaker, int side, const std::string &message, events::chat_handler::MESSAGE_TYPE type=events::chat_handler::MESSAGE_PRIVATE)
inherited form chat_handler
void user_dialog_callback(user_info *info)
void invalidate_layout()
Updates the size of the window.
tsub_player_list active_game
bool playerlist_sort_name()
bool playerlist_group_players()
twesnothd_connection & wesnothd_connection_
void clear()
Removes all child items from the widget.
bool word_match(const std::string &message, const std::string &word)
Check if a message contains a word.
unsigned last_gamelist_update_
void set_map_data(const std::string &map_data)