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 "payments/ui/payments_panel_data.h" 12 #include "base/object_ptr.h" 13 #include "styles/style_widgets.h" 14 15 namespace Ui { 16 class ScrollArea; 17 class FadeShadow; 18 class RoundButton; 19 class VerticalLayout; 20 } // namespace Ui 21 22 namespace Payments::Ui { 23 24 using namespace ::Ui; 25 26 class PanelDelegate; 27 28 class FormSummary final : public RpWidget { 29 public: 30 FormSummary( 31 QWidget *parent, 32 const Invoice &invoice, 33 const RequestedInformation ¤t, 34 const PaymentMethodDetails &method, 35 const ShippingOptions &options, 36 not_null<PanelDelegate*> delegate, 37 int scrollTop); 38 39 void updateThumbnail(const QImage &thumbnail); 40 [[nodiscard]] rpl::producer<int> scrollTopValue() const; 41 42 bool showCriticalError(const TextWithEntities &text); 43 [[nodiscard]] int contentHeight() const; 44 45 private: 46 void resizeEvent(QResizeEvent *e) override; 47 48 void setupControls(); 49 void setupContent(not_null<VerticalLayout*> layout); 50 void setupCover(not_null<VerticalLayout*> layout); 51 void setupPrices(not_null<VerticalLayout*> layout); 52 void setupSuggestedTips(not_null<VerticalLayout*> layout); 53 void setupSections(not_null<VerticalLayout*> layout); 54 void updateControlsGeometry(); 55 56 [[nodiscard]] QString formatAmount( 57 int64 amount, 58 bool forceStripDotZero = false) const; 59 [[nodiscard]] int64 computeTotalAmount() const; 60 61 const not_null<PanelDelegate*> _delegate; 62 Invoice _invoice; 63 PaymentMethodDetails _method; 64 ShippingOptions _options; 65 RequestedInformation _information; 66 object_ptr<ScrollArea> _scroll; 67 not_null<VerticalLayout*> _layout; 68 object_ptr<FadeShadow> _topShadow; 69 object_ptr<FadeShadow> _bottomShadow; 70 object_ptr<RoundButton> _submit; 71 object_ptr<RoundButton> _cancel; 72 rpl::event_stream<QImage> _thumbnails; 73 74 style::complex_color _tipLightBg; 75 style::complex_color _tipLightRipple; 76 style::complex_color _tipChosenBg; 77 style::complex_color _tipChosenRipple; 78 style::RoundButton _tipButton; 79 style::RoundButton _tipChosen; 80 int _initialScrollTop = 0; 81 82 }; 83 84 } // namespace Payments::Ui 85