Merge pull request #5262 from seanyeh/add-help-to-mp-lobby

Add help hotkey to mp lobby (fixes #4685)
This commit is contained in:
Charles Dang 2020-11-06 14:03:08 +11:00 committed by GitHub
commit a2dab95743
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -45,6 +45,7 @@
#include "formula/string_utils.hpp"
#include "preferences/game.hpp"
#include "gettext.hpp"
#include "help/help.hpp"
#include "preferences/lobby.hpp"
#include "playmp_controller.hpp"
#include "wesnothd_connection.hpp"
@ -171,6 +172,9 @@ mp_lobby::~mp_lobby()
void mp_lobby::post_build(window& win)
{
/*** Local hotkeys. ***/
win.register_hotkey(hotkey::HOTKEY_HELP,
std::bind(&mp_lobby::show_help_callback, this));
win.register_hotkey(hotkey::HOTKEY_PREFERENCES,
std::bind(&mp_lobby::show_preferences_button_callback, this, std::ref(win)));
}
@ -1042,6 +1046,12 @@ void mp_lobby::refresh_lobby()
network_connection_.send_data(config("refresh_lobby"));
}
void mp_lobby::show_help_callback()
{
help::help_manager help_manager(&game_config_);
help::show_help();
}
void mp_lobby::show_preferences_button_callback(window& window)
{
gui2::dialogs::preferences_dialog::display(game_config_);

View file

@ -136,6 +136,8 @@ private:
/** Enter game by index, where index is the selected game listbox row. */
void enter_selected_game(JOIN_MODE mode);
void show_help_callback();
void show_preferences_button_callback(window& window);
void show_server_info();