The Battle for Wesnoth  1.15.12+dev
mp_login.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by Mark de Wever <koraq@xs4all.nl>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
18 
19 namespace gui2
20 {
21 class field_text;
22 
23 namespace dialogs
24 {
25 
26 /**
27  * @ingroup GUIWindowDefinitionWML
28  *
29  * This shows the dialog to log in to the MP server.
30  * Key |Type |Mandatory|Description
31  * ------------------|---------------|---------|-----------
32  * user_name | text_box |yes |The login user name.
33  * password | text_box |yes |The password.
34  * remember_password | toggle_button |no |A toggle button to offer to remember the password in the preferences.
35  * password_reminder | @ref button |no |Request a password reminder.
36  * change_username | @ref button |no |Use a different username.
37  * login_label | @ref button |no |Displays the information received from the server.
38  */
39 class mp_login : public modal_dialog
40 {
41 public:
42  mp_login(const std::string& host, const std::string& label, const bool focus_password);
43 
44 private:
45  virtual const std::string& window_id() const override;
46 
47  virtual void pre_show(window& window) override;
48 
49  virtual void post_show(window& window) override;
50 
51  void load_password() const;
52  void save_password() const;
53 
54  const std::string host_;
57 };
58 
59 } // namespace dialogs
60 } // namespace gui2
field_text * username_
Definition: mp_login.hpp:55
void load_password() const
Definition: mp_login.cpp:48
const std::string host_
Definition: mp_login.hpp:54
A label displays a text, the text can be wrapped but no scrollbars are provided.
Definition: label.hpp:56
Generic file dialog.
Definition: field-fwd.hpp:22
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
Definition: mp_login.cpp:60
virtual const std::string & window_id() const override
The id of the window to build.
Various uncategorised dialogs.
mp_login(const std::string &host, const std::string &label, const bool focus_password)
Definition: mp_login.cpp:34
void save_password() const
Definition: mp_login.cpp:54
This shows the dialog to log in to the MP server.
Definition: mp_login.hpp:39
Abstract base class for all modal dialogs.
Specialized field class for text.
Definition: field.hpp:592
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:64
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
Definition: mp_login.cpp:75