Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #define GETTEXT_DOMAIN "wesnoth-lib"
00017
00018 #include "gui/dialogs/mp_login.hpp"
00019
00020 #include "game_preferences.hpp"
00021 #include "gui/widgets/button.hpp"
00022 #include "gui/widgets/password_box.hpp"
00023 #include "gui/widgets/settings.hpp"
00024 #include "gui/widgets/scroll_label.hpp"
00025 #include "gui/widgets/toggle_button.hpp"
00026 #include "gui/widgets/window.hpp"
00027
00028 namespace gui2 {
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 REGISTER_DIALOG(mp_login)
00063
00064 tmp_login::tmp_login(const std::string& label, const bool focus_password)
00065 {
00066 register_label("login_label", false, label);
00067 register_text("user_name"
00068 , true
00069 , &preferences::login
00070 , &preferences::set_login
00071 , !focus_password);
00072
00073 register_text("password"
00074 , true
00075 , &preferences::password
00076 , NULL
00077 , focus_password);
00078
00079 register_bool("remember_password"
00080 , false
00081 , &preferences::remember_password
00082 , &preferences::set_remember_password);
00083 }
00084
00085 void tmp_login::pre_show(CVideo& , twindow& window)
00086 {
00087 if(tbutton* button = find_widget<tbutton>(
00088 &window, "password_reminder", false, false)) {
00089
00090 button->set_retval(1);
00091 }
00092
00093 if(tbutton* button = find_widget<tbutton>(
00094 &window, "change_username", false, false)) {
00095
00096 button->set_retval(2);
00097 }
00098 }
00099
00100 void tmp_login::post_show(twindow& window)
00101 {
00102 if(get_retval() == twindow::OK) {
00103 preferences::set_password(find_widget<tpassword_box>(
00104 &window, "password", false).get_real_value());
00105 }
00106 }
00107
00108 }
00109