/* 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 "base/object_ptr.h" namespace Ui { class RpWidget; class SeparatePanel; class BoxContent; class Checkbox; } // namespace Ui namespace Webview { struct Available; } // namespace Webview namespace Payments::Ui { using namespace ::Ui; class PanelDelegate; struct Invoice; struct RequestedInformation; struct ShippingOptions; enum class InformationField; enum class CardField; class FormSummary; class EditInformation; class EditCard; struct PaymentMethodDetails; struct NativeMethodDetails; class Panel final { public: explicit Panel(not_null delegate); ~Panel(); void requestActivate(); void toggleProgress(bool shown); void showForm( const Invoice &invoice, const RequestedInformation ¤t, const PaymentMethodDetails &method, const ShippingOptions &options); void updateFormThumbnail(const QImage &thumbnail); void showEditInformation( const Invoice &invoice, const RequestedInformation ¤t, InformationField field); void showInformationError( const Invoice &invoice, const RequestedInformation ¤t, InformationField field); void showEditPaymentMethod(const PaymentMethodDetails &method); void showEditCard( const NativeMethodDetails &native, CardField field); void showCardError( const NativeMethodDetails &native, CardField field); void chooseShippingOption(const ShippingOptions &options); void chooseTips(const Invoice &invoice); void choosePaymentMethod(const PaymentMethodDetails &method); void askSetPassword(); void showCloseConfirm(); void showWarning(const QString &bot, const QString &provider); bool showWebview( const QString &url, bool allowBack, rpl::producer bottomText); [[nodiscard]] rpl::producer<> backRequests() const; void showBox(object_ptr box); void showToast(const TextWithEntities &text); void showCriticalError(const TextWithEntities &text); [[nodiscard]] rpl::lifetime &lifetime(); private: struct Progress; struct WebviewWithLifetime; bool createWebview(); void showWebviewProgress(); void hideWebviewProgress(); void showWebviewError( const QString &text, const Webview::Available &information); void setTitle(rpl::producer title); [[nodiscard]] bool progressWithBackground() const; [[nodiscard]] QRect progressRect() const; void setupProgressGeometry(); const not_null _delegate; std::unique_ptr _widget; std::unique_ptr _webview; std::unique_ptr _webviewBottom; std::unique_ptr _progress; QPointer _saveWebviewInformation; QPointer _weakFormSummary; rpl::variable _formScrollTop; QPointer _weakEditInformation; QPointer _weakEditCard; bool _webviewProgress = false; bool _testMode = false; }; } // namespace Payments::Ui