Open the forum profile of the currently selected user.

Rather than always opening your own.
This commit is contained in:
Pentarctagon 2022-08-21 00:17:18 -05:00
parent 0bdd9281db
commit f0943366e4
2 changed files with 11 additions and 6 deletions

View file

@ -819,12 +819,7 @@ void mp_lobby::pre_show(window& window)
find_widget<label>(profile_panel, "username", false).set_label(your_info->name);
auto& profile_button = find_widget<button>(profile_panel, "view_profile", false);
if(your_info->forum_id != 0) {
connect_signal_mouse_left_click(profile_button,
std::bind(&desktop::open_object, mp::get_profile_link(your_info->forum_id)));
} else {
profile_button.set_active(false);
}
connect_signal_mouse_left_click(profile_button, std::bind(&mp_lobby::open_profile_url, this));
// TODO: implement
find_widget<button>(profile_panel, "view_match_history", false).set_active(false);
@ -854,6 +849,14 @@ void mp_lobby::pre_show(window& window)
//plugins_context_->set_accessor("game_config", [this](const config&) { return game_config_; });
}
void mp_lobby::open_profile_url()
{
const mp::user_info* info = player_list_.get_selected_info();
if(info && info->forum_id != 0) {
desktop::open_object(mp::get_profile_link(info->forum_id));
}
}
void mp_lobby::post_show(window& /*window*/)
{
remove_timer(lobby_update_timer_);

View file

@ -140,6 +140,8 @@ private:
void show_server_info();
void open_profile_url();
void refresh_lobby();
void game_filter_reload();