1 /*
2 This file is part of Telegram Desktop,
3 the official desktop application for the Telegram messaging service.
4 
5 For license and copyright information please follow this link:
6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7 */
8 #pragma once
9 
10 #include "ui/rp_widget.h"
11 #include "base/object_ptr.h"
12 
13 namespace Ui {
14 class PasswordInput;
15 class FlatLabel;
16 class LinkButton;
17 class RoundButton;
18 class UserpicButton;
19 class VerticalLayout;
20 } // namespace Ui
21 
22 namespace Passport {
23 
24 class PanelController;
25 
26 class PanelAskPassword : public Ui::RpWidget {
27 public:
28 	PanelAskPassword(
29 		QWidget *parent,
30 		not_null<PanelController*> controller);
31 
32 	void submit();
33 
34 protected:
35 	void resizeEvent(QResizeEvent *e) override;
36 	void focusInEvent(QFocusEvent *e) override;
37 
38 private:
39 	void updateControlsGeometry();
40 	void showError(const QString &error);
41 	void hideError();
42 	void recover();
43 
44 	not_null<PanelController*> _controller;
45 
46 	object_ptr<Ui::UserpicButton> _userpic;
47 	object_ptr<Ui::FlatLabel> _about1;
48 	object_ptr<Ui::FlatLabel> _about2;
49 	object_ptr<Ui::PasswordInput> _password;
50 	object_ptr<Ui::FlatLabel> _hint = { nullptr };
51 	object_ptr<Ui::FlatLabel> _error = { nullptr };
52 	object_ptr<Ui::RoundButton> _submit;
53 	object_ptr<Ui::LinkButton> _forgot;
54 
55 };
56 
57 class PanelNoPassword : public Ui::RpWidget {
58 public:
59 	PanelNoPassword(
60 		QWidget *parent,
61 		not_null<PanelController*> controller);
62 
63 private:
64 	void setupContent();
65 	void refreshBottom();
66 
67 	not_null<PanelController*> _controller;
68 
69 	not_null<Ui::VerticalLayout*> _inner;
70 	base::unique_qptr<Ui::RpWidget> _about;
71 
72 };
73 
74 } // namespace Passport
75