mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 10:09:22 +00:00
* MP Method Selection: clarified the account requirement for the official server
Also sets the tooltip type for this dialog back to bottom-of-the-screen ones instead of floating ones. And some formatting cleanup to the C++. (cherry-picked from commit 851b28e24bfefd068069aa9ac2eaada6593718b4)
This commit is contained in:
parent
ff61a878c8
commit
d90c6d9d34
@ -14,17 +14,19 @@
|
|||||||
vertical_placement = "center"
|
vertical_placement = "center"
|
||||||
horizontal_placement = "center"
|
horizontal_placement = "center"
|
||||||
|
|
||||||
|
maximum_width = 420
|
||||||
|
|
||||||
[linked_group]
|
[linked_group]
|
||||||
id = "icon"
|
id = "icon"
|
||||||
fixed_width = true
|
fixed_width = true
|
||||||
[/linked_group]
|
[/linked_group]
|
||||||
|
|
||||||
[tooltip]
|
[tooltip]
|
||||||
id = "tooltip"
|
id = "tooltip_large"
|
||||||
[/tooltip]
|
[/tooltip]
|
||||||
|
|
||||||
[helptip]
|
[helptip]
|
||||||
id = "tooltip"
|
id = "tooltip_large"
|
||||||
[/helptip]
|
[/helptip]
|
||||||
|
|
||||||
[grid]
|
[grid]
|
||||||
@ -81,17 +83,13 @@
|
|||||||
|
|
||||||
border = "all"
|
border = "all"
|
||||||
border_size = 5
|
border_size = 5
|
||||||
horizontal_alignment = "right"
|
horizontal_grow = true
|
||||||
|
|
||||||
[text_box]
|
[text_box]
|
||||||
id = "user_name"
|
id = "user_name"
|
||||||
definition = "default"
|
definition = "default"
|
||||||
history = "mp_user_name_history"
|
history = "mp_user_name_history"
|
||||||
max_input_length = 20
|
max_input_length = 20
|
||||||
|
|
||||||
tooltip = _ "You may login to the official multiplayer server with your forum username and password.
|
|
||||||
|
|
||||||
The Battle for Wesnoth forum can be found at https://forums.wesnoth.org/"
|
|
||||||
[/text_box]
|
[/text_box]
|
||||||
|
|
||||||
[/column]
|
[/column]
|
||||||
@ -104,6 +102,52 @@ The Battle for Wesnoth forum can be found at https://forums.wesnoth.org/"
|
|||||||
|
|
||||||
[/row]
|
[/row]
|
||||||
|
|
||||||
|
[row]
|
||||||
|
grow_factor = 0
|
||||||
|
|
||||||
|
[column]
|
||||||
|
horizontal_grow = true
|
||||||
|
|
||||||
|
[grid]
|
||||||
|
|
||||||
|
[row]
|
||||||
|
|
||||||
|
[column]
|
||||||
|
border = "all"
|
||||||
|
border_size = 5
|
||||||
|
horizontal_grow = true
|
||||||
|
|
||||||
|
[label]
|
||||||
|
label = _ "A registered account on the Wesnoth forums is required to join the official server."
|
||||||
|
wrap = true
|
||||||
|
[/label]
|
||||||
|
|
||||||
|
[/column]
|
||||||
|
|
||||||
|
[column]
|
||||||
|
border = "all"
|
||||||
|
border_size = 5
|
||||||
|
horizontal_alignment = "right"
|
||||||
|
|
||||||
|
[button]
|
||||||
|
id = "register"
|
||||||
|
definition = "default"
|
||||||
|
|
||||||
|
label = _ "Sign Up"
|
||||||
|
[/button]
|
||||||
|
|
||||||
|
[/column]
|
||||||
|
|
||||||
|
[/row]
|
||||||
|
|
||||||
|
[/grid]
|
||||||
|
|
||||||
|
[/column]
|
||||||
|
|
||||||
|
[/row]
|
||||||
|
|
||||||
|
{GUI_FILLER_ROW HEIGHT=10}
|
||||||
|
|
||||||
[row]
|
[row]
|
||||||
grow_factor = 1
|
grow_factor = 1
|
||||||
|
|
||||||
|
@ -16,24 +16,24 @@
|
|||||||
|
|
||||||
#include "gui/dialogs/multiplayer/mp_method_selection.hpp"
|
#include "gui/dialogs/multiplayer/mp_method_selection.hpp"
|
||||||
|
|
||||||
#include "preferences/credentials.hpp"
|
#include "desktop/open.hpp"
|
||||||
|
#include "game_initialization/multiplayer.hpp"
|
||||||
#include "gui/auxiliary/find_widget.hpp"
|
#include "gui/auxiliary/find_widget.hpp"
|
||||||
|
#include "gui/widgets/button.hpp"
|
||||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||||
#include "gui/widgets/list.hpp"
|
#include "gui/widgets/list.hpp"
|
||||||
#else
|
#else
|
||||||
#include "gui/widgets/listbox.hpp"
|
#include "gui/widgets/listbox.hpp"
|
||||||
#endif
|
#endif
|
||||||
#include "gui/widgets/window.hpp"
|
|
||||||
#include "gui/widgets/settings.hpp"
|
#include "gui/widgets/settings.hpp"
|
||||||
#include "gui/widgets/text_box.hpp"
|
#include "gui/widgets/text_box.hpp"
|
||||||
#include "gui/widgets/toggle_button.hpp"
|
#include "gui/widgets/window.hpp"
|
||||||
#include "game_initialization/multiplayer.hpp"
|
#include "preferences/credentials.hpp"
|
||||||
|
|
||||||
namespace gui2
|
namespace gui2
|
||||||
{
|
{
|
||||||
namespace dialogs
|
namespace dialogs
|
||||||
{
|
{
|
||||||
|
|
||||||
/*WIKI
|
/*WIKI
|
||||||
* @page = GUIWindowDefinitionWML
|
* @page = GUIWindowDefinitionWML
|
||||||
* @order = 2_mp_method_selection
|
* @order = 2_mp_method_selection
|
||||||
@ -56,30 +56,34 @@ namespace dialogs
|
|||||||
|
|
||||||
REGISTER_DIALOG(mp_method_selection)
|
REGISTER_DIALOG(mp_method_selection)
|
||||||
|
|
||||||
|
static const std::string forum_registration_url = "https://forums.wesnoth.org/ucp.php?mode=register";
|
||||||
|
|
||||||
void mp_method_selection::pre_show(window& window)
|
void mp_method_selection::pre_show(window& window)
|
||||||
{
|
{
|
||||||
user_name_ = preferences::login();
|
user_name_ = preferences::login();
|
||||||
text_box* user_widget
|
|
||||||
= find_widget<text_box>(&window, "user_name", false, true);
|
text_box* user_widget = find_widget<text_box>(&window, "user_name", false, true);
|
||||||
user_widget->set_value(user_name_);
|
user_widget->set_value(user_name_);
|
||||||
user_widget->set_maximum_length(mp::max_login_size);
|
user_widget->set_maximum_length(mp::max_login_size);
|
||||||
|
|
||||||
window.keyboard_capture(user_widget);
|
window.keyboard_capture(user_widget);
|
||||||
|
|
||||||
listbox* list = find_widget<listbox>(&window, "method_list", false, true);
|
listbox* list = find_widget<listbox>(&window, "method_list", false, true);
|
||||||
|
|
||||||
window.add_to_keyboard_chain(list);
|
window.add_to_keyboard_chain(list);
|
||||||
|
|
||||||
|
connect_signal_mouse_left_click(find_widget<button>(&window, "register", false),
|
||||||
|
std::bind(&desktop::open_object, forum_registration_url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void mp_method_selection::post_show(window& window)
|
void mp_method_selection::post_show(window& window)
|
||||||
{
|
{
|
||||||
if(get_retval() == retval::OK) {
|
if(get_retval() == retval::OK) {
|
||||||
text_box& user_widget
|
|
||||||
= find_widget<text_box>(&window, "user_name", false);
|
|
||||||
listbox& list = find_widget<listbox>(&window, "method_list", false);
|
listbox& list = find_widget<listbox>(&window, "method_list", false);
|
||||||
|
|
||||||
choice_ = list.get_selected_row();
|
choice_ = list.get_selected_row();
|
||||||
|
|
||||||
|
text_box& user_widget = find_widget<text_box>(&window, "user_name", false);
|
||||||
user_widget.save_to_history();
|
user_widget.save_to_history();
|
||||||
|
|
||||||
user_name_ = user_widget.get_value();
|
user_name_ = user_widget.get_value();
|
||||||
preferences::set_login(user_name_);
|
preferences::set_login(user_name_);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user