Author: mordante
Date: Sun Mar  6 09:39:35 2011
New Revision: 48780

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48780&view=rev
Log:
Move tmp_login to its own files.

Added:
    trunk/src/gui/dialogs/mp_login.cpp   (with props)
    trunk/src/gui/dialogs/mp_login.hpp   (with props)
Modified:
    trunk/po/wesnoth-lib/POTFILES.in
    trunk/src/CMakeLists.txt
    trunk/src/SConscript
    trunk/src/gui/dialogs/mp_connect.cpp
    trunk/src/gui/dialogs/mp_connect.hpp
    trunk/src/multiplayer.cpp
    trunk/src/tests/gui/test_gui2.cpp

Modified: trunk/po/wesnoth-lib/POTFILES.in
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/po/wesnoth-lib/POTFILES.in?rev=48780&r1=48779&r2=48780&view=diff
==============================================================================
--- trunk/po/wesnoth-lib/POTFILES.in (original)
+++ trunk/po/wesnoth-lib/POTFILES.in Sun Mar  6 09:39:35 2011
@@ -81,6 +81,7 @@
 src/gui/dialogs/mp_connect.cpp
 src/gui/dialogs/mp_create_game.cpp
 src/gui/dialogs/mp_create_game_set_password.cpp
+src/gui/dialogs/mp_login.cpp
 src/gui/dialogs/mp_method_selection.cpp
 src/gui/dialogs/popup.cpp
 src/gui/dialogs/simple_item_selector.cpp

Modified: trunk/src/CMakeLists.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/CMakeLists.txt?rev=48780&r1=48779&r2=48780&view=diff
==============================================================================
--- trunk/src/CMakeLists.txt (original)
+++ trunk/src/CMakeLists.txt Sun Mar  6 09:39:35 2011
@@ -444,6 +444,7 @@
        gui/dialogs/mp_connect.cpp
        gui/dialogs/mp_create_game.cpp
        gui/dialogs/mp_create_game_set_password.cpp
+       gui/dialogs/mp_login.cpp
        gui/dialogs/mp_method_selection.cpp
        gui/dialogs/popup.cpp
        gui/dialogs/simple_item_selector.cpp

Modified: trunk/src/SConscript
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=48780&r1=48779&r2=48780&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Sun Mar  6 09:39:35 2011
@@ -310,6 +310,7 @@
     gui/dialogs/mp_connect.cpp
     gui/dialogs/mp_create_game.cpp
     gui/dialogs/mp_create_game_set_password.cpp
+    gui/dialogs/login.cpp
     gui/dialogs/mp_method_selection.cpp
     gui/dialogs/popup.cpp
     gui/dialogs/simple_item_selector.cpp

Modified: trunk/src/gui/dialogs/mp_connect.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/mp_connect.cpp?rev=48780&r1=48779&r2=48780&view=diff
==============================================================================
--- trunk/src/gui/dialogs/mp_connect.cpp (original)
+++ trunk/src/gui/dialogs/mp_connect.cpp Sun Mar  6 09:39:35 2011
@@ -26,11 +26,7 @@
 #else
 #include "gui/widgets/listbox.hpp"
 #endif
-#include "gui/widgets/label.hpp"
-#include "gui/widgets/password_box.hpp"
 #include "gui/widgets/settings.hpp"
-#include "gui/widgets/scroll_label.hpp"
-#include "gui/widgets/toggle_button.hpp"
 
 #include <boost/bind.hpp>
 
@@ -185,95 +181,5 @@
 
 }
 
