/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "ui/rp_widget.h" namespace Ui { class InputField; class ScrollArea; class FadeShadow; class PlainShadow; class RoundButton; } // namespace Ui namespace Passport { class PanelController; struct ValueMap; struct ScanInfo; class EditScans; class PanelDetailsRow; enum class PanelDetailsType; class PanelEditDocument : public Ui::RpWidget { public: struct Scheme { enum class ValueType { Fields, Scans, }; struct Row { ValueType type = ValueType::Fields; PanelDetailsType inputType = PanelDetailsType(); QString key; QString label; base::lambda validate; base::lambda format; }; std::vector rows; QString rowsHeader; QString scansHeader; }; PanelEditDocument( QWidget *parent, not_null controller, Scheme scheme, const ValueMap &data, const ValueMap &scanData, std::vector &&files, std::unique_ptr &&selfie); PanelEditDocument( QWidget *parent, not_null controller, Scheme scheme, const ValueMap &data); bool hasUnsavedChanges() const; protected: void focusInEvent(QFocusEvent *e) override; void resizeEvent(QResizeEvent *e) override; private: struct Result; void setupControls( const ValueMap &data, const ValueMap *scanData, std::vector &&files, std::unique_ptr &&selfie); not_null setupContent( const ValueMap &data, const ValueMap *scanData, std::vector &&files, std::unique_ptr &&selfie); void updateControlsGeometry(); Result collect() const; void save(); not_null _controller; Scheme _scheme; object_ptr _scroll; object_ptr _topShadow; object_ptr _bottomShadow; QPointer _editScans; std::map> _details; object_ptr _done; }; object_ptr RequestIdentityType( base::lambda submit, std::vector labels); object_ptr RequestAddressType( base::lambda submit, std::vector labels); } // namespace Passport