2021-03-23 12:34:34 +00:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
|
2021-03-23 16:06:59 +00:00
|
|
|
#include "base/object_ptr.h"
|
|
|
|
|
2021-03-23 12:34:34 +00:00
|
|
|
namespace Ui {
|
2021-03-31 17:15:49 +00:00
|
|
|
class RpWidget;
|
2021-03-23 12:34:34 +00:00
|
|
|
class SeparatePanel;
|
2021-03-23 16:06:59 +00:00
|
|
|
class BoxContent;
|
2021-03-31 17:15:49 +00:00
|
|
|
class Checkbox;
|
2021-03-23 12:34:34 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2021-03-25 16:58:52 +00:00
|
|
|
namespace Webview {
|
2021-04-02 15:18:49 +00:00
|
|
|
struct Available;
|
2021-03-25 16:58:52 +00:00
|
|
|
} // namespace Webview
|
|
|
|
|
2021-03-23 12:34:34 +00:00
|
|
|
namespace Payments::Ui {
|
|
|
|
|
|
|
|
using namespace ::Ui;
|
|
|
|
|
|
|
|
class PanelDelegate;
|
|
|
|
struct Invoice;
|
2021-03-23 16:06:59 +00:00
|
|
|
struct RequestedInformation;
|
|
|
|
struct ShippingOptions;
|
2021-03-25 15:27:30 +00:00
|
|
|
enum class InformationField;
|
|
|
|
enum class CardField;
|
2021-03-26 13:05:31 +00:00
|
|
|
class FormSummary;
|
2021-03-24 11:30:01 +00:00
|
|
|
class EditInformation;
|
2021-03-25 15:27:30 +00:00
|
|
|
class EditCard;
|
2021-03-25 16:58:52 +00:00
|
|
|
struct PaymentMethodDetails;
|
|
|
|
struct NativeMethodDetails;
|
2021-03-23 12:34:34 +00:00
|
|
|
|
|
|
|
class Panel final {
|
|
|
|
public:
|
|
|
|
explicit Panel(not_null<PanelDelegate*> delegate);
|
|
|
|
~Panel();
|
|
|
|
|
|
|
|
void requestActivate();
|
2021-04-12 15:24:36 +00:00
|
|
|
void toggleProgress(bool shown);
|
2021-03-23 12:34:34 +00:00
|
|
|
|
2021-03-23 16:06:59 +00:00
|
|
|
void showForm(
|
|
|
|
const Invoice &invoice,
|
|
|
|
const RequestedInformation ¤t,
|
2021-03-25 16:58:52 +00:00
|
|
|
const PaymentMethodDetails &method,
|
2021-03-23 16:06:59 +00:00
|
|
|
const ShippingOptions &options);
|
2021-03-26 13:05:31 +00:00
|
|
|
void updateFormThumbnail(const QImage &thumbnail);
|
2021-03-23 16:06:59 +00:00
|
|
|
void showEditInformation(
|
|
|
|
const Invoice &invoice,
|
|
|
|
const RequestedInformation ¤t,
|
2021-03-25 15:27:30 +00:00
|
|
|
InformationField field);
|
|
|
|
void showInformationError(
|
2021-03-24 11:30:01 +00:00
|
|
|
const Invoice &invoice,
|
|
|
|
const RequestedInformation ¤t,
|
2021-03-25 15:27:30 +00:00
|
|
|
InformationField field);
|
2021-03-25 16:58:52 +00:00
|
|
|
void showEditPaymentMethod(const PaymentMethodDetails &method);
|
2021-03-25 15:27:30 +00:00
|
|
|
void showEditCard(
|
2021-03-25 16:58:52 +00:00
|
|
|
const NativeMethodDetails &native,
|
2021-03-25 15:27:30 +00:00
|
|
|
CardField field);
|
|
|
|
void showCardError(
|
2021-03-25 16:58:52 +00:00
|
|
|
const NativeMethodDetails &native,
|
2021-03-25 15:27:30 +00:00
|
|
|
CardField field);
|
2021-03-23 16:06:59 +00:00
|
|
|
void chooseShippingOption(const ShippingOptions &options);
|
2021-03-30 14:49:41 +00:00
|
|
|
void chooseTips(const Invoice &invoice);
|
2021-03-25 16:58:52 +00:00
|
|
|
void choosePaymentMethod(const PaymentMethodDetails &method);
|
2021-03-31 17:15:49 +00:00
|
|
|
void askSetPassword();
|
2021-04-02 12:10:23 +00:00
|
|
|
void showCloseConfirm();
|
2021-04-02 12:59:54 +00:00
|
|
|
void showWarning(const QString &bot, const QString &provider);
|
2021-03-25 16:58:52 +00:00
|
|
|
|
2021-04-01 14:39:44 +00:00
|
|
|
bool showWebview(
|
|
|
|
const QString &url,
|
|
|
|
bool allowBack,
|
|
|
|
rpl::producer<QString> bottomText);
|
2021-03-23 16:06:59 +00:00
|
|
|
|
2021-03-24 11:30:01 +00:00
|
|
|
[[nodiscard]] rpl::producer<> backRequests() const;
|
|
|
|
|
2021-03-23 16:06:59 +00:00
|
|
|
void showBox(object_ptr<Ui::BoxContent> box);
|
2021-03-24 11:30:01 +00:00
|
|
|
void showToast(const TextWithEntities &text);
|
2021-04-02 15:18:49 +00:00
|
|
|
void showCriticalError(const TextWithEntities &text);
|
2021-03-24 11:30:01 +00:00
|
|
|
|
|
|
|
[[nodiscard]] rpl::lifetime &lifetime();
|
2021-03-23 12:34:34 +00:00
|
|
|
|
|
|
|
private:
|
2021-04-12 15:24:36 +00:00
|
|
|
struct Progress;
|
2021-06-29 08:07:16 +00:00
|
|
|
struct WebviewWithLifetime;
|
2021-04-12 15:24:36 +00:00
|
|
|
|
2021-03-25 16:58:52 +00:00
|
|
|
bool createWebview();
|
2021-04-13 10:05:31 +00:00
|
|
|
void showWebviewProgress();
|
|
|
|
void hideWebviewProgress();
|
2021-04-02 15:18:49 +00:00
|
|
|
void showWebviewError(
|
|
|
|
const QString &text,
|
|
|
|
const Webview::Available &information);
|
2021-04-01 15:22:01 +00:00
|
|
|
void setTitle(rpl::producer<QString> title);
|
2021-03-25 16:58:52 +00:00
|
|
|
|
2021-04-12 15:24:36 +00:00
|
|
|
[[nodiscard]] bool progressWithBackground() const;
|
|
|
|
[[nodiscard]] QRect progressRect() const;
|
|
|
|
void setupProgressGeometry();
|
|
|
|
|
2021-03-23 12:34:34 +00:00
|
|
|
const not_null<PanelDelegate*> _delegate;
|
|
|
|
std::unique_ptr<SeparatePanel> _widget;
|
2021-06-29 08:07:16 +00:00
|
|
|
std::unique_ptr<WebviewWithLifetime> _webview;
|
2021-03-31 17:15:49 +00:00
|
|
|
std::unique_ptr<RpWidget> _webviewBottom;
|
2021-04-12 15:24:36 +00:00
|
|
|
std::unique_ptr<Progress> _progress;
|
2021-03-31 17:15:49 +00:00
|
|
|
QPointer<Checkbox> _saveWebviewInformation;
|
2021-03-26 13:05:31 +00:00
|
|
|
QPointer<FormSummary> _weakFormSummary;
|
2021-04-02 11:46:48 +00:00
|
|
|
rpl::variable<int> _formScrollTop;
|
2021-03-25 15:27:30 +00:00
|
|
|
QPointer<EditInformation> _weakEditInformation;
|
|
|
|
QPointer<EditCard> _weakEditCard;
|
2021-04-13 10:05:31 +00:00
|
|
|
bool _webviewProgress = false;
|
2021-04-01 15:22:01 +00:00
|
|
|
bool _testMode = false;
|
2021-03-23 12:34:34 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Payments::Ui
|