-/*WIKI
- * @page = GUIWindowDefinitionWML
- * @order = 2_mp_login
- *
- * == Multiplayer connect ==
- *
- * This shows the dialog to log in to the MP server
- *
- * @begin{table}{dialog_widgets}
- *
- * user_name & & text_box & m &
- *         The login user name. $
- *
- * password & & text_box & m &
- *         The password. $
- *
- * password_reminder & & button & o &
- *         Request a password reminder. $
- *
- * change_username & & button & o &
- *         Use a different username. $
- *
- * login_label & & button & o &
- *         Displays the information received from the server. $
- *
- * @end{table}
- */
-
-REGISTER_DIALOG(mp_login)
-
-tmp_login::tmp_login(const t_string& label,    const bool focus_password)
-       : label_(label)
-       , focus_password_(focus_password)
-{
-}
-
-void tmp_login::pre_show(CVideo& /*video*/, twindow& window)
-{
-       ttext_box* username =
-                       find_widget<ttext_box>(&window, "user_name", false, 
true);
-       username->set_value(preferences::login());
-
-       tpassword_box* password =
-                       find_widget<tpassword_box>(&window, "password", false, 
true);
-       password->set_value(preferences::password());
-
-       window.keyboard_capture(focus_password_ ? password : username);
-
-       if(tbutton* button = find_widget<tbutton>(
-                       &window, "password_reminder", false, false)) {
-
-               button->set_retval(1);
-       }
-
-       if(tbutton* button = find_widget<tbutton>(
-                       &window, "change_username", false, false)) {
-
-               button->set_retval(2);
-       }
-
-       // Needs to be a scroll_label since the text can get long and a normal
-       // label can't wrap (at the moment).
-       tcontrol* label =
-               dynamic_cast<tscroll_label*>(window.find("login_label", false));
-       if(label) label->set_label(label_);
-
-       if(ttoggle_button* button = find_widget<ttoggle_button>(
-                       &window, "remember_password", false, false)) {
-
-               button->set_value(preferences::remember_password());
-       }
-}
-
-void tmp_login::post_show(twindow& window)
-{
-       if(get_retval() == twindow::OK) {
-               if(ttoggle_button* button = find_widget<ttoggle_button>(
-                               &window, "remember_password", false, false)) {
-
-                       preferences::set_remember_password(button->get_value());
-               }
-
-               preferences::set_login(find_widget<ttext_box>(
-                               &window, "user_name", false).get_value());
-
-               preferences::set_password(find_widget<tpassword_box>(
-                               &window, "password", false).get_real_value());
-       }
-}
-
 } // namespace gui2
 

Modified: trunk/src/gui/dialogs/mp_connect.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/mp_connect.hpp?rev=48780&r1=48779&r2=48780&view=diff
==============================================================================
--- trunk/src/gui/dialogs/mp_connect.hpp (original)
+++ trunk/src/gui/dialogs/mp_connect.hpp Sun Mar  6 09:39:35 2011
@@ -17,7 +17,6 @@
 #define GUI_DIALOGS_MP_CONNECT_HPP_INCLUDED
 
 #include "gui/dialogs/dialog.hpp"
-#include "tstring.hpp"
 
 namespace gui2 {
 
@@ -38,29 +37,6 @@
        tfield_text* host_name_;
 };
 
-class tmp_login : public tdialog
-{
-public:
-       tmp_login(const t_string& label,
-               const bool focus_password);
-
-private:
-
-       /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
-       virtual const std::string& window_id() const;
-
-       /** Inherited from tdialog. */
-       void pre_show(CVideo& video, twindow& window);
-
-       /** Inherited from tdialog. */
-       void post_show(twindow& window);
-
-       t_string label_;
-
-       /** Should the password box be focussed upon showing the dialog? */
-       bool focus_password_;
-};
-
 } // namespace gui2
 
 #endif

Added: trunk/src/gui/dialogs/mp_login.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/mp_login.cpp?rev=48780&view=auto
==============================================================================
--- trunk/src/gui/dialogs/mp_login.cpp (added)
+++ trunk/src/gui/dialogs/mp_login.cpp Sun Mar  6 09:39:35 2011
@@ -1,0 +1,121 @@
+/* $Id$ */
+/*
+   Copyright (C) 2008 - 2011 by Mark de Wever <[email protected]>
+   Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY.
+
+   See the COPYING file for more details.
+*/
+
+#define GETTEXT_DOMAIN "wesnoth-lib"
+
+#include "gui/dialogs/mp_login.hpp"
+
+#include "game_preferences.hpp"
+#include "gui/widgets/button.hpp"
+#include "gui/widgets/password_box.hpp"
+#include "gui/widgets/settings.hpp"
+#include "gui/widgets/scroll_label.hpp"
+#include "gui/widgets/toggle_button.hpp"
+#include "gui/widgets/window.hpp"
+
+namespace gui2 {
+
+/*WIKI
+ * @page = GUIWindowDefinitionWML
+ * @order = 2_mp_login
+ *
+ * == Multiplayer connect ==
+ *
+ * This shows the dialog to log in to the MP server
+ *
+ * @begin{table}{dialog_widgets}
+ *
+ * user_name & & text_box & m &
+ *         The login user name. $
+ *
+ * password & & text_box & m &
+ *         The password. $
+ *
+ * password_reminder & & button & o &
+ *         Request a password reminder. $
+ *
+ * change_username & & button & o &
+ *         Use a different username. $
+ *
+ * login_label & & button & o &
+ *         Displays the information received from the server. $
+ *
+ * @end{table}
+ */
+
+REGISTER_DIALOG(mp_login)
+
+tmp_login::tmp_login(const t_string& label,    const bool focus_password)
+       : label_(label)
+       , focus_password_(focus_password)
+{
+}
+
+void tmp_login::pre_show(CVideo& /*video*/, twindow& window)
+{
+       ttext_box* username =
+                       find_widget<ttext_box>(&window, "user_name", false, 
true);
+       username->set_value(preferences::login());
+
+       tpassword_box* password =
+                       find_widget<tpassword_box>(&window, "password", false, 
true);
+       password->set_value(preferences::password());
+
+       window.keyboard_capture(focus_password_ ? password : username);
+
+       if(tbutton* button = find_widget<tbutton>(
+                       &window, "password_reminder", false, false)) {
+
+               button->set_retval(1);
+       }
+
+       if(tbutton* button = find_widget<tbutton>(
+                       &window, "change_username", false, false)) {
+
+               button->set_retval(2);
+       }
+
+       // Needs to be a scroll_label since the text can get long and a normal
+       // label can't wrap (at the moment).
+       tcontrol* label =
+               dynamic_cast<tscroll_label*>(window.find("login_label", false));
+       if(label) label->set_label(label_);
+
+       if(ttoggle_button* button = find_widget<ttoggle_button>(
+                       &window, "remember_password", false, false)) {
+
+               button->set_value(preferences::remember_password());
+       }
+}
+
+void tmp_login::post_show(twindow& window)
+{
+       if(get_retval() == twindow::OK) {
+               if(ttoggle_button* button = find_widget<ttoggle_button>(
+                               &window, "remember_password", false, false)) {
+
+                       preferences::set_remember_password(button->get_value());
+               }
+
+               preferences::set_login(find_widget<ttext_box>(
+                               &window, "user_name", false).get_value());
+
+               preferences::set_password(find_widget<tpassword_box>(
+                               &window, "password", false).get_real_value());
+       }
+}
+
+} // namespace gui2
+

