SuperTuxKart
recovery_dialog.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2013-2015 Glenn De Jonghe
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 3
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 
18 
19 #ifndef HEADER_RECOVERY_DIALOG_HPP
20 #define HEADER_RECOVERY_DIALOG_HPP
21 
22 
23 #include "guiengine/modaldialog.hpp"
24 #include "guiengine/widgets.hpp"
25 
26 namespace Online
27 {
28  class XMLRequest;
29 }
30 
36 {
37 public:
38  enum Phase
39  {
40  Input = 1,
41  Info = 2,
42  };
44  virtual ~RecoveryDialog();
45 
47  GUIEngine::EventPropagation processEvent(const std::string& eventSource);
48 
49  virtual void onUpdate(float dt);
50  virtual bool onEscapePressed();
51 
52 private:
53  Phase m_phase;
54  bool m_self_destroy;
55  bool m_show_recovery_input;
56  bool m_show_recovery_info;
57 
58  std::shared_ptr<Online::XMLRequest> m_recovery_request;
59 
60  GUIEngine::TextBoxWidget * m_username_widget;
61  GUIEngine::TextBoxWidget * m_email_widget;
62 
63  GUIEngine::LabelWidget * m_info_widget;
64 
65  GUIEngine::RibbonWidget * m_options_widget;
66  GUIEngine::IconButtonWidget * m_submit_widget;
67  GUIEngine::IconButtonWidget * m_cancel_widget;
68 
69  void showRecoveryInput();
70  void showRecoveryInfo();
71  void processInput();
72 };
73 
74 #endif
A text field widget.
Definition: text_box_widget.hpp:52
virtual ~RecoveryDialog()
Destructor, destroys the recovery request.
Definition: recovery_dialog.cpp:49
Definition: input.hpp:34
virtual void onUpdate(float dt)
This is called every frame and checks if an outstanding recovery request was finished.
Definition: recovery_dialog.cpp:184
void onEnterPressedInternal()
Called when the user pressed enter.
Definition: recovery_dialog.cpp:170
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:43
Dialog that allows a user to recover his account.
Definition: recovery_dialog.hpp:35
GUIEngine::EventPropagation processEvent(const std::string &eventSource)
Handle a user event.
Definition: recovery_dialog.cpp:142
void showRecoveryInput()
Shows the input screen to get the account name and email address.
Definition: recovery_dialog.cpp:56
A static text/icons/tabs bar widget.
Definition: ribbon_widget.hpp:59
void showRecoveryInfo()
Informs the user that an email will be sent.
Definition: recovery_dialog.cpp:85
A simple label widget.
Definition: label_widget.hpp:35
virtual bool onEscapePressed()
Let esc act as cancel.
Definition: recovery_dialog.cpp:104
RecoveryDialog()
Constructor for the recovery dialog.
Definition: recovery_dialog.cpp:38
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:55