payments_edit_information.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "ui/rp_widget.h"
  9. #include "payments/ui/payments_panel_data.h"
  10. #include "base/object_ptr.h"
  11. namespace Ui {
  12. class ScrollArea;
  13. class FadeShadow;
  14. class RoundButton;
  15. class InputField;
  16. class MaskedInputField;
  17. class Checkbox;
  18. } // namespace Ui
  19. namespace Payments::Ui {
  20. using namespace ::Ui;
  21. class PanelDelegate;
  22. class Field;
  23. class EditInformation final : public RpWidget {
  24. public:
  25. EditInformation(
  26. QWidget *parent,
  27. const Invoice &invoice,
  28. const RequestedInformation &current,
  29. InformationField field,
  30. not_null<PanelDelegate*> delegate);
  31. ~EditInformation();
  32. void setFocus(InformationField field);
  33. void setFocusFast(InformationField field);
  34. void showError(InformationField field);
  35. private:
  36. void resizeEvent(QResizeEvent *e) override;
  37. void focusInEvent(QFocusEvent *e) override;
  38. void setupControls();
  39. [[nodiscard]] not_null<Ui::RpWidget*> setupContent();
  40. void updateControlsGeometry();
  41. [[nodiscard]] Field *lookupField(InformationField field) const;
  42. [[nodiscard]] RequestedInformation collect() const;
  43. const not_null<PanelDelegate*> _delegate;
  44. Invoice _invoice;
  45. RequestedInformation _information;
  46. object_ptr<ScrollArea> _scroll;
  47. object_ptr<FadeShadow> _topShadow;
  48. object_ptr<FadeShadow> _bottomShadow;
  49. object_ptr<RoundButton> _submit;
  50. object_ptr<RoundButton> _cancel;
  51. std::unique_ptr<Field> _street1;
  52. std::unique_ptr<Field> _street2;
  53. std::unique_ptr<Field> _city;
  54. std::unique_ptr<Field> _state;
  55. std::unique_ptr<Field> _country;
  56. std::unique_ptr<Field> _postcode;
  57. std::unique_ptr<Field> _name;
  58. std::unique_ptr<Field> _email;
  59. std::unique_ptr<Field> _phone;
  60. Checkbox *_save = nullptr;
  61. InformationField _focusField = InformationField::ShippingStreet;
  62. };
  63. } // namespace Payments::Ui