Propchange: trunk/src/gui/dialogs/mp_login.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/src/gui/dialogs/mp_login.cpp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: trunk/src/gui/dialogs/mp_login.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/mp_login.hpp?rev=48780&view=auto
==============================================================================
--- trunk/src/gui/dialogs/mp_login.hpp (added)
+++ trunk/src/gui/dialogs/mp_login.hpp Sun Mar  6 09:39:35 2011
@@ -1,0 +1,50 @@
+/* $Id$ */
+/*
+   Copyright (C) 2008 - 2011 by Mark de Wever <[email protected]>
+   Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY.
+
+   See the COPYING file for more details.
+*/
+
+#ifndef GUI_DIALOGS_MP_LOGIN_HPP_INCLUDED
+#define GUI_DIALOGS_MP_LOGIN_HPP_INCLUDED
+
+#include "gui/dialogs/dialog.hpp"
+#include "tstring.hpp"
+
+namespace gui2 {
+
+class tmp_login : public tdialog
+{
+public:
+       tmp_login(const t_string& label,
+               const bool focus_password);
+
+private:
+
+       /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
+       virtual const std::string& window_id() const;
+
+       /** Inherited from tdialog. */
+       void pre_show(CVideo& video, twindow& window);
+
+       /** Inherited from tdialog. */
+       void post_show(twindow& window);
+
+       t_string label_;
+
+       /** Should the password box be focussed upon showing the dialog? */
+       bool focus_password_;
+};
+
+} // namespace gui2
+
+#endif
+

Propchange: trunk/src/gui/dialogs/mp_login.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/src/gui/dialogs/mp_login.hpp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: trunk/src/multiplayer.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer.cpp?rev=48780&r1=48779&r2=48780&view=diff
==============================================================================
--- trunk/src/multiplayer.cpp (original)
+++ trunk/src/multiplayer.cpp Sun Mar  6 09:39:35 2011
@@ -23,6 +23,7 @@
 #include "gui/dialogs/message.hpp"
 #include "gui/dialogs/mp_connect.hpp"
 #include "gui/dialogs/mp_create_game.hpp"
+#include "gui/dialogs/mp_login.hpp"
 #include "gui/widgets/settings.hpp"
 #include "gui/widgets/window.hpp"
 #include "hash.hpp"

Modified: trunk/src/tests/gui/test_gui2.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tests/gui/test_gui2.cpp?rev=48780&r1=48779&r2=48780&view=diff
==============================================================================
--- trunk/src/tests/gui/test_gui2.cpp (original)
+++ trunk/src/tests/gui/test_gui2.cpp Sun Mar  6 09:39:35 2011
@@ -46,6 +46,7 @@
 #include "gui/dialogs/mp_cmd_wrapper.hpp"
 #include "gui/dialogs/mp_connect.hpp"
 #include "gui/dialogs/mp_create_game.hpp"
+#include "gui/dialogs/mp_login.hpp"
 #include "gui/dialogs/mp_method_selection.hpp"
 #include "gui/dialogs/simple_item_selector.hpp"
 #include "gui/dialogs/title_screen.hpp"


